mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ce54f1855 | ||
|
|
8897351a80 | ||
|
|
b0b34c638e | ||
|
|
212da42d6e | ||
|
|
fe616ffe20 | ||
|
|
dba4691cd3 | ||
|
|
00fc008f7f | ||
|
|
e23fc25a6c | ||
|
|
b8bbf950a9 | ||
|
|
208adc1109 | ||
|
|
60904744b9 | ||
|
|
ac5141c97c | ||
|
|
0b1eefc6d5 | ||
|
|
3de4e38d10 | ||
|
|
384fe451fc | ||
|
|
6a78310a52 | ||
|
|
4305f6de49 | ||
|
|
9d64011438 | ||
|
|
a0a71c6c53 | ||
|
|
7060036589 | ||
|
|
97e6b96cbb | ||
|
|
915d8a8f7d | ||
|
|
69037051ab | ||
|
|
1fe85f5396 | ||
|
|
5693e5d11a | ||
|
|
da2f435810 | ||
|
|
c24aff8a53 | ||
|
|
d38ce3d794 | ||
|
|
87b4f6367a | ||
|
|
b81e7dfe73 | ||
|
|
9d02da81cf | ||
|
|
5b1ab8b40b | ||
|
|
542db422ad | ||
|
|
ac10315810 | ||
|
|
8006e4ff48 | ||
|
|
dd8e7ffd16 | ||
|
|
976d710c10 | ||
|
|
1b44cda8ed | ||
|
|
10bc7b8e2e | ||
|
|
333a8e16ad | ||
|
|
0554de0251 | ||
|
|
845f315c47 | ||
|
|
c6f3726b6d | ||
|
|
46ea9fca8e | ||
|
|
0f2dac73ea | ||
|
|
576c61cf7d | ||
|
|
5eb5c34636 | ||
|
|
8f17370cb7 | ||
|
|
bc0c89ff69 |
No files matched your search
+1
-1
@@ -27,6 +27,6 @@ abstract class BytecodePredicateFinder extends BytecodeFinder {
|
||||
@Internal
|
||||
@Override
|
||||
protected Object getData() {
|
||||
return matches.toSorted(Comparator.naturalOrder()) ?: {throw new RuntimeException('Failed to find any targets, please ensure that method names and descriptors are correct.')}()
|
||||
return matches.toSorted(Comparator.<String>naturalOrder()) ?: {throw new RuntimeException('Failed to find any targets, please ensure that method names and descriptors are correct.')}()
|
||||
}
|
||||
}
|
||||
+34
-1
@@ -117,7 +117,7 @@ dependencies {
|
||||
bootstrap(libs.unsafe) // Needed by securemodules
|
||||
bootstrap(libs.bundles.asm) // Needed by securemodules
|
||||
|
||||
implementation(libs.jopt.simple) { version { strictly '5.0.4' } }
|
||||
implementation(libs.jopt.simple)
|
||||
|
||||
installer(libs.bootstrap)
|
||||
installer(libs.bootstrap.api) // Needed by securemodules
|
||||
@@ -404,6 +404,16 @@ tasks.register("downloadServerShim", DownloadMavenArtifact) {
|
||||
artifact = libs.bootstrap.shim.get().toString()
|
||||
changing = true
|
||||
}
|
||||
tasks.register("downloadMCPConfig", DownloadMavenArtifact) {
|
||||
artifact = MCP_ARTIFACT
|
||||
}
|
||||
tasks.register('extractMCPConfigMappings', net.minecraftforge.gradle.common.tasks.JarExec) {
|
||||
ext.output = file('build/mcp_mappings.tsrg')
|
||||
tool = INSTALLER_TOOLS + ':fatjar'
|
||||
args = ['--task', 'MCP_DATA', '--key', 'mappings', '--input', downloadMCPConfig.output.get().asFile.absolutePath, '--output', output.absolutePath]
|
||||
outputs.file(output)
|
||||
inputs.file(downloadMCPConfig.output)
|
||||
}
|
||||
tasks.register('downloadClientMappings', net.minecraftforge.gradle.common.tasks.JarExec) {
|
||||
ext.output = file('build/client_mappings.tsrg')
|
||||
tool = INSTALLER_TOOLS + ':fatjar'
|
||||
@@ -610,6 +620,9 @@ tasks.register('installerJson', InstallerJson) {
|
||||
dependsOn(launcherJson)
|
||||
input.from(launcherJson.output)
|
||||
|
||||
// Extract MCP Mappings
|
||||
dependsOn(extractMCPConfigMappings)
|
||||
input.from(extractMCPConfigMappings.output)
|
||||
// Download Official Mappings
|
||||
dependsOn(downloadClientMappings, downloadServerMappings)
|
||||
input.from(downloadClientMappings.output, downloadServerMappings.output)
|
||||
@@ -636,6 +649,14 @@ tasks.register('installerJson', InstallerJson) {
|
||||
minecraft: MC_VERSION,
|
||||
serverJarPath: '{LIBRARY_DIR}/net/minecraft/server/{MINECRAFT_VERSION}/server-{MINECRAFT_VERSION}-bundled.jar',
|
||||
data: [
|
||||
MAPPINGS: [
|
||||
client: "[${MCP_ARTIFACT.group}:${MCP_ARTIFACT.name}:${MCP_ARTIFACT.version}:mappings@tsrg]",
|
||||
server: "[${MCP_ARTIFACT.group}:${MCP_ARTIFACT.name}:${MCP_ARTIFACT.version}:mappings@tsrg]"
|
||||
],
|
||||
MAPPINGS_SHA: [
|
||||
client: "'${extractMCPConfigMappings.output.sha1}'",
|
||||
server: "'${extractMCPConfigMappings.output.sha1}'"
|
||||
],
|
||||
MOJMAPS: [
|
||||
client: "[net.minecraft:client:${MC_VERSION}:mappings@tsrg]",
|
||||
server: "[net.minecraft:server:${MC_VERSION}:mappings@tsrg]"
|
||||
@@ -725,6 +746,18 @@ tasks.register('installerJson', InstallerJson) {
|
||||
outputs: [
|
||||
'{MC_UNPACKED}': '{MC_UNPACKED_SHA}'
|
||||
]
|
||||
], [
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: INSTALLER_TOOLS_CLASSPATH,
|
||||
args: [
|
||||
'--task', 'MCP_DATA',
|
||||
'--input', "[${MCP_ARTIFACT.descriptor}]",
|
||||
'--output', '{MAPPINGS}',
|
||||
'--key', 'mappings'
|
||||
],
|
||||
outputs: [
|
||||
'{MAPPINGS}': '{MAPPINGS_SHA}'
|
||||
]
|
||||
], [
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: INSTALLER_TOOLS_CLASSPATH,
|
||||
|
||||
+8
-1
@@ -44,7 +44,6 @@ tasks.withType(JavaCompile).configureEach {
|
||||
dependsOn 'processResources' // Needed because we merge the output of this with the output of the compile task. And gradle detects downstream tasks using the output without a hard dep
|
||||
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||
options.warnings = false // Shutup deprecated for removal warnings
|
||||
options.forkOptions.jvmArgs += '-Xmx3G' // Needed to make compiling faster, and not run out of heap space in some cases.
|
||||
}
|
||||
|
||||
// Merge the resources and classes into the same directory. We'll need to split them at runtime because
|
||||
@@ -75,3 +74,11 @@ eclipse {
|
||||
// Run when importing the project
|
||||
synchronizationTasks generateResources, copyEclipseSettings, eclipseClasspath, eclipseProject
|
||||
}
|
||||
|
||||
idea {
|
||||
module {
|
||||
// IntelliJ IDEA does not do this by itself anymore...
|
||||
downloadJavadoc = true
|
||||
downloadSources = true
|
||||
}
|
||||
}
|
||||
+23
-4
@@ -8,10 +8,9 @@ MinecraftForge
|
||||
|
||||
Forge is a free, open-source modding API all of your favourite mods use!
|
||||
|
||||
| Version | Support |
|
||||
|---------| ------------- |
|
||||
| 1.20.x | Active |
|
||||
| 1.19.x | Legacy |
|
||||
| Version | Support |
|
||||
|--------------|-----------------------------|
|
||||
| All versions | [Supported][Support-Policy] |
|
||||
|
||||
* [Download]
|
||||
* [Forum]
|
||||
@@ -31,6 +30,19 @@ You can download the installer for the *Recommended Build* or the
|
||||
|
||||
For support and questions, visit [the Support Forum][Support-Forum] or [the Forge Discord server][Discord].
|
||||
|
||||
## Required Java Versions
|
||||
|
||||
We require the version of Java that Minecraft requires, which is currently:
|
||||
|
||||
| Minecraft | Java |
|
||||
|---------------|-------------------|
|
||||
| 1.20.6+ | [21][Adoptium-21] |
|
||||
| 1.18 - 1.20.4 | [17][Adoptium-17] |
|
||||
| 1.17.1 | [16][Adoptium-16] |
|
||||
| 1.16.5- | [8][Adoptium-8] |
|
||||
|
||||
**If you are on Windows and have difficulty using Java to launch JAR files, consider using [Jarfix by Johann Löfflmann][Jarfix].**
|
||||
|
||||
# Creating Mods
|
||||
|
||||
[See the "Getting Started" section in the Forge Documentation][Getting-Started].
|
||||
@@ -63,8 +75,15 @@ Please ensure you have a valid email address associated with your GitHub account
|
||||
|
||||
[Download]: https://files.minecraftforge.net/
|
||||
|
||||
[Adoptium-21]: https://adoptium.net/temurin/releases/?version=21
|
||||
[Adoptium-17]: https://adoptium.net/temurin/releases/?version=17
|
||||
[Adoptium-16]: https://adoptium.net/temurin/releases/?version=16
|
||||
[Adoptium-8]: https://adoptium.net/temurin/releases/?version=8
|
||||
[Jarfix]: https://johann.loefflmann.net/en/software/jarfix/index.html
|
||||
|
||||
[Forum]: https://forums.minecraftforge.net/
|
||||
[Support-Forum]: https://forums.minecraftforge.net/forum/18-support-bug-reports/
|
||||
[Support-Policy]: https://forums.minecraftforge.net/topic/144690-new-tiered-support-policy
|
||||
|
||||
[Discord]: https://discord.minecraftforge.net/
|
||||
|
||||
|
||||
@@ -19,28 +19,45 @@ public class ModLoadingContext
|
||||
{
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final ThreadLocal<ModLoadingContext> context = ThreadLocal.withInitial(ModLoadingContext::new);
|
||||
private ModContainer activeContainer;
|
||||
private Object languageExtension;
|
||||
private ModLoadingStage stage;
|
||||
|
||||
/**
|
||||
* @deprecated Use the context provided by your language loader in your mod's constructor.
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.21.1")
|
||||
public static ModLoadingContext get() {
|
||||
return context.get();
|
||||
}
|
||||
|
||||
private ModContainer activeContainer;
|
||||
|
||||
/**
|
||||
* @deprecated Going to be moved to ForgeHooks for internal use.
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.21.1")
|
||||
public void setActiveContainer(final ModContainer container) {
|
||||
this.activeContainer = container;
|
||||
this.languageExtension = container == null ? null : container.contextExtension.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Going to be moved to ForgeHooks for internal use.
|
||||
* @deprecated Override/Use {@link ModLoadingContext#getContainer()}
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.21.1")
|
||||
public ModContainer getActiveContainer() {
|
||||
return activeContainer == null ? ModList.get().getModContainerById("minecraft").orElseThrow(()->new RuntimeException("Where is minecraft???!")) : activeContainer;
|
||||
}
|
||||
|
||||
@Deprecated(forRemoval = true, since = "1.21.1")
|
||||
public String getActiveNamespace() {
|
||||
return activeContainer == null ? "minecraft" : activeContainer.getNamespace();
|
||||
}
|
||||
|
||||
public ModContainer getContainer() {
|
||||
return getActiveContainer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register an {@link IExtensionPoint} with the mod container.
|
||||
* @param point The extension point to register
|
||||
@@ -48,7 +65,7 @@ public class ModLoadingContext
|
||||
* @param <T> The type signature of the extension operator
|
||||
*/
|
||||
public <T extends Record & IExtensionPoint<T>> void registerExtensionPoint(Class<? extends IExtensionPoint<T>> point, Supplier<T> extension) {
|
||||
getActiveContainer().registerExtensionPoint(point, extension);
|
||||
getContainer().registerExtensionPoint(point, extension);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,7 +74,7 @@ public class ModLoadingContext
|
||||
* @param displayTest The {@link IExtensionPoint.DisplayTest} to register
|
||||
*/
|
||||
public void registerDisplayTest(IExtensionPoint.DisplayTest displayTest) {
|
||||
getActiveContainer().registerDisplayTest(() -> displayTest);
|
||||
getContainer().registerDisplayTest(() -> displayTest);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +83,7 @@ public class ModLoadingContext
|
||||
* @param displayTest The {@link Supplier<IExtensionPoint.DisplayTest>} to register
|
||||
*/
|
||||
public void registerDisplayTest(Supplier<IExtensionPoint.DisplayTest> displayTest) {
|
||||
getActiveContainer().registerDisplayTest(displayTest);
|
||||
getContainer().registerDisplayTest(displayTest);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,7 +93,7 @@ public class ModLoadingContext
|
||||
* @see IExtensionPoint.DisplayTest#DisplayTest(String, BiPredicate)
|
||||
*/
|
||||
public void registerDisplayTest(String version, BiPredicate<String, Boolean> remoteVersionTest) {
|
||||
getActiveContainer().registerDisplayTest(new IExtensionPoint.DisplayTest(version, remoteVersionTest));
|
||||
getContainer().registerDisplayTest(new IExtensionPoint.DisplayTest(version, remoteVersionTest));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,32 +103,31 @@ public class ModLoadingContext
|
||||
* @see IExtensionPoint.DisplayTest#DisplayTest(Supplier, BiPredicate)
|
||||
*/
|
||||
public void registerDisplayTest(Supplier<String> suppliedVersion, BiPredicate<String, Boolean> remoteVersionTest) {
|
||||
getActiveContainer().registerDisplayTest(new IExtensionPoint.DisplayTest(suppliedVersion, remoteVersionTest));
|
||||
getContainer().registerDisplayTest(new IExtensionPoint.DisplayTest(suppliedVersion, remoteVersionTest));
|
||||
}
|
||||
|
||||
public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec) {
|
||||
if (spec.isEmpty())
|
||||
{
|
||||
// This handles the case where a mod tries to register a config, without any options configured inside it.
|
||||
LOGGER.debug("Attempted to register an empty config for type {} on mod {}", type, getActiveContainer().getModId());
|
||||
LOGGER.debug("Attempted to register an empty config for type {} on mod {}", type, getContainer().getModId());
|
||||
return;
|
||||
}
|
||||
|
||||
getActiveContainer().addConfig(new ModConfig(type, spec, getActiveContainer()));
|
||||
getContainer().addConfig(new ModConfig(type, spec, getContainer()));
|
||||
}
|
||||
|
||||
public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec, String fileName) {
|
||||
if (spec.isEmpty())
|
||||
{
|
||||
// This handles the case where a mod tries to register a config, without any options configured inside it.
|
||||
LOGGER.debug("Attempted to register an empty config for type {} on mod {} using file name {}", type, getActiveContainer().getModId(), fileName);
|
||||
LOGGER.debug("Attempted to register an empty config for type {} on mod {} using file name {}", type, getContainer().getModId(), fileName);
|
||||
return;
|
||||
}
|
||||
|
||||
getActiveContainer().addConfig(new ModConfig(type, spec, getActiveContainer(), fileName));
|
||||
getContainer().addConfig(new ModConfig(type, spec, getContainer(), fileName));
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T extension() {
|
||||
return (T)languageExtension;
|
||||
|
||||
@@ -47,8 +47,12 @@ public class ConfigFileTypeHandler {
|
||||
throw new ConfigLoadingException(c, ex);
|
||||
}
|
||||
LOGGER.debug(CONFIG, "Loaded TOML config file {}", configPath.toString());
|
||||
FileWatcher.defaultInstance().addWatch(configPath, new ConfigWatcher(c, configData, Thread.currentThread().getContextClassLoader()));
|
||||
LOGGER.debug(CONFIG, "Watching TOML config file {} for changes", configPath.toString());
|
||||
try {
|
||||
FileWatcher.defaultInstance().addWatch(configPath, new ConfigWatcher(c, configData, Thread.currentThread().getContextClassLoader()));
|
||||
LOGGER.debug(CONFIG, "Watching TOML config file {} for changes", configPath.toString());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Couldn't watch config file", e);
|
||||
}
|
||||
return configData;
|
||||
};
|
||||
}
|
||||
|
||||
+4
-5
@@ -13,10 +13,10 @@ import java.lang.management.MemoryMXBean;
|
||||
import java.lang.management.MemoryUsage;
|
||||
|
||||
public class PerformanceInfo {
|
||||
private static final MemoryMXBean MEMORY_BEAN = ManagementFactory.getMemoryMXBean();
|
||||
|
||||
private final boolean showCPUUsage;
|
||||
private final OperatingSystemMXBean osBean;
|
||||
private final MemoryMXBean memoryBean;
|
||||
|
||||
private float memory;
|
||||
private String text;
|
||||
@@ -24,15 +24,14 @@ public class PerformanceInfo {
|
||||
PerformanceInfo() {
|
||||
showCPUUsage = FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.EARLY_WINDOW_SHOW_CPU);
|
||||
osBean = showCPUUsage ? ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class) : null;
|
||||
memoryBean = ManagementFactory.getMemoryMXBean();
|
||||
}
|
||||
|
||||
void update() {
|
||||
final MemoryUsage heapusage = memoryBean.getHeapMemoryUsage();
|
||||
final MemoryUsage heapusage = MEMORY_BEAN.getHeapMemoryUsage();
|
||||
memory = (float) heapusage.getUsed() / heapusage.getMax();
|
||||
|
||||
if (!showCPUUsage) {
|
||||
text = "Heap: %d/%d MB (%.1f%%) OffHeap: %d MB".formatted(heapusage.getUsed() >> 20, heapusage.getMax() >> 20, memory * 100.0, memoryBean.getNonHeapMemoryUsage().getUsed() >> 20);
|
||||
text = "Memory: %d/%dMB (%.1f%%)".formatted(heapusage.getUsed() >>> 20, heapusage.getMax() >>> 20, memory * 100f);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -44,7 +43,7 @@ public class PerformanceInfo {
|
||||
cpuText = "CPU: %.1f%%".formatted(cpuLoad * 100f);
|
||||
}
|
||||
|
||||
text = "Heap: %d/%d MB (%.1f%%) OffHeap: %d MB %s".formatted(heapusage.getUsed() >> 20, heapusage.getMax() >> 20, memory * 100.0, memoryBean.getNonHeapMemoryUsage().getUsed() >> 20, cpuText);
|
||||
text = "Memory: %d/%dMB (%.1f%%) %s".formatted(heapusage.getUsed() >>> 20, heapusage.getMax() >>> 20, memory * 100f, cpuText);
|
||||
}
|
||||
|
||||
String text() {
|
||||
|
||||
+38
-17
@@ -36,9 +36,9 @@ import cpw.mods.modlauncher.serviceapi.ILaunchPluginService;
|
||||
*/
|
||||
public class CapabilityTokenSubclass implements ILaunchPluginService {
|
||||
|
||||
private final String FUNC_NAME = "getType";
|
||||
private final String FUNC_DESC = "()Ljava/lang/String;";
|
||||
private final String CAP_INJECT = "net/minecraftforge/common/capabilities/CapabilityToken"; //Don't directly reference this to prevent class loading.
|
||||
private static final String FUNC_NAME = "getType";
|
||||
private static final String FUNC_DESC = "()Ljava/lang/String;";
|
||||
private static final String CAP_INJECT = "net/minecraftforge/common/capabilities/CapabilityToken"; //Don't directly reference this to prevent class loading.
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
@@ -49,38 +49,56 @@ public class CapabilityTokenSubclass implements ILaunchPluginService {
|
||||
private static final EnumSet<Phase> NAY = EnumSet.noneOf(Phase.class);
|
||||
|
||||
@Override
|
||||
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty) {
|
||||
return isEmpty ? NAY : YAY;
|
||||
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty)
|
||||
{
|
||||
if (isEmpty)
|
||||
return NAY;
|
||||
|
||||
String internalName = classType.getInternalName();
|
||||
if (internalName.startsWith("net/minecraft/") || internalName.startsWith("com/mojang/"))
|
||||
return NAY;
|
||||
|
||||
return YAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int processClassWithFlags(final Phase phase, final ClassNode classNode, final Type classType, final String reason) {
|
||||
if (CAP_INJECT.equals(classNode.name)) {
|
||||
for (MethodNode mtd : classNode.methods) {
|
||||
if (FUNC_NAME.equals(mtd.name) && FUNC_DESC.equals(mtd.desc)) {
|
||||
public int processClassWithFlags(final Phase phase, final ClassNode classNode, final Type classType, final String reason)
|
||||
{
|
||||
if (CAP_INJECT.equals(classNode.name))
|
||||
{
|
||||
for (MethodNode mtd : classNode.methods)
|
||||
{
|
||||
if (FUNC_NAME.equals(mtd.name) && FUNC_DESC.equals(mtd.desc))
|
||||
{
|
||||
mtd.access &= ~Opcodes.ACC_FINAL; // We have it final in code so people don't override it, cuz that'd be stupid, and make our transformer more complicated.
|
||||
}
|
||||
}
|
||||
return ComputeFlags.SIMPLE_REWRITE;
|
||||
} else if (CAP_INJECT.equals(classNode.superName)) {
|
||||
}
|
||||
else if (CAP_INJECT.equals(classNode.superName))
|
||||
{
|
||||
Holder cls = new Holder();
|
||||
|
||||
SignatureReader reader = new SignatureReader(classNode.signature); // Having a node version of this would probably be useful.
|
||||
reader.accept(new SignatureVisitor(Opcodes.ASM9) {
|
||||
Deque<String> stack = new ArrayDeque<>();
|
||||
reader.accept(new SignatureVisitor(Opcodes.ASM9)
|
||||
{
|
||||
final Deque<String> stack = new ArrayDeque<>();
|
||||
|
||||
@Override
|
||||
public void visitClassType(final String name) {
|
||||
public void visitClassType(final String name)
|
||||
{
|
||||
stack.push(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitInnerClassType(final String name) {
|
||||
public void visitInnerClassType(final String name)
|
||||
{
|
||||
stack.push(stack.pop() + '$' + name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitEnd() {
|
||||
public void visitEnd()
|
||||
{
|
||||
var val = stack.pop();
|
||||
if (!stack.isEmpty() && CAP_INJECT.equals(stack.peek()))
|
||||
cls.value = val;
|
||||
@@ -95,12 +113,15 @@ public class CapabilityTokenSubclass implements ILaunchPluginService {
|
||||
mtd.visitInsn(Opcodes.ARETURN);
|
||||
mtd.visitEnd();
|
||||
return ComputeFlags.COMPUTE_MAXS;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return ComputeFlags.NO_REWRITE;
|
||||
}
|
||||
}
|
||||
|
||||
private static class Holder {
|
||||
private static final class Holder {
|
||||
String value;
|
||||
}
|
||||
|
||||
}
|
||||
+29
-9
@@ -8,6 +8,7 @@ package net.minecraftforge.fml.common.asm;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -35,7 +36,11 @@ public class ObjectHolderDefinalize implements ILaunchPluginService {
|
||||
new VanillaObjectHolderData("net.minecraft.core.particles.ParticleTypes", "particle_type", "net.minecraft.core.particles.ParticleType"),
|
||||
new VanillaObjectHolderData("net.minecraft.sounds.SoundEvents", "sound_event", "net.minecraft.sounds.SoundEvent")
|
||||
).collect(Collectors.toMap(VanillaObjectHolderData::holderClass, Function.identity()));
|
||||
private final String OBJECT_HOLDER = "Lnet/minecraftforge/registries/ObjectHolder;"; //Don't directly reference this to prevent class loading.
|
||||
private static final Set<String> VANILLA_OBJECT_HOLDER_CLASSES = VANILLA_OBJECT_HOLDERS.keySet().stream()
|
||||
.map(it -> it.replace('.', '/'))
|
||||
.collect(Collectors.toUnmodifiableSet());
|
||||
private static final String OBJECT_HOLDER = "Lnet/minecraftforge/registries/ObjectHolder;"; //Don't directly reference this to prevent class loading.
|
||||
private static final int PUBLIC_STATIC_FINAL_FLAGS = Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL;
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
@@ -46,13 +51,29 @@ public class ObjectHolderDefinalize implements ILaunchPluginService {
|
||||
private static final EnumSet<Phase> NAY = EnumSet.noneOf(Phase.class);
|
||||
|
||||
@Override
|
||||
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty)
|
||||
{
|
||||
return isEmpty ? NAY : YAY;
|
||||
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty) {
|
||||
if (isEmpty)
|
||||
return NAY;
|
||||
|
||||
// Let's skip processing classes that definitely don't have object holders
|
||||
String internalName = classType.getInternalName();
|
||||
|
||||
// Forge classes that aren't in the debug package (that package is used for tests)
|
||||
if (internalName.startsWith("net/minecraftforge/") && !internalName.substring(18).contains("debug"))
|
||||
return NAY;
|
||||
|
||||
// Vanilla classes that don't have object holders
|
||||
if (internalName.startsWith("com/mojang/"))
|
||||
return NAY;
|
||||
|
||||
// ...except specific ones we added to the VANILLA_OBJECT_HOLDERS map
|
||||
if (internalName.startsWith("net/minecraft/") && !VANILLA_OBJECT_HOLDER_CLASSES.contains(internalName))
|
||||
return NAY;
|
||||
|
||||
return YAY;
|
||||
}
|
||||
|
||||
private boolean hasHolder(List<AnnotationNode> lst)
|
||||
{
|
||||
private boolean hasHolder(List<AnnotationNode> lst) {
|
||||
return lst != null && lst.stream().anyMatch(n -> n.desc.equals(OBJECT_HOLDER));
|
||||
}
|
||||
|
||||
@@ -76,10 +97,9 @@ public class ObjectHolderDefinalize implements ILaunchPluginService {
|
||||
{
|
||||
final AtomicBoolean changes = new AtomicBoolean();
|
||||
//Must be public static finals, and non-array objects
|
||||
final int flags = Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL;
|
||||
|
||||
//Fix Annotated Fields before injecting from class level
|
||||
classNode.fields.stream().filter(f -> ((f.access & flags) == flags) && f.desc.startsWith("L") && hasHolder(f.visibleAnnotations)).forEach(f ->
|
||||
classNode.fields.stream().filter(f -> ((f.access & PUBLIC_STATIC_FINAL_FLAGS) == PUBLIC_STATIC_FINAL_FLAGS) && f.desc.startsWith("L") && hasHolder(f.visibleAnnotations)).forEach(f ->
|
||||
{
|
||||
int prev = f.access;
|
||||
f.access &= ~Opcodes.ACC_FINAL; //Strip final
|
||||
@@ -89,7 +109,7 @@ public class ObjectHolderDefinalize implements ILaunchPluginService {
|
||||
|
||||
if (VANILLA_OBJECT_HOLDERS.containsKey(classType.getClassName())) //Class level, de-finalize all fields and add @ObjectHolder to them!
|
||||
{
|
||||
classNode.fields.stream().filter(f -> ((f.access & flags) == flags) && f.desc.startsWith("L")).forEach(f ->
|
||||
classNode.fields.stream().filter(f -> ((f.access & PUBLIC_STATIC_FINAL_FLAGS) == PUBLIC_STATIC_FINAL_FLAGS) && f.desc.startsWith("L")).forEach(f ->
|
||||
{
|
||||
int prev = f.access;
|
||||
f.access &= ~Opcodes.ACC_FINAL;
|
||||
|
||||
+29
-24
@@ -28,15 +28,16 @@ import org.slf4j.Logger;
|
||||
public class RuntimeEnumExtender implements ILaunchPluginService {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private final Type STRING = Type.getType(String.class);
|
||||
private final Type ENUM = Type.getType(Enum.class);
|
||||
private final Type MARKER_IFACE = Type.getType("Lnet/minecraftforge/common/IExtensibleEnum;");
|
||||
private final Type ARRAY_UTILS = Type.getType("Lorg/apache/commons/lang3/ArrayUtils;"); //Don't directly reference this to prevent class loading.
|
||||
private final String ADD_DESC = Type.getMethodDescriptor(Type.getType(Object[].class), Type.getType(Object[].class), Type.getType(Object.class));
|
||||
private final Type UNSAFE_HACKS = Type.getType("Lnet/minecraftforge/fml/unsafe/UnsafeHacks;"); //Again, not direct reference to prevent class loading.
|
||||
private final String CLEAN_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, Type.getType(Class.class));
|
||||
private final String NAME_DESC = Type.getMethodDescriptor(STRING);
|
||||
private final String EQUALS_DESC = Type.getMethodDescriptor(Type.BOOLEAN_TYPE, STRING);
|
||||
private static final Type STRING = Type.getType(String.class);
|
||||
private static final Type ENUM = Type.getType(Enum.class);
|
||||
private static final Type MARKER_IFACE = Type.getType("Lnet/minecraftforge/common/IExtensibleEnum;");
|
||||
private static final Type ARRAY_UTILS = Type.getType("Lorg/apache/commons/lang3/ArrayUtils;"); //Don't directly reference this to prevent class loading.
|
||||
private static final String ADD_DESC = Type.getMethodDescriptor(Type.getType(Object[].class), Type.getType(Object[].class), Type.getType(Object.class));
|
||||
private static final Type UNSAFE_HACKS = Type.getType("Lnet/minecraftforge/fml/unsafe/UnsafeHacks;"); //Again, not direct reference to prevent class loading.
|
||||
private static final String CLEAN_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, Type.getType(Class.class));
|
||||
private static final String NAME_DESC = Type.getMethodDescriptor(STRING);
|
||||
private static final String EQUALS_DESC = Type.getMethodDescriptor(Type.BOOLEAN_TYPE, STRING);
|
||||
private static final int FLAGS = Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL | Opcodes.ACC_SYNTHETIC;
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
@@ -47,9 +48,15 @@ public class RuntimeEnumExtender implements ILaunchPluginService {
|
||||
private static final EnumSet<Phase> NAY = EnumSet.noneOf(Phase.class);
|
||||
|
||||
@Override
|
||||
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty)
|
||||
{
|
||||
return isEmpty ? NAY : YAY;
|
||||
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty) {
|
||||
if (isEmpty)
|
||||
return NAY;
|
||||
|
||||
String internalName = classType.getInternalName();
|
||||
if (internalName.startsWith("net/minecraftforge/") || internalName.startsWith("com/mojang/"))
|
||||
return NAY;
|
||||
|
||||
return YAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,25 +65,24 @@ public class RuntimeEnumExtender implements ILaunchPluginService {
|
||||
if ((classNode.access & Opcodes.ACC_ENUM) == 0)
|
||||
return ComputeFlags.NO_REWRITE;
|
||||
|
||||
Type array = Type.getType("[" + classType.getDescriptor());
|
||||
final int flags = Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL | Opcodes.ACC_SYNTHETIC;
|
||||
|
||||
FieldNode values = classNode.fields.stream().filter(f -> f.desc.contentEquals(array.getDescriptor()) && ((f.access & flags) == flags)).findFirst().orElse(null);
|
||||
|
||||
if (!classNode.interfaces.contains(MARKER_IFACE.getInternalName())) {
|
||||
if (!classNode.interfaces.contains(MARKER_IFACE.getInternalName()))
|
||||
return ComputeFlags.NO_REWRITE;
|
||||
}
|
||||
|
||||
Type array = Type.getType("[" + classType.getDescriptor());
|
||||
String arrayDesc = array.getDescriptor();
|
||||
|
||||
FieldNode values = classNode.fields.stream().filter(f -> f.desc.equals(arrayDesc) && ((f.access & FLAGS) == FLAGS)).findFirst().orElse(null);
|
||||
|
||||
//Static methods named "create" with first argument as a string
|
||||
List<MethodNode> candidates = classNode.methods.stream()
|
||||
.filter(m -> ((m.access & Opcodes.ACC_STATIC) != 0) && m.name.equals("create"))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
if (candidates.isEmpty()) {
|
||||
throw new IllegalStateException("IExtensibleEnum has no candidate factory methods: " + classType.getClassName());
|
||||
}
|
||||
|
||||
candidates.forEach(mtd ->
|
||||
for (var mtd : candidates)
|
||||
{
|
||||
Type[] args = Type.getArgumentTypes(mtd.desc);
|
||||
if (args.length == 0 || !args[0].equals(STRING)) {
|
||||
@@ -108,8 +114,7 @@ public class RuntimeEnumExtender implements ILaunchPluginService {
|
||||
Type[] ctrArgs = new Type[args.length + 1];
|
||||
ctrArgs[0] = STRING;
|
||||
ctrArgs[1] = Type.INT_TYPE;
|
||||
for (int x = 1; x < args.length; x++)
|
||||
ctrArgs[1 + x] = args[x];
|
||||
System.arraycopy(args, 1, ctrArgs, 2, args.length - 1);
|
||||
|
||||
String desc = Type.getMethodDescriptor(Type.VOID_TYPE, ctrArgs);
|
||||
|
||||
@@ -231,7 +236,7 @@ public class RuntimeEnumExtender implements ILaunchPluginService {
|
||||
ins.load(vars, classType);
|
||||
ins.areturn(classType);
|
||||
}
|
||||
});
|
||||
}
|
||||
return ComputeFlags.COMPUTE_FRAMES;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,9 @@ public class FMLLoader {
|
||||
LOGGER.debug(CORE, "Detected version data : {}", versionInfo);
|
||||
LOGGER.debug(CORE, "FML {} loading", LauncherVersion.getVersion());
|
||||
|
||||
// Allows us to communicate properties with other services through ModLauncher
|
||||
setupBlackboardKeys();
|
||||
|
||||
checkPackage(ITransformationService.class, "4.0", "ModLauncher");
|
||||
accessTransformer = getPlugin(env, "accesstransformer", "1.0", "AccessTransformer");
|
||||
/*eventBus =*/ getPlugin(env, "eventbus", "1.0", "EventBus");
|
||||
@@ -120,6 +123,12 @@ public class FMLLoader {
|
||||
return providers.get(0);
|
||||
}
|
||||
|
||||
private static void setupBlackboardKeys() {
|
||||
LOGGER.debug(CORE, "Requesting CoreMods to not apply the fix for ASMAPI.findFirstInstructionBefore by default");
|
||||
var blackboardKey = TypesafeMap.Key.getOrCreate(Launcher.INSTANCE.blackboard(), "coremods.use_old_findFirstInstructionBefore", Boolean.class);
|
||||
Launcher.INSTANCE.blackboard().<Boolean>computeIfAbsent(blackboardKey, k -> true);
|
||||
}
|
||||
|
||||
static void setupLaunchHandler(final IEnvironment environment, final Map<String, Object> arguments) {
|
||||
final String launchTarget = environment.getProperty(IEnvironment.Keys.LAUNCHTARGET.get()).orElse("MISSING");
|
||||
arguments.put("launchTarget", launchTarget);
|
||||
|
||||
@@ -173,7 +173,7 @@ public class RuntimeDistCleaner implements ILaunchPluginService
|
||||
return unpacked;
|
||||
}
|
||||
|
||||
private boolean remove(final List<AnnotationNode> anns, final String side)
|
||||
private static boolean remove(final List<AnnotationNode> anns, final String side)
|
||||
{
|
||||
var onlyIns = unpack(anns);
|
||||
|
||||
@@ -193,7 +193,7 @@ public class RuntimeDistCleaner implements ILaunchPluginService
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean hasOnlyInWithModAnnotation(final List<AnnotationNode> anns)
|
||||
private static boolean hasOnlyInWithModAnnotation(final List<AnnotationNode> anns)
|
||||
{
|
||||
if (anns == null)
|
||||
{
|
||||
@@ -231,9 +231,15 @@ public class RuntimeDistCleaner implements ILaunchPluginService
|
||||
private static final EnumSet<Phase> NAY = EnumSet.noneOf(Phase.class);
|
||||
|
||||
@Override
|
||||
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty)
|
||||
{
|
||||
return isEmpty ? NAY : YAY;
|
||||
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty) {
|
||||
if (isEmpty)
|
||||
return NAY;
|
||||
|
||||
String internalName = classType.getInternalName();
|
||||
if (internalName.startsWith("net/minecraftforge/"))
|
||||
return NAY;
|
||||
|
||||
return YAY;
|
||||
}
|
||||
|
||||
private static class LambdaGatherer extends MethodVisitor {
|
||||
|
||||
+66
-84
@@ -7,6 +7,7 @@ package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import cpw.mods.modlauncher.api.LamdbaExceptionUtils;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.fml.loading.StringUtils;
|
||||
import net.minecraftforge.forgespi.language.IConfigurable;
|
||||
@@ -17,15 +18,17 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.slf4j.Logger;
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
import java.net.URL;
|
||||
import java.security.CodeSigner;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.NoSuchProviderException;
|
||||
import java.security.SignatureException;
|
||||
import java.security.cert.CertificateEncodingException;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -34,8 +37,10 @@ import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class ModFileInfo implements IModFileInfo, IConfigurable {
|
||||
public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
{
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final String MAYBE_NOT_JAVAFML_VER = "[2,)";
|
||||
private static final String JAVAFML = "javafml";
|
||||
@@ -55,7 +60,8 @@ public class ModFileInfo implements IModFileInfo, IConfigurable {
|
||||
private final String license;
|
||||
private final List<String> usesServices;
|
||||
|
||||
ModFileInfo(final ModFile modFile, final IConfigurable config, Consumer<IModFileInfo> configFileConsumer) {
|
||||
ModFileInfo(final ModFile modFile, final IConfigurable config, Consumer<IModFileInfo> configFileConsumer)
|
||||
{
|
||||
this.modFile = modFile;
|
||||
this.config = config;
|
||||
configFileConsumer.accept(this);
|
||||
@@ -80,6 +86,10 @@ public class ModFileInfo implements IModFileInfo, IConfigurable {
|
||||
.orElse(false);
|
||||
this.clientSideOnly = config.<Boolean>getConfigElement("clientSideOnly")
|
||||
.orElse(false);
|
||||
if (this.clientSideOnly) {
|
||||
// if clientSideOnly, then this is definitely a Forge mod
|
||||
maybeNotAForgeMod = false;
|
||||
}
|
||||
this.showAsDataPack = config.<Boolean>getConfigElement("showAsDataPack")
|
||||
.orElse(false);
|
||||
this.usesServices = config.<List<String>>getConfigElement("services")
|
||||
@@ -88,10 +98,6 @@ public class ModFileInfo implements IModFileInfo, IConfigurable {
|
||||
.map(StringUtils::toURL)
|
||||
.orElse(null);
|
||||
|
||||
// if clientSideOnly, then this is definitely a Forge mod
|
||||
if (this.clientSideOnly)
|
||||
maybeNotAForgeMod = false;
|
||||
|
||||
if (maybeNotAForgeMod) {
|
||||
// mark this file as not a Forge mod. Note: this marker may be removed later based on the mod dependencies
|
||||
this.properties = config.<Map<String, Object>>getConfigElement("properties")
|
||||
@@ -105,13 +111,14 @@ public class ModFileInfo implements IModFileInfo, IConfigurable {
|
||||
|
||||
final List<? extends IConfigurable> modConfigs = config.getConfigList("mods");
|
||||
if (modConfigs.isEmpty())
|
||||
{
|
||||
throw new InvalidModFileException("Missing mods list", this);
|
||||
|
||||
}
|
||||
this.mods = modConfigs.stream()
|
||||
.map(mi-> (IModInfo)new ModInfo(this, mi))
|
||||
.toList();
|
||||
|
||||
if (LOGGER.isDebugEnabled(LogMarkers.LOADING)) {
|
||||
if (LOGGER.isDebugEnabled(LogMarkers.LOADING))
|
||||
{
|
||||
LOGGER.debug(LogMarkers.LOADING, "Found valid mod file {} with {} mods - versions {}",
|
||||
this.modFile.getFileName(),
|
||||
this.mods.stream().map(IModInfo::getModId).collect(Collectors.joining(",", "{", "}")),
|
||||
@@ -125,11 +132,13 @@ public class ModFileInfo implements IModFileInfo, IConfigurable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IModInfo> getMods() {
|
||||
public List<IModInfo> getMods()
|
||||
{
|
||||
return mods;
|
||||
}
|
||||
|
||||
public ModFile getFile() {
|
||||
public ModFile getFile()
|
||||
{
|
||||
return this.modFile;
|
||||
}
|
||||
|
||||
@@ -139,37 +148,44 @@ public class ModFileInfo implements IModFileInfo, IConfigurable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getFileProperties() {
|
||||
public Map<String, Object> getFileProperties()
|
||||
{
|
||||
return this.properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showAsResourcePack() {
|
||||
public boolean showAsResourcePack()
|
||||
{
|
||||
return this.showAsResourcePack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClientSideOnly() {
|
||||
public boolean isClientSideOnly()
|
||||
{
|
||||
return this.clientSideOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showAsDataPack() {
|
||||
public boolean showAsDataPack()
|
||||
{
|
||||
return this.showAsDataPack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Optional<T> getConfigElement(final String... key) {
|
||||
public <T> Optional<T> getConfigElement(final String... key)
|
||||
{
|
||||
return this.config.getConfigElement(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends IConfigurable> getConfigList(final String... key) {
|
||||
public List<? extends IConfigurable> getConfigList(final String... key)
|
||||
{
|
||||
return this.config.getConfigList(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLicense() {
|
||||
public String getLicense()
|
||||
{
|
||||
return license;
|
||||
}
|
||||
|
||||
@@ -178,78 +194,49 @@ public class ModFileInfo implements IModFileInfo, IConfigurable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public URL getIssueURL() {
|
||||
public URL getIssueURL()
|
||||
{
|
||||
return issueURL;
|
||||
}
|
||||
|
||||
public boolean missingLicense() {
|
||||
public boolean missingLicense()
|
||||
{
|
||||
return Strings.isNullOrEmpty(license);
|
||||
}
|
||||
|
||||
private final char[] HEX = "0123456789ABCDEF".toCharArray();
|
||||
public Optional<String> getCodeSigningFingerprint() {
|
||||
var signers = this.modFile.getSecureJar().getManifestSigners();
|
||||
if (signers == null)
|
||||
return Optional.empty();
|
||||
|
||||
for (var signer : signers) {
|
||||
for (var cert : signer.getSignerCertPath().getCertificates()) {
|
||||
try {
|
||||
var encoded = cert.getEncoded();
|
||||
var sha256 = MessageDigest.getInstance("SHA-256");
|
||||
var digest = sha256.digest(encoded);
|
||||
var buf = new StringBuilder(digest.length * 3);
|
||||
for (int x = 0; x < digest.length - 1; x++) {
|
||||
buf.append(HEX[(digest[x] & 0xF0) >> 4]);
|
||||
buf.append(HEX[(digest[x] & 0x0F) ]);
|
||||
buf.append(':');
|
||||
}
|
||||
buf.append(HEX[(digest[digest.length - 1] & 0xF0) >> 4]);
|
||||
buf.append(HEX[(digest[digest.length - 1] & 0x0F) ]);
|
||||
|
||||
// We only care about the first. Should we list them all?
|
||||
return Optional.of(buf.toString());
|
||||
} catch (CertificateEncodingException | NoSuchAlgorithmException e) {
|
||||
sneak(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
|
||||
return (signers == null ? Stream.<CodeSigner>of() : Arrays.stream(signers))
|
||||
.flatMap(csa->csa.getSignerCertPath().getCertificates().stream())
|
||||
.findFirst()
|
||||
.map(LamdbaExceptionUtils.rethrowFunction(Certificate::getEncoded))
|
||||
.map(bytes->LamdbaExceptionUtils.uncheck(()->MessageDigest.getInstance("SHA-256")).digest(bytes))
|
||||
.map(StringUtils::binToHex)
|
||||
.map(str-> String.join(":", str.split("(?<=\\G.{2})")));
|
||||
}
|
||||
|
||||
public Optional<String> getTrustData() {
|
||||
var signers = this.modFile.getSecureJar().getManifestSigners();
|
||||
if (signers == null)
|
||||
return Optional.empty();
|
||||
|
||||
for (var signer : signers) {
|
||||
for (var cert : signer.getSignerCertPath().getCertificates()) {
|
||||
if (!(cert instanceof X509Certificate x509))
|
||||
continue;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.append(x509.getSubjectX500Principal().getName(X500Principal.RFC2253).split(",")[0]);
|
||||
|
||||
var selfSigned = false;
|
||||
try {
|
||||
x509.verify(x509.getPublicKey());
|
||||
selfSigned = true;
|
||||
} catch (CertificateException | NoSuchAlgorithmException | InvalidKeyException | SignatureException | NoSuchProviderException e) {
|
||||
// not self signed
|
||||
}
|
||||
|
||||
if (selfSigned)
|
||||
return Arrays.stream(this.modFile.getSecureJar().getManifestSigners())
|
||||
.flatMap(csa->csa.getSignerCertPath().getCertificates().stream())
|
||||
.findFirst()
|
||||
.map(X509Certificate.class::cast)
|
||||
.map(c->{
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(c.getSubjectX500Principal().getName(X500Principal.RFC2253).split(",")[0]);
|
||||
boolean selfSigned = false;
|
||||
try {
|
||||
c.verify(c.getPublicKey());
|
||||
selfSigned = true;
|
||||
} catch (CertificateException | NoSuchAlgorithmException | InvalidKeyException | SignatureException | NoSuchProviderException e) {
|
||||
// not self signed
|
||||
}
|
||||
if (selfSigned) {
|
||||
sb.append(" self-signed");
|
||||
else
|
||||
sb.append(" signed by ").append(x509.getIssuerX500Principal().getName(X500Principal.RFC2253).split(",")[0]);
|
||||
|
||||
return Optional.of(sb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
} else {
|
||||
sb.append(" signed by ").append(c.getIssuerX500Principal().getName(X500Principal.RFC2253).split(",")[0]);
|
||||
};
|
||||
return sb.toString();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -266,9 +253,4 @@ public class ModFileInfo implements IModFileInfo, IConfigurable {
|
||||
public List<String> usesServices() {
|
||||
return usesServices;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <E extends Throwable, R> R sneak(Throwable e) throws E {
|
||||
throw (E)e;
|
||||
}
|
||||
}
|
||||
@@ -19,11 +19,11 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ApiStatus.Internal
|
||||
@@ -50,39 +50,34 @@ public class ModInfo implements IModInfo, IConfigurable {
|
||||
private final IConfigurable config;
|
||||
private final Optional<URL> modUrl;
|
||||
|
||||
public ModInfo(final ModFileInfo owningFile, final IConfigurable config) {
|
||||
public ModInfo(final ModFileInfo owningFile, final IConfigurable config)
|
||||
{
|
||||
Optional<ModFileInfo> ownFile = Optional.ofNullable(owningFile);
|
||||
this.owningFile = owningFile;
|
||||
this.config = config;
|
||||
|
||||
// These are sourced from the mod specific [[mod]] entry
|
||||
this.modId = config.<String>getConfigElement("modId")
|
||||
.orElseThrow(() -> new InvalidModFileException("Missing modId", owningFile));
|
||||
|
||||
// verify we have a valid modid
|
||||
if (!VALID_MODID.matcher(this.modId).matches()) {
|
||||
LOGGER.error(LogUtils.FATAL_MARKER, "Invalid modId found in file {} - {} does not match the standard: {}", this.owningFile.getFile().getFilePath(), this.modId, VALID_MODID.pattern());
|
||||
throw new InvalidModFileException("Invalid modId found : " + this.modId, owningFile);
|
||||
}
|
||||
|
||||
this.namespace = config.<String>getConfigElement("namespace")
|
||||
.orElse(this.modId);
|
||||
|
||||
// verify our namespace is valid
|
||||
if (!VALID_NAMESPACE.matcher(this.namespace).matches()) {
|
||||
LOGGER.error(LogUtils.FATAL_MARKER, "Invalid override namespace found in file {} - {} does not match the standard: {}", this.owningFile.getFile().getFilePath(), this.namespace, VALID_NAMESPACE.pattern());
|
||||
throw new InvalidModFileException("Invalid override namespace found : " + this.namespace, owningFile);
|
||||
}
|
||||
|
||||
this.version = config.<String>getConfigElement("version")
|
||||
.map(s -> StringSubstitutor.replace(s, ownFile.map(ModFileInfo::getFile).orElse(null)))
|
||||
.map(DefaultArtifactVersion::new)
|
||||
.orElse(DEFAULT_VERSION);
|
||||
|
||||
// verify we have a valid mod version
|
||||
if (!VALID_VERSION.matcher(this.version.toString()).matches())
|
||||
throw new InvalidModFileException("Illegal version number specified " + this.version, this.getOwningFile());
|
||||
|
||||
if (!VALID_VERSION.matcher(this.version.toString()).matches()) {
|
||||
throw new InvalidModFileException("Illegal version number specified "+this.version, this.getOwningFile());
|
||||
}
|
||||
// The remaining properties all default to sensible values and are not essential
|
||||
this.displayName = config.<String>getConfigElement("displayName")
|
||||
.orElse(this.modId);
|
||||
@@ -93,48 +88,25 @@ public class ModInfo implements IModInfo, IConfigurable {
|
||||
.orElseGet(() -> ownFile.flatMap(mf -> mf.<String>getConfigElement("logoFile"))
|
||||
.orElse(null)));
|
||||
this.logoBlur = config.<Boolean>getConfigElement("logoBlur")
|
||||
.orElseGet(() -> ownFile.flatMap(mf -> mf.<Boolean>getConfigElement("logoBlur"))
|
||||
.orElseGet(() -> ownFile.flatMap(f -> f.<Boolean>getConfigElement("logoBlur"))
|
||||
.orElse(true));
|
||||
this.updateJSONURL = config.<String>getConfigElement("updateJSONURL")
|
||||
.map(StringUtils::toURL);
|
||||
this.modUrl = config.<String>getConfigElement("modUrl")
|
||||
.map(StringUtils::toURL);
|
||||
|
||||
// These are sourced from the file rather than the mod-specific block, but with a modid tag
|
||||
if (ownFile.isEmpty()) {
|
||||
this.dependencies = Collections.emptyList();
|
||||
this.features = Collections.emptyList();
|
||||
this.properties = Collections.emptyMap();
|
||||
} else {
|
||||
var deps = this.owningFile.getConfigList("dependencies", this.modId);
|
||||
if (deps == null || deps.isEmpty()) {
|
||||
this.dependencies = Collections.emptyList();
|
||||
} else {
|
||||
var tmp = new ArrayList<ModVersion>();
|
||||
for (var dep : deps)
|
||||
tmp.add(new ModVersion(this, dep));
|
||||
this.dependencies = Collections.unmodifiableList(tmp);
|
||||
}
|
||||
|
||||
var feats = this.owningFile.<Map<String, Object>>getConfigElement("features", this.modId).orElse(null);
|
||||
if (feats == null) {
|
||||
this.features = Collections.emptyList();
|
||||
} else {
|
||||
var tmp = new ArrayList<ForgeFeature.Bound>();
|
||||
for (var entry : feats.entrySet()) {
|
||||
if (!(entry.getValue() instanceof String val))
|
||||
throw new InvalidModFileException("Invalid feature bound {" + entry.getValue() + "} for key {" + entry.getKey() + "} only strings are accepted", this.owningFile);
|
||||
tmp.add(new ForgeFeature.Bound(entry.getKey(), val, this));
|
||||
}
|
||||
this.features = Collections.unmodifiableList(tmp);
|
||||
}
|
||||
|
||||
var props = this.owningFile.<Map<String, Object>>getConfigElement("modproperties", this.modId).orElse(null);
|
||||
if (props == null)
|
||||
this.properties = Collections.emptyMap();
|
||||
else
|
||||
this.properties = Collections.unmodifiableMap(props);
|
||||
}
|
||||
this.dependencies = ownFile.map(mfi -> mfi.getConfigList("dependencies", this.modId))
|
||||
.orElse(Collections.emptyList())
|
||||
.stream()
|
||||
.map(dep -> new ModVersion(this, dep))
|
||||
.toList();
|
||||
this.features = ownFile.flatMap(mfi -> mfi.<Map<String, Object>>getConfigElement("features", this.modId))
|
||||
.stream()
|
||||
.flatMap(m->m.entrySet().stream())
|
||||
.map(this::makeBound)
|
||||
.toList();
|
||||
this.properties = ownFile.flatMap(mfi -> mfi.<Map<String, Object>>getConfigElement("modproperties", this.modId))
|
||||
.orElse(Collections.emptyMap());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -148,12 +120,14 @@ public class ModInfo implements IModInfo, IConfigurable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
public String getDisplayName()
|
||||
{
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
public String getDescription()
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
|
||||
@@ -183,12 +157,14 @@ public class ModInfo implements IModInfo, IConfigurable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> getLogoFile() {
|
||||
public Optional<String> getLogoFile()
|
||||
{
|
||||
return this.logoFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getLogoBlur() {
|
||||
public boolean getLogoBlur()
|
||||
{
|
||||
return this.logoBlur;
|
||||
}
|
||||
|
||||
@@ -217,6 +193,14 @@ public class ModInfo implements IModInfo, IConfigurable {
|
||||
return modUrl;
|
||||
}
|
||||
|
||||
private ForgeFeature.Bound makeBound(Map.Entry<String, Object> e) {
|
||||
if (e.getValue() instanceof String val) {
|
||||
return new ForgeFeature.Bound(e.getKey(), val, this);
|
||||
} else {
|
||||
throw new InvalidModFileException("Invalid feature bound {" + e.getValue() + "} for key {" + e.getKey() + "} only strings are accepted", this.owningFile);
|
||||
}
|
||||
}
|
||||
|
||||
class ModVersion implements net.minecraftforge.forgespi.language.IModInfo.ModVersion {
|
||||
private IModInfo owner;
|
||||
private final String modId;
|
||||
@@ -230,7 +214,6 @@ public class ModInfo implements IModInfo, IConfigurable {
|
||||
this.owner = owner;
|
||||
this.modId = config.<String>getConfigElement("modId")
|
||||
.orElseThrow(()->new InvalidModFileException("Missing required field modid in dependency", getOwningFile()));
|
||||
|
||||
if (this.modId.equals("forge")) {
|
||||
var fileProps = owner.getOwningFile().getFileProperties();
|
||||
// Checking containsKey to avoid a possible exception if the property is not present (due to Collections.emptyMap())
|
||||
@@ -240,15 +223,14 @@ public class ModInfo implements IModInfo, IConfigurable {
|
||||
fileProps.remove(ModFileInfo.NOT_A_FORGE_MOD_PROP);
|
||||
}
|
||||
}
|
||||
|
||||
var mandatory = config.<Boolean>getConfigElement("mandatory");
|
||||
if (mandatory.isPresent())
|
||||
if (mandatory.isPresent()) {
|
||||
this.mandatory = mandatory.get();
|
||||
else if (owner.getOwningFile().getFileProperties().containsKey(ModFileInfo.NOT_A_FORGE_MOD_PROP))
|
||||
} else if (owner.getOwningFile().getFileProperties().containsKey(ModFileInfo.NOT_A_FORGE_MOD_PROP)) {
|
||||
this.mandatory = true;
|
||||
else
|
||||
} else {
|
||||
throw new InvalidModFileException("Missing required field mandatory in dependency", getOwningFile());
|
||||
|
||||
}
|
||||
this.versionRange = config.<String>getConfigElement("versionRange")
|
||||
.map(MavenVersionAdapter::createFromVersionSpec)
|
||||
.orElse(UNBOUNDED);
|
||||
@@ -262,38 +244,46 @@ public class ModInfo implements IModInfo, IConfigurable {
|
||||
.map(StringUtils::toURL);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getModId() {
|
||||
public String getModId()
|
||||
{
|
||||
return modId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VersionRange getVersionRange() {
|
||||
public VersionRange getVersionRange()
|
||||
{
|
||||
return versionRange;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMandatory() {
|
||||
public boolean isMandatory()
|
||||
{
|
||||
return mandatory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ordering getOrdering() {
|
||||
public Ordering getOrdering()
|
||||
{
|
||||
return ordering;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DependencySide getSide() {
|
||||
public DependencySide getSide()
|
||||
{
|
||||
return side;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(final IModInfo owner) {
|
||||
public void setOwner(final IModInfo owner)
|
||||
{
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModInfo getOwner() {
|
||||
public IModInfo getOwner()
|
||||
{
|
||||
return owner;
|
||||
}
|
||||
|
||||
@@ -302,4 +292,5 @@ public class ModInfo implements IModInfo, IConfigurable {
|
||||
return referralUrl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+2
-8
@@ -6,8 +6,6 @@
|
||||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import com.electronwill.nightconfig.core.UnmodifiableConfig;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.minecraftforge.forgespi.language.IConfigurable;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
|
||||
@@ -40,12 +38,8 @@ class NightConfigWrapper implements IConfigurable {
|
||||
public <T> Optional<T> getConfigElement(final String... key) {
|
||||
var path = asList(key);
|
||||
return this.config.getOptional(path).map(value -> {
|
||||
if (value instanceof UnmodifiableConfig cfg) {
|
||||
// New Night config doesn't implement valueMap(), so do a copy.
|
||||
var builder = ImmutableMap.builder();
|
||||
for (var e: cfg.entrySet())
|
||||
builder.put(e.getKey(), e.getValue());
|
||||
return (T)builder.build();
|
||||
if (value instanceof UnmodifiableConfig) {
|
||||
return (T) ((UnmodifiableConfig) value).valueMap();
|
||||
} else if (value instanceof ArrayList<?> al && al.size() > 0 && al.get(0) instanceof UnmodifiableConfig) {
|
||||
throw new InvalidModFileException("The configuration path " + path + " is invalid. I wasn't expecting a multi-object list - remove one of the [[ ]]", file);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class Scanner {
|
||||
try (InputStream in = Files.newInputStream(path)){
|
||||
ModClassVisitor mcv = new ModClassVisitor();
|
||||
ClassReader cr = new ClassReader(in);
|
||||
cr.accept(mcv, 0);
|
||||
cr.accept(mcv, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
|
||||
mcv.buildData(result.getClasses(), result.getAnnotations());
|
||||
} catch (IOException | IllegalArgumentException e) {
|
||||
// mark path bad
|
||||
|
||||
+5
-5
@@ -5,13 +5,13 @@ org.gradle.daemon=false
|
||||
org.gradle.parallel=true
|
||||
|
||||
JAVA_VERSION=21
|
||||
MC_VERSION=1.21.1
|
||||
MC_NEXT_VERSION=1.22
|
||||
MCP_VERSION=20240808.132146
|
||||
MC_VERSION=1.20.6
|
||||
MC_NEXT_VERSION=1.21
|
||||
MCP_VERSION=20240429.135109
|
||||
MAPPING_CHANNEL=official
|
||||
MAPPING_VERSION=1.21.1
|
||||
MAPPING_VERSION=1.20.6
|
||||
|
||||
// Set to true before the first build of a new MC version, so we don't do compatibility checks
|
||||
CHECK_COMPATIBILITY=false
|
||||
// Set to true to allow for fuzzy patching. Useful during updateing
|
||||
UPDATING=true
|
||||
UPDATING=false
|
||||
Vendored
BIN
Binary file not shown.
+2
-1
@@ -1,6 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -83,7 +83,8 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -130,10 +131,13 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
@@ -141,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@@ -149,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -198,11 +202,11 @@ fi
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
|
||||
Vendored
+10
-10
@@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Automatic eventbus subscriber - reads {@link EventBusSubscriber}
|
||||
* annotations and passes the class instances to the {@link nBus}
|
||||
* annotations and passes the class instances to the {@link Bus}
|
||||
* defined by the annotation. Defaults to {@code MinecraftForge#EVENT_BUS}
|
||||
*/
|
||||
public class AutomaticEventSubscriber {
|
||||
|
||||
+8
-1
@@ -8,7 +8,7 @@ package net.minecraftforge.fml.javafmlmod;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
|
||||
public class FMLJavaModLoadingContext
|
||||
public class FMLJavaModLoadingContext extends ModLoadingContext
|
||||
{
|
||||
private final FMLModContainer container;
|
||||
|
||||
@@ -24,11 +24,18 @@ public class FMLJavaModLoadingContext
|
||||
return container.getEventBus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FMLModContainer getContainer() {
|
||||
return container;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to get the right instance from the {@link ModLoadingContext} correctly.
|
||||
* @return The FMLJavaMod language specific extension from the ModLoadingContext
|
||||
*
|
||||
* @deprecated use {@link FMLJavaModLoadingContext} in your mod constructor
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.21.1")
|
||||
public static FMLJavaModLoadingContext get() {
|
||||
return ModLoadingContext.get().extension();
|
||||
}
|
||||
|
||||
+10
-4
@@ -21,6 +21,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.Marker;
|
||||
import org.apache.logging.log4j.MarkerManager;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
@@ -32,6 +33,7 @@ public class FMLModContainer extends ModContainer {
|
||||
private final IEventBus eventBus;
|
||||
private Object modInstance;
|
||||
private final Class<?> modClass;
|
||||
private final FMLJavaModLoadingContext context = new FMLJavaModLoadingContext(this);
|
||||
|
||||
public FMLModContainer(IModInfo info, String className, ModFileScanData modFileScanResults, ModuleLayer gameLayer) {
|
||||
super(info);
|
||||
@@ -40,9 +42,7 @@ public class FMLModContainer extends ModContainer {
|
||||
activityMap.put(ModLoadingStage.CONSTRUCT, this::constructMod);
|
||||
this.eventBus = BusBuilder.builder().setExceptionHandler(this::onEventFailed).setTrackPhases(false).markerType(IModBusEvent.class).useModLauncher().build();
|
||||
this.configHandler = Optional.of(ce->this.eventBus.post(ce.self()));
|
||||
final FMLJavaModLoadingContext contextExtension = new FMLJavaModLoadingContext(this);
|
||||
this.contextExtension = () -> contextExtension;
|
||||
|
||||
this.contextExtension = () -> context;
|
||||
|
||||
try {
|
||||
var moduleName = info.getOwningFile().moduleName();
|
||||
@@ -63,7 +63,13 @@ public class FMLModContainer extends ModContainer {
|
||||
private void constructMod() {
|
||||
try {
|
||||
LOGGER.trace(LOADING, "Loading mod instance {} of type {}", getModId(), modClass.getName());
|
||||
this.modInstance = modClass.getDeclaredConstructor().newInstance();
|
||||
Constructor<?> constructor;
|
||||
try {
|
||||
constructor = modClass.getDeclaredConstructor(context.getClass());
|
||||
} catch (NoSuchMethodException | SecurityException exception) {
|
||||
constructor = modClass.getDeclaredConstructor();
|
||||
}
|
||||
this.modInstance = constructor.getParameterCount() == 0 ? constructor.newInstance() : constructor.newInstance(context);
|
||||
LOGGER.trace(LOADING, "Loaded mod instance {} of type {}", getModId(), modClass.getName());
|
||||
} catch (Throwable e) {
|
||||
// When a mod constructor throws an exception, it's wrapped in an InvocationTargetException which hides the
|
||||
|
||||
+4
-3
@@ -141,9 +141,6 @@ dependencies {
|
||||
// For more info:
|
||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
|
||||
// Hack fix for now, force jopt-simple to be exactly 5.0.4 because Mojang ships that version, but some transitive dependencies request 6.0+
|
||||
implementation('net.sf.jopt-simple:jopt-simple:5.0.4') { version { strictly '5.0.4' } }
|
||||
}
|
||||
|
||||
// This block of code expands all declared replace properties in the specified resource targets.
|
||||
@@ -197,6 +194,10 @@ tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||
}
|
||||
|
||||
// IntelliJ no longer downloads javadocs and sources by default.
|
||||
// This tells Gradle to force IDEA to do it.
|
||||
idea.module { downloadJavadoc = downloadSources = true }
|
||||
|
||||
eclipse {
|
||||
// Run everytime eclipse builds the code
|
||||
//autoBuildTasks genEclipseRuns
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Config
|
||||
|
||||
private static boolean validateItemName(final Object obj)
|
||||
{
|
||||
return obj instanceof final String itemName && ForgeRegistries.ITEMS.containsKey(ResourceLocation.tryParse(itemName));
|
||||
return obj instanceof final String itemName && ForgeRegistries.ITEMS.containsKey(new ResourceLocation(itemName));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -58,7 +58,7 @@ public class Config
|
||||
|
||||
// convert the list of strings into a set of items
|
||||
items = ITEM_STRINGS.get().stream()
|
||||
.map(itemName -> ForgeRegistries.ITEMS.getValue(ResourceLocation.tryParse(itemName)))
|
||||
.map(itemName -> ForgeRegistries.ITEMS.getValue(new ResourceLocation(itemName)))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,6 @@ import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
|
||||
import net.minecraftforge.event.server.ServerStartingEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
@@ -61,9 +60,9 @@ public class ExampleMod
|
||||
output.accept(EXAMPLE_ITEM.get()); // Add the example item to the tab. For your own tabs, this method is preferred over the event
|
||||
}).build());
|
||||
|
||||
public ExampleMod()
|
||||
public ExampleMod(FMLJavaModLoadingContext context)
|
||||
{
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
IEventBus modEventBus = context.getModEventBus();
|
||||
|
||||
// Register the commonSetup method for modloading
|
||||
modEventBus.addListener(this::commonSetup);
|
||||
@@ -82,7 +81,7 @@ public class ExampleMod
|
||||
modEventBus.addListener(this::addCreative);
|
||||
|
||||
// Register our mod's ForgeConfigSpec so that Forge can create and load the config file for us
|
||||
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC);
|
||||
context.registerConfig(ModConfig.Type.COMMON, Config.SPEC);
|
||||
}
|
||||
|
||||
private void commonSetup(final FMLCommonSetupEvent event)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/blaze3d/pipeline/RenderTarget.java
|
||||
+++ b/com/mojang/blaze3d/pipeline/RenderTarget.java
|
||||
@@ -104,7 +_,10 @@
|
||||
@@ -106,7 +_,10 @@
|
||||
GlStateManager._texParameter(3553, 34892, 0);
|
||||
GlStateManager._texParameter(3553, 10242, 33071);
|
||||
GlStateManager._texParameter(3553, 10243, 33071);
|
||||
@@ -11,7 +11,7 @@
|
||||
}
|
||||
|
||||
this.setFilterMode(9728, true);
|
||||
@@ -114,8 +_,13 @@
|
||||
@@ -116,8 +_,13 @@
|
||||
GlStateManager._texImage2D(3553, 0, 32856, this.width, this.height, 0, 6408, 5121, null);
|
||||
GlStateManager._glBindFramebuffer(36160, this.frameBufferId);
|
||||
GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, this.colorTextureId, 0);
|
||||
@@ -26,7 +26,7 @@
|
||||
}
|
||||
|
||||
this.checkStatus();
|
||||
@@ -257,5 +_,26 @@
|
||||
@@ -280,5 +_,26 @@
|
||||
|
||||
public int getDepthTextureId() {
|
||||
return this.depthBufferId;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/blaze3d/platform/Window.java
|
||||
+++ b/com/mojang/blaze3d/platform/Window.java
|
||||
@@ -84,7 +_,8 @@
|
||||
@@ -82,7 +_,8 @@
|
||||
GLFW.glfwWindowHint(139267, 2);
|
||||
GLFW.glfwWindowHint(139272, 204801);
|
||||
GLFW.glfwWindowHint(139270, 1);
|
||||
@@ -10,7 +10,7 @@
|
||||
if (monitor != null) {
|
||||
VideoMode videomode = monitor.getPreferredVidMode(this.fullscreen ? this.preferredFullscreenVideoMode : Optional.empty());
|
||||
this.windowedX = this.x = monitor.getX() + videomode.getWidth() / 2 - this.width / 2;
|
||||
@@ -96,6 +_,7 @@
|
||||
@@ -94,6 +_,7 @@
|
||||
this.windowedX = this.x = aint1[0];
|
||||
this.windowedY = this.y = aint[0];
|
||||
}
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
GLFW.glfwMakeContextCurrent(this.window);
|
||||
GL.createCapabilities();
|
||||
@@ -254,6 +_,9 @@
|
||||
@@ -242,6 +_,9 @@
|
||||
GLFW.glfwGetFramebufferSize(this.window, aint, aint1);
|
||||
this.framebufferWidth = aint[0] > 0 ? aint[0] : 1;
|
||||
this.framebufferHeight = aint1[0] > 0 ? aint1[0] : 1;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--- a/com/mojang/blaze3d/vertex/BufferBuilder.java
|
||||
+++ b/com/mojang/blaze3d/vertex/BufferBuilder.java
|
||||
@@ -389,6 +_,15 @@
|
||||
return MemoryUtil.memSlice(this.buffer, p_231170_, p_231171_ - p_231170_);
|
||||
}
|
||||
|
||||
+ public void putBulkData(ByteBuffer buffer) {
|
||||
+ ensureCapacity(buffer.limit() + this.format.getVertexSize());
|
||||
+ this.buffer.position(this.nextElementByte);
|
||||
+ this.buffer.put(buffer);
|
||||
+ this.buffer.position(0);
|
||||
+ this.vertices += buffer.limit() / this.format.getVertexSize();
|
||||
+ this.nextElementByte += buffer.limit();
|
||||
+ }
|
||||
+
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static record DrawState(
|
||||
VertexFormat format, int vertexCount, int indexCount, VertexFormat.Mode mode, VertexFormat.IndexType indexType, boolean indexOnly, boolean sequentialIndex
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java
|
||||
+++ b/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java
|
||||
@@ -62,7 +_,7 @@
|
||||
public VertexConsumer setNormal(float p_344306_, float p_342091_, float p_344579_) {
|
||||
this.delegate.setNormal(p_344306_, p_342091_, p_344579_);
|
||||
Vector3f vector3f = this.normalInversePose.transform(p_344306_, p_342091_, p_344579_, this.normal);
|
||||
@@ -47,7 +_,7 @@
|
||||
@Override
|
||||
public void endVertex() {
|
||||
Vector3f vector3f = this.normalInversePose.transform(new Vector3f(this.nx, this.ny, this.nz));
|
||||
- Direction direction = Direction.getNearest(vector3f.x(), vector3f.y(), vector3f.z());
|
||||
+ Direction direction = net.minecraftforge.client.ForgeHooksClient.getNearestStable(vector3f.x(), vector3f.y(), vector3f.z());
|
||||
Vector3f vector3f1 = this.cameraInversePose.transformPosition(this.x, this.y, this.z, this.worldPos);
|
||||
vector3f1.rotateY((float) Math.PI);
|
||||
vector3f1.rotateX((float) (-Math.PI / 2));
|
||||
Vector4f vector4f = this.cameraInversePose.transform(new Vector4f(this.x, this.y, this.z, 1.0F));
|
||||
vector4f.rotateY((float) Math.PI);
|
||||
vector4f.rotateX((float) (-Math.PI / 2));
|
||||
@@ -1,24 +1,24 @@
|
||||
--- a/com/mojang/blaze3d/vertex/VertexConsumer.java
|
||||
+++ b/com/mojang/blaze3d/vertex/VertexConsumer.java
|
||||
@@ -12,7 +_,7 @@
|
||||
@@ -13,7 +_,7 @@
|
||||
import org.lwjgl.system.MemoryStack;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public interface VertexConsumer {
|
||||
+public interface VertexConsumer extends net.minecraftforge.client.extensions.IForgeVertexConsumer {
|
||||
VertexConsumer addVertex(float p_344294_, float p_342213_, float p_344859_);
|
||||
VertexConsumer vertex(double p_85945_, double p_85946_, double p_85947_);
|
||||
|
||||
VertexConsumer setColor(int p_342749_, int p_344324_, int p_343336_, int p_342831_);
|
||||
@@ -135,10 +_,11 @@
|
||||
VertexConsumer color(int p_85973_, int p_85974_, int p_85975_, int p_85976_);
|
||||
@@ -142,10 +_,11 @@
|
||||
f5 = afloat[k] * p_85992_;
|
||||
}
|
||||
|
||||
int i1 = FastColor.ARGB32.color(k, (int)f3, (int)f4, (int)f5);
|
||||
- int j1 = p_331444_[l];
|
||||
+ int j1 = applyBakedLighting(p_331444_[l], bytebuffer);
|
||||
float f10 = bytebuffer.getFloat(16);
|
||||
float f9 = bytebuffer.getFloat(20);
|
||||
Vector3f vector3f1 = matrix4f.transformPosition(f, f1, f2, new Vector3f());
|
||||
- int l = aint[k];
|
||||
+ int l = applyBakedLighting(aint[k], bytebuffer);
|
||||
float f9 = bytebuffer.getFloat(16);
|
||||
float f10 = bytebuffer.getFloat(20);
|
||||
Vector4f vector4f = matrix4f.transform(new Vector4f(f, f1, f2, 1.0F));
|
||||
+ applyBakedNormals(vector3f, bytebuffer, p_85988_.normal());
|
||||
this.addVertex(vector3f1.x(), vector3f1.y(), vector3f1.z(), i1, f10, f9, p_85993_, j1, vector3f.x(), vector3f.y(), vector3f.z());
|
||||
this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, p_335371_, f9, f10, p_85993_, l, vector3f.x(), vector3f.y(), vector3f.z());
|
||||
}
|
||||
}
|
||||
@@ -1,41 +1,21 @@
|
||||
--- a/com/mojang/blaze3d/vertex/VertexFormat.java
|
||||
+++ b/com/mojang/blaze3d/vertex/VertexFormat.java
|
||||
@@ -13,7 +_,7 @@
|
||||
@@ -12,7 +_,7 @@
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public class VertexFormat {
|
||||
+public class VertexFormat implements net.minecraftforge.client.extensions.IForgeVertexFormat {
|
||||
public static final int UNKNOWN_ELEMENT = -1;
|
||||
private final List<VertexFormatElement> elements;
|
||||
private final List<String> names;
|
||||
@@ -22,6 +_,7 @@
|
||||
private final int[] offsetsByElement = new int[32];
|
||||
@Nullable
|
||||
private VertexBuffer immediateDrawVertexBuffer;
|
||||
+ private final com.google.common.collect.ImmutableMap<String, VertexFormatElement> elementMapping;
|
||||
|
||||
VertexFormat(List<VertexFormatElement> p_343616_, List<String> p_345241_, IntList p_345522_, int p_344162_) {
|
||||
this.elements = p_343616_;
|
||||
@@ -34,6 +_,11 @@
|
||||
int j = vertexformatelement != null ? p_343616_.indexOf(vertexformatelement) : -1;
|
||||
this.offsetsByElement[i] = j != -1 ? p_345522_.getInt(j) : -1;
|
||||
}
|
||||
+
|
||||
+ ImmutableMap.Builder<String, VertexFormatElement> elements = ImmutableMap.builder();
|
||||
+ for (int i = 0; i < p_343616_.size(); i++)
|
||||
+ elements.put(p_345241_.get(i), p_343616_.get(i));
|
||||
+ this.elementMapping = elements.buildOrThrow();
|
||||
}
|
||||
|
||||
public static VertexFormat.Builder builder() {
|
||||
@@ -158,6 +_,9 @@
|
||||
private final ImmutableList<VertexFormatElement> elements;
|
||||
private final ImmutableMap<String, VertexFormatElement> elementMapping;
|
||||
private final IntList offsets = new IntArrayList();
|
||||
@@ -113,6 +_,9 @@
|
||||
|
||||
return vertexbuffer;
|
||||
}
|
||||
+
|
||||
+ public ImmutableMap<String, VertexFormatElement> getElementMapping() { return elementMapping; }
|
||||
+ public int getOffset(int index) { return offsetsByElement[index]; }
|
||||
+ public int getOffset(int index) { return offsets.getInt(index); }
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class Builder {
|
||||
public static enum IndexType {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/CrashReport.java
|
||||
+++ b/net/minecraft/CrashReport.java
|
||||
@@ -58,14 +_,9 @@
|
||||
@@ -59,14 +_,9 @@
|
||||
if (this.uncategorizedStackTrace != null && this.uncategorizedStackTrace.length > 0) {
|
||||
p_127520_.append("-- Head --\n");
|
||||
p_127520_.append("Thread: ").append(Thread.currentThread().getName()).append("\n");
|
||||
@@ -18,7 +18,7 @@
|
||||
}
|
||||
|
||||
for (CrashReportCategory crashreportcategory : this.details) {
|
||||
@@ -73,6 +_,7 @@
|
||||
@@ -74,6 +_,7 @@
|
||||
p_127520_.append("\n\n");
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
this.systemReport.appendToCrashReportString(p_127520_);
|
||||
}
|
||||
|
||||
@@ -92,18 +_,7 @@
|
||||
@@ -93,18 +_,7 @@
|
||||
throwable.setStackTrace(this.exception.getStackTrace());
|
||||
}
|
||||
|
||||
@@ -45,4 +45,4 @@
|
||||
+ return net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(throwable);
|
||||
}
|
||||
|
||||
public String getFriendlyReport(ReportType p_343869_, List<String> p_342487_) {
|
||||
public String getFriendlyReport() {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/SharedConstants.java
|
||||
+++ b/net/minecraft/SharedConstants.java
|
||||
@@ -171,6 +_,7 @@
|
||||
@@ -181,6 +_,7 @@
|
||||
}
|
||||
|
||||
static {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
}
|
||||
|
||||
public AdvancementHolder save(Consumer<AdvancementHolder> p_138390_, String p_138391_) {
|
||||
- AdvancementHolder advancementholder = this.build(ResourceLocation.parse(p_138391_));
|
||||
+ return save(p_138390_, ResourceLocation.parse(p_138391_));
|
||||
- AdvancementHolder advancementholder = this.build(new ResourceLocation(p_138391_));
|
||||
+ return save(p_138390_, new ResourceLocation(p_138391_));
|
||||
+ }
|
||||
+
|
||||
+ public AdvancementHolder save(Consumer<AdvancementHolder> p_138390_, ResourceLocation id) {
|
||||
|
||||
@@ -1,24 +1,12 @@
|
||||
--- a/net/minecraft/client/Camera.java
|
||||
+++ b/net/minecraft/client/Camera.java
|
||||
@@ -105,9 +_,13 @@
|
||||
@@ -227,6 +_,18 @@
|
||||
return this.partialTickTime;
|
||||
}
|
||||
|
||||
protected void setRotation(float p_90573_, float p_90574_) {
|
||||
+ setRotation(p_90573_, p_90574_, 0.0f);
|
||||
+ }
|
||||
+
|
||||
+ public void setRotation(float p_90573_, float p_90574_, float z) {
|
||||
this.xRot = p_90574_;
|
||||
this.yRot = p_90573_;
|
||||
- this.rotation.rotationYXZ((float) Math.PI - p_90573_ * (float) (Math.PI / 180.0), -p_90574_ * (float) (Math.PI / 180.0), 0.0F);
|
||||
+ this.rotation.rotationYXZ((float) Math.PI - p_90573_ * (float) (Math.PI / 180.0), -p_90574_ * (float) (Math.PI / 180.0), z * (float) (Math.PI / 180.0));
|
||||
FORWARDS.rotate(this.rotation, this.forwards);
|
||||
UP.rotate(this.rotation, this.up);
|
||||
LEFT.rotate(this.rotation, this.left);
|
||||
@@ -223,6 +_,13 @@
|
||||
|
||||
public float getPartialTickTime() {
|
||||
return this.partialTickTime;
|
||||
+ public void setAnglesInternal(float yaw, float pitch) {
|
||||
+ this.yRot = yaw;
|
||||
+ this.xRot = pitch;
|
||||
+ }
|
||||
+
|
||||
+ public net.minecraft.world.level.block.state.BlockState getBlockAtCamera() {
|
||||
@@ -26,6 +14,8 @@
|
||||
+ return net.minecraft.world.level.block.Blocks.AIR.defaultBlockState();
|
||||
+ else
|
||||
+ return this.level.getBlockState(this.blockPosition).getStateAtViewpoint(this.level, this.blockPosition, this.position);
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class NearPlane {
|
||||
final Vec3 forward;
|
||||
@@ -1,25 +0,0 @@
|
||||
--- a/net/minecraft/client/DeltaTracker.java
|
||||
+++ b/net/minecraft/client/DeltaTracker.java
|
||||
@@ -87,18 +_,22 @@
|
||||
|
||||
private void pause() {
|
||||
if (!this.paused) {
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePre(true)) return;
|
||||
this.pausedDeltaTickResidual = this.deltaTickResidual;
|
||||
}
|
||||
|
||||
this.paused = true;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePost(true);
|
||||
}
|
||||
|
||||
private void unPause() {
|
||||
if (this.paused) {
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePre(false)) return;
|
||||
this.deltaTickResidual = this.pausedDeltaTickResidual;
|
||||
}
|
||||
|
||||
this.paused = false;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePost(false);
|
||||
}
|
||||
|
||||
public void updateFrozenState(boolean p_344005_) {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/KeyboardHandler.java
|
||||
+++ b/net/minecraft/client/KeyboardHandler.java
|
||||
@@ -405,9 +_,9 @@
|
||||
@@ -410,9 +_,9 @@
|
||||
Screen.wrapScreenError(() -> {
|
||||
if (p_90897_ == 1 || p_90897_ == 2) {
|
||||
screen.afterKeyboardAction();
|
||||
@@ -12,7 +12,7 @@
|
||||
}
|
||||
}, "keyPressed event handler", screen.getClass().getCanonicalName());
|
||||
if (aboolean[0]) {
|
||||
@@ -476,20 +_,21 @@
|
||||
@@ -481,20 +_,21 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/Minecraft.java
|
||||
+++ b/net/minecraft/client/Minecraft.java
|
||||
@@ -254,7 +_,7 @@
|
||||
@@ -259,7 +_,7 @@
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -9,7 +9,7 @@
|
||||
static Minecraft instance;
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final boolean ON_OSX = Util.getPlatform() == Util.OS.OSX;
|
||||
@@ -431,7 +_,6 @@
|
||||
@@ -438,7 +_,6 @@
|
||||
}
|
||||
}, Util.nonCriticalIoPool());
|
||||
LOGGER.info("Setting user: {}", this.user.getName());
|
||||
@@ -17,7 +17,7 @@
|
||||
this.demo = p_91084_.game.demo;
|
||||
this.allowsMultiplayer = !p_91084_.game.disableMultiplayer;
|
||||
this.allowsChat = !p_91084_.game.disableChat;
|
||||
@@ -468,15 +_,15 @@
|
||||
@@ -475,15 +_,15 @@
|
||||
}
|
||||
|
||||
this.window.setFramerateLimit(this.options.framerateLimit().get());
|
||||
@@ -34,8 +34,8 @@
|
||||
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.resourcePackRepository, this.resourceManager);
|
||||
this.resourcePackRepository.reload();
|
||||
this.options.loadSelectedResourcePacks(this.resourcePackRepository);
|
||||
this.languageManager = new LanguageManager(this.options.languageCode, p_340763_ -> {
|
||||
@@ -540,6 +_,7 @@
|
||||
this.languageManager = new LanguageManager(this.options.languageCode);
|
||||
@@ -542,6 +_,7 @@
|
||||
this.entityRenderDispatcher = new EntityRenderDispatcher(this, this.textureManager, this.itemRenderer, this.blockRenderer, this.font, this.options, this.entityModels);
|
||||
this.resourceManager.registerReloadListener(this.entityRenderDispatcher);
|
||||
this.particleEngine = new ParticleEngine(this.level, this.textureManager);
|
||||
@@ -43,12 +43,16 @@
|
||||
this.resourceManager.registerReloadListener(this.particleEngine);
|
||||
this.paintingTextures = new PaintingTextureManager(this.textureManager);
|
||||
this.resourceManager.registerReloadListener(this.paintingTextures);
|
||||
@@ -552,11 +_,15 @@
|
||||
@@ -554,13 +_,18 @@
|
||||
this.gameRenderer = new GameRenderer(this, this.entityRenderDispatcher.getItemInHandRenderer(), this.resourceManager, this.renderBuffers);
|
||||
this.resourceManager.registerReloadListener(this.gameRenderer.createReloadListener());
|
||||
this.levelRenderer = new LevelRenderer(this, this.entityRenderDispatcher, this.blockEntityRenderDispatcher, this.renderBuffers);
|
||||
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RenderLevelStageEvent.RegisterStageEvent());
|
||||
this.resourceManager.registerReloadListener(this.levelRenderer);
|
||||
- this.createSearchTrees();
|
||||
+ // Forge: We delay this to allow registration of modded creative mode tabs
|
||||
+ //this.createSearchTrees();
|
||||
this.resourceManager.registerReloadListener(this.searchRegistry);
|
||||
this.gpuWarnlistManager = new GpuWarnlistManager();
|
||||
this.resourceManager.registerReloadListener(this.gpuWarnlistManager);
|
||||
this.resourceManager.registerReloadListener(this.regionalCompliancies);
|
||||
@@ -59,7 +63,7 @@
|
||||
this.debugRenderer = new DebugRenderer(this);
|
||||
RealmsClient realmsclient = RealmsClient.create(this);
|
||||
this.realmsDataFetcher = new RealmsDataFetcher(realmsclient);
|
||||
@@ -580,6 +_,7 @@
|
||||
@@ -584,6 +_,7 @@
|
||||
this.options.fullscreen().set(this.window.isFullscreen());
|
||||
}
|
||||
|
||||
@@ -67,7 +71,7 @@
|
||||
this.window.updateVsync(this.options.enableVsync().get());
|
||||
this.window.updateRawMouseInput(this.options.rawMouseInput().get());
|
||||
this.window.setDefaultErrorCallback();
|
||||
@@ -600,16 +_,17 @@
|
||||
@@ -604,16 +_,17 @@
|
||||
GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS);
|
||||
Minecraft.GameLoadCookie minecraft$gameloadcookie = new Minecraft.GameLoadCookie(realmsclient, p_91084_.quickPlay);
|
||||
this.setOverlay(
|
||||
@@ -88,7 +92,7 @@
|
||||
);
|
||||
this.quickPlayLog = QuickPlayLog.of(p_91084_.quickPlay.path());
|
||||
}
|
||||
@@ -698,6 +_,7 @@
|
||||
@@ -702,6 +_,7 @@
|
||||
StringBuilder stringbuilder = new StringBuilder("Minecraft");
|
||||
if (checkModStatus().shouldReportAsModified()) {
|
||||
stringbuilder.append("*");
|
||||
@@ -96,7 +100,7 @@
|
||||
}
|
||||
|
||||
stringbuilder.append(" ");
|
||||
@@ -721,6 +_,8 @@
|
||||
@@ -725,6 +_,8 @@
|
||||
}
|
||||
|
||||
private UserApiService createUserApiService(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
|
||||
@@ -105,7 +109,7 @@
|
||||
return p_193587_.user.user.getType() != User.Type.MSA
|
||||
? UserApiService.OFFLINE
|
||||
: p_193586_.createUserApiService(p_193587_.user.user.getAccessToken());
|
||||
@@ -731,7 +_,7 @@
|
||||
@@ -735,7 +_,7 @@
|
||||
}
|
||||
|
||||
private void rollbackResourcePacks(Throwable p_91240_, @Nullable Minecraft.GameLoadCookie p_299515_) {
|
||||
@@ -114,7 +118,48 @@
|
||||
this.clearResourcePacksOnError(p_91240_, null, p_299515_);
|
||||
} else {
|
||||
Util.throwAsRuntime(p_91240_);
|
||||
@@ -991,12 +_,6 @@
|
||||
@@ -817,9 +_,12 @@
|
||||
}
|
||||
|
||||
public void createSearchTrees() {
|
||||
+ var nameSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKeys();
|
||||
+ var tagSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKeys();
|
||||
+ for (var nameSearchKey : nameSearchKeys.values())
|
||||
this.searchRegistry
|
||||
.register(
|
||||
- SearchRegistry.CREATIVE_NAMES,
|
||||
+ nameSearchKey,
|
||||
p_231451_ -> new FullTextSearchTree<>(
|
||||
p_325272_ -> p_325272_.getTooltipLines(Item.TooltipContext.EMPTY, null, TooltipFlag.Default.NORMAL.asCreative())
|
||||
.stream()
|
||||
@@ -829,8 +_,9 @@
|
||||
p_231451_
|
||||
)
|
||||
);
|
||||
+ for (var tagSearchKey : tagSearchKeys.values())
|
||||
this.searchRegistry
|
||||
- .register(SearchRegistry.CREATIVE_TAGS, p_231430_ -> new IdSearchTree<>(p_231353_ -> p_231353_.getTags().map(TagKey::location), p_231430_));
|
||||
+ .register(tagSearchKey, p_231430_ -> new IdSearchTree<>(p_231353_ -> p_231353_.getTags().map(TagKey::location), p_231430_));
|
||||
this.searchRegistry
|
||||
.register(
|
||||
SearchRegistry.RECIPE_COLLECTIONS,
|
||||
@@ -854,9 +_,12 @@
|
||||
p_301514_
|
||||
)
|
||||
);
|
||||
- CreativeModeTabs.searchTab().setSearchTreeBuilder(p_255439_ -> {
|
||||
- this.populateSearchTree(SearchRegistry.CREATIVE_NAMES, p_255439_);
|
||||
- this.populateSearchTree(SearchRegistry.CREATIVE_TAGS, p_255439_);
|
||||
+ nameSearchKeys.forEach((tab, nameSearchKey) -> {
|
||||
+ var tagSearchKey = tagSearchKeys.get(tab);
|
||||
+ tab.setSearchTreeBuilder(contents -> {
|
||||
+ this.populateSearchTree(nameSearchKey, contents);
|
||||
+ this.populateSearchTree(tagSearchKey, contents);
|
||||
+ });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1039,12 +_,6 @@
|
||||
LOGGER.error("setScreen called from non-game thread");
|
||||
}
|
||||
|
||||
@@ -127,7 +172,7 @@
|
||||
if (p_91153_ == null && this.clientLevelTeardownInProgress) {
|
||||
throw new IllegalStateException("Trying to return to in-game GUI during disconnection");
|
||||
} else {
|
||||
@@ -1010,6 +_,23 @@
|
||||
@@ -1058,6 +_,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,19 +196,37 @@
|
||||
this.screen = p_91153_;
|
||||
if (this.screen != null) {
|
||||
this.screen.added();
|
||||
@@ -1155,9 +_,11 @@
|
||||
@@ -1204,9 +_,12 @@
|
||||
this.mouseHandler.handleAccumulatedMovement();
|
||||
this.profiler.pop();
|
||||
if (!this.noRender) {
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickStart(this.timer);
|
||||
+ this.realPartialTick = this.pause ? this.pausePartialTick : this.timer.partialTick; // Cache this since pause is volatile
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickStart(this.realPartialTick);
|
||||
this.profiler.popPush("gameRenderer");
|
||||
this.gameRenderer.render(this.timer, p_91384_);
|
||||
this.gameRenderer.render(this.pause ? this.pausePartialTick : this.timer.partialTick, i, p_91384_);
|
||||
this.profiler.pop();
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickEnd(this.timer);
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickEnd(this.realPartialTick);
|
||||
}
|
||||
|
||||
if (this.fpsPieResults != null) {
|
||||
@@ -1283,10 +_,12 @@
|
||||
@@ -1240,7 +_,7 @@
|
||||
boolean flag1 = this.hasSingleplayerServer()
|
||||
&& (this.screen != null && this.screen.isPauseScreen() || this.overlay != null && this.overlay.isPauseScreen())
|
||||
&& !this.singleplayerServer.isPublished();
|
||||
- if (this.pause != flag1) {
|
||||
+ if (this.pause != flag1 && !net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePre(flag1)) {
|
||||
if (flag1) {
|
||||
this.pausePartialTick = this.timer.partialTick;
|
||||
} else {
|
||||
@@ -1248,6 +_,7 @@
|
||||
}
|
||||
|
||||
this.pause = flag1;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePost(flag1);
|
||||
}
|
||||
|
||||
long l = Util.getNanos();
|
||||
@@ -1340,10 +_,12 @@
|
||||
this.window.setGuiScale((double)i);
|
||||
if (this.screen != null) {
|
||||
this.screen.resize(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
|
||||
@@ -176,7 +239,7 @@
|
||||
this.gameRenderer.resize(this.window.getWidth(), this.window.getHeight());
|
||||
this.mouseHandler.setIgnoreFirstMove();
|
||||
}
|
||||
@@ -1554,6 +_,7 @@
|
||||
@@ -1619,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
@@ -184,7 +247,7 @@
|
||||
this.running = false;
|
||||
}
|
||||
|
||||
@@ -1582,10 +_,18 @@
|
||||
@@ -1647,10 +_,18 @@
|
||||
if (p_91387_ && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) {
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
||||
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||
@@ -206,7 +269,7 @@
|
||||
this.player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
}
|
||||
@@ -1613,6 +_,8 @@
|
||||
@@ -1678,6 +_,8 @@
|
||||
return false;
|
||||
} else {
|
||||
boolean flag = false;
|
||||
@@ -215,7 +278,7 @@
|
||||
switch (this.hitResult.getType()) {
|
||||
case ENTITY:
|
||||
this.gameMode.attack(this.player, ((EntityHitResult)this.hitResult).getEntity());
|
||||
@@ -1620,7 +_,7 @@
|
||||
@@ -1685,7 +_,7 @@
|
||||
case BLOCK:
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
||||
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||
@@ -224,7 +287,7 @@
|
||||
this.gameMode.startDestroyBlock(blockpos, blockhitresult.getDirection());
|
||||
if (this.level.getBlockState(blockpos).isAir()) {
|
||||
flag = true;
|
||||
@@ -1633,8 +_,10 @@
|
||||
@@ -1698,8 +_,10 @@
|
||||
}
|
||||
|
||||
this.player.resetAttackStrengthTicker();
|
||||
@@ -235,7 +298,7 @@
|
||||
this.player.swing(InteractionHand.MAIN_HAND);
|
||||
return flag;
|
||||
}
|
||||
@@ -1650,6 +_,12 @@
|
||||
@@ -1715,6 +_,12 @@
|
||||
}
|
||||
|
||||
for (InteractionHand interactionhand : InteractionHand.values()) {
|
||||
@@ -248,7 +311,7 @@
|
||||
ItemStack itemstack = this.player.getItemInHand(interactionhand);
|
||||
if (!itemstack.isItemEnabled(this.level.enabledFeatures())) {
|
||||
return;
|
||||
@@ -1670,7 +_,7 @@
|
||||
@@ -1735,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (interactionresult.consumesAction()) {
|
||||
@@ -257,7 +320,7 @@
|
||||
this.player.swing(interactionhand);
|
||||
}
|
||||
|
||||
@@ -1682,7 +_,7 @@
|
||||
@@ -1747,7 +_,7 @@
|
||||
int i = itemstack.getCount();
|
||||
InteractionResult interactionresult1 = this.gameMode.useItemOn(this.player, interactionhand, blockhitresult);
|
||||
if (interactionresult1.consumesAction()) {
|
||||
@@ -266,7 +329,7 @@
|
||||
this.player.swing(interactionhand);
|
||||
if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.gameMode.hasInfiniteItems())) {
|
||||
this.gameRenderer.itemInHandRenderer.itemUsed(interactionhand);
|
||||
@@ -1698,6 +_,9 @@
|
||||
@@ -1763,6 +_,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,7 +339,7 @@
|
||||
if (!itemstack.isEmpty()) {
|
||||
InteractionResult interactionresult2 = this.gameMode.useItem(this.player, interactionhand);
|
||||
if (interactionresult2.consumesAction()) {
|
||||
@@ -1728,6 +_,8 @@
|
||||
@@ -1793,6 +_,8 @@
|
||||
this.rightClickDelay--;
|
||||
}
|
||||
|
||||
@@ -285,7 +348,7 @@
|
||||
this.profiler.push("gui");
|
||||
this.chatListener.tick();
|
||||
this.gui.tick(this.pause);
|
||||
@@ -1811,6 +_,7 @@
|
||||
@@ -1877,6 +_,7 @@
|
||||
|
||||
this.tutorial.tick();
|
||||
|
||||
@@ -293,7 +356,7 @@
|
||||
try {
|
||||
this.level.tick(() -> true);
|
||||
} catch (Throwable throwable) {
|
||||
@@ -1824,6 +_,7 @@
|
||||
@@ -1890,6 +_,7 @@
|
||||
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
@@ -301,15 +364,15 @@
|
||||
}
|
||||
|
||||
this.profiler.popPush("animateTick");
|
||||
@@ -1843,6 +_,7 @@
|
||||
@@ -1909,6 +_,7 @@
|
||||
this.profiler.popPush("keyboard");
|
||||
this.keyboardHandler.tick();
|
||||
this.profiler.pop();
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPostClientTick();
|
||||
}
|
||||
|
||||
private boolean isLevelRunningNormally() {
|
||||
@@ -2043,6 +_,7 @@
|
||||
private boolean isMultiplayerServer() {
|
||||
@@ -2105,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void setLevel(ClientLevel p_91157_, ReceivingLevelScreen.Reason p_335893_) {
|
||||
@@ -317,7 +380,7 @@
|
||||
this.updateScreenAndTick(new ReceivingLevelScreen(() -> false, p_335893_));
|
||||
this.level = p_91157_;
|
||||
this.updateLevelInEngines(p_91157_);
|
||||
@@ -2080,6 +_,7 @@
|
||||
@@ -2142,6 +_,7 @@
|
||||
IntegratedServer integratedserver = this.singleplayerServer;
|
||||
this.singleplayerServer = null;
|
||||
this.gameRenderer.resetData();
|
||||
@@ -325,7 +388,7 @@
|
||||
this.gameMode = null;
|
||||
this.narrator.clear();
|
||||
this.clientLevelTeardownInProgress = true;
|
||||
@@ -2087,6 +_,7 @@
|
||||
@@ -2149,6 +_,7 @@
|
||||
try {
|
||||
this.updateScreenAndTick(p_335030_);
|
||||
if (this.level != null) {
|
||||
@@ -333,7 +396,7 @@
|
||||
if (integratedserver != null) {
|
||||
this.profiler.push("waitForServer");
|
||||
|
||||
@@ -2099,6 +_,7 @@
|
||||
@@ -2161,6 +_,7 @@
|
||||
|
||||
this.gui.onDisconnected();
|
||||
this.isLocalServer = false;
|
||||
@@ -341,7 +404,7 @@
|
||||
}
|
||||
|
||||
this.level = null;
|
||||
@@ -2245,6 +_,7 @@
|
||||
@@ -2307,6 +_,7 @@
|
||||
|
||||
private void pickBlock() {
|
||||
if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) {
|
||||
@@ -349,7 +412,7 @@
|
||||
boolean flag = this.player.getAbilities().instabuild;
|
||||
BlockEntity blockentity = null;
|
||||
HitResult.Type hitresult$type = this.hitResult.getType();
|
||||
@@ -2257,7 +_,7 @@
|
||||
@@ -2319,7 +_,7 @@
|
||||
}
|
||||
|
||||
Block block = blockstate.getBlock();
|
||||
@@ -358,7 +421,7 @@
|
||||
if (itemstack.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -2271,7 +_,7 @@
|
||||
@@ -2333,7 +_,7 @@
|
||||
}
|
||||
|
||||
Entity entity = ((EntityHitResult)this.hitResult).getEntity();
|
||||
@@ -367,7 +430,7 @@
|
||||
if (itemstack == null) {
|
||||
return;
|
||||
}
|
||||
@@ -2855,6 +_,10 @@
|
||||
@@ -2931,6 +_,19 @@
|
||||
@Nullable
|
||||
public static String getLauncherBrand() {
|
||||
return System.getProperty("minecraft.launcher.brand");
|
||||
@@ -375,6 +438,15 @@
|
||||
+
|
||||
+ public ItemColors getItemColors() {
|
||||
+ return this.itemColors;
|
||||
+ }
|
||||
+
|
||||
+ public SearchRegistry getSearchTreeManager() {
|
||||
+ return this.searchRegistry;
|
||||
+ }
|
||||
+
|
||||
+ private float realPartialTick;
|
||||
+ public float getPartialTick() {
|
||||
+ return this.realPartialTick;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/MouseHandler.java
|
||||
+++ b/net/minecraft/client/MouseHandler.java
|
||||
@@ -79,6 +_,7 @@
|
||||
@@ -74,6 +_,7 @@
|
||||
this.activeButton = -1;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
boolean[] aboolean = new boolean[]{false};
|
||||
if (this.minecraft.getOverlay() == null) {
|
||||
if (this.minecraft.screen == null) {
|
||||
@@ -91,9 +_,9 @@
|
||||
@@ -86,9 +_,9 @@
|
||||
Screen screen = this.minecraft.screen;
|
||||
if (flag) {
|
||||
screen.afterMouseAction();
|
||||
@@ -20,7 +20,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,6 +_,7 @@
|
||||
@@ -111,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +_,9 @@
|
||||
@@ -124,7 +_,9 @@
|
||||
if (this.minecraft.screen != null) {
|
||||
double d3 = this.xpos * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth();
|
||||
double d4 = this.ypos * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
|
||||
@@ -39,7 +39,7 @@
|
||||
this.minecraft.screen.afterMouseAction();
|
||||
} else if (this.minecraft.player != null) {
|
||||
if (this.accumulatedScrollX != 0.0 && Math.signum(d1) != Math.signum(this.accumulatedScrollX)) {
|
||||
@@ -151,6 +_,7 @@
|
||||
@@ -146,6 +_,7 @@
|
||||
this.accumulatedScrollX -= (double)j;
|
||||
this.accumulatedScrollY -= (double)i;
|
||||
int k = i == 0 ? -j : i;
|
||||
@@ -47,7 +47,7 @@
|
||||
if (this.minecraft.player.isSpectator()) {
|
||||
if (this.minecraft.gui.getSpectatorGui().isMenuActive()) {
|
||||
this.minecraft.gui.getSpectatorGui().onMouseScrolled(-k);
|
||||
@@ -236,7 +_,7 @@
|
||||
@@ -216,7 +_,7 @@
|
||||
if (this.activeButton != -1 && this.mousePressedTime > 0.0) {
|
||||
double d4 = this.accumulatedDX * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth();
|
||||
double d5 = this.accumulatedDY * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
|
||||
@@ -56,7 +56,7 @@
|
||||
}
|
||||
|
||||
screen.afterMouseMove();
|
||||
@@ -303,6 +_,14 @@
|
||||
@@ -283,6 +_,14 @@
|
||||
|
||||
public double ypos() {
|
||||
return this.ypos;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/Options.java
|
||||
+++ b/net/minecraft/client/Options.java
|
||||
@@ -681,7 +_,8 @@
|
||||
@@ -680,7 +_,8 @@
|
||||
},
|
||||
new OptionInstance.LazyEnum<>(
|
||||
() -> Stream.concat(Stream.of(""), Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().stream()).toList(),
|
||||
@@ -10,7 +10,7 @@
|
||||
? Optional.empty()
|
||||
: Optional.of(p_232011_),
|
||||
Codec.STRING
|
||||
@@ -1050,6 +_,7 @@
|
||||
@@ -1044,6 +_,7 @@
|
||||
}
|
||||
|
||||
public Options(Minecraft p_92138_, File p_92139_) {
|
||||
@@ -18,7 +18,7 @@
|
||||
this.minecraft = p_92138_;
|
||||
this.optionsFile = new File(p_92139_, "options.txt");
|
||||
boolean flag = Runtime.getRuntime().maxMemory() >= 1000000000L;
|
||||
@@ -1184,12 +_,22 @@
|
||||
@@ -1178,12 +_,22 @@
|
||||
p_168428_.process("telemetryOptInExtra", this.telemetryOptInExtra);
|
||||
this.onboardAccessibility = p_168428_.process("onboardAccessibility", this.onboardAccessibility);
|
||||
p_168428_.process("menuBackgroundBlurriness", this.menuBackgroundBlurriness);
|
||||
@@ -42,7 +42,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1207,6 +_,10 @@
|
||||
@@ -1201,6 +_,10 @@
|
||||
}
|
||||
|
||||
public void load() {
|
||||
@@ -53,7 +53,7 @@
|
||||
try {
|
||||
if (!this.optionsFile.exists()) {
|
||||
return;
|
||||
@@ -1234,7 +_,8 @@
|
||||
@@ -1228,7 +_,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
new Options.FieldAccess() {
|
||||
@Nullable
|
||||
private String getValueOrNull(String p_168459_) {
|
||||
@@ -1428,6 +_,7 @@
|
||||
@@ -1422,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void broadcastOptions() {
|
||||
@@ -71,7 +71,7 @@
|
||||
if (this.minecraft.player != null) {
|
||||
this.minecraft.player.connection.send(new ServerboundClientInformationPacket(this.buildPlayerInformation()));
|
||||
}
|
||||
@@ -1546,6 +_,23 @@
|
||||
@@ -1544,6 +_,23 @@
|
||||
|
||||
public static Component genericValueLabel(Component p_231901_, int p_231902_) {
|
||||
return genericValueLabel(p_231901_, Component.literal(Integer.toString(p_231902_)));
|
||||
@@ -94,4 +94,4 @@
|
||||
+ keySmoothCamera.setKeyConflictContext(inGame);
|
||||
}
|
||||
|
||||
public static Component genericValueOrOffLabel(Component p_345288_, int p_344826_) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -9,7 +9,7 @@
|
||||
private final SubtitleOverlay subtitleOverlay;
|
||||
private final SpectatorGui spectatorGui;
|
||||
private final PlayerTabOverlay tabList;
|
||||
@@ -318,7 +_,7 @@
|
||||
@@ -320,7 +_,7 @@
|
||||
Window window = this.minecraft.getWindow();
|
||||
int i = Mth.floor(this.minecraft.mouseHandler.xpos() * (double)window.getGuiScaledWidth() / (double)window.getScreenWidth());
|
||||
int j = Mth.floor(this.minecraft.mouseHandler.ypos() * (double)window.getGuiScaledHeight() / (double)window.getScreenHeight());
|
||||
@@ -18,7 +18,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,6 +_,8 @@
|
||||
@@ -444,6 +_,8 @@
|
||||
|
||||
for (MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
|
||||
Holder<MobEffect> holder = mobeffectinstance.getEffect();
|
||||
@@ -27,7 +27,7 @@
|
||||
if (mobeffectinstance.showIcon()) {
|
||||
int i = p_282812_.guiWidth();
|
||||
int j = 1;
|
||||
@@ -463,6 +_,7 @@
|
||||
@@ -473,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(holder);
|
||||
int l1 = i;
|
||||
int i1 = j;
|
||||
@@ -625,6 +_,10 @@
|
||||
@@ -635,6 +_,10 @@
|
||||
}
|
||||
|
||||
private void renderSelectedItemName(GuiGraphics p_283501_) {
|
||||
@@ -46,34 +46,32 @@
|
||||
this.minecraft.getProfiler().push("selectedItemName");
|
||||
if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) {
|
||||
MutableComponent mutablecomponent = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().color());
|
||||
@@ -632,9 +_,10 @@
|
||||
@@ -642,9 +_,13 @@
|
||||
mutablecomponent.withStyle(ChatFormatting.ITALIC);
|
||||
}
|
||||
|
||||
- int i = this.getFont().width(mutablecomponent);
|
||||
+ Component highlightTip = this.lastToolHighlight.getHighlightTip(mutablecomponent);
|
||||
+ int i = this.getFont().width(highlightTip);
|
||||
+ Font font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(lastToolHighlight).getFont(lastToolHighlight, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.SELECTED_ITEM_NAME);
|
||||
+ if (font == null)
|
||||
+ font = this.getFont();
|
||||
+ int i = font.width(highlightTip);
|
||||
int j = (p_283501_.guiWidth() - i) / 2;
|
||||
- int k = p_283501_.guiHeight() - 59;
|
||||
+ int k = p_283501_.guiHeight() - Math.max(yShift, 59);
|
||||
if (!this.minecraft.gameMode.canHurtPlayer()) {
|
||||
k += 14;
|
||||
}
|
||||
@@ -646,6 +_,13 @@
|
||||
@@ -656,7 +_,7 @@
|
||||
|
||||
if (l > 0) {
|
||||
p_283501_.drawStringWithBackdrop(this.getFont(), mutablecomponent, j, k, i, FastColor.ARGB32.color(l, -1));
|
||||
+ Font font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(lastToolHighlight).getFont(lastToolHighlight, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.SELECTED_ITEM_NAME);
|
||||
+ if (font == null) {
|
||||
+ p_283501_.drawString(this.getFont(), highlightTip, j, k, 16777215 + (l << 24));
|
||||
+ } else {
|
||||
+ j = (p_283501_.guiWidth() - font.width(highlightTip)) / 2;
|
||||
+ p_283501_.drawString(font, highlightTip, j, k, 16777215 + (l << 24));
|
||||
+ }
|
||||
p_283501_.fill(j - 2, k - 2, j + i + 2, k + 9 + 2, this.minecraft.options.getBackgroundColor(0));
|
||||
- p_283501_.drawString(this.getFont(), mutablecomponent, j, k, 16777215 + (l << 24));
|
||||
+ p_283501_.drawString(font, highlightTip, j, k, 16777215 + (l << 24));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1146,7 +_,7 @@
|
||||
@@ -1155,7 +_,7 @@
|
||||
ItemStack itemstack = this.minecraft.player.getInventory().getSelected();
|
||||
if (itemstack.isEmpty()) {
|
||||
this.toolHighlightTimer = 0;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public static final float MAX_GUI_Z = 10000.0F;
|
||||
public static final float MIN_GUI_Z = -10000.0F;
|
||||
private static final int EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE = 2;
|
||||
@@ -268,6 +_,11 @@
|
||||
@@ -280,6 +_,11 @@
|
||||
}
|
||||
|
||||
public int drawString(Font p_283343_, @Nullable String p_281896_, int p_283569_, int p_283418_, int p_281560_, boolean p_282130_) {
|
||||
@@ -21,7 +21,7 @@
|
||||
if (p_281896_ == null) {
|
||||
return 0;
|
||||
} else {
|
||||
@@ -294,6 +_,11 @@
|
||||
@@ -306,6 +_,11 @@
|
||||
}
|
||||
|
||||
public int drawString(Font p_282636_, FormattedCharSequence p_281596_, int p_281586_, int p_282816_, int p_281743_, boolean p_282394_) {
|
||||
@@ -33,7 +33,7 @@
|
||||
int i = p_282636_.drawInBatch(
|
||||
p_281596_,
|
||||
(float)p_281586_,
|
||||
@@ -864,6 +_,7 @@
|
||||
@@ -872,6 +_,7 @@
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Rendering item");
|
||||
CrashReportCategory crashreportcategory = crashreport.addCategory("Item being rendered");
|
||||
crashreportcategory.setDetail("Item Type", () -> String.valueOf(p_281675_.getItem()));
|
||||
@@ -41,7 +41,7 @@
|
||||
crashreportcategory.setDetail("Item Components", () -> String.valueOf(p_281675_.getComponents()));
|
||||
crashreportcategory.setDetail("Item Foil", () -> String.valueOf(p_281675_.hasFoil()));
|
||||
throw new ReportedException(crashreport);
|
||||
@@ -904,16 +_,26 @@
|
||||
@@ -912,16 +_,26 @@
|
||||
}
|
||||
|
||||
this.pose.popPose();
|
||||
@@ -70,7 +70,7 @@
|
||||
this.renderTooltipInternal(p_283128_, list, p_283678_, p_281696_, DefaultTooltipPositioner.INSTANCE);
|
||||
}
|
||||
|
||||
@@ -922,7 +_,22 @@
|
||||
@@ -930,7 +_,22 @@
|
||||
}
|
||||
|
||||
public void renderComponentTooltip(Font p_282739_, List<Component> p_281832_, int p_282191_, int p_282446_) {
|
||||
@@ -94,7 +94,7 @@
|
||||
}
|
||||
|
||||
public void renderTooltip(Font p_282192_, List<? extends FormattedCharSequence> p_282297_, int p_281680_, int p_283325_) {
|
||||
@@ -941,11 +_,13 @@
|
||||
@@ -949,11 +_,13 @@
|
||||
|
||||
private void renderTooltipInternal(Font p_282675_, List<ClientTooltipComponent> p_282615_, int p_283230_, int p_283417_, ClientTooltipPositioner p_282442_) {
|
||||
if (!p_282615_.isEmpty()) {
|
||||
@@ -109,7 +109,7 @@
|
||||
if (k > i) {
|
||||
i = k;
|
||||
}
|
||||
@@ -955,18 +_,21 @@
|
||||
@@ -963,18 +_,21 @@
|
||||
|
||||
int i2 = i;
|
||||
int j2 = j;
|
||||
@@ -134,7 +134,7 @@
|
||||
k1 += clienttooltipcomponent1.getHeight() + (l1 == 0 ? 2 : 0);
|
||||
}
|
||||
|
||||
@@ -974,7 +_,7 @@
|
||||
@@ -982,7 +_,7 @@
|
||||
|
||||
for (int k2 = 0; k2 < p_282615_.size(); k2++) {
|
||||
ClientTooltipComponent clienttooltipcomponent2 = p_282615_.get(k2);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/components/AbstractButton.java
|
||||
+++ b/net/minecraft/client/gui/components/AbstractButton.java
|
||||
@@ -34,7 +_,7 @@
|
||||
@@ -32,7 +_,7 @@
|
||||
RenderSystem.enableDepthTest();
|
||||
p_281670_.blitSprite(SPRITES.get(this.active, this.isHoveredOrFocused()), this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
||||
p_281670_.setColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
@@ -79,13 +79,13 @@
|
||||
+ protected void drawGameInformation(GuiGraphics p_281525_) {
|
||||
+ List<String> list = this.getGameInformation();
|
||||
+ list.addAll(this.getOverlayHelp());
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeDebugEvent(p_281525_, minecraft.getWindow(), minecraft.getTimer().getRealtimeDeltaTicks(), list, true);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeDebugEvent(p_281525_, minecraft.getWindow(), minecraft.getFrameTime(), list, true);
|
||||
+ this.renderLines(p_281525_, list, true);
|
||||
}
|
||||
|
||||
protected void drawSystemInformation(GuiGraphics p_281261_) {
|
||||
List<String> list = this.getSystemInformation();
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeDebugEvent(p_281261_, minecraft.getWindow(), minecraft.getTimer().getRealtimeDeltaTicks(), list, false);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeDebugEvent(p_281261_, minecraft.getWindow(), minecraft.getFrameTime(), list, false);
|
||||
this.renderLines(p_281261_, list, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/PauseScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/PauseScreen.java
|
||||
@@ -94,6 +_,7 @@
|
||||
@@ -86,6 +_,7 @@
|
||||
} else {
|
||||
gridlayout$rowhelper.addChild(this.openScreenButton(PLAYER_REPORTING, () -> new SocialInteractionsScreen(this)));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/Screen.java
|
||||
+++ b/net/minecraft/client/gui/screens/Screen.java
|
||||
@@ -201,7 +_,7 @@
|
||||
@@ -204,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void onClose() {
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
protected <T extends GuiEventListener & Renderable & NarratableEntry> T addRenderableWidget(T p_169406_) {
|
||||
@@ -312,8 +_,10 @@
|
||||
@@ -320,8 +_,10 @@
|
||||
this.width = p_96608_;
|
||||
this.height = p_96609_;
|
||||
if (!this.initialized) {
|
||||
@@ -20,7 +20,7 @@
|
||||
} else {
|
||||
this.repositionElements();
|
||||
}
|
||||
@@ -326,8 +_,10 @@
|
||||
@@ -334,8 +_,10 @@
|
||||
protected void rebuildWidgets() {
|
||||
this.clearWidgets();
|
||||
this.clearFocus();
|
||||
@@ -31,7 +31,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -354,6 +_,7 @@
|
||||
@@ -362,6 +_,7 @@
|
||||
|
||||
this.renderBlurredBackground(p_297268_);
|
||||
this.renderMenuBackground(p_283688_);
|
||||
@@ -39,7 +39,7 @@
|
||||
}
|
||||
|
||||
protected void renderBlurredBackground(float p_336041_) {
|
||||
@@ -463,6 +_,19 @@
|
||||
@@ -492,6 +_,19 @@
|
||||
}
|
||||
|
||||
public void onFilesDrop(List<Path> p_96591_) {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/client/gui/screens/TitleScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/TitleScreen.java
|
||||
@@ -60,6 +_,7 @@
|
||||
private boolean fading;
|
||||
private long fadeInStart;
|
||||
@@ -61,6 +_,7 @@
|
||||
@Nullable
|
||||
private TitleScreen.WarningLabel warningLabel;
|
||||
private final LogoRenderer logoRenderer;
|
||||
+ private net.minecraftforge.client.gui.TitleScreenModUpdateIndicator modUpdateNotification;
|
||||
|
||||
public TitleScreen() {
|
||||
this(false);
|
||||
@@ -115,11 +_,15 @@
|
||||
@@ -116,11 +_,15 @@
|
||||
int j = this.width - i - 2;
|
||||
int k = 24;
|
||||
int l = this.height / 4 + 48;
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
SpriteIconButton spriteiconbutton = this.addRenderableWidget(
|
||||
CommonButtons.language(
|
||||
@@ -170,7 +_,7 @@
|
||||
@@ -171,7 +_,7 @@
|
||||
}).bounds(this.width / 2 - 100, p_96764_ + p_96765_ * 1, 200, 20).tooltip(tooltip).build()).active = flag;
|
||||
this.addRenderableWidget(
|
||||
Button.builder(Component.translatable("menu.online"), p_325369_ -> this.minecraft.setScreen(new RealmsMainScreen(this)))
|
||||
@@ -33,15 +33,15 @@
|
||||
.tooltip(tooltip)
|
||||
.build()
|
||||
)
|
||||
@@ -276,6 +_,7 @@
|
||||
if ((i & -67108864) != 0) {
|
||||
super.render(p_282860_, p_281753_, p_283539_, p_282628_);
|
||||
this.logoRenderer.renderLogo(p_282860_, this.width, f);
|
||||
@@ -281,6 +_,7 @@
|
||||
this.warningLabel.render(p_282860_, i);
|
||||
}
|
||||
|
||||
+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_282860_, this.font, this.width, this.height, i);
|
||||
if (this.splash != null && !this.minecraft.options.hideSplashTexts().get()) {
|
||||
this.splash.render(p_282860_, this.width, this.font, i);
|
||||
}
|
||||
@@ -291,11 +_,19 @@
|
||||
@@ -296,11 +_,19 @@
|
||||
s = s + I18n.get("menu.modded");
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -1,5 +1,5 @@
|
||||
--- a/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java
|
||||
+++ b/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java
|
||||
--- a/net/minecraft/client/gui/screens/controls/KeyBindsList.java
|
||||
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsList.java
|
||||
@@ -69,6 +_,11 @@
|
||||
return 340;
|
||||
}
|
||||
@@ -13,25 +13,25 @@
|
||||
public class CategoryEntry extends KeyBindsList.Entry {
|
||||
final Component name;
|
||||
@@ -153,9 +_,10 @@
|
||||
this.name = p_343976_;
|
||||
this.changeButton = Button.builder(p_343976_, p_342196_ -> {
|
||||
KeyBindsList.this.keyBindsScreen.selectedKey = p_343088_;
|
||||
+ p_343088_.setKeyModifierAndCode(null, com.mojang.blaze3d.platform.InputConstants.UNKNOWN);
|
||||
this.name = p_193917_;
|
||||
this.changeButton = Button.builder(p_193917_, p_269618_ -> {
|
||||
KeyBindsList.this.keyBindsScreen.selectedKey = p_193916_;
|
||||
+ p_193916_.setKeyModifierAndCode(null, com.mojang.blaze3d.platform.InputConstants.UNKNOWN);
|
||||
KeyBindsList.this.resetMappingAndUpdateButtons();
|
||||
})
|
||||
- .bounds(0, 0, 75, 20)
|
||||
+ .bounds(0, 0, 75 + 20 /* Forge: Add space */, 20)
|
||||
.createNarration(
|
||||
p_342179_ -> p_343088_.isUnbound()
|
||||
? Component.translatable("narrator.controls.unbound", p_343976_)
|
||||
p_253311_ -> p_193916_.isUnbound()
|
||||
? Component.translatable("narrator.controls.unbound", p_193917_)
|
||||
@@ -163,6 +_,7 @@
|
||||
)
|
||||
.build();
|
||||
this.resetButton = Button.builder(RESET_BUTTON_TITLE, p_343650_ -> {
|
||||
this.resetButton = Button.builder(RESET_BUTTON_TITLE, p_325376_ -> {
|
||||
+ this.key.setToDefault();
|
||||
KeyBindsList.this.minecraft.options.setKey(p_343088_, p_343088_.getDefaultKey());
|
||||
KeyBindsList.this.minecraft.options.setKey(p_193916_, p_193916_.getDefaultKey());
|
||||
KeyBindsList.this.resetMappingAndUpdateButtons();
|
||||
}).bounds(0, 0, 50, 20).createNarration(p_344192_ -> Component.translatable("narrator.controls.reset", p_343976_)).build();
|
||||
}).bounds(0, 0, 50, 20).createNarration(p_253313_ -> Component.translatable("narrator.controls.reset", p_193917_)).build();
|
||||
@@ -215,7 +_,7 @@
|
||||
MutableComponent mutablecomponent = Component.empty();
|
||||
if (!this.key.isUnbound()) {
|
||||
@@ -0,0 +1,46 @@
|
||||
--- a/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java
|
||||
@@ -33,7 +_,7 @@
|
||||
this.keyBindsList = this.addRenderableWidget(new KeyBindsList(this, this.minecraft));
|
||||
this.resetButton = Button.builder(Component.translatable("controls.resetAll"), p_269619_ -> {
|
||||
for (KeyMapping keymapping : this.options.keyMappings) {
|
||||
- keymapping.setKey(keymapping.getDefaultKey());
|
||||
+ keymapping.setToDefault();
|
||||
}
|
||||
|
||||
this.keyBindsList.resetMappingAndUpdateButtons();
|
||||
@@ -70,11 +_,14 @@
|
||||
public boolean keyPressed(int p_193987_, int p_193988_, int p_193989_) {
|
||||
if (this.selectedKey != null) {
|
||||
if (p_193987_ == 256) {
|
||||
+ this.selectedKey.setKeyModifierAndCode(null, InputConstants.UNKNOWN);
|
||||
this.options.setKey(this.selectedKey, InputConstants.UNKNOWN);
|
||||
} else {
|
||||
+ this.selectedKey.setKeyModifierAndCode(null, InputConstants.getKey(p_193987_, p_193988_));
|
||||
this.options.setKey(this.selectedKey, InputConstants.getKey(p_193987_, p_193988_));
|
||||
}
|
||||
|
||||
+ if (p_193987_ == 256 || !net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.selectedKey.getKey()))
|
||||
this.selectedKey = null;
|
||||
this.lastKeySelection = Util.getMillis();
|
||||
this.keyBindsList.resetMappingAndUpdateButtons();
|
||||
@@ -82,6 +_,19 @@
|
||||
} else {
|
||||
return super.keyPressed(p_193987_, p_193988_, p_193989_);
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean keyReleased(int keyCode, int scanCode, int modifiers) {
|
||||
+ // Forge: We wait for a second key above if the first press is a modifier
|
||||
+ // but if they release the modifier then set it explicitly.
|
||||
+ var key = InputConstants.getKey(keyCode, scanCode);
|
||||
+ if (this.selectedKey != null && this.selectedKey.getKey() == key) {
|
||||
+ this.selectedKey = null;
|
||||
+ this.lastKeySelection = Util.getMillis();
|
||||
+ this.keyBindsList.resetMappingAndUpdateButtons();
|
||||
+ }
|
||||
+ return super.keyReleased(keyCode, scanCode, modifiers);
|
||||
}
|
||||
|
||||
@Override
|
||||
+45
-37
@@ -7,9 +7,9 @@
|
||||
+ private final List<net.minecraftforge.client.gui.CreativeTabsScreenPage> pages = new java.util.ArrayList<>();
|
||||
+ private net.minecraftforge.client.gui.CreativeTabsScreenPage currentPage = new net.minecraftforge.client.gui.CreativeTabsScreenPage(new java.util.ArrayList<>());
|
||||
|
||||
public CreativeModeInventoryScreen(LocalPlayer p_344408_, FeatureFlagSet p_260074_, boolean p_259569_) {
|
||||
super(new CreativeModeInventoryScreen.ItemPickerMenu(p_344408_), p_344408_.getInventory(), CommonComponents.EMPTY);
|
||||
@@ -159,7 +_,7 @@
|
||||
public CreativeModeInventoryScreen(Player p_259788_, FeatureFlagSet p_260074_, boolean p_259569_) {
|
||||
super(new CreativeModeInventoryScreen.ItemPickerMenu(p_259788_), p_259788_.getInventory(), CommonComponents.EMPTY);
|
||||
@@ -144,7 +_,7 @@
|
||||
private void refreshCurrentTabContents(Collection<ItemStack> p_261591_) {
|
||||
int i = this.menu.getRowIndexForScroll(this.scrollOffs);
|
||||
this.menu.items.clear();
|
||||
@@ -18,7 +18,7 @@
|
||||
this.refreshSearchResults();
|
||||
} else {
|
||||
this.menu.items.addAll(p_261591_);
|
||||
@@ -322,6 +_,35 @@
|
||||
@@ -307,6 +_,35 @@
|
||||
protected void init() {
|
||||
if (this.minecraft.gameMode.hasInfiniteItems()) {
|
||||
super.init();
|
||||
@@ -54,7 +54,7 @@
|
||||
this.searchBox = new EditBox(this.font, this.leftPos + 82, this.topPos + 6, 80, 9, Component.translatable("itemGroup.search"));
|
||||
this.searchBox.setMaxLength(50);
|
||||
this.searchBox.setBordered(false);
|
||||
@@ -368,7 +_,7 @@
|
||||
@@ -353,7 +_,7 @@
|
||||
public boolean charTyped(char p_98521_, int p_98522_) {
|
||||
if (this.ignoreTextInput) {
|
||||
return false;
|
||||
@@ -63,7 +63,7 @@
|
||||
return false;
|
||||
} else {
|
||||
String s = this.searchBox.getValue();
|
||||
@@ -387,7 +_,7 @@
|
||||
@@ -372,7 +_,7 @@
|
||||
@Override
|
||||
public boolean keyPressed(int p_98547_, int p_98548_, int p_98549_) {
|
||||
this.ignoreTextInput = false;
|
||||
@@ -72,7 +72,7 @@
|
||||
if (this.minecraft.options.keyChat.matches(p_98547_, p_98548_)) {
|
||||
this.ignoreTextInput = true;
|
||||
this.selectTab(CreativeModeTabs.searchTab());
|
||||
@@ -423,6 +_,7 @@
|
||||
@@ -408,6 +_,7 @@
|
||||
}
|
||||
|
||||
private void refreshSearchResults() {
|
||||
@@ -80,20 +80,20 @@
|
||||
this.menu.items.clear();
|
||||
this.visibleTags.clear();
|
||||
String s = this.searchBox.getValue();
|
||||
@@ -435,10 +_,10 @@
|
||||
SearchTree<ItemStack> searchtree;
|
||||
if (s.startsWith("#")) {
|
||||
s = s.substring(1);
|
||||
- searchtree = sessionsearchtrees.creativeTagSearch();
|
||||
+ searchtree = sessionsearchtrees.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKey(selectedTab));
|
||||
this.updateVisibleTags(s);
|
||||
} else {
|
||||
- searchtree = sessionsearchtrees.creativeNameSearch();
|
||||
+ searchtree = sessionsearchtrees.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKey(selectedTab));
|
||||
}
|
||||
@@ -417,10 +_,10 @@
|
||||
SearchTree<ItemStack> searchtree;
|
||||
if (s.startsWith("#")) {
|
||||
s = s.substring(1);
|
||||
- searchtree = this.minecraft.getSearchTree(SearchRegistry.CREATIVE_TAGS);
|
||||
+ searchtree = this.minecraft.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKey(selectedTab));
|
||||
this.updateVisibleTags(s);
|
||||
} else {
|
||||
- searchtree = this.minecraft.getSearchTree(SearchRegistry.CREATIVE_NAMES);
|
||||
+ searchtree = this.minecraft.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKey(selectedTab));
|
||||
}
|
||||
|
||||
this.menu.items.addAll(searchtree.search(s.toLowerCase(Locale.ROOT)));
|
||||
@@ -466,7 +_,8 @@
|
||||
this.menu.items.addAll(searchtree.search(s.toLowerCase(Locale.ROOT)));
|
||||
@@ -447,7 +_,8 @@
|
||||
@Override
|
||||
protected void renderLabels(GuiGraphics p_283168_, int p_281774_, int p_281466_) {
|
||||
if (selectedTab.showTitle()) {
|
||||
@@ -103,7 +103,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -476,7 +_,7 @@
|
||||
@@ -457,7 +_,7 @@
|
||||
double d0 = p_98531_ - (double)this.leftPos;
|
||||
double d1 = p_98532_ - (double)this.topPos;
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
if (this.checkTabClicked(creativemodetab, d0, d1)) {
|
||||
return true;
|
||||
}
|
||||
@@ -498,7 +_,7 @@
|
||||
@@ -479,7 +_,7 @@
|
||||
double d1 = p_98623_ - (double)this.topPos;
|
||||
this.scrolling = false;
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
if (this.checkTabClicked(creativemodetab, d0, d1)) {
|
||||
this.selectTab(creativemodetab);
|
||||
return true;
|
||||
@@ -516,6 +_,7 @@
|
||||
@@ -497,6 +_,7 @@
|
||||
private void selectTab(CreativeModeTab p_98561_) {
|
||||
CreativeModeTab creativemodetab = selectedTab;
|
||||
selectedTab = p_98561_;
|
||||
@@ -129,7 +129,7 @@
|
||||
this.quickCraftSlots.clear();
|
||||
this.menu.items.clear();
|
||||
this.clearDraggingState();
|
||||
@@ -592,13 +_,15 @@
|
||||
@@ -573,13 +_,15 @@
|
||||
this.originalSlots = null;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
|
||||
this.refreshSearchResults();
|
||||
} else {
|
||||
@@ -661,7 +_,15 @@
|
||||
@@ -642,7 +_,15 @@
|
||||
public void render(GuiGraphics p_283000_, int p_281317_, int p_282770_, float p_281295_) {
|
||||
super.render(p_283000_, p_281317_, p_282770_, p_281295_);
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
if (this.checkTabHovering(p_283000_, creativemodetab, p_281317_, p_282770_)) {
|
||||
break;
|
||||
}
|
||||
@@ -673,6 +_,7 @@
|
||||
@@ -654,6 +_,7 @@
|
||||
p_283000_.renderTooltip(this.font, TRASH_SLOT_TOOLTIP, p_281317_, p_282770_);
|
||||
}
|
||||
|
||||
@@ -171,16 +171,16 @@
|
||||
this.renderTooltip(p_283000_, p_281317_, p_282770_);
|
||||
}
|
||||
|
||||
@@ -680,7 +_,7 @@
|
||||
@@ -661,7 +_,7 @@
|
||||
public List<Component> getTooltipFromContainerItem(ItemStack p_281769_) {
|
||||
boolean flag = this.hoveredSlot != null && this.hoveredSlot instanceof CreativeModeInventoryScreen.CustomCreativeSlot;
|
||||
boolean flag1 = selectedTab.getType() == CreativeModeTab.Type.CATEGORY;
|
||||
- boolean flag2 = selectedTab.getType() == CreativeModeTab.Type.SEARCH;
|
||||
+ boolean flag2 = selectedTab.hasSearchBar();
|
||||
+ boolean flag2 =selectedTab.hasSearchBar();
|
||||
TooltipFlag.Default tooltipflag$default = this.minecraft.options.advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL;
|
||||
TooltipFlag tooltipflag = flag ? tooltipflag$default.asCreative() : tooltipflag$default;
|
||||
List<Component> list = p_281769_.getTooltipLines(Item.TooltipContext.of(this.minecraft.level), this.minecraft.player, tooltipflag);
|
||||
@@ -699,7 +_,7 @@
|
||||
@@ -680,7 +_,7 @@
|
||||
int i = 1;
|
||||
|
||||
for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
|
||||
@@ -189,7 +189,7 @@
|
||||
list1.add(i++, creativemodetab.getDisplayName().copy().withStyle(ChatFormatting.BLUE));
|
||||
}
|
||||
}
|
||||
@@ -710,7 +_,7 @@
|
||||
@@ -691,14 +_,14 @@
|
||||
|
||||
@Override
|
||||
protected void renderBg(GuiGraphics p_282663_, float p_282504_, int p_282089_, int p_282249_) {
|
||||
@@ -198,7 +198,15 @@
|
||||
if (creativemodetab != selectedTab) {
|
||||
this.renderTabButton(p_282663_, creativemodetab);
|
||||
}
|
||||
@@ -726,6 +_,7 @@
|
||||
}
|
||||
|
||||
p_282663_.blit(
|
||||
- new ResourceLocation("textures/gui/container/creative_inventory/tab_" + selectedTab.getBackgroundSuffix()),
|
||||
+ selectedTab.getBackgroundLocation(),
|
||||
this.leftPos,
|
||||
this.topPos,
|
||||
0,
|
||||
@@ -715,6 +_,7 @@
|
||||
p_282663_.blitSprite(resourcelocation, j, k + (int)((float)(i - k - 17) * this.scrollOffs), 12, 15);
|
||||
}
|
||||
|
||||
@@ -206,7 +214,7 @@
|
||||
this.renderTabButton(p_282663_, selectedTab);
|
||||
if (selectedTab.getType() == CreativeModeTab.Type.INVENTORY) {
|
||||
InventoryScreen.renderEntityInInventoryFollowsMouse(
|
||||
@@ -744,7 +_,7 @@
|
||||
@@ -733,7 +_,7 @@
|
||||
}
|
||||
|
||||
private int getTabX(CreativeModeTab p_260136_) {
|
||||
@@ -215,7 +223,7 @@
|
||||
int j = 27;
|
||||
int k = 27 * i;
|
||||
if (p_260136_.isAlignedRight()) {
|
||||
@@ -756,7 +_,7 @@
|
||||
@@ -745,7 +_,7 @@
|
||||
|
||||
private int getTabY(CreativeModeTab p_260181_) {
|
||||
int i = 0;
|
||||
@@ -224,7 +232,7 @@
|
||||
i -= 32;
|
||||
} else {
|
||||
i += this.imageHeight;
|
||||
@@ -784,8 +_,8 @@
|
||||
@@ -773,8 +_,8 @@
|
||||
|
||||
protected void renderTabButton(GuiGraphics p_283590_, CreativeModeTab p_283489_) {
|
||||
boolean flag = p_283489_ == selectedTab;
|
||||
@@ -235,7 +243,7 @@
|
||||
int j = this.leftPos + this.getTabX(p_283489_);
|
||||
int k = this.topPos - (flag1 ? 28 : -(this.imageHeight - 4));
|
||||
ResourceLocation[] aresourcelocation;
|
||||
@@ -795,6 +_,7 @@
|
||||
@@ -784,6 +_,7 @@
|
||||
aresourcelocation = flag ? SELECTED_BOTTOM_TABS : UNSELECTED_BOTTOM_TABS;
|
||||
}
|
||||
|
||||
@@ -243,7 +251,7 @@
|
||||
p_283590_.blitSprite(aresourcelocation[Mth.clamp(i, 0, aresourcelocation.length)], j, k, 26, 32);
|
||||
p_283590_.pose().pushPose();
|
||||
p_283590_.pose().translate(0.0F, 0.0F, 100.0F);
|
||||
@@ -836,6 +_,14 @@
|
||||
@@ -825,6 +_,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,7 +266,7 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
static class CustomCreativeSlot extends Slot {
|
||||
public CustomCreativeSlot(Container p_98633_, int p_98634_, int p_98635_, int p_98636_) {
|
||||
@@ -1020,6 +_,22 @@
|
||||
@@ -1009,6 +_,22 @@
|
||||
@Override
|
||||
public boolean mayPickup(Player p_98665_) {
|
||||
return this.target.mayPickup(p_98665_);
|
||||
|
||||
+18
-22
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
|
||||
@@ -111,7 +_,7 @@
|
||||
@@ -108,7 +_,7 @@
|
||||
int l1 = 86 - this.font.width(s);
|
||||
FormattedText formattedtext = EnchantmentNames.getInstance().getRandomName(this.font, l1);
|
||||
int i2 = 6839882;
|
||||
@@ -9,24 +9,20 @@
|
||||
RenderSystem.enableBlend();
|
||||
p_282430_.blitSprite(ENCHANTMENT_SLOT_DISABLED_SPRITE, i1, j + 14 + 19 * l, 108, 19);
|
||||
p_282430_.blitSprite(DISABLED_LEVEL_SPRITES[l], i1 + 1, j + 15 + 19 * l, 16, 16);
|
||||
@@ -177,13 +_,16 @@
|
||||
.registryAccess()
|
||||
.registryOrThrow(Registries.ENCHANTMENT)
|
||||
.getHolder(this.menu.enchantClue[j]);
|
||||
- if (!optional.isEmpty()) {
|
||||
+ {
|
||||
int l = this.menu.levelClue[j];
|
||||
int i1 = j + 1;
|
||||
- if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0 && l >= 0 && optional != null) {
|
||||
+ if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0) {
|
||||
List<Component> list = Lists.newArrayList();
|
||||
- list.add(Component.translatable("container.enchant.clue", Enchantment.getFullname(optional.get(), l)).withStyle(ChatFormatting.WHITE));
|
||||
- if (!flag) {
|
||||
+ list.add(Component.translatable("container.enchant.clue", optional.isEmpty() ? "" : Enchantment.getFullname(optional.get(), l)).withStyle(ChatFormatting.WHITE));
|
||||
+ if (optional.isEmpty()) {
|
||||
+ list.add(Component.literal(""));
|
||||
+ list.add(Component.translatable("forge.container.enchant.limitedEnchantability").withStyle(ChatFormatting.RED));
|
||||
+ } else if (!flag) {
|
||||
list.add(CommonComponents.EMPTY);
|
||||
if (this.minecraft.player.experienceLevel < k) {
|
||||
list.add(Component.translatable("container.enchant.level.requirement", this.menu.costs[j]).withStyle(ChatFormatting.RED));
|
||||
@@ -173,10 +_,13 @@
|
||||
Enchantment enchantment = Enchantment.byId(this.menu.enchantClue[j]);
|
||||
int l = this.menu.levelClue[j];
|
||||
int i1 = j + 1;
|
||||
- if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0 && l >= 0 && enchantment != null) {
|
||||
+ if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0) {
|
||||
List<Component> list = Lists.newArrayList();
|
||||
- list.add(Component.translatable("container.enchant.clue", enchantment.getFullname(l)).withStyle(ChatFormatting.WHITE));
|
||||
- if (!flag) {
|
||||
+ list.add((Component.translatable("container.enchant.clue", enchantment == null ? "" : enchantment.getFullname(l))).withStyle(ChatFormatting.WHITE));
|
||||
+ if (enchantment == null) {
|
||||
+ list.add(Component.literal(""));
|
||||
+ list.add(Component.translatable("forge.container.enchant.limitedEnchantability").withStyle(ChatFormatting.RED));
|
||||
+ } else if (!flag) {
|
||||
list.add(CommonComponents.EMPTY);
|
||||
if (this.minecraft.player.experienceLevel < k) {
|
||||
list.add(Component.translatable("container.enchant.level.requirement", this.menu.costs[j]).withStyle(ChatFormatting.RED));
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
private static final Vector3f TEXT_SCALE = new Vector3f(1.0F, 1.0F, 1.0F);
|
||||
private static final int TEXTURE_WIDTH = 16;
|
||||
private static final int TEXTURE_HEIGHT = 16;
|
||||
- private final ResourceLocation texture = ResourceLocation.withDefaultNamespace("textures/gui/hanging_signs/" + this.woodType.name() + ".png");
|
||||
+ private final ResourceLocation texture = ResourceLocation.parse(this.woodType.name() + ".png").withPrefix("textures/gui/hanging_signs/");
|
||||
- private final ResourceLocation texture = new ResourceLocation("textures/gui/hanging_signs/" + this.woodType.name() + ".png");
|
||||
+ private final ResourceLocation texture = new ResourceLocation(this.woodType.name() + ".png").withPrefix("textures/gui/hanging_signs/"); // possibly unnecessary patch(?) -Paint_Ninja
|
||||
|
||||
public HangingSignEditScreen(SignBlockEntity p_278017_, boolean p_277942_, boolean p_277778_) {
|
||||
super(p_278017_, p_277942_, p_277778_, Component.translatable("hanging_sign.edit"));
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
|
||||
@@ -22,6 +_,8 @@
|
||||
} else if (p_169951_ instanceof ClientActivePlayersTooltip.ActivePlayersTooltip clientactiveplayerstooltip$activeplayerstooltip) {
|
||||
return new ClientActivePlayersTooltip(clientactiveplayerstooltip$activeplayerstooltip);
|
||||
@@ -20,6 +_,8 @@
|
||||
if (p_169951_ instanceof BundleTooltip bundletooltip) {
|
||||
return new ClientBundleTooltip(bundletooltip.contents());
|
||||
} else {
|
||||
+ ClientTooltipComponent result = net.minecraftforge.client.gui.ClientTooltipComponentManager.createClientTooltipComponent(p_169951_);
|
||||
+ if (result != null) return result;
|
||||
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
--- a/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java
|
||||
@@ -41,7 +_,7 @@
|
||||
protected void addFooter() {
|
||||
this.resetButton = Button.builder(Component.translatable("controls.resetAll"), p_343640_ -> {
|
||||
for (KeyMapping keymapping : this.options.keyMappings) {
|
||||
- keymapping.setKey(keymapping.getDefaultKey());
|
||||
+ keymapping.setToDefault();
|
||||
}
|
||||
|
||||
this.keyBindsList.resetMappingAndUpdateButtons();
|
||||
@@ -73,11 +_,14 @@
|
||||
public boolean keyPressed(int p_342715_, int p_342862_, int p_345515_) {
|
||||
if (this.selectedKey != null) {
|
||||
if (p_342715_ == 256) {
|
||||
+ this.selectedKey.setKeyModifierAndCode(null, InputConstants.UNKNOWN);
|
||||
this.options.setKey(this.selectedKey, InputConstants.UNKNOWN);
|
||||
} else {
|
||||
+ this.selectedKey.setKeyModifierAndCode(null, InputConstants.getKey(p_342715_, p_342862_));
|
||||
this.options.setKey(this.selectedKey, InputConstants.getKey(p_342715_, p_342862_));
|
||||
}
|
||||
|
||||
+ if (p_342715_ == 256 || !net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.selectedKey.getKey()))
|
||||
this.selectedKey = null;
|
||||
this.lastKeySelection = Util.getMillis();
|
||||
this.keyBindsList.resetMappingAndUpdateButtons();
|
||||
@@ -100,5 +_,18 @@
|
||||
}
|
||||
|
||||
this.resetButton.active = flag;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean keyReleased(int keyCode, int scanCode, int modifiers) {
|
||||
+ // Forge: We wait for a second key above if the first press is a modifier
|
||||
+ // but if they release the modifier then set it explicitly.
|
||||
+ var key = InputConstants.getKey(keyCode, scanCode);
|
||||
+ if (this.selectedKey != null && this.selectedKey.getKey() == key) {
|
||||
+ this.selectedKey = null;
|
||||
+ this.lastKeySelection = Util.getMillis();
|
||||
+ this.keyBindsList.resetMappingAndUpdateButtons();
|
||||
+ }
|
||||
+ return super.keyReleased(keyCode, scanCode, modifiers);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -6,6 +6,6 @@
|
||||
p_100014_.setSelected(null);
|
||||
- p_100015_.forEach(
|
||||
+ p_100015_.filter(PackSelectionModel.Entry::notHidden).forEach(
|
||||
p_340813_ -> {
|
||||
p_325390_ -> {
|
||||
TransferableSelectionList.PackEntry transferableselectionlist$packentry1 = new TransferableSelectionList.PackEntry(
|
||||
this.minecraft, p_100014_, p_340813_
|
||||
this.minecraft, p_100014_, p_325390_
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
|
||||
+++ b/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
|
||||
@@ -115,7 +_,7 @@
|
||||
@@ -116,7 +_,7 @@
|
||||
this.initFilterButtonTextures();
|
||||
this.tabButtons.clear();
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
this.tabButtons.add(new RecipeBookTabButton(recipebookcategories));
|
||||
}
|
||||
|
||||
@@ -293,7 +_,7 @@
|
||||
@@ -291,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (itemstack != null && this.minecraft.screen != null) {
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||
@@ -118,6 +_,7 @@
|
||||
@@ -119,6 +_,7 @@
|
||||
public static void openFresh(Minecraft p_232897_, @Nullable Screen p_232898_) {
|
||||
queueLoadScreen(p_232897_, PREPARING_WORLD_DATA);
|
||||
PackRepository packrepository = new PackRepository(new ServerPacksSource(p_232897_.directoryValidator()));
|
||||
@@ -8,7 +8,7 @@
|
||||
WorldLoader.InitConfig worldloader$initconfig = createDefaultLoadConfig(packrepository, WorldDataConfiguration.DEFAULT);
|
||||
CompletableFuture<WorldCreationContext> completablefuture = WorldLoader.load(
|
||||
worldloader$initconfig,
|
||||
@@ -415,7 +_,7 @@
|
||||
@@ -419,7 +_,7 @@
|
||||
if (p_269627_) {
|
||||
p_270552_.accept(this.uiState.getSettings().dataConfiguration());
|
||||
} else {
|
||||
@@ -17,7 +17,7 @@
|
||||
}
|
||||
},
|
||||
Component.translatable("dataPack.validation.failed"),
|
||||
@@ -533,6 +_,7 @@
|
||||
@@ -537,6 +_,7 @@
|
||||
if (path != null) {
|
||||
if (this.tempDataPackRepository == null) {
|
||||
this.tempDataPackRepository = ServerPacksSource.createPackRepository(path, this.packValidator);
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
|
||||
@@ -75,6 +_,7 @@
|
||||
static final ResourceLocation JOIN_HIGHLIGHTED_SPRITE = ResourceLocation.withDefaultNamespace("world_list/join_highlighted");
|
||||
static final ResourceLocation JOIN_SPRITE = ResourceLocation.withDefaultNamespace("world_list/join");
|
||||
static final ResourceLocation JOIN_HIGHLIGHTED_SPRITE = new ResourceLocation("world_list/join_highlighted");
|
||||
static final ResourceLocation JOIN_SPRITE = new ResourceLocation("world_list/join");
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
+ private static final ResourceLocation FORGE_EXPERIMENTAL_WARNING_ICON = ResourceLocation.fromNamespaceAndPath("forge","textures/gui/experimental_warning.png");
|
||||
+ private static final ResourceLocation FORGE_EXPERIMENTAL_WARNING_ICON = new ResourceLocation("forge","textures/gui/experimental_warning.png");
|
||||
static final Component FROM_NEWER_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.fromNewerVersion1").withStyle(ChatFormatting.RED);
|
||||
static final Component FROM_NEWER_TOOLTIP_2 = Component.translatable("selectWorld.tooltip.fromNewerVersion2").withStyle(ChatFormatting.RED);
|
||||
static final Component SNAPSHOT_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.snapshot1").withStyle(ChatFormatting.GOLD);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
--- a/net/minecraft/client/main/Main.java
|
||||
+++ b/net/minecraft/client/main/Main.java
|
||||
@@ -111,8 +_,8 @@
|
||||
CrashReport.preload();
|
||||
logger = LogUtils.getLogger();
|
||||
s1 = "Bootstrap";
|
||||
@@ -154,8 +_,8 @@
|
||||
CrashReport.preload();
|
||||
|
||||
try {
|
||||
- Bootstrap.bootStrap();
|
||||
GameLoadTimesEvent.INSTANCE.setBootstrapTime(Bootstrap.bootstrapDuration.get());
|
||||
+ net.minecraftforge.fml.loading.BackgroundWaiter.runAndTick(Bootstrap::bootStrap, net.minecraftforge.fml.loading.FMLLoader.progressWindowTick);
|
||||
Bootstrap.validate();
|
||||
s1 = "Argument parsing";
|
||||
List<String> list = optionset.valuesOf(optionspec27);
|
||||
} catch (Throwable throwable2) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable2, "Bootstrap");
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/model/geom/LayerDefinitions.java
|
||||
+++ b/net/minecraft/client/model/geom/LayerDefinitions.java
|
||||
@@ -329,6 +_,7 @@
|
||||
@@ -328,6 +_,7 @@
|
||||
WoodType.values().forEach(p_171114_ -> builder.put(ModelLayers.createSignModelName(p_171114_), layerdefinition23));
|
||||
LayerDefinition layerdefinition24 = HangingSignRenderer.createHangingSignLayer();
|
||||
WoodType.values().forEach(p_247864_ -> builder.put(ModelLayers.createHangingSignModelName(p_247864_), layerdefinition24));
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
--- a/net/minecraft/client/model/geom/ModelLayers.java
|
||||
+++ b/net/minecraft/client/model/geom/ModelLayers.java
|
||||
@@ -229,11 +_,13 @@
|
||||
@@ -228,11 +_,13 @@
|
||||
}
|
||||
|
||||
public static ModelLayerLocation createSignModelName(WoodType p_171292_) {
|
||||
- return createLocation("sign/" + p_171292_.name(), "main");
|
||||
+ ResourceLocation location = ResourceLocation.parse(p_171292_.name());
|
||||
+ return new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(location.getNamespace(), "sign/" + location.getPath()), "main");
|
||||
+ ResourceLocation location = new ResourceLocation(p_171292_.name());
|
||||
+ return new ModelLayerLocation(new ResourceLocation(location.getNamespace(), "sign/" + location.getPath()), "main");
|
||||
}
|
||||
|
||||
public static ModelLayerLocation createHangingSignModelName(WoodType p_252225_) {
|
||||
- return createLocation("hanging_sign/" + p_252225_.name(), "main");
|
||||
+ ResourceLocation location = ResourceLocation.parse(p_252225_.name());
|
||||
+ return new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(location.getNamespace(), "hanging_sign/" + location.getPath()), "main");
|
||||
+ ResourceLocation location = new ResourceLocation(p_252225_.name());
|
||||
+ return new ModelLayerLocation(new ResourceLocation(location.getNamespace(), "hanging_sign/" + location.getPath()), "main");
|
||||
}
|
||||
|
||||
public static Stream<ModelLayerLocation> getKnownLocations() {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java
|
||||
+++ b/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java
|
||||
@@ -149,6 +_,7 @@
|
||||
@@ -116,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void handleCustomPayload(ClientboundCustomPayloadPacket p_298103_) {
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
|
||||
+++ b/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
|
||||
@@ -143,6 +_,7 @@
|
||||
@@ -141,6 +_,7 @@
|
||||
);
|
||||
this.connection.send(ServerboundFinishConfigurationPacket.INSTANCE);
|
||||
this.connection.setupOutboundProtocol(GameProtocols.SERVERBOUND_TEMPLATE.bind(RegistryFriendlyByteBuf.decorator(registryaccess$frozen)));
|
||||
this.connection.setupOutboundProtocol(GameProtocols.SERVERBOUND.bind(RegistryFriendlyByteBuf.decorator(registryaccess$frozen)));
|
||||
+ net.minecraftforge.common.ForgeHooks.handleClientConfigurationComplete(this.connection);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
|
||||
+++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
|
||||
@@ -210,6 +_,7 @@
|
||||
@@ -205,6 +_,7 @@
|
||||
Component component = this.wasTransferredTo ? CommonComponents.TRANSFER_CONNECT_FAILED : CommonComponents.CONNECT_FAILED;
|
||||
if (this.serverData != null && this.serverData.isRealm()) {
|
||||
this.minecraft.setScreen(new DisconnectedRealmsScreen(this.parent, component, p_342266_.reason()));
|
||||
+ } else if (net.minecraftforge.client.ForgeHooksClient.onClientDisconnect(this.connection, this.minecraft, this.parent, p_342266_.reason())) {
|
||||
this.minecraft.setScreen(new DisconnectedRealmsScreen(this.parent, component, p_104543_));
|
||||
+ } else if (net.minecraftforge.client.ForgeHooksClient.onClientDisconnect(this.connection, this.minecraft, this.parent, p_104543_)) {
|
||||
} else {
|
||||
this.minecraft.setScreen(new DisconnectedScreen(this.parent, component, p_342266_));
|
||||
this.minecraft.setScreen(new DisconnectedScreen(this.parent, component, p_104543_));
|
||||
}
|
||||
@@ -234,6 +_,7 @@
|
||||
@@ -229,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void handleCustomQuery(ClientboundCustomQueryPacket p_104545_) {
|
||||
|
||||
+12
-12
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/multiplayer/ClientPacketListener.java
|
||||
+++ b/net/minecraft/client/multiplayer/ClientPacketListener.java
|
||||
@@ -427,6 +_,7 @@
|
||||
@@ -425,6 +_,7 @@
|
||||
|
||||
this.minecraft.debugRenderer.clear();
|
||||
this.minecraft.player.resetPos();
|
||||
@@ -8,8 +8,8 @@
|
||||
this.minecraft.player.setId(p_105030_.playerId());
|
||||
this.level.addEntity(this.minecraft.player);
|
||||
this.minecraft.player.input = new KeyboardInput(this.minecraft.options);
|
||||
@@ -1164,7 +_,9 @@
|
||||
localplayer1.getAttributes().assignBaseValues(localplayer.getAttributes());
|
||||
@@ -1159,7 +_,9 @@
|
||||
localplayer1.getAttributes().assignValues(localplayer.getAttributes());
|
||||
}
|
||||
|
||||
+ localplayer1.updateSyncFields(localplayer); // Forge: fix MC-10657
|
||||
@@ -18,7 +18,7 @@
|
||||
this.level.addEntity(localplayer1);
|
||||
localplayer1.setYRot(-180.0F);
|
||||
localplayer1.input = new KeyboardInput(this.minecraft.options);
|
||||
@@ -1300,10 +_,7 @@
|
||||
@@ -1294,10 +_,7 @@
|
||||
PacketUtils.ensureRunningOnSameThread(p_104976_, this, this.minecraft);
|
||||
BlockPos blockpos = p_104976_.getPos();
|
||||
this.minecraft.level.getBlockEntity(blockpos, p_104976_.getType()).ifPresent(p_325478_ -> {
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
if (p_325478_ instanceof CommandBlockEntity && this.minecraft.screen instanceof CommandBlockEditScreen) {
|
||||
((CommandBlockEditScreen)this.minecraft.screen).updateGui();
|
||||
@@ -1465,7 +_,9 @@
|
||||
@@ -1464,7 +_,9 @@
|
||||
@Override
|
||||
public void handleCommands(ClientboundCommandsPacket p_104990_) {
|
||||
PacketUtils.ensureRunningOnSameThread(p_104990_, this, this.minecraft);
|
||||
@@ -41,24 +41,24 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1487,6 +_,7 @@
|
||||
@@ -1486,6 +_,7 @@
|
||||
ClientRecipeBook clientrecipebook = this.minecraft.player.getRecipeBook();
|
||||
clientrecipebook.setupCollections(this.recipeManager.getOrderedRecipes(), this.minecraft.level.registryAccess());
|
||||
this.searchTrees.updateRecipes(clientrecipebook, this.registryAccess);
|
||||
this.minecraft.populateSearchTree(SearchRegistry.RECIPE_COLLECTIONS, clientrecipebook.getCollections());
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated(this.recipeManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1585,6 +_,8 @@
|
||||
@@ -1582,6 +_,8 @@
|
||||
TagCollector tagcollector = new TagCollector();
|
||||
p_298004_.getTags().forEach(tagcollector::append);
|
||||
tagcollector.updateTags(this.registryAccess, this.connection.isMemoryConnection());
|
||||
List<ItemStack> list = List.copyOf(CreativeModeTabs.searchTab().getDisplayItems());
|
||||
this.searchTrees.updateCreativeTags(list);
|
||||
+
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onTagsUpdated(this.registryAccess, true, this.connection.isMemoryConnection());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2389,6 +_,8 @@
|
||||
@@ -2388,6 +_,8 @@
|
||||
}
|
||||
|
||||
public void sendChat(String p_249888_) {
|
||||
@@ -67,7 +67,7 @@
|
||||
Instant instant = Instant.now();
|
||||
long i = Crypt.SaltSupplier.getLong();
|
||||
LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.lastSeenMessages.generateAndApplyUpdate();
|
||||
@@ -2397,6 +_,7 @@
|
||||
@@ -2396,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void sendCommand(String p_250092_) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/multiplayer/MultiPlayerGameMode.java
|
||||
+++ b/net/minecraft/client/multiplayer/MultiPlayerGameMode.java
|
||||
@@ -105,6 +_,7 @@
|
||||
@@ -106,6 +_,7 @@
|
||||
}
|
||||
|
||||
public boolean destroyBlock(BlockPos p_105268_) {
|
||||
@@ -8,7 +8,7 @@
|
||||
if (this.minecraft.player.blockActionRestricted(this.minecraft.level, p_105268_, this.localPlayerMode)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -119,9 +_,8 @@
|
||||
@@ -120,9 +_,8 @@
|
||||
} else if (blockstate.isAir()) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -19,7 +19,7 @@
|
||||
if (flag) {
|
||||
block.destroy(level, p_105268_, blockstate);
|
||||
}
|
||||
@@ -142,6 +_,7 @@
|
||||
@@ -143,6 +_,7 @@
|
||||
BlockState blockstate = this.minecraft.level.getBlockState(p_105270_);
|
||||
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105270_, blockstate, 1.0F);
|
||||
this.startPrediction(this.minecraft.level, p_233757_ -> {
|
||||
@@ -27,7 +27,7 @@
|
||||
this.destroyBlock(p_105270_);
|
||||
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233757_);
|
||||
});
|
||||
@@ -151,15 +_,18 @@
|
||||
@@ -152,15 +_,18 @@
|
||||
this.connection
|
||||
.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, p_105271_));
|
||||
}
|
||||
@@ -46,7 +46,7 @@
|
||||
if (flag && blockstate1.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105270_) >= 1.0F) {
|
||||
this.destroyBlock(p_105270_);
|
||||
} else {
|
||||
@@ -170,6 +_,7 @@
|
||||
@@ -171,6 +_,7 @@
|
||||
this.destroyTicks = 0.0F;
|
||||
this.minecraft.level.destroyBlockProgress(this.minecraft.player.getId(), this.destroyBlockPos, this.getDestroyStage());
|
||||
}
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233728_);
|
||||
});
|
||||
@@ -202,6 +_,7 @@
|
||||
@@ -203,6 +_,7 @@
|
||||
BlockState blockstate1 = this.minecraft.level.getBlockState(p_105284_);
|
||||
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate1, 1.0F);
|
||||
this.startPrediction(this.minecraft.level, p_233753_ -> {
|
||||
@@ -62,7 +62,7 @@
|
||||
this.destroyBlock(p_105284_);
|
||||
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105284_, p_105285_, p_233753_);
|
||||
});
|
||||
@@ -214,7 +_,7 @@
|
||||
@@ -215,7 +_,7 @@
|
||||
} else {
|
||||
this.destroyProgress = this.destroyProgress + blockstate.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105284_);
|
||||
if (this.destroyTicks % 4.0F == 0.0F) {
|
||||
@@ -71,7 +71,7 @@
|
||||
this.minecraft
|
||||
.getSoundManager()
|
||||
.play(
|
||||
@@ -231,6 +_,7 @@
|
||||
@@ -232,6 +_,7 @@
|
||||
|
||||
this.destroyTicks++;
|
||||
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate, Mth.clamp(this.destroyProgress, 0.0F, 1.0F));
|
||||
@@ -79,7 +79,7 @@
|
||||
if (this.destroyProgress >= 1.0F) {
|
||||
this.isDestroying = false;
|
||||
this.startPrediction(this.minecraft.level, p_233739_ -> {
|
||||
@@ -269,7 +_,7 @@
|
||||
@@ -270,7 +_,7 @@
|
||||
|
||||
private boolean sameDestroyTarget(BlockPos p_105282_) {
|
||||
ItemStack itemstack = this.minecraft.player.getMainHandItem();
|
||||
@@ -88,7 +88,7 @@
|
||||
}
|
||||
|
||||
private void ensureHasSentCarriedItem() {
|
||||
@@ -297,12 +_,23 @@
|
||||
@@ -298,12 +_,23 @@
|
||||
private InteractionResult performUseItemOn(LocalPlayer p_233747_, InteractionHand p_233748_, BlockHitResult p_233749_) {
|
||||
BlockPos blockpos = p_233749_.getBlockPos();
|
||||
ItemStack itemstack = p_233747_.getItemInHand(p_233748_);
|
||||
@@ -114,7 +114,7 @@
|
||||
BlockState blockstate = this.minecraft.level.getBlockState(blockpos);
|
||||
if (!this.connection.isFeatureEnabled(blockstate.getBlock().requiredFeatures())) {
|
||||
return InteractionResult.FAIL;
|
||||
@@ -323,8 +_,10 @@
|
||||
@@ -324,8 +_,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,26 +127,26 @@
|
||||
InteractionResult interactionresult1;
|
||||
if (this.localPlayerMode.isCreative()) {
|
||||
int i = itemstack.getCount();
|
||||
@@ -358,10 +_,18 @@
|
||||
mutableobject.setValue(InteractionResult.PASS);
|
||||
return serverbounduseitempacket;
|
||||
} else {
|
||||
+ var event = net.minecraftforge.event.ForgeEventFactory.onRightClickItem(p_233722_, p_233723_);
|
||||
+ if (event.isCanceled()) {
|
||||
+ mutableobject.setValue(event.getCancellationResult());
|
||||
+ return serverbounduseitempacket;
|
||||
@@ -361,10 +_,18 @@
|
||||
mutableobject.setValue(InteractionResult.PASS);
|
||||
return serverbounduseitempacket;
|
||||
} else {
|
||||
+ var event = net.minecraftforge.event.ForgeEventFactory.onRightClickItem(p_233722_, p_233723_);
|
||||
+ if (event.isCanceled()) {
|
||||
+ mutableobject.setValue(event.getCancellationResult());
|
||||
+ return serverbounduseitempacket;
|
||||
+ }
|
||||
InteractionResultHolder<ItemStack> interactionresultholder = itemstack.use(this.minecraft.level, p_233722_, p_233723_);
|
||||
ItemStack itemstack1 = interactionresultholder.getObject();
|
||||
if (itemstack1 != itemstack) {
|
||||
p_233722_.setItemInHand(p_233723_, itemstack1);
|
||||
+ if (itemstack1.isEmpty()) {
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_233722_, itemstack, p_233723_);
|
||||
+ }
|
||||
InteractionResultHolder<ItemStack> interactionresultholder = itemstack.use(this.minecraft.level, p_233722_, p_233723_);
|
||||
ItemStack itemstack1 = interactionresultholder.getObject();
|
||||
if (itemstack1 != itemstack) {
|
||||
p_233722_.setItemInHand(p_233723_, itemstack1);
|
||||
+ if (itemstack1.isEmpty()) {
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_233722_, itemstack, p_233723_);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
mutableobject.setValue(interactionresultholder.getResult());
|
||||
@@ -393,6 +_,10 @@
|
||||
mutableobject.setValue(interactionresultholder.getResult());
|
||||
@@ -395,6 +_,10 @@
|
||||
public InteractionResult interact(Player p_105227_, Entity p_105228_, InteractionHand p_105229_) {
|
||||
this.ensureHasSentCarriedItem();
|
||||
this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105228_, p_105227_.isShiftKeyDown(), p_105229_));
|
||||
@@ -157,7 +157,7 @@
|
||||
return this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : p_105227_.interactOn(p_105228_, p_105229_);
|
||||
}
|
||||
|
||||
@@ -400,6 +_,10 @@
|
||||
@@ -402,6 +_,10 @@
|
||||
this.ensureHasSentCarriedItem();
|
||||
Vec3 vec3 = p_105233_.getLocation().subtract(p_105232_.getX(), p_105232_.getY(), p_105232_.getZ());
|
||||
this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105232_, p_105231_.isShiftKeyDown(), p_105234_, vec3));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/multiplayer/ServerStatusPinger.java
|
||||
+++ b/net/minecraft/client/multiplayer/ServerStatusPinger.java
|
||||
@@ -99,6 +_,7 @@
|
||||
@@ -98,6 +_,7 @@
|
||||
p_105461_.run();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
--- a/net/minecraft/client/multiplayer/SessionSearchTrees.java
|
||||
+++ b/net/minecraft/client/multiplayer/SessionSearchTrees.java
|
||||
@@ -31,8 +_,8 @@
|
||||
private static final SessionSearchTrees.Key RECIPE_COLLECTIONS = new SessionSearchTrees.Key();
|
||||
public static final SessionSearchTrees.Key CREATIVE_NAMES = new SessionSearchTrees.Key();
|
||||
public static final SessionSearchTrees.Key CREATIVE_TAGS = new SessionSearchTrees.Key();
|
||||
- private CompletableFuture<SearchTree<ItemStack>> creativeByNameSearch = CompletableFuture.completedFuture(SearchTree.empty());
|
||||
- private CompletableFuture<SearchTree<ItemStack>> creativeByTagSearch = CompletableFuture.completedFuture(SearchTree.empty());
|
||||
+ private CompletableFuture<SearchTree<ItemStack>> EMPTY = CompletableFuture.completedFuture(SearchTree.empty());
|
||||
+ private Map<SessionSearchTrees.Key, CompletableFuture<SearchTree<ItemStack>>> creativeSearch = new IdentityHashMap<>();
|
||||
private CompletableFuture<SearchTree<RecipeCollection>> recipeSearch = CompletableFuture.completedFuture(SearchTree.empty());
|
||||
private final Map<SessionSearchTrees.Key, Runnable> reloaders = new IdentityHashMap<>();
|
||||
|
||||
@@ -82,44 +_,52 @@
|
||||
}
|
||||
|
||||
public void updateCreativeTags(List<ItemStack> p_344581_) {
|
||||
+ for (var entry : net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKeys().entrySet())
|
||||
this.register(
|
||||
- CREATIVE_TAGS,
|
||||
+ entry.getValue(),
|
||||
() -> {
|
||||
- CompletableFuture<?> completablefuture = this.creativeByTagSearch;
|
||||
- this.creativeByTagSearch = CompletableFuture.supplyAsync(
|
||||
- () -> new IdSearchTree<>(p_342206_ -> p_342206_.getTags().map(TagKey::location), p_344581_), Util.backgroundExecutor()
|
||||
- );
|
||||
+ var items = entry.getKey() == net.minecraft.world.item.CreativeModeTabs.searchTab() ? p_344581_ : List.copyOf(entry.getKey().getDisplayItems());
|
||||
+ CompletableFuture<?> completablefuture = this.creativeSearch.getOrDefault(entry.getValue(), EMPTY);
|
||||
+ this.creativeSearch.put(entry.getValue(), CompletableFuture.supplyAsync(
|
||||
+ () -> new IdSearchTree<>(p_342206_ -> p_342206_.getTags().map(TagKey::location), items), Util.backgroundExecutor()
|
||||
+ ));
|
||||
completablefuture.cancel(true);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public SearchTree<ItemStack> creativeTagSearch() {
|
||||
- return this.creativeByTagSearch.join();
|
||||
+ return this.getSearchTree(CREATIVE_TAGS);
|
||||
}
|
||||
|
||||
public void updateCreativeTooltips(HolderLookup.Provider p_343364_, List<ItemStack> p_342500_) {
|
||||
+ for (var entry : net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKeys().entrySet())
|
||||
this.register(
|
||||
- CREATIVE_NAMES,
|
||||
+ entry.getValue(),
|
||||
() -> {
|
||||
+ var items = entry.getKey() == net.minecraft.world.item.CreativeModeTabs.searchTab() ? p_342500_ : List.copyOf(entry.getKey().getDisplayItems());
|
||||
Item.TooltipContext item$tooltipcontext = Item.TooltipContext.of(p_343364_);
|
||||
TooltipFlag tooltipflag = TooltipFlag.Default.NORMAL.asCreative();
|
||||
- CompletableFuture<?> completablefuture = this.creativeByNameSearch;
|
||||
- this.creativeByNameSearch = CompletableFuture.supplyAsync(
|
||||
+ CompletableFuture<?> completablefuture = this.creativeSearch.getOrDefault(entry.getValue(), EMPTY);
|
||||
+ this.creativeSearch.put(entry.getValue(), CompletableFuture.supplyAsync(
|
||||
() -> new FullTextSearchTree<>(
|
||||
p_345254_ -> getTooltipLines(Stream.of(p_345254_), item$tooltipcontext, tooltipflag),
|
||||
p_344415_ -> p_344415_.getItemHolder().unwrapKey().map(ResourceKey::location).stream(),
|
||||
- p_342500_
|
||||
+ items
|
||||
),
|
||||
Util.backgroundExecutor()
|
||||
- );
|
||||
+ ));
|
||||
completablefuture.cancel(true);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public SearchTree<ItemStack> creativeNameSearch() {
|
||||
- return this.creativeByNameSearch.join();
|
||||
+ return this.getSearchTree(CREATIVE_NAMES);
|
||||
+ }
|
||||
+
|
||||
+ public SearchTree<ItemStack> getSearchTree(SessionSearchTrees.Key key) {
|
||||
+ return this.creativeSearch.getOrDefault(key, EMPTY).join();
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/client/multiplayer/TagCollector.java
|
||||
+++ b/net/minecraft/client/multiplayer/TagCollector.java
|
||||
@@ -23,7 +_,7 @@
|
||||
}
|
||||
|
||||
private static void refreshCommonTagDependentData() {
|
||||
- CreativeModeTabs.searchTab().rebuildSearchTree();
|
||||
+ CreativeModeTabs.allTabs().stream().filter(tab -> tab.hasSearchBar()).forEach(tab -> tab.rebuildSearchTree());
|
||||
}
|
||||
|
||||
private static void refreshBuiltInTagDependentData() {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/particle/ParticleEngine.java
|
||||
+++ b/net/minecraft/client/particle/ParticleEngine.java
|
||||
@@ -77,11 +_,11 @@
|
||||
@@ -75,11 +_,11 @@
|
||||
ParticleRenderType.TERRAIN_SHEET, ParticleRenderType.PARTICLE_SHEET_OPAQUE, ParticleRenderType.PARTICLE_SHEET_LIT, ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT, ParticleRenderType.CUSTOM
|
||||
);
|
||||
protected ClientLevel level;
|
||||
@@ -14,7 +14,7 @@
|
||||
private final Queue<Particle> particlesToAdd = Queues.newArrayDeque();
|
||||
private final Map<ResourceLocation, ParticleEngine.MutableSpriteSet> spriteSets = Maps.newHashMap();
|
||||
private final TextureAtlas textureAtlas;
|
||||
@@ -212,10 +_,14 @@
|
||||
@@ -210,10 +_,14 @@
|
||||
this.register(ParticleTypes.OMINOUS_SPAWNING, FlyStraightTowardsParticle.OminousSpawnProvider::new);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
public <T extends ParticleOptions> void register(ParticleType<T> p_273423_, ParticleProvider.Sprite<T> p_273134_) {
|
||||
this.register(
|
||||
p_273423_,
|
||||
@@ -232,10 +_,12 @@
|
||||
@@ -230,10 +_,12 @@
|
||||
);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -361,7 +_,7 @@
|
||||
@@ -359,7 +_,7 @@
|
||||
private <T extends ParticleOptions> Particle makeParticle(
|
||||
T p_107396_, double p_107397_, double p_107398_, double p_107399_, double p_107400_, double p_107401_, double p_107402_
|
||||
) {
|
||||
@@ -53,7 +53,7 @@
|
||||
return particleprovider == null
|
||||
? null
|
||||
: particleprovider.createParticle(p_107396_, this.level, p_107397_, p_107398_, p_107399_, p_107400_, p_107401_, p_107402_);
|
||||
@@ -437,11 +_,19 @@
|
||||
@@ -435,11 +_,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,18 +71,18 @@
|
||||
- for (ParticleRenderType particlerendertype : RENDER_ORDER) {
|
||||
+ for (ParticleRenderType particlerendertype : this.particles.keySet()) { // Forge: allow custom IParticleRenderType's
|
||||
+ if (particlerendertype == ParticleRenderType.NO_RENDER) continue;
|
||||
Queue<Particle> queue = this.particles.get(particlerendertype);
|
||||
if (queue != null && !queue.isEmpty()) {
|
||||
Iterable<Particle> iterable = this.particles.get(particlerendertype);
|
||||
if (iterable != null) {
|
||||
RenderSystem.setShader(GameRenderer::getParticleShader);
|
||||
@@ -449,6 +_,7 @@
|
||||
BufferBuilder bufferbuilder = particlerendertype.begin(tesselator, this.textureManager);
|
||||
if (bufferbuilder != null) {
|
||||
for (Particle particle : queue) {
|
||||
+ if (frustum != null && particle.shouldCull() && !frustum.isVisible(particle.getBoundingBox())) continue;
|
||||
try {
|
||||
particle.render(bufferbuilder, p_107340_, p_107341_);
|
||||
} catch (Throwable throwable) {
|
||||
@@ -480,7 +_,7 @@
|
||||
@@ -448,6 +_,7 @@
|
||||
particlerendertype.begin(bufferbuilder, this.textureManager);
|
||||
|
||||
for (Particle particle : iterable) {
|
||||
+ if (frustum != null && particle.shouldCull() && !frustum.isVisible(particle.getBoundingBox())) continue;
|
||||
try {
|
||||
particle.render(bufferbuilder, p_107340_, p_107341_);
|
||||
} catch (Throwable throwable) {
|
||||
@@ -475,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void destroy(BlockPos p_107356_, BlockState p_107357_) {
|
||||
@@ -91,7 +91,7 @@
|
||||
VoxelShape voxelshape = p_107357_.getShape(this.level, p_107356_);
|
||||
double d0 = 0.25;
|
||||
voxelshape.forAllBoxes(
|
||||
@@ -513,6 +_,7 @@
|
||||
@@ -508,6 +_,7 @@
|
||||
p_107357_,
|
||||
p_107356_
|
||||
)
|
||||
@@ -99,7 +99,7 @@
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -522,6 +_,13 @@
|
||||
@@ -517,6 +_,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
public void crack(BlockPos p_107368_, Direction p_107369_) {
|
||||
BlockState blockstate = this.level.getBlockState(p_107368_);
|
||||
if (blockstate.getRenderShape() != RenderShape.INVISIBLE && blockstate.shouldSpawnTerrainParticles()) {
|
||||
@@ -557,7 +_,7 @@
|
||||
@@ -552,7 +_,7 @@
|
||||
d0 = (double)i + aabb.maxX + 0.1F;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/particle/VibrationSignalParticle.java
|
||||
+++ b/net/minecraft/client/particle/VibrationSignalParticle.java
|
||||
@@ -76,6 +_,7 @@
|
||||
@@ -122,6 +_,7 @@
|
||||
this.x = Mth.lerp(d0, this.x, vec3.x());
|
||||
this.y = Mth.lerp(d0, this.y, vec3.y());
|
||||
this.z = Mth.lerp(d0, this.z, vec3.z());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/player/LocalPlayer.java
|
||||
+++ b/net/minecraft/client/player/LocalPlayer.java
|
||||
@@ -161,6 +_,7 @@
|
||||
@@ -160,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public boolean hurt(DamageSource p_108662_, float p_108663_) {
|
||||
@@ -8,7 +8,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -304,6 +_,7 @@
|
||||
@@ -303,6 +_,7 @@
|
||||
ServerboundPlayerActionPacket.Action serverboundplayeractionpacket$action = p_108701_
|
||||
? ServerboundPlayerActionPacket.Action.DROP_ALL_ITEMS
|
||||
: ServerboundPlayerActionPacket.Action.DROP_ITEM;
|
||||
@@ -16,7 +16,7 @@
|
||||
ItemStack itemstack = this.getInventory().removeFromSelected(p_108701_);
|
||||
this.connection.send(new ServerboundPlayerActionPacket(serverboundplayeractionpacket$action, BlockPos.ZERO, Direction.DOWN));
|
||||
return !itemstack.isEmpty();
|
||||
@@ -501,7 +_,11 @@
|
||||
@@ -505,7 +_,11 @@
|
||||
|
||||
@Override
|
||||
public void playSound(SoundEvent p_108651_, float p_108652_, float p_108653_) {
|
||||
@@ -29,15 +29,15 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -694,6 +_,7 @@
|
||||
@@ -697,6 +_,7 @@
|
||||
&& (this.isShiftKeyDown() || !this.isSleeping() && !this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.STANDING));
|
||||
float f = (float)this.getAttributeValue(Attributes.SNEAKING_SPEED);
|
||||
float f = Mth.clamp(0.3F + EnchantmentHelper.getSneakingSpeedBonus(this), 0.0F, 1.0F);
|
||||
this.input.tick(this.isMovingSlowly(), f);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onMovementInputUpdate(this, this.input);
|
||||
this.minecraft.getTutorial().onInput(this.input);
|
||||
if (this.isUsingItem() && !this.isPassenger()) {
|
||||
this.input.leftImpulse *= 0.2F;
|
||||
@@ -722,7 +_,7 @@
|
||||
@@ -725,7 +_,7 @@
|
||||
boolean flag4 = this.canStartSprinting();
|
||||
boolean flag5 = this.isPassenger() ? this.getVehicle().onGround() : this.onGround();
|
||||
boolean flag6 = !flag1 && !flag2;
|
||||
@@ -46,7 +46,7 @@
|
||||
if (this.sprintTriggerTime <= 0 && !this.minecraft.options.keySprint.isDown()) {
|
||||
this.sprintTriggerTime = 7;
|
||||
} else {
|
||||
@@ -730,15 +_,15 @@
|
||||
@@ -733,15 +_,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
this.setSprinting(false);
|
||||
}
|
||||
} else if (flag8) {
|
||||
@@ -772,14 +_,15 @@
|
||||
@@ -775,14 +_,15 @@
|
||||
|
||||
if (this.input.jumping && !flag9 && !flag && !abilities.flying && !this.isPassenger() && !this.onClimbable()) {
|
||||
ItemStack itemstack = this.getItemBySlot(EquipmentSlot.CHEST);
|
||||
@@ -84,7 +84,7 @@
|
||||
}
|
||||
|
||||
if (this.isEyeInFluid(FluidTags.WATER)) {
|
||||
@@ -885,6 +_,7 @@
|
||||
@@ -882,6 +_,7 @@
|
||||
@Override
|
||||
public void rideTick() {
|
||||
super.rideTick();
|
||||
@@ -92,7 +92,7 @@
|
||||
this.handsBusy = false;
|
||||
if (this.getControlledVehicle() instanceof Boat boat) {
|
||||
boat.setInput(this.input.left, this.input.right, this.input.up, this.input.down);
|
||||
@@ -1142,5 +_,17 @@
|
||||
@@ -1139,5 +_,17 @@
|
||||
@Override
|
||||
public float getVisualRotationYInDegrees() {
|
||||
return this.getYRot();
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
--- a/net/minecraft/client/renderer/EffectInstance.java
|
||||
+++ b/net/minecraft/client/renderer/EffectInstance.java
|
||||
@@ -58,7 +_,7 @@
|
||||
@@ -58,7 +_,8 @@
|
||||
private final EffectProgram fragmentProgram;
|
||||
|
||||
public EffectInstance(ResourceProvider p_334130_, String p_108942_) throws IOException {
|
||||
- ResourceLocation resourcelocation = ResourceLocation.withDefaultNamespace("shaders/program/" + p_108942_ + ".json");
|
||||
+ ResourceLocation resourcelocation = ResourceLocation.tryParse(p_108942_).withPath(p -> "shaders/program/" + p + ".json");
|
||||
- ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_108942_ + ".json");
|
||||
+ ResourceLocation rl = ResourceLocation.tryParse(p_108942_);
|
||||
+ ResourceLocation resourcelocation = new ResourceLocation(rl.getNamespace(), "shaders/program/" + rl.getPath() + ".json");
|
||||
this.name = p_108942_;
|
||||
Resource resource = p_334130_.getResourceOrThrow(resourcelocation);
|
||||
|
||||
@@ -150,7 +_,7 @@
|
||||
@@ -150,7 +_,8 @@
|
||||
} else {
|
||||
EffectProgram effectprogram;
|
||||
if (program == null) {
|
||||
- ResourceLocation resourcelocation = ResourceLocation.withDefaultNamespace("shaders/program/" + p_172569_ + p_172568_.getExtension());
|
||||
+ ResourceLocation resourcelocation = ResourceLocation.tryParse(p_172569_).withPath(p -> "shaders/program/" + p + p_172568_.getExtension());
|
||||
- ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_172569_ + p_172568_.getExtension());
|
||||
+ ResourceLocation rl = ResourceLocation.tryParse(p_172569_);
|
||||
+ ResourceLocation resourcelocation = new ResourceLocation(rl.getNamespace(), "shaders/program/" + rl.getPath() + p_172568_.getExtension());
|
||||
Resource resource = p_331503_.getResourceOrThrow(resourcelocation);
|
||||
|
||||
try (InputStream inputstream = resource.open()) {
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/client/renderer/GameRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/GameRenderer.java
|
||||
@@ -311,6 +_,8 @@
|
||||
this.loadEffect(ResourceLocation.withDefaultNamespace("shaders/post/spider.json"));
|
||||
@@ -310,6 +_,8 @@
|
||||
this.loadEffect(new ResourceLocation("shaders/post/spider.json"));
|
||||
} else if (p_109107_ instanceof EnderMan) {
|
||||
this.loadEffect(ResourceLocation.withDefaultNamespace("shaders/post/invert.json"));
|
||||
this.loadEffect(new ResourceLocation("shaders/post/invert.json"));
|
||||
+ } else {
|
||||
+ net.minecraftforge.client.ForgeHooksClient.loadEntityShader(p_109107_, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -526,6 +_,7 @@
|
||||
@@ -532,6 +_,7 @@
|
||||
Pair.of(new ShaderInstance(p_250719_, "rendertype_gui_ghost_recipe_overlay", DefaultVertexFormat.POSITION_COLOR), p_286147_ -> rendertypeGuiGhostRecipeOverlayShader = p_286147_)
|
||||
);
|
||||
list1.add(Pair.of(new ShaderInstance(p_250719_, "rendertype_breeze_wind", DefaultVertexFormat.NEW_ENTITY), p_308287_ -> rendertypeBreezeWindShader = p_308287_));
|
||||
@@ -17,7 +17,7 @@
|
||||
this.loadBlurEffect(p_250719_);
|
||||
} catch (IOException ioexception) {
|
||||
list1.forEach(p_172729_ -> p_172729_.getFirst().close());
|
||||
@@ -685,7 +_,7 @@
|
||||
@@ -691,7 +_,7 @@
|
||||
d0 *= Mth.lerp(this.minecraft.options.fovEffectScale().get(), 1.0, 0.85714287F);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -843,12 +_,12 @@
|
||||
@@ -850,12 +_,12 @@
|
||||
(float)((double)window.getHeight() / window.getGuiScale()),
|
||||
0.0F,
|
||||
1000.0F,
|
||||
@@ -41,28 +41,29 @@
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
Lighting.setupFor3DItems();
|
||||
GuiGraphics guigraphics = new GuiGraphics(this.minecraft, this.renderBuffers.bufferSource());
|
||||
@@ -882,7 +_,7 @@
|
||||
@@ -889,7 +_,7 @@
|
||||
}
|
||||
} else if (flag && this.minecraft.screen != null) {
|
||||
try {
|
||||
- this.minecraft.screen.renderWithTooltip(guigraphics, i, j, p_343467_.getRealtimeDeltaTicks());
|
||||
+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.minecraft.screen, guigraphics, i, j, p_343467_.getRealtimeDeltaTicks());
|
||||
- this.minecraft.screen.renderWithTooltip(guigraphics, i, j, this.minecraft.getDeltaFrameTime());
|
||||
+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.minecraft.screen, guigraphics, i, j, this.minecraft.getDeltaFrameTime());
|
||||
} catch (Throwable throwable1) {
|
||||
CrashReport crashreport1 = CrashReport.forThrowable(throwable1, "Rendering screen");
|
||||
CrashReportCategory crashreportcategory1 = crashreport1.addCategory("Screen render details");
|
||||
@@ -1053,12 +_,17 @@
|
||||
@@ -1064,12 +_,17 @@
|
||||
}
|
||||
|
||||
this.resetProjectionMatrix(matrix4f);
|
||||
+
|
||||
+ var cameraSetup = net.minecraftforge.client.event.ForgeEventFactoryClient.fireComputeCameraAngles(this, camera, f);
|
||||
+ camera.setRotation(cameraSetup.getYaw(), cameraSetup.getPitch(), cameraSetup.getRoll());
|
||||
Quaternionf quaternionf = camera.rotation().conjugate(new Quaternionf());
|
||||
Matrix4f matrix4f1 = new Matrix4f().rotation(quaternionf);
|
||||
+ var cameraSetup = net.minecraftforge.client.event.ForgeEventFactoryClient.fireComputeCameraAngles(this, camera, p_109090_);
|
||||
+ camera.setAnglesInternal(cameraSetup.getYaw(), cameraSetup.getPitch());
|
||||
Matrix4f matrix4f1 = new Matrix4f()
|
||||
- .rotationXYZ(camera.getXRot() * (float) (Math.PI / 180.0), camera.getYRot() * (float) (Math.PI / 180.0) + (float) Math.PI, 0.0F);
|
||||
+ .rotationXYZ(camera.getXRot() * (float) (Math.PI / 180.0), camera.getYRot() * (float) (Math.PI / 180.0) + (float) Math.PI, cameraSetup.getRoll() * (float) (Math.PI / 180.0));
|
||||
this.minecraft
|
||||
.levelRenderer
|
||||
.prepareCullFrustum(camera.getPosition(), matrix4f1, this.getProjectionMatrix(Math.max(d0, (double)this.minecraft.options.fov().get().intValue())));
|
||||
this.minecraft.levelRenderer.renderLevel(p_342230_, flag, camera, this, this.lightTexture, matrix4f1, matrix4f);
|
||||
this.minecraft.levelRenderer.renderLevel(p_109090_, p_109091_, flag, camera, this, this.lightTexture, matrix4f1, matrix4f);
|
||||
+ this.minecraft.getProfiler().popPush("forge_render_last");
|
||||
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_LEVEL.dispatch(this.minecraft.levelRenderer, posestack.last().pose(), matrix4f, this.minecraft.levelRenderer.getTicks(), camera, this.minecraft.levelRenderer.getFrustum());
|
||||
this.minecraft.getProfiler().popPush("hand");
|
||||
|
||||
@@ -5,18 +5,18 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ItemBlockRenderTypes {
|
||||
+ @Deprecated
|
||||
private static final Map<Block, RenderType> TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_340896_ -> {
|
||||
private static final Map<Block, RenderType> TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_325496_ -> {
|
||||
RenderType rendertype = RenderType.tripwire();
|
||||
p_340896_.put(Blocks.TRIPWIRE, rendertype);
|
||||
@@ -335,6 +_,7 @@
|
||||
p_340896_.put(Blocks.BUBBLE_COLUMN, rendertype3);
|
||||
p_340896_.put(Blocks.TINTED_GLASS, rendertype3);
|
||||
p_325496_.put(Blocks.TRIPWIRE, rendertype);
|
||||
@@ -336,6 +_,7 @@
|
||||
p_325496_.put(Blocks.BUBBLE_COLUMN, rendertype3);
|
||||
p_325496_.put(Blocks.TINTED_GLASS, rendertype3);
|
||||
});
|
||||
+ @Deprecated
|
||||
private static final Map<Fluid, RenderType> TYPE_BY_FLUID = Util.make(Maps.newHashMap(), p_109290_ -> {
|
||||
RenderType rendertype = RenderType.translucent();
|
||||
p_109290_.put(Fluids.FLOWING_WATER, rendertype);
|
||||
@@ -342,6 +_,8 @@
|
||||
@@ -343,6 +_,8 @@
|
||||
});
|
||||
private static boolean renderCutout;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
public static RenderType getChunkRenderType(BlockState p_109283_) {
|
||||
Block block = p_109283_.getBlock();
|
||||
if (block instanceof LeavesBlock) {
|
||||
@@ -352,6 +_,8 @@
|
||||
@@ -353,6 +_,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
public static RenderType getMovingBlockRenderType(BlockState p_109294_) {
|
||||
Block block = p_109294_.getBlock();
|
||||
if (block instanceof LeavesBlock) {
|
||||
@@ -366,6 +_,8 @@
|
||||
@@ -367,6 +_,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
public static RenderType getRenderType(BlockState p_109285_, boolean p_109286_) {
|
||||
RenderType rendertype = getChunkRenderType(p_109285_);
|
||||
if (rendertype == RenderType.translucent()) {
|
||||
@@ -379,6 +_,8 @@
|
||||
@@ -380,6 +_,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
public static RenderType getRenderType(ItemStack p_109280_, boolean p_109281_) {
|
||||
Item item = p_109280_.getItem();
|
||||
if (item instanceof BlockItem) {
|
||||
@@ -390,11 +_,74 @@
|
||||
@@ -391,11 +_,79 @@
|
||||
}
|
||||
|
||||
public static RenderType getRenderLayer(FluidState p_109288_) {
|
||||
@@ -65,6 +65,11 @@
|
||||
renderCutout = p_109292_;
|
||||
+ }
|
||||
+
|
||||
+ /** Forge: Check if we are running in {@linkplain net.minecraft.client.Minecraft#useFancyGraphics() fancy graphics} to account for fast graphics render types */
|
||||
+ public static boolean isFancy() {
|
||||
+ return renderCutout;
|
||||
+ }
|
||||
+
|
||||
+ private static final net.minecraftforge.client.ChunkRenderTypeSet CUTOUT_MIPPED = net.minecraftforge.client.ChunkRenderTypeSet.of(RenderType.cutoutMipped());
|
||||
+ private static final net.minecraftforge.client.ChunkRenderTypeSet SOLID = net.minecraftforge.client.ChunkRenderTypeSet.of(RenderType.solid());
|
||||
+ private static final Map<net.minecraft.core.Holder.Reference<Block>, net.minecraftforge.client.ChunkRenderTypeSet> BLOCK_RENDER_TYPES = Util.make(new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(TYPE_BY_BLOCK.size(), 0.5F), map -> {
|
||||
@@ -81,7 +86,7 @@
|
||||
+ });
|
||||
+
|
||||
+ /** @deprecated Use {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)}. */
|
||||
+ @Deprecated(since = "1.19")
|
||||
+ @Deprecated(since = "1.21.4", forRemoval = true)
|
||||
+ public static net.minecraftforge.client.ChunkRenderTypeSet getRenderLayers(BlockState state) {
|
||||
+ Block block = state.getBlock();
|
||||
+ if (block instanceof LeavesBlock) {
|
||||
@@ -92,20 +97,20 @@
|
||||
+ }
|
||||
+
|
||||
+ /** @deprecated Set your render type in your block model's JSON (eg. {@code "render_type": "cutout"}) or override {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)} */
|
||||
+ @Deprecated(since = "1.19")
|
||||
+ @Deprecated(since = "1.21.4", forRemoval = true)
|
||||
+ public static void setRenderLayer(Block block, RenderType type) {
|
||||
+ com.google.common.base.Preconditions.checkArgument(type.getChunkLayerId() >= 0, "The argument must be a valid chunk render type returned by RenderType#chunkBufferLayers().");
|
||||
+ setRenderLayer(block, net.minecraftforge.client.ChunkRenderTypeSet.of(type));
|
||||
+ }
|
||||
+
|
||||
+ /** @deprecated Set your render type in your block model's JSON (eg. {@code "render_type": "cutout"}) or override {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)} */
|
||||
+ @Deprecated(since = "1.19")
|
||||
+ @Deprecated(since = "1.21.4", forRemoval = true)
|
||||
+ public static synchronized void setRenderLayer(Block block, java.util.function.Predicate<RenderType> predicate) {
|
||||
+ setRenderLayer(block, createSetFromPredicate(predicate));
|
||||
+ }
|
||||
+
|
||||
+ /** @deprecated Set your render type in your block model's JSON (eg. {@code "render_type": "cutout"}) or override {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)} */
|
||||
+ @Deprecated(since = "1.19")
|
||||
+ @Deprecated(since = "1.21.4", forRemoval = true)
|
||||
+ public static synchronized void setRenderLayer(Block block, net.minecraftforge.client.ChunkRenderTypeSet layers) {
|
||||
+ checkClientLoading();
|
||||
+ BLOCK_RENDER_TYPES.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), layers);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/ItemInHandRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/ItemInHandRenderer.java
|
||||
@@ -332,12 +_,14 @@
|
||||
@@ -331,12 +_,14 @@
|
||||
if (iteminhandrenderer$handrenderselection.renderMainHand) {
|
||||
float f4 = interactionhand == InteractionHand.MAIN_HAND ? f : 0.0F;
|
||||
float f5 = 1.0F - Mth.lerp(p_109315_, this.oMainHandHeight, this.mainHandHeight);
|
||||
@@ -15,7 +15,7 @@
|
||||
this.renderArmWithItem(p_109318_, p_109315_, f1, InteractionHand.OFF_HAND, f6, this.offHandItem, f7, p_109316_, p_109317_, p_109319_);
|
||||
}
|
||||
|
||||
@@ -403,7 +_,7 @@
|
||||
@@ -402,7 +_,7 @@
|
||||
} else {
|
||||
this.renderOneHandedMap(p_109379_, p_109380_, p_109381_, p_109378_, humanoidarm, p_109376_, p_109377_);
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
boolean flag1 = CrossbowItem.isCharged(p_109377_);
|
||||
boolean flag2 = humanoidarm == HumanoidArm.RIGHT;
|
||||
int i = flag2 ? 1 : -1;
|
||||
@@ -453,6 +_,7 @@
|
||||
@@ -452,6 +_,7 @@
|
||||
);
|
||||
} else {
|
||||
boolean flag3 = humanoidarm == HumanoidArm.RIGHT;
|
||||
@@ -32,7 +32,7 @@
|
||||
if (p_109372_.isUsingItem() && p_109372_.getUseItemRemainingTicks() > 0 && p_109372_.getUsedItemHand() == p_109375_) {
|
||||
int k = flag3 ? 1 : -1;
|
||||
switch (p_109377_.getUseAnimation()) {
|
||||
@@ -567,8 +_,16 @@
|
||||
@@ -566,8 +_,16 @@
|
||||
this.offHandHeight = Mth.clamp(this.offHandHeight - 0.4F, 0.0F, 1.0F);
|
||||
} else {
|
||||
float f = localplayer.getAttackStrengthScale(1.0F);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/LevelRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/LevelRenderer.java
|
||||
@@ -256,6 +_,9 @@
|
||||
@@ -251,6 +_,9 @@
|
||||
}
|
||||
|
||||
private void renderSnowAndRain(LightTexture p_109704_, float p_109705_, double p_109706_, double p_109707_, double p_109708_) {
|
||||
@@ -10,7 +10,7 @@
|
||||
float f = this.minecraft.level.getRainLevel(p_109705_);
|
||||
if (!(f <= 0.0F)) {
|
||||
p_109704_.turnOnLightLayer();
|
||||
@@ -418,6 +_,9 @@
|
||||
@@ -405,6 +_,9 @@
|
||||
}
|
||||
|
||||
public void tickRain(Camera p_109694_) {
|
||||
@@ -20,11 +20,11 @@
|
||||
float f = this.minecraft.level.getRainLevel(1.0F) / (Minecraft.useFancyGraphics() ? 1.0F : 2.0F);
|
||||
if (!(f <= 0.0F)) {
|
||||
RandomSource randomsource = RandomSource.create((long)this.ticks * 312987231L);
|
||||
@@ -929,9 +_,11 @@
|
||||
@@ -956,9 +_,11 @@
|
||||
RenderSystem.clear(16640, Minecraft.ON_OSX);
|
||||
float f1 = p_109605_.getRenderDistance();
|
||||
boolean flag1 = this.minecraft.level.effects().isFoggyAt(Mth.floor(d0), Mth.floor(d1)) || this.minecraft.gui.getBossOverlay().shouldCreateWorldFog();
|
||||
+ FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f1, flag1, f);
|
||||
+ FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag1, p_109601_);
|
||||
profilerfiller.popPush("sky");
|
||||
RenderSystem.setShader(GameRenderer::getPositionShader);
|
||||
this.renderSky(p_254120_, p_330527_, f, p_109604_, flag1, () -> FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f1, flag1, f));
|
||||
@@ -32,7 +32,7 @@
|
||||
profilerfiller.popPush("fog");
|
||||
FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_TERRAIN, Math.max(f1, 32.0F), flag1, f);
|
||||
profilerfiller.popPush("terrain_setup");
|
||||
@@ -940,7 +_,9 @@
|
||||
@@ -967,7 +_,9 @@
|
||||
this.compileSections(p_109604_);
|
||||
profilerfiller.popPush("terrain");
|
||||
this.renderSectionLayer(RenderType.solid(), d0, d1, d2, p_254120_, p_330527_);
|
||||
@@ -42,7 +42,7 @@
|
||||
this.renderSectionLayer(RenderType.cutout(), d0, d1, d2, p_254120_, p_330527_);
|
||||
if (this.level.effects().constantAmbientLight()) {
|
||||
Lighting.setupNetherLevel();
|
||||
@@ -983,7 +_,7 @@
|
||||
@@ -1010,7 +_,7 @@
|
||||
|| p_109604_.isDetached()
|
||||
|| p_109604_.getEntity() instanceof LivingEntity && ((LivingEntity)p_109604_.getEntity()).isSleeping()
|
||||
)
|
||||
@@ -51,7 +51,7 @@
|
||||
this.renderedEntities++;
|
||||
if (entity.tickCount == 0) {
|
||||
entity.xOld = entity.getX();
|
||||
@@ -999,6 +_,9 @@
|
||||
@@ -1026,6 +_,9 @@
|
||||
int i = entity.getTeamColor();
|
||||
outlinebuffersource.setColor(FastColor.ARGB32.red(i), FastColor.ARGB32.green(i), FastColor.ARGB32.blue(i), 255);
|
||||
} else {
|
||||
@@ -61,7 +61,7 @@
|
||||
multibuffersource = multibuffersource$buffersource;
|
||||
}
|
||||
|
||||
@@ -1014,12 +_,14 @@
|
||||
@@ -1041,12 +_,14 @@
|
||||
multibuffersource$buffersource.endBatch(RenderType.entityCutout(TextureAtlas.LOCATION_BLOCKS));
|
||||
multibuffersource$buffersource.endBatch(RenderType.entityCutoutNoCull(TextureAtlas.LOCATION_BLOCKS));
|
||||
multibuffersource$buffersource.endBatch(RenderType.entitySmoothCutout(TextureAtlas.LOCATION_BLOCKS));
|
||||
@@ -76,7 +76,7 @@
|
||||
BlockPos blockpos4 = blockentity1.getBlockPos();
|
||||
MultiBufferSource multibuffersource1 = multibuffersource$buffersource;
|
||||
posestack.pushPose();
|
||||
@@ -1039,6 +_,10 @@
|
||||
@@ -1066,6 +_,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
this.blockEntityRenderDispatcher.render(blockentity1, f, posestack, multibuffersource1);
|
||||
posestack.popPose();
|
||||
}
|
||||
@@ -1047,9 +_,13 @@
|
||||
@@ -1074,9 +_,13 @@
|
||||
|
||||
synchronized (this.globalBlockEntities) {
|
||||
for (BlockEntity blockentity : this.globalBlockEntities) {
|
||||
@@ -101,7 +101,7 @@
|
||||
this.blockEntityRenderDispatcher.render(blockentity, f, posestack, multibuffersource$buffersource);
|
||||
posestack.popPose();
|
||||
}
|
||||
@@ -1072,6 +_,7 @@
|
||||
@@ -1099,6 +_,7 @@
|
||||
this.minecraft.getMainRenderTarget().bindWrite(false);
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
profilerfiller.popPush("destroyProgress");
|
||||
|
||||
for (Entry<SortedSet<BlockDestructionProgress>> entry : this.destructionProgress.long2ObjectEntrySet()) {
|
||||
@@ -1089,7 +_,8 @@
|
||||
@@ -1116,7 +_,8 @@
|
||||
VertexConsumer vertexconsumer1 = new SheetedDecalTextureGenerator(
|
||||
this.renderBuffers.crumblingBufferSource().getBuffer(ModelBakery.DESTROY_TYPES.get(k)), posestack$pose1, 1.0F
|
||||
);
|
||||
@@ -119,49 +119,49 @@
|
||||
posestack.popPose();
|
||||
}
|
||||
}
|
||||
@@ -1101,10 +_,13 @@
|
||||
@@ -1128,10 +_,13 @@
|
||||
profilerfiller.popPush("outline");
|
||||
BlockPos blockpos1 = ((BlockHitResult)hitresult).getBlockPos();
|
||||
BlockState blockstate = this.level.getBlockState(blockpos1);
|
||||
+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawHighlight(this, p_109604_, hitresult, f, posestack, multibuffersource$buffersource))
|
||||
+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawHighlight(this, p_109604_, hitresult, p_109601_, posestack, multibuffersource$buffersource))
|
||||
if (!blockstate.isAir() && this.level.getWorldBorder().isWithinBounds(blockpos1)) {
|
||||
VertexConsumer vertexconsumer2 = multibuffersource$buffersource.getBuffer(RenderType.lines());
|
||||
this.renderHitOutline(posestack, vertexconsumer2, p_109604_.getEntity(), d0, d1, d2, blockpos1, blockstate);
|
||||
}
|
||||
+ } else if (hitresult != null && hitresult.getType() == HitResult.Type.ENTITY) {
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onDrawHighlight(this, p_109604_, hitresult, f, posestack, multibuffersource$buffersource);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onDrawHighlight(this, p_109604_, hitresult, p_109601_, posestack, multibuffersource$buffersource);
|
||||
}
|
||||
|
||||
this.minecraft.debugRenderer.render(posestack, multibuffersource$buffersource, d0, d1, d2);
|
||||
@@ -1132,7 +_,8 @@
|
||||
@@ -1161,7 +_,8 @@
|
||||
this.particlesTarget.copyDepthFrom(this.minecraft.getMainRenderTarget());
|
||||
RenderStateShard.PARTICLES_TARGET.setupRenderState();
|
||||
profilerfiller.popPush("particles");
|
||||
- this.minecraft.particleEngine.render(p_109606_, p_109604_, f);
|
||||
+ this.minecraft.particleEngine.render(p_109606_, p_109604_, f, frustum);
|
||||
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES.dispatch(this, posestack.last().pose(), p_254120_, this.ticks, p_109604_, frustum);
|
||||
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES.dispatch(this, p_254120_, p_254120_, this.ticks, p_109604_, frustum);
|
||||
RenderStateShard.PARTICLES_TARGET.clearRenderState();
|
||||
} else {
|
||||
profilerfiller.popPush("translucent");
|
||||
@@ -1146,7 +_,8 @@
|
||||
@@ -1175,7 +_,8 @@
|
||||
profilerfiller.popPush("string");
|
||||
this.renderSectionLayer(RenderType.tripwire(), d0, d1, d2, p_254120_, p_330527_);
|
||||
profilerfiller.popPush("particles");
|
||||
- this.minecraft.particleEngine.render(p_109606_, p_109604_, f);
|
||||
+ this.minecraft.particleEngine.render(p_109606_, p_109604_, f, frustum);
|
||||
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES.dispatch(this, posestack.last().pose(), p_254120_, this.ticks, p_109604_, frustum);
|
||||
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES.dispatch(this, p_254120_, p_254120_, this.ticks, p_109604_, frustum);
|
||||
}
|
||||
|
||||
if (this.minecraft.options.getCloudsType() != CloudStatus.OFF) {
|
||||
@@ -1162,6 +_,7 @@
|
||||
@@ -1191,6 +_,7 @@
|
||||
RenderStateShard.WEATHER_TARGET.setupRenderState();
|
||||
profilerfiller.popPush("weather");
|
||||
this.renderSnowAndRain(p_109606_, f, d0, d1, d2);
|
||||
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_WEATHER.dispatch(this, posestack.last().pose(), p_254120_, this.ticks, p_109604_, frustum);
|
||||
this.renderWorldBorder(p_109604_);
|
||||
RenderStateShard.WEATHER_TARGET.clearRenderState();
|
||||
this.transparencyChain.process(p_342180_.getGameTimeDeltaTicks());
|
||||
@@ -1170,6 +_,7 @@
|
||||
this.transparencyChain.process(f);
|
||||
@@ -1199,6 +_,7 @@
|
||||
RenderSystem.depthMask(false);
|
||||
profilerfiller.popPush("weather");
|
||||
this.renderSnowAndRain(p_109606_, f, d0, d1, d2);
|
||||
@@ -169,7 +169,7 @@
|
||||
this.renderWorldBorder(p_109604_);
|
||||
RenderSystem.depthMask(true);
|
||||
}
|
||||
@@ -1269,6 +_,7 @@
|
||||
@@ -1344,6 +_,7 @@
|
||||
shaderinstance.clear();
|
||||
VertexBuffer.unbind();
|
||||
this.minecraft.getProfiler().pop();
|
||||
@@ -177,7 +177,7 @@
|
||||
p_298012_.clearRenderState();
|
||||
}
|
||||
|
||||
@@ -1519,6 +_,9 @@
|
||||
@@ -1604,6 +_,9 @@
|
||||
}
|
||||
|
||||
public void renderSky(Matrix4f p_254034_, Matrix4f p_333200_, float p_202426_, Camera p_202427_, boolean p_202428_, Runnable p_202429_) {
|
||||
@@ -187,7 +187,7 @@
|
||||
p_202429_.run();
|
||||
if (!p_202428_) {
|
||||
FogType fogtype = p_202427_.getFluidInCamera();
|
||||
@@ -1642,6 +_,9 @@
|
||||
@@ -1728,6 +_,9 @@
|
||||
}
|
||||
|
||||
public void renderClouds(PoseStack p_254145_, Matrix4f p_254537_, Matrix4f p_330176_, float p_254364_, double p_253843_, double p_253663_, double p_253795_) {
|
||||
@@ -197,7 +197,7 @@
|
||||
float f = this.level.effects().getCloudHeight();
|
||||
if (!Float.isNaN(f)) {
|
||||
float f1 = 12.0F;
|
||||
@@ -1901,7 +_,7 @@
|
||||
@@ -2017,7 +_,7 @@
|
||||
boolean flag = false;
|
||||
if (this.minecraft.options.prioritizeChunkUpdates().get() == PrioritizeChunkUpdates.NEARBY) {
|
||||
BlockPos blockpos1 = sectionrenderdispatcher$rendersection.getOrigin().offset(8, 8, 8);
|
||||
@@ -206,7 +206,7 @@
|
||||
} else if (this.minecraft.options.prioritizeChunkUpdates().get() == PrioritizeChunkUpdates.PLAYER_AFFECTED) {
|
||||
flag = sectionrenderdispatcher$rendersection.isDirtyFromPlayer();
|
||||
}
|
||||
@@ -2477,6 +_,14 @@
|
||||
@@ -2609,7 +_,23 @@
|
||||
this.viewArea.setDirty(p_109502_, p_109503_, p_109504_, p_109505_);
|
||||
}
|
||||
|
||||
@@ -218,10 +218,37 @@
|
||||
+ return this.ticks;
|
||||
+ }
|
||||
+
|
||||
public void playJukeboxSong(Holder<JukeboxSong> p_343944_, BlockPos p_342259_) {
|
||||
if (this.level != null) {
|
||||
this.stopJukeboxSong(p_342259_);
|
||||
@@ -2886,7 +_,7 @@
|
||||
+ /**
|
||||
+ * @deprecated Forge: Use item aware function below
|
||||
+ */
|
||||
+ @Deprecated
|
||||
public void playStreamingMusic(@Nullable SoundEvent p_109515_, BlockPos p_109516_) {
|
||||
+ this.playStreamingMusic(p_109515_, p_109516_, p_109515_ == null? null : RecordItem.getBySound(p_109515_));
|
||||
+ }
|
||||
+
|
||||
+ public void playStreamingMusic(@Nullable SoundEvent p_109515_, BlockPos p_109516_, @Nullable RecordItem musicDiscItem) {
|
||||
SoundInstance soundinstance = this.playingRecords.get(p_109516_);
|
||||
if (soundinstance != null) {
|
||||
this.minecraft.getSoundManager().stop(soundinstance);
|
||||
@@ -2617,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (p_109515_ != null) {
|
||||
- RecordItem recorditem = RecordItem.getBySound(p_109515_);
|
||||
+ RecordItem recorditem = musicDiscItem;
|
||||
if (recorditem != null) {
|
||||
this.minecraft.gui.setNowPlaying(recorditem.getDisplayName());
|
||||
}
|
||||
@@ -2809,7 +_,7 @@
|
||||
break;
|
||||
case 1010:
|
||||
if (Item.byId(p_234307_) instanceof RecordItem recorditem) {
|
||||
- this.playStreamingMusic(recorditem.getSound(), p_234306_);
|
||||
+ this.playStreamingMusic(recorditem.getSound(), p_234306_, recorditem);
|
||||
}
|
||||
break;
|
||||
case 1011:
|
||||
@@ -3011,7 +_,7 @@
|
||||
case 2001:
|
||||
BlockState blockstate1 = Block.stateById(p_234307_);
|
||||
if (!blockstate1.isAir()) {
|
||||
@@ -230,7 +257,7 @@
|
||||
this.level
|
||||
.playLocalSound(
|
||||
p_234306_, soundtype.getBreakSound(), SoundSource.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F, false
|
||||
@@ -3338,7 +_,7 @@
|
||||
@@ -3466,7 +_,7 @@
|
||||
} else {
|
||||
int i = p_109538_.getBrightness(LightLayer.SKY, p_109540_);
|
||||
int j = p_109538_.getBrightness(LightLayer.BLOCK, p_109540_);
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
--- a/net/minecraft/client/renderer/PostChain.java
|
||||
+++ b/net/minecraft/client/renderer/PostChain.java
|
||||
@@ -156,7 +_,7 @@
|
||||
@@ -156,7 +_,8 @@
|
||||
throw new ChainedJsonException("Render target '" + s4 + "' can't be used as depth buffer");
|
||||
}
|
||||
|
||||
- ResourceLocation resourcelocation = ResourceLocation.withDefaultNamespace("textures/effect/" + s4 + ".png");
|
||||
+ ResourceLocation resourcelocation = ResourceLocation.tryParse(s4).withPath(p -> "textures/effect/" + p + ".png");
|
||||
- ResourceLocation resourcelocation = new ResourceLocation("textures/effect/" + s4 + ".png");
|
||||
+ ResourceLocation rl = ResourceLocation.tryParse(s4);
|
||||
+ ResourceLocation resourcelocation = new ResourceLocation(rl.getNamespace(), "textures/effect/" + rl.getPath() + ".png");
|
||||
this.resourceProvider
|
||||
.getResource(resourcelocation)
|
||||
.orElseThrow(() -> new ChainedJsonException("Render target or texture '" + s4 + "' does not exist"));
|
||||
|
||||
@@ -1,29 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/RenderType.java
|
||||
+++ b/net/minecraft/client/renderer/RenderType.java
|
||||
@@ -674,11 +_,22 @@
|
||||
RenderType.CompositeState.builder().setShaderState(RENDERTYPE_GUI_GHOST_RECIPE_OVERLAY_SHADER).setTransparencyState(TRANSLUCENT_TRANSPARENCY).setDepthTestState(GREATER_DEPTH_TEST).setWriteMaskState(COLOR_WRITE).createCompositeState(false)
|
||||
);
|
||||
private static final ImmutableList<RenderType> CHUNK_BUFFER_LAYERS = ImmutableList.of(solid(), cutoutMipped(), cutout(), translucent(), tripwire());
|
||||
+ static {
|
||||
+ int i = 0;
|
||||
+ for (var layer : CHUNK_BUFFER_LAYERS)
|
||||
+ layer.chunkLayerId = i++;
|
||||
+ }
|
||||
+
|
||||
private final VertexFormat format;
|
||||
private final VertexFormat.Mode mode;
|
||||
private final int bufferSize;
|
||||
private final boolean affectsCrumbling;
|
||||
private final boolean sortOnUpload;
|
||||
+ private int chunkLayerId = -1;
|
||||
+ /** {@return the unique ID of this {@link RenderType} for chunk rendering purposes, or {@literal -1} if this is not a chunk {@link RenderType}} */
|
||||
+ public final int getChunkLayerId() {
|
||||
+ return chunkLayerId;
|
||||
+ }
|
||||
|
||||
public static RenderType solid() {
|
||||
return SOLID;
|
||||
@@ -899,7 +_,7 @@
|
||||
@@ -907,7 +_,7 @@
|
||||
}
|
||||
|
||||
public static RenderType text(ResourceLocation p_110498_) {
|
||||
@@ -32,7 +9,7 @@
|
||||
}
|
||||
|
||||
public static RenderType textBackground() {
|
||||
@@ -907,19 +_,19 @@
|
||||
@@ -915,19 +_,19 @@
|
||||
}
|
||||
|
||||
public static RenderType textIntensity(ResourceLocation p_173238_) {
|
||||
@@ -56,7 +33,7 @@
|
||||
}
|
||||
|
||||
public static RenderType textBackgroundSeeThrough() {
|
||||
@@ -927,7 +_,7 @@
|
||||
@@ -935,12 +_,25 @@
|
||||
}
|
||||
|
||||
public static RenderType textIntensitySeeThrough(ResourceLocation p_173241_) {
|
||||
@@ -65,3 +42,21 @@
|
||||
}
|
||||
|
||||
public static RenderType lightning() {
|
||||
return LIGHTNING;
|
||||
}
|
||||
+
|
||||
+ // Forge start
|
||||
+ private int chunkLayerId = -1;
|
||||
+ /** {@return the unique ID of this {@link RenderType} for chunk rendering purposes, or {@literal -1} if this is not a chunk {@link RenderType}} */
|
||||
+ public final int getChunkLayerId() {
|
||||
+ return chunkLayerId;
|
||||
+ }
|
||||
+ static {
|
||||
+ int i = 0;
|
||||
+ for (var layer : chunkBufferLayers())
|
||||
+ layer.chunkLayerId = i++;
|
||||
+ }
|
||||
+ // Forge end
|
||||
|
||||
private static RenderType.CompositeState tripwireState() {
|
||||
return RenderType.CompositeState.builder()
|
||||
@@ -49,7 +49,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,8 +_,12 @@
|
||||
@@ -89,8 +_,12 @@
|
||||
}
|
||||
|
||||
private static void renderWater(Minecraft p_110726_, PoseStack p_110727_) {
|
||||
@@ -60,6 +60,6 @@
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
- RenderSystem.setShaderTexture(0, UNDERWATER_LOCATION);
|
||||
+ RenderSystem.setShaderTexture(0, texture);
|
||||
BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder();
|
||||
BlockPos blockpos = BlockPos.containing(p_110726_.player.getX(), p_110726_.player.getEyeY(), p_110726_.player.getZ());
|
||||
float f = LightTexture.getBrightness(p_110726_.player.level().dimensionType(), p_110726_.player.level().getMaxLocalRawBrightness(blockpos));
|
||||
RenderSystem.enableBlend();
|
||||
@@ -7,30 +7,31 @@
|
||||
+ @Deprecated // Forge: Use the ResourceLocation variant below
|
||||
public ShaderInstance(ResourceProvider p_173336_, String p_173337_, VertexFormat p_173338_) throws IOException {
|
||||
- this.name = p_173337_;
|
||||
+ this(p_173336_, ResourceLocation.parse(p_173337_), p_173338_);
|
||||
+ this(p_173336_, new ResourceLocation(p_173337_), p_173338_);
|
||||
+ }
|
||||
+
|
||||
+ public ShaderInstance(ResourceProvider p_173336_, ResourceLocation shaderLocation, VertexFormat p_173338_) throws IOException {
|
||||
+ this.name = shaderLocation.getNamespace().equals("minecraft") ? shaderLocation.getPath() : shaderLocation.toString();
|
||||
this.vertexFormat = p_173338_;
|
||||
- ResourceLocation resourcelocation = ResourceLocation.withDefaultNamespace("shaders/core/" + p_173337_ + ".json");
|
||||
+ ResourceLocation resourcelocation = shaderLocation.withPath(p -> "shaders/core/" + p + ".json");
|
||||
- ResourceLocation resourcelocation = new ResourceLocation("shaders/core/" + p_173337_ + ".json");
|
||||
+ ResourceLocation resourcelocation = new ResourceLocation(shaderLocation.getNamespace(), "shaders/core/" + shaderLocation.getPath() + ".json");
|
||||
|
||||
try (Reader reader = p_173336_.openAsReader(resourcelocation)) {
|
||||
JsonObject jsonobject = GsonHelper.parse(reader);
|
||||
@@ -177,8 +_,9 @@
|
||||
@@ -178,8 +_,10 @@
|
||||
Program program1 = p_173342_.getPrograms().get(p_173343_);
|
||||
Program program;
|
||||
if (program1 == null) {
|
||||
- String s = "shaders/core/" + p_173343_ + p_173342_.getExtension();
|
||||
- Resource resource = p_173341_.getResourceOrThrow(ResourceLocation.withDefaultNamespace(s));
|
||||
+ ResourceLocation resourcelocation = ResourceLocation.parse(p_173343_).withPath(p -> "shaders/core/" + p + p_173342_.getExtension());
|
||||
+ String s = resourcelocation.getPath();
|
||||
- Resource resource = p_173341_.getResourceOrThrow(new ResourceLocation(s));
|
||||
+ ResourceLocation loc = new ResourceLocation(p_173343_);
|
||||
+ String s = "shaders/core/" + loc.getPath() + p_173342_.getExtension();
|
||||
+ ResourceLocation resourcelocation = new ResourceLocation(loc.getNamespace(), s);
|
||||
+ Resource resource = p_173341_.getResourceOrThrow(resourcelocation);
|
||||
|
||||
try (InputStream inputstream = resource.open()) {
|
||||
final String s1 = FileUtil.getFullResourcePath(s);
|
||||
@@ -187,12 +_,11 @@
|
||||
@@ -188,12 +_,11 @@
|
||||
|
||||
@Override
|
||||
public String applyImport(boolean p_173374_, String p_173375_) {
|
||||
@@ -41,12 +42,12 @@
|
||||
+ if (!this.importedPaths.add(resourcelocation.toString())) {
|
||||
return null;
|
||||
} else {
|
||||
- ResourceLocation resourcelocation = ResourceLocation.parse(p_173375_);
|
||||
- ResourceLocation resourcelocation = new ResourceLocation(p_173375_);
|
||||
-
|
||||
try {
|
||||
String s2;
|
||||
try (Reader reader = p_173341_.openAsReader(resourcelocation)) {
|
||||
@@ -201,7 +_,8 @@
|
||||
@@ -202,7 +_,8 @@
|
||||
|
||||
return s2;
|
||||
} catch (IOException ioexception) {
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
--- a/net/minecraft/client/renderer/Sheets.java
|
||||
+++ b/net/minecraft/client/renderer/Sheets.java
|
||||
@@ -145,11 +_,11 @@
|
||||
@@ -144,11 +_,13 @@
|
||||
}
|
||||
|
||||
private static Material createSignMaterial(WoodType p_173386_) {
|
||||
- return new Material(SIGN_SHEET, ResourceLocation.withDefaultNamespace("entity/signs/" + p_173386_.name()));
|
||||
+ return new Material(SIGN_SHEET, ResourceLocation.parse(p_173386_.name()).withPrefix("entity/signs/"));
|
||||
- return new Material(SIGN_SHEET, new ResourceLocation("entity/signs/" + p_173386_.name()));
|
||||
+ ResourceLocation location = new ResourceLocation(p_173386_.name());
|
||||
+ return new Material(SIGN_SHEET, new ResourceLocation(location.getNamespace(), "entity/signs/" + location.getPath()));
|
||||
}
|
||||
|
||||
private static Material createHangingSignMaterial(WoodType p_251735_) {
|
||||
- return new Material(SIGN_SHEET, ResourceLocation.withDefaultNamespace("entity/signs/hanging/" + p_251735_.name()));
|
||||
+ return new Material(SIGN_SHEET, ResourceLocation.parse(p_251735_.name()).withPrefix("entity/signs/hanging/"));
|
||||
- return new Material(SIGN_SHEET, new ResourceLocation("entity/signs/hanging/" + p_251735_.name()));
|
||||
+ ResourceLocation location = new ResourceLocation(p_251735_.name());
|
||||
+ return new Material(SIGN_SHEET, new ResourceLocation(location.getNamespace(), "entity/signs/hanging/" + location.getPath()));
|
||||
}
|
||||
|
||||
public static Material getSignMaterial(WoodType p_173382_) {
|
||||
@@ -208,6 +_,23 @@
|
||||
@@ -207,6 +_,23 @@
|
||||
case SINGLE:
|
||||
default:
|
||||
return p_110773_;
|
||||
|
||||
+18
-18
@@ -3,44 +3,44 @@
|
||||
@@ -17,32 +_,38 @@
|
||||
|
||||
@Override
|
||||
public VertexConsumer addVertex(float p_342932_, float p_342886_, float p_342696_) {
|
||||
- return this.delegate.addVertex(p_342932_, p_342886_, p_342696_);
|
||||
+ this.delegate.addVertex(p_342932_, p_342886_, p_342696_);
|
||||
public VertexConsumer vertex(double p_110801_, double p_110802_, double p_110803_) {
|
||||
- return this.delegate.vertex(p_110801_, p_110802_, p_110803_);
|
||||
+ this.delegate.vertex(p_110801_, p_110802_, p_110803_);
|
||||
+ return this; // Forge: Fix MC-263524 not working with chained methods
|
||||
}
|
||||
|
||||
@Override
|
||||
public VertexConsumer setColor(int p_344589_, int p_342555_, int p_344320_, int p_345258_) {
|
||||
- return this.delegate.setColor(p_344589_, p_342555_, p_344320_, p_345258_);
|
||||
+ this.delegate.setColor(p_344589_, p_342555_, p_344320_, p_345258_);
|
||||
public VertexConsumer color(int p_110826_, int p_110827_, int p_110828_, int p_110829_) {
|
||||
- return this.delegate.color(p_110826_, p_110827_, p_110828_, p_110829_);
|
||||
+ this.delegate.color(p_110826_, p_110827_, p_110828_, p_110829_);
|
||||
+ return this; // Forge: Fix MC-263524 not working with chained methods
|
||||
}
|
||||
|
||||
@Override
|
||||
public VertexConsumer setUv(float p_343856_, float p_344420_) {
|
||||
- return this.delegate.setUv(this.sprite.getU(p_343856_), this.sprite.getV(p_344420_));
|
||||
+ this.delegate.setUv(this.sprite.getU(p_343856_), this.sprite.getV(p_344420_));
|
||||
public VertexConsumer uv(float p_110805_, float p_110806_) {
|
||||
- return this.delegate.uv(this.sprite.getU(p_110805_), this.sprite.getV(p_110806_));
|
||||
+ this.delegate.uv(this.sprite.getU(p_110805_), this.sprite.getV(p_110806_));
|
||||
+ return this; // Forge: Fix MC-263524 not working with chained methods
|
||||
}
|
||||
|
||||
@Override
|
||||
public VertexConsumer setUv1(int p_343784_, int p_344827_) {
|
||||
- return this.delegate.setUv1(p_343784_, p_344827_);
|
||||
+ this.delegate.setUv1(p_343784_, p_344827_);
|
||||
public VertexConsumer overlayCoords(int p_110823_, int p_110824_) {
|
||||
- return this.delegate.overlayCoords(p_110823_, p_110824_);
|
||||
+ this.delegate.overlayCoords(p_110823_, p_110824_);
|
||||
+ return this; // Forge: Fix MC-263524 not working with chained methods
|
||||
}
|
||||
|
||||
@Override
|
||||
public VertexConsumer setUv2(int p_345257_, int p_344124_) {
|
||||
- return this.delegate.setUv2(p_345257_, p_344124_);
|
||||
+ this.delegate.setUv2(p_345257_, p_344124_);
|
||||
public VertexConsumer uv2(int p_110835_, int p_110836_) {
|
||||
- return this.delegate.uv2(p_110835_, p_110836_);
|
||||
+ this.delegate.uv2(p_110835_, p_110836_);
|
||||
+ return this; // Forge: Fix MC-263524 not working with chained methods
|
||||
}
|
||||
|
||||
@Override
|
||||
public VertexConsumer setNormal(float p_342779_, float p_342534_, float p_344783_) {
|
||||
- return this.delegate.setNormal(p_342779_, p_342534_, p_344783_);
|
||||
+ this.delegate.setNormal(p_342779_, p_342534_, p_344783_);
|
||||
public VertexConsumer normal(float p_110831_, float p_110832_, float p_110833_) {
|
||||
- return this.delegate.normal(p_110831_, p_110832_, p_110833_);
|
||||
+ this.delegate.normal(p_110831_, p_110832_, p_110833_);
|
||||
+ return this; // Forge: Fix MC-263524 not working with chained methods
|
||||
}
|
||||
|
||||
|
||||
+13
-13
@@ -43,19 +43,19 @@
|
||||
+ net.minecraft.client.renderer.RenderType renderType
|
||||
) {
|
||||
try {
|
||||
this.modelRenderer
|
||||
@@ -74,7 +_,9 @@
|
||||
p_234361_,
|
||||
p_234362_,
|
||||
p_234356_.getSeed(p_234357_),
|
||||
- OverlayTexture.NO_OVERLAY
|
||||
+ OverlayTexture.NO_OVERLAY,
|
||||
+ modelData,
|
||||
+ renderType
|
||||
);
|
||||
RenderShape rendershape = p_234356_.getRenderShape();
|
||||
@@ -76,7 +_,9 @@
|
||||
p_234361_,
|
||||
p_234362_,
|
||||
p_234356_.getSeed(p_234357_),
|
||||
- OverlayTexture.NO_OVERLAY
|
||||
+ OverlayTexture.NO_OVERLAY,
|
||||
+ modelData,
|
||||
+ renderType
|
||||
);
|
||||
}
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Tesselating block in world");
|
||||
@@ -103,7 +_,12 @@
|
||||
@@ -106,7 +_,12 @@
|
||||
return this.blockModelShaper.getBlockModel(p_110911_);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
RenderShape rendershape = p_110913_.getRenderShape();
|
||||
if (rendershape != RenderShape.INVISIBLE) {
|
||||
switch (rendershape) {
|
||||
@@ -113,21 +_,26 @@
|
||||
@@ -116,21 +_,26 @@
|
||||
float f = (float)(i >> 16 & 0xFF) / 255.0F;
|
||||
float f1 = (float)(i >> 8 & 0xFF) / 255.0F;
|
||||
float f2 = (float)(i & 0xFF) / 255.0F;
|
||||
|
||||
+57
-57
@@ -14,41 +14,41 @@
|
||||
float f1 = (float)(i >> 8 & 0xFF) / 255.0F;
|
||||
float f2 = (float)(i & 0xFF) / 255.0F;
|
||||
@@ -181,15 +_,15 @@
|
||||
float f57 = f4 * f;
|
||||
float f29 = f4 * f1;
|
||||
float f30 = f4 * f2;
|
||||
- this.vertex(p_234372_, f36 + 0.0F, f37 + f8, f38 + 0.0F, f57, f29, f30, f17, f21, l);
|
||||
- this.vertex(p_234372_, f36 + 0.0F, f37 + f10, f38 + 1.0F, f57, f29, f30, f18, f22, l);
|
||||
- this.vertex(p_234372_, f36 + 1.0F, f37 + f9, f38 + 1.0F, f57, f29, f30, f19, f23, l);
|
||||
- this.vertex(p_234372_, f36 + 1.0F, f37 + f7, f38 + 0.0F, f57, f29, f30, f20, f24, l);
|
||||
+ this.vertex(p_234372_, f36 + 0.0F, f37 + f8, f38 + 0.0F, f57, f29, f30, f17, f21, l, alpha);
|
||||
+ this.vertex(p_234372_, f36 + 0.0F, f37 + f10, f38 + 1.0F, f57, f29, f30, f18, f22, l, alpha);
|
||||
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f9, f38 + 1.0F, f57, f29, f30, f19, f23, l, alpha);
|
||||
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f7, f38 + 0.0F, f57, f29, f30, f20, f24, l, alpha);
|
||||
float f52 = f4 * f;
|
||||
float f30 = f4 * f1;
|
||||
float f31 = f4 * f2;
|
||||
- this.vertex(p_234372_, d1 + 0.0, d2 + (double)f8, d0 + 0.0, f52, f30, f31, f18, f22, l);
|
||||
- this.vertex(p_234372_, d1 + 0.0, d2 + (double)f10, d0 + 1.0, f52, f30, f31, f19, f23, l);
|
||||
- this.vertex(p_234372_, d1 + 1.0, d2 + (double)f9, d0 + 1.0, f52, f30, f31, f20, f24, l);
|
||||
- this.vertex(p_234372_, d1 + 1.0, d2 + (double)f7, d0 + 0.0, f52, f30, f31, f21, f25, l);
|
||||
+ this.vertex(p_234372_, d1 + 0.0, d2 + (double)f8, d0 + 0.0, f52, f30, f31, f18, f22, l, alpha);
|
||||
+ this.vertex(p_234372_, d1 + 0.0, d2 + (double)f10, d0 + 1.0, f52, f30, f31, f19, f23, l, alpha);
|
||||
+ this.vertex(p_234372_, d1 + 1.0, d2 + (double)f9, d0 + 1.0, f52, f30, f31, f20, f24, l, alpha);
|
||||
+ this.vertex(p_234372_, d1 + 1.0, d2 + (double)f7, d0 + 0.0, f52, f30, f31, f21, f25, l, alpha);
|
||||
if (p_234374_.shouldRenderBackwardUpFace(p_234370_, p_234371_.above())) {
|
||||
- this.vertex(p_234372_, f36 + 0.0F, f37 + f8, f38 + 0.0F, f57, f29, f30, f17, f21, l);
|
||||
- this.vertex(p_234372_, f36 + 1.0F, f37 + f7, f38 + 0.0F, f57, f29, f30, f20, f24, l);
|
||||
- this.vertex(p_234372_, f36 + 1.0F, f37 + f9, f38 + 1.0F, f57, f29, f30, f19, f23, l);
|
||||
- this.vertex(p_234372_, f36 + 0.0F, f37 + f10, f38 + 1.0F, f57, f29, f30, f18, f22, l);
|
||||
+ this.vertex(p_234372_, f36 + 0.0F, f37 + f8, f38 + 0.0F, f57, f29, f30, f17, f21, l, alpha);
|
||||
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f7, f38 + 0.0F, f57, f29, f30, f20, f24, l, alpha);
|
||||
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f9, f38 + 1.0F, f57, f29, f30, f19, f23, l, alpha);
|
||||
+ this.vertex(p_234372_, f36 + 0.0F, f37 + f10, f38 + 1.0F, f57, f29, f30, f18, f22, l, alpha);
|
||||
- this.vertex(p_234372_, d1 + 0.0, d2 + (double)f8, d0 + 0.0, f52, f30, f31, f18, f22, l);
|
||||
- this.vertex(p_234372_, d1 + 1.0, d2 + (double)f7, d0 + 0.0, f52, f30, f31, f21, f25, l);
|
||||
- this.vertex(p_234372_, d1 + 1.0, d2 + (double)f9, d0 + 1.0, f52, f30, f31, f20, f24, l);
|
||||
- this.vertex(p_234372_, d1 + 0.0, d2 + (double)f10, d0 + 1.0, f52, f30, f31, f19, f23, l);
|
||||
+ this.vertex(p_234372_, d1 + 0.0, d2 + (double)f8, d0 + 0.0, f52, f30, f31, f18, f22, l, alpha);
|
||||
+ this.vertex(p_234372_, d1 + 1.0, d2 + (double)f7, d0 + 0.0, f52, f30, f31, f21, f25, l, alpha);
|
||||
+ this.vertex(p_234372_, d1 + 1.0, d2 + (double)f9, d0 + 1.0, f52, f30, f31, f20, f24, l, alpha);
|
||||
+ this.vertex(p_234372_, d1 + 0.0, d2 + (double)f10, d0 + 1.0, f52, f30, f31, f19, f23, l, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,10 +_,10 @@
|
||||
float f46 = f3 * f;
|
||||
float f48 = f3 * f1;
|
||||
float f50 = f3 * f2;
|
||||
- this.vertex(p_234372_, f36, f37 + f16, f38 + 1.0F, f46, f48, f50, f40, f43, k);
|
||||
- this.vertex(p_234372_, f36, f37 + f16, f38, f46, f48, f50, f40, f42, k);
|
||||
- this.vertex(p_234372_, f36 + 1.0F, f37 + f16, f38, f46, f48, f50, f41, f42, k);
|
||||
- this.vertex(p_234372_, f36 + 1.0F, f37 + f16, f38 + 1.0F, f46, f48, f50, f41, f43, k);
|
||||
+ this.vertex(p_234372_, f36, f37 + f16, f38 + 1.0F, f46, f48, f50, f40, f43, k, alpha);
|
||||
+ this.vertex(p_234372_, f36, f37 + f16, f38, f46, f48, f50, f40, f42, k, alpha);
|
||||
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f16, f38, f46, f48, f50, f41, f42, k, alpha);
|
||||
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f16, f38 + 1.0F, f46, f48, f50, f41, f43, k, alpha);
|
||||
float f47 = f3 * f1;
|
||||
float f48 = f3 * f2;
|
||||
- this.vertex(p_234372_, d1, d2 + (double)f17, d0 + 1.0, f46, f47, f48, f40, f43, k);
|
||||
- this.vertex(p_234372_, d1, d2 + (double)f17, d0, f46, f47, f48, f40, f42, k);
|
||||
- this.vertex(p_234372_, d1 + 1.0, d2 + (double)f17, d0, f46, f47, f48, f41, f42, k);
|
||||
- this.vertex(p_234372_, d1 + 1.0, d2 + (double)f17, d0 + 1.0, f46, f47, f48, f41, f43, k);
|
||||
+ this.vertex(p_234372_, d1, d2 + (double)f17, d0 + 1.0, f46, f47, f48, f40, f43, k, alpha);
|
||||
+ this.vertex(p_234372_, d1, d2 + (double)f17, d0, f46, f47, f48, f40, f42, k, alpha);
|
||||
+ this.vertex(p_234372_, d1 + 1.0, d2 + (double)f17, d0, f46, f47, f48, f41, f42, k, alpha);
|
||||
+ this.vertex(p_234372_, d1 + 1.0, d2 + (double)f17, d0 + 1.0, f46, f47, f48, f41, f43, k, alpha);
|
||||
}
|
||||
|
||||
int j = this.getLightColor(p_234370_, p_234371_);
|
||||
@@ -67,40 +67,40 @@
|
||||
}
|
||||
|
||||
@@ -275,15 +_,15 @@
|
||||
float f33 = f4 * f32 * f;
|
||||
float f34 = f4 * f32 * f1;
|
||||
float f35 = f4 * f32 * f2;
|
||||
- this.vertex(p_234372_, f47, f37 + f44, f49, f33, f34, f35, f56, f59, j);
|
||||
- this.vertex(p_234372_, f51, f37 + f45, f52, f33, f34, f35, f58, f60, j);
|
||||
- this.vertex(p_234372_, f51, f37 + f16, f52, f33, f34, f35, f58, f31, j);
|
||||
- this.vertex(p_234372_, f47, f37 + f16, f49, f33, f34, f35, f56, f31, j);
|
||||
+ this.vertex(p_234372_, f47, f37 + f44, f49, f33, f34, f35, f56, f59, j, alpha);
|
||||
+ this.vertex(p_234372_, f51, f37 + f45, f52, f33, f34, f35, f58, f60, j, alpha);
|
||||
+ this.vertex(p_234372_, f51, f37 + f16, f52, f33, f34, f35, f58, f31, j, alpha);
|
||||
+ this.vertex(p_234372_, f47, f37 + f16, f49, f33, f34, f35, f56, f31, j, alpha);
|
||||
float f37 = f4 * f36 * f;
|
||||
float f38 = f4 * f36 * f1;
|
||||
float f39 = f4 * f36 * f2;
|
||||
- this.vertex(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, f53, f33, j);
|
||||
- this.vertex(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, f32, f34, j);
|
||||
- this.vertex(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, f32, f35, j);
|
||||
- this.vertex(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, f53, f35, j);
|
||||
+ this.vertex(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, f53, f33, j, alpha);
|
||||
+ this.vertex(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, f32, f34, j, alpha);
|
||||
+ this.vertex(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, f32, f35, j, alpha);
|
||||
+ this.vertex(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, f53, f35, j, alpha);
|
||||
if (textureatlassprite2 != this.waterOverlay) {
|
||||
- this.vertex(p_234372_, f47, f37 + f16, f49, f33, f34, f35, f56, f31, j);
|
||||
- this.vertex(p_234372_, f51, f37 + f16, f52, f33, f34, f35, f58, f31, j);
|
||||
- this.vertex(p_234372_, f51, f37 + f45, f52, f33, f34, f35, f58, f60, j);
|
||||
- this.vertex(p_234372_, f47, f37 + f44, f49, f33, f34, f35, f56, f59, j);
|
||||
+ this.vertex(p_234372_, f47, f37 + f16, f49, f33, f34, f35, f56, f31, j, alpha);
|
||||
+ this.vertex(p_234372_, f51, f37 + f16, f52, f33, f34, f35, f58, f31, j, alpha);
|
||||
+ this.vertex(p_234372_, f51, f37 + f45, f52, f33, f34, f35, f58, f60, j, alpha);
|
||||
+ this.vertex(p_234372_, f47, f37 + f44, f49, f33, f34, f35, f56, f59, j, alpha);
|
||||
- this.vertex(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, f53, f35, j);
|
||||
- this.vertex(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, f32, f35, j);
|
||||
- this.vertex(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, f32, f34, j);
|
||||
- this.vertex(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, f53, f33, j);
|
||||
+ this.vertex(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, f53, f35, j, alpha);
|
||||
+ this.vertex(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, f32, f35, j, alpha);
|
||||
+ this.vertex(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, f32, f34, j, alpha);
|
||||
+ this.vertex(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, f53, f33, j, alpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -345,10 +_,11 @@
|
||||
float p_343128_,
|
||||
float p_344448_,
|
||||
float p_344284_,
|
||||
float p_110991_,
|
||||
float p_110992_,
|
||||
float p_110993_,
|
||||
- int p_110994_
|
||||
+ int p_110994_,
|
||||
+ float alpha
|
||||
) {
|
||||
p_110985_.addVertex(p_110989_, p_110990_, p_110991_)
|
||||
- .setColor(p_110992_, p_110993_, p_343128_, 1.0F)
|
||||
+ .setColor(p_110992_, p_110993_, p_343128_, alpha)
|
||||
.setUv(p_344448_, p_344284_)
|
||||
.setLight(p_110994_)
|
||||
.setNormal(0.0F, 1.0F, 0.0F);
|
||||
p_110985_.vertex(p_110986_, p_110987_, p_110988_)
|
||||
- .color(p_110989_, p_110990_, p_110991_, 1.0F)
|
||||
+ .color(p_110989_, p_110990_, p_110991_, alpha)
|
||||
.uv(p_110992_, p_110993_)
|
||||
.uv2(p_110994_)
|
||||
.normal(0.0F, 1.0F, 0.0F)
|
||||
@@ -0,0 +1,50 @@
|
||||
--- a/net/minecraft/client/renderer/block/model/BlockElement.java
|
||||
+++ b/net/minecraft/client/renderer/block/model/BlockElement.java
|
||||
@@ -29,16 +_,23 @@
|
||||
public final Map<Direction, BlockElementFace> faces;
|
||||
public final BlockElementRotation rotation;
|
||||
public final boolean shade;
|
||||
+ private net.minecraftforge.client.model.ForgeFaceData faceData;
|
||||
|
||||
public BlockElement(
|
||||
Vector3f p_253626_, Vector3f p_254426_, Map<Direction, BlockElementFace> p_254454_, @Nullable BlockElementRotation p_254229_, boolean p_253661_
|
||||
) {
|
||||
+ this(p_253626_, p_254426_, p_254454_, p_254229_, p_253661_, net.minecraftforge.client.model.ForgeFaceData.DEFAULT);
|
||||
+ }
|
||||
+
|
||||
+ public BlockElement(Vector3f p_253626_, Vector3f p_254426_, Map<Direction, BlockElementFace> p_254454_, @Nullable BlockElementRotation p_254229_, boolean p_253661_, net.minecraftforge.client.model.ForgeFaceData faceData) {
|
||||
this.from = p_253626_;
|
||||
this.to = p_254426_;
|
||||
this.faces = p_254454_;
|
||||
this.rotation = p_254229_;
|
||||
this.shade = p_253661_;
|
||||
this.fillUvs();
|
||||
+ this.setFaceData(faceData);
|
||||
+ this.faces.values().forEach(face -> face.parent = this);
|
||||
}
|
||||
|
||||
private void fillUvs() {
|
||||
@@ -66,6 +_,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ public net.minecraftforge.client.model.ForgeFaceData getFaceData() {
|
||||
+ return this.faceData;
|
||||
+ }
|
||||
+
|
||||
+ public void setFaceData(net.minecraftforge.client.model.ForgeFaceData faceData) {
|
||||
+ this.faceData = java.util.Objects.requireNonNull(faceData);
|
||||
+ }
|
||||
+
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class Deserializer implements JsonDeserializer<BlockElement> {
|
||||
private static final boolean DEFAULT_SHADE = true;
|
||||
@@ -80,7 +_,7 @@
|
||||
throw new JsonParseException("Expected shade to be a Boolean");
|
||||
} else {
|
||||
boolean flag = GsonHelper.getAsBoolean(jsonobject, "shade", true);
|
||||
- return new BlockElement(vector3f, vector3f1, map, blockelementrotation, flag);
|
||||
+ return new BlockElement(vector3f, vector3f1, map, blockelementrotation, flag, net.minecraftforge.client.model.ForgeFaceData.read(jsonobject.get("forge_data"), net.minecraftforge.client.model.ForgeFaceData.DEFAULT));
|
||||
}
|
||||
}
|
||||
|
||||
+27
-15
@@ -1,26 +1,38 @@
|
||||
--- a/net/minecraft/client/renderer/block/model/BlockElementFace.java
|
||||
+++ b/net/minecraft/client/renderer/block/model/BlockElementFace.java
|
||||
@@ -13,9 +_,18 @@
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -19,13 +_,31 @@
|
||||
public final int tintIndex;
|
||||
public final String texture;
|
||||
public final BlockFaceUV uv;
|
||||
+ @Nullable
|
||||
+ private final net.minecraftforge.client.model.ForgeFaceData faceData; // If null, we defer to the parent BlockElement's ForgeFaceData, which is not nullable.
|
||||
+ @Nullable
|
||||
+ BlockElement parent; // Parent canot be set by the constructor due to instantiation ordering. This shouldn't really ever be null, but it could theoretically be.
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public record BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, BlockFaceUV uv) {
|
||||
+public record BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, BlockFaceUV uv, @Nullable net.minecraftforge.client.model.ForgeFaceData data) {
|
||||
public static final int NO_TINT = -1;
|
||||
|
||||
+ public BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, BlockFaceUV uv) {
|
||||
+ this(cullForDirection, tintIndex, texture, uv, null);
|
||||
public BlockElementFace(@Nullable Direction p_111359_, int p_111360_, String p_111361_, BlockFaceUV p_111362_) {
|
||||
+ this(p_111359_, p_111360_, p_111361_, p_111362_, null);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public net.minecraftforge.client.model.ForgeFaceData data() {
|
||||
+ return this.data == null ? net.minecraftforge.client.model.ForgeFaceData.DEFAULT : this.data;
|
||||
+ }
|
||||
+ public BlockElementFace(@Nullable Direction p_111359_, int p_111360_, String p_111361_, BlockFaceUV p_111362_, @Nullable net.minecraftforge.client.model.ForgeFaceData faceData) {
|
||||
this.cullForDirection = p_111359_;
|
||||
this.tintIndex = p_111360_;
|
||||
this.texture = p_111361_;
|
||||
this.uv = p_111362_;
|
||||
+ this.faceData = faceData;
|
||||
}
|
||||
+
|
||||
+ public net.minecraftforge.client.model.ForgeFaceData getFaceData() {
|
||||
+ if (this.faceData != null) {
|
||||
+ return this.faceData;
|
||||
+ } else if (this.parent != null) {
|
||||
+ return this.parent.getFaceData();
|
||||
+ }
|
||||
+ return net.minecraftforge.client.model.ForgeFaceData.DEFAULT;
|
||||
+ }
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class Deserializer implements JsonDeserializer<BlockElementFace> {
|
||||
private static final int DEFAULT_TINT_INDEX = -1;
|
||||
@@ -26,7 +_,7 @@
|
||||
@@ -37,7 +_,7 @@
|
||||
int i = this.getTintIndex(jsonobject);
|
||||
String s = this.getTexture(jsonobject);
|
||||
BlockFaceUV blockfaceuv = p_111367_.deserialize(jsonobject, BlockFaceUV.class);
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
this.overrides.forEach(p_247932_ -> {
|
||||
UnbakedModel unbakedmodel1 = p_249059_.apply(p_247932_.getModel());
|
||||
if (!Objects.equals(unbakedmodel1, this)) {
|
||||
@@ -192,13 +_,21 @@
|
||||
@@ -192,18 +_,27 @@
|
||||
});
|
||||
}
|
||||
|
||||
@@ -61,21 +61,27 @@
|
||||
+ */
|
||||
+ @Deprecated
|
||||
@Override
|
||||
public BakedModel bake(ModelBaker p_252120_, Function<Material, TextureAtlasSprite> p_250023_, ModelState p_251130_) {
|
||||
return this.bake(p_252120_, this, p_250023_, p_251130_, true);
|
||||
public BakedModel bake(ModelBaker p_252120_, Function<Material, TextureAtlasSprite> p_250023_, ModelState p_251130_, ResourceLocation p_252208_) {
|
||||
return this.bake(p_252120_, this, p_250023_, p_251130_, p_252208_, true);
|
||||
}
|
||||
|
||||
+ public BakedModel bake(ModelBaker p_249720_, BlockModel p_111451_, Function<Material, TextureAtlasSprite> p_111452_, ModelState p_111453_, boolean p_111455_) {
|
||||
+ return net.minecraftforge.client.model.geometry.UnbakedGeometryHelper.bake(this, p_249720_, p_111451_, p_111452_, p_111453_, p_111455_);
|
||||
+ public BakedModel bake(ModelBaker p_249720_, BlockModel p_111451_, Function<Material, TextureAtlasSprite> p_111452_, ModelState p_111453_, ResourceLocation p_111454_, boolean p_111455_) {
|
||||
+ return net.minecraftforge.client.model.geometry.UnbakedGeometryHelper.bake(this, p_249720_, p_111451_, p_111452_, p_111453_, p_111454_, p_111455_);
|
||||
+ }
|
||||
+
|
||||
public BakedModel bake(
|
||||
- ModelBaker p_249720_, BlockModel p_111451_, Function<Material, TextureAtlasSprite> p_111452_, ModelState p_111453_, boolean p_111455_
|
||||
+ ModelBaker p_249720_, BlockModel p_111451_, Function<Material, TextureAtlasSprite> p_111452_, ModelState p_111453_, boolean p_111455_, net.minecraftforge.client.RenderTypeGroup renderTypes
|
||||
ModelBaker p_249720_,
|
||||
BlockModel p_111451_,
|
||||
Function<Material, TextureAtlasSprite> p_111452_,
|
||||
ModelState p_111453_,
|
||||
ResourceLocation p_111454_,
|
||||
- boolean p_111455_
|
||||
+ boolean p_111455_,
|
||||
+ net.minecraftforge.client.RenderTypeGroup renderTypes
|
||||
) {
|
||||
TextureAtlasSprite textureatlassprite = p_111452_.apply(this.getMaterial("particle"));
|
||||
if (this.getRootModel() == ModelBakery.BLOCK_ENTITY_MARKER) {
|
||||
@@ -290,7 +_,18 @@
|
||||
@@ -295,7 +_,18 @@
|
||||
ItemTransform itemtransform5 = this.getTransform(ItemDisplayContext.GUI);
|
||||
ItemTransform itemtransform6 = this.getTransform(ItemDisplayContext.GROUND);
|
||||
ItemTransform itemtransform7 = this.getTransform(ItemDisplayContext.FIXED);
|
||||
@@ -95,7 +101,7 @@
|
||||
}
|
||||
|
||||
private ItemTransform getTransform(ItemDisplayContext p_270662_) {
|
||||
@@ -408,6 +_,10 @@
|
||||
@@ -413,6 +_,10 @@
|
||||
|
||||
public boolean lightLikeBlock() {
|
||||
return this == SIDE;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
--- a/net/minecraft/client/renderer/block/model/FaceBakery.java
|
||||
+++ b/net/minecraft/client/renderer/block/model/FaceBakery.java
|
||||
@@ -57,7 +_,14 @@
|
||||
@@ -59,7 +_,14 @@
|
||||
this.recalculateWinding(aint, direction);
|
||||
}
|
||||
|
||||
- return new BakedQuad(aint, p_111603_.tintIndex(), direction, p_111604_, p_111608_);
|
||||
+ var data = p_111603_.data();
|
||||
+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, direction, data.calculateNormals());
|
||||
+ var quad = new BakedQuad(aint, p_111603_.tintIndex(), direction, p_111604_, p_111608_, data.ambientOcclusion());
|
||||
- return new BakedQuad(aint, p_111603_.tintIndex, direction, p_111604_, p_111608_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, direction, p_111603_.getFaceData().calculateNormals());
|
||||
+ var data = p_111603_.getFaceData();
|
||||
+ var quad = new BakedQuad(aint, p_111603_.tintIndex, direction, p_111604_, p_111608_, data.ambientOcclusion());
|
||||
+ if (!net.minecraftforge.client.model.ForgeFaceData.DEFAULT.equals(data)) {
|
||||
+ net.minecraftforge.client.model.QuadTransformers.applyingLightmap(data.blockLight(), data.skyLight()).processInPlace(quad);
|
||||
+ net.minecraftforge.client.model.QuadTransformers.applyingColor(data.color()).processInPlace(quad);
|
||||
@@ -15,4 +15,4 @@
|
||||
+ return quad;
|
||||
}
|
||||
|
||||
public static BlockFaceUV recomputeUVs(BlockFaceUV p_111582_, Direction p_111583_, Transformation p_111584_) {
|
||||
public static BlockFaceUV recomputeUVs(BlockFaceUV p_111582_, Direction p_111583_, Transformation p_111584_, ResourceLocation p_111585_) {
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/client/renderer/chunk/RenderChunkRegion.java
|
||||
+++ b/net/minecraft/client/renderer/chunk/RenderChunkRegion.java
|
||||
@@ -78,4 +_,14 @@
|
||||
public static int index(int p_345383_, int p_342744_, int p_343921_, int p_343462_) {
|
||||
return p_343921_ - p_345383_ + (p_343462_ - p_342744_) * 3;
|
||||
@@ -74,4 +_,14 @@
|
||||
public int getHeight() {
|
||||
return this.level.getHeight();
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
--- a/net/minecraft/client/renderer/chunk/SectionCompiler.java
|
||||
+++ b/net/minecraft/client/renderer/chunk/SectionCompiler.java
|
||||
@@ -41,6 +_,7 @@
|
||||
}
|
||||
|
||||
public SectionCompiler.Results compile(SectionPos p_344383_, RenderChunkRegion p_342669_, VertexSorting p_342522_, SectionBufferBuilderPack p_343546_) {
|
||||
+ var modelDataMap = net.minecraft.client.Minecraft.getInstance().level.getModelDataManager().getAt(p_344383_);
|
||||
SectionCompiler.Results sectioncompiler$results = new SectionCompiler.Results();
|
||||
BlockPos blockpos = p_344383_.origin();
|
||||
BlockPos blockpos1 = blockpos.offset(15, 15, 15);
|
||||
@@ -71,7 +_,11 @@
|
||||
}
|
||||
|
||||
if (blockstate.getRenderShape() == RenderShape.MODEL) {
|
||||
- RenderType rendertype2 = ItemBlockRenderTypes.getChunkRenderType(blockstate);
|
||||
+ var model = this.blockRenderer.getBlockModel(blockstate);
|
||||
+ var data = modelDataMap.getOrDefault(blockpos2, net.minecraftforge.client.model.data.ModelData.EMPTY);
|
||||
+ data = model.getModelData(p_342669_, blockpos2, blockstate, data);
|
||||
+ randomsource.setSeed(blockstate.getSeed(blockpos2));
|
||||
+ for (RenderType rendertype2 : model.getRenderTypes(blockstate, randomsource, data)) {
|
||||
BufferBuilder bufferbuilder1 = this.getOrBeginLayer(map, p_343546_, rendertype2);
|
||||
posestack.pushPose();
|
||||
posestack.translate(
|
||||
@@ -79,8 +_,9 @@
|
||||
(float)SectionPos.sectionRelative(blockpos2.getY()),
|
||||
(float)SectionPos.sectionRelative(blockpos2.getZ())
|
||||
);
|
||||
- this.blockRenderer.renderBatched(blockstate, blockpos2, p_342669_, posestack, bufferbuilder1, true, randomsource);
|
||||
+ this.blockRenderer.renderBatched(blockstate, blockpos2, p_342669_, posestack, bufferbuilder1, true, randomsource, data, rendertype2);
|
||||
posestack.popPose();
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,9 +_,10 @@
|
||||
private <E extends BlockEntity> void handleBlockEntity(SectionCompiler.Results p_343713_, E p_343478_) {
|
||||
BlockEntityRenderer<E> blockentityrenderer = this.blockEntityRenderer.getRenderer(p_343478_);
|
||||
if (blockentityrenderer != null) {
|
||||
- p_343713_.blockEntities.add(p_343478_);
|
||||
if (blockentityrenderer.shouldRenderOffScreen(p_343478_)) {
|
||||
p_343713_.globalBlockEntities.add(p_343478_);
|
||||
+ } else {
|
||||
+ p_343713_.blockEntities.add(p_343478_); //FORGE: Fix MC-112730
|
||||
}
|
||||
}
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
--- a/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java
|
||||
+++ b/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java
|
||||
@@ -402,7 +_,7 @@
|
||||
if (!sectionrenderdispatcher$compiledsection.hasBlocks.contains(p_301074_)) {
|
||||
return false;
|
||||
} else {
|
||||
- this.lastResortTransparencyTask = new SectionRenderDispatcher.RenderSection.ResortTransparencyTask(this.getDistToPlayerSqr(), sectionrenderdispatcher$compiledsection);
|
||||
+ this.lastResortTransparencyTask = new SectionRenderDispatcher.RenderSection.ResortTransparencyTask(new net.minecraft.world.level.ChunkPos(getOrigin()), this.getDistToPlayerSqr(), sectionrenderdispatcher$compiledsection);
|
||||
p_298196_.schedule(this.lastResortTransparencyTask);
|
||||
return true;
|
||||
}
|
||||
@@ -436,7 +_,7 @@
|
||||
this.initialCompilationCancelCount.incrementAndGet();
|
||||
}
|
||||
|
||||
- this.lastRebuildTask = new SectionRenderDispatcher.RenderSection.RebuildTask(this.getDistToPlayerSqr(), renderchunkregion, !flag1 || this.initialCompilationCancelCount.get() > 2);
|
||||
+ this.lastRebuildTask = new SectionRenderDispatcher.RenderSection.RebuildTask(new net.minecraft.world.level.ChunkPos(getOrigin()), this.getDistToPlayerSqr(), renderchunkregion, !flag1 || this.initialCompilationCancelCount.get() > 2);
|
||||
return this.lastRebuildTask;
|
||||
}
|
||||
|
||||
@@ -476,10 +_,21 @@
|
||||
protected final double distAtCreation;
|
||||
protected final AtomicBoolean isCancelled = new AtomicBoolean(false);
|
||||
protected final boolean isHighPriority;
|
||||
+ protected java.util.Map<net.minecraft.core.BlockPos, net.minecraftforge.client.model.data.ModelData> modelData;
|
||||
|
||||
+ @Deprecated
|
||||
public CompileTask(final double p_300617_, final boolean p_299251_) {
|
||||
+ this(null, p_300617_, p_299251_);
|
||||
+ }
|
||||
+
|
||||
+ public CompileTask(@Nullable net.minecraft.world.level.ChunkPos pos, double p_300617_, boolean p_299251_) {
|
||||
this.distAtCreation = p_300617_;
|
||||
this.isHighPriority = p_299251_;
|
||||
+ if (pos == null) {
|
||||
+ this.modelData = java.util.Collections.emptyMap();
|
||||
+ } else {
|
||||
+ this.modelData = net.minecraft.client.Minecraft.getInstance().level.getModelDataManager().getAt(pos);
|
||||
+ }
|
||||
}
|
||||
|
||||
public abstract CompletableFuture<SectionRenderDispatcher.SectionTaskResult> doTask(SectionBufferBuilderPack p_300298_);
|
||||
@@ -491,6 +_,10 @@
|
||||
public int compareTo(SectionRenderDispatcher.RenderSection.CompileTask p_298947_) {
|
||||
return Doubles.compare(this.distAtCreation, p_298947_.distAtCreation);
|
||||
}
|
||||
+
|
||||
+ public net.minecraftforge.client.model.data.ModelData getModelData(net.minecraft.core.BlockPos pos) {
|
||||
+ return modelData.getOrDefault(pos, net.minecraftforge.client.model.data.ModelData.EMPTY);
|
||||
+ }
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -498,8 +_,13 @@
|
||||
@Nullable
|
||||
protected RenderChunkRegion region;
|
||||
|
||||
+ @Deprecated
|
||||
public RebuildTask(final double p_301300_, @Nullable final RenderChunkRegion p_300496_, final boolean p_299891_) {
|
||||
- super(p_301300_, p_299891_);
|
||||
+ this(null, p_301300_, p_300496_, p_299891_);
|
||||
+ }
|
||||
+
|
||||
+ public RebuildTask(@Nullable net.minecraft.world.level.ChunkPos pos, double p_301300_, @Nullable RenderChunkRegion p_300496_, boolean p_299891_) {
|
||||
+ super(pos, p_301300_, p_299891_);
|
||||
this.region = p_300496_;
|
||||
}
|
||||
|
||||
@@ -601,7 +_,10 @@
|
||||
}
|
||||
|
||||
if (blockstate.getRenderShape() != RenderShape.INVISIBLE) {
|
||||
- RenderType rendertype2 = ItemBlockRenderTypes.getChunkRenderType(blockstate);
|
||||
+ var model = blockrenderdispatcher.getBlockModel(blockstate);
|
||||
+ var modelData = model.getModelData(renderchunkregion, blockpos2, blockstate, getModelData(blockpos2));
|
||||
+ randomsource.setSeed(blockstate.getSeed(blockpos2));
|
||||
+ for (RenderType rendertype2 : model.getRenderTypes(blockstate, randomsource, modelData)) {
|
||||
BufferBuilder bufferbuilder2 = p_300020_.builder(rendertype2);
|
||||
if (set.add(rendertype2)) {
|
||||
RenderSection.this.beginLayer(bufferbuilder2);
|
||||
@@ -609,8 +_,9 @@
|
||||
|
||||
posestack.pushPose();
|
||||
posestack.translate((float)(blockpos2.getX() & 15), (float)(blockpos2.getY() & 15), (float)(blockpos2.getZ() & 15));
|
||||
- blockrenderdispatcher.renderBatched(blockstate, blockpos2, renderchunkregion, posestack, bufferbuilder2, true, randomsource);
|
||||
+ blockrenderdispatcher.renderBatched(blockstate, blockpos2, renderchunkregion, posestack, bufferbuilder2, true, randomsource, modelData, rendertype2);
|
||||
posestack.popPose();
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -643,9 +_,10 @@
|
||||
private <E extends BlockEntity> void handleBlockEntity(SectionRenderDispatcher.RenderSection.RebuildTask.CompileResults p_297364_, E p_299361_) {
|
||||
BlockEntityRenderer<E> blockentityrenderer = Minecraft.getInstance().getBlockEntityRenderDispatcher().getRenderer(p_299361_);
|
||||
if (blockentityrenderer != null) {
|
||||
- p_297364_.blockEntities.add(p_299361_);
|
||||
if (blockentityrenderer.shouldRenderOffScreen(p_299361_)) {
|
||||
p_297364_.globalBlockEntities.add(p_299361_);
|
||||
+ } else {
|
||||
+ p_297364_.blockEntities.add(p_299361_); //FORGE: Fix MC-112730
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -673,8 +_,13 @@
|
||||
class ResortTransparencyTask extends SectionRenderDispatcher.RenderSection.CompileTask {
|
||||
private final SectionRenderDispatcher.CompiledSection compiledSection;
|
||||
|
||||
+ @Deprecated
|
||||
public ResortTransparencyTask(final double p_300619_, final SectionRenderDispatcher.CompiledSection p_297742_) {
|
||||
- super(p_300619_, true);
|
||||
+ this(null, p_300619_, p_297742_);
|
||||
+ }
|
||||
+
|
||||
+ public ResortTransparencyTask(@Nullable net.minecraft.world.level.ChunkPos pos, double p_300619_, SectionRenderDispatcher.CompiledSection p_297742_) {
|
||||
+ super(pos, p_300619_, true);
|
||||
this.compiledSection = p_297742_;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/entity/BoatRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/entity/BoatRenderer.java
|
||||
@@ -76,7 +_,7 @@
|
||||
@@ -75,7 +_,7 @@
|
||||
p_113932_.mulPose(new Quaternionf().setAngleAxis(p_113929_.getBubbleAngle(p_113931_) * (float) (Math.PI / 180.0), 1.0F, 0.0F, 1.0F));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
ResourceLocation resourcelocation = pair.getFirst();
|
||||
ListModel<Boat> listmodel = pair.getSecond();
|
||||
p_113932_.scale(-1.0F, -1.0F, 1.0F);
|
||||
@@ -95,7 +_,12 @@
|
||||
@@ -94,7 +_,12 @@
|
||||
super.render(p_113929_, p_113930_, p_113931_, p_113932_, p_113933_, p_113934_);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java
|
||||
+++ b/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java
|
||||
@@ -222,12 +_,12 @@
|
||||
) {
|
||||
@@ -190,12 +_,12 @@
|
||||
private static void renderHitbox(PoseStack p_114442_, VertexConsumer p_114443_, Entity p_114444_, float p_114445_) {
|
||||
AABB aabb = p_114444_.getBoundingBox().move(-p_114444_.getX(), -p_114444_.getY(), -p_114444_.getZ());
|
||||
LevelRenderer.renderLineBox(p_114442_, p_114443_, aabb, p_343193_, p_342304_, p_342638_, 1.0F);
|
||||
LevelRenderer.renderLineBox(p_114442_, p_114443_, aabb, 1.0F, 1.0F, 1.0F, 1.0F);
|
||||
- if (p_114444_ instanceof EnderDragon) {
|
||||
+ if (p_114444_.isMultipartEntity()) {
|
||||
double d0 = -Mth.lerp((double)p_114445_, p_114444_.xOld, p_114444_.getX());
|
||||
@@ -15,7 +15,7 @@
|
||||
p_114442_.pushPose();
|
||||
double d3 = d0 + Mth.lerp((double)p_114445_, enderdragonpart.xOld, enderdragonpart.getX());
|
||||
double d4 = d1 + Mth.lerp((double)p_114445_, enderdragonpart.yOld, enderdragonpart.getY());
|
||||
@@ -467,6 +_,10 @@
|
||||
@@ -440,6 +_,10 @@
|
||||
return this.itemInHandRenderer;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
@Override
|
||||
public void onResourceManagerReload(ResourceManager p_174004_) {
|
||||
EntityRendererProvider.Context entityrendererprovider$context = new EntityRendererProvider.Context(
|
||||
@@ -474,5 +_,6 @@
|
||||
@@ -447,5 +_,6 @@
|
||||
);
|
||||
this.renderers = EntityRenderers.createEntityRenderers(entityrendererprovider$context);
|
||||
this.playerRenderers = EntityRenderers.createPlayerRenderers(entityrendererprovider$context);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/client/renderer/entity/EntityRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/entity/EntityRenderer.java
|
||||
@@ -94,8 +_,9 @@
|
||||
}
|
||||
}
|
||||
@@ -71,8 +_,9 @@
|
||||
}
|
||||
|
||||
public void render(T p_114485_, float p_114486_, float p_114487_, PoseStack p_114488_, MultiBufferSource p_114489_, int p_114490_) {
|
||||
- if (this.shouldShowName(p_114485_)) {
|
||||
- this.renderNameTag(p_114485_, p_114485_.getDisplayName(), p_114488_, p_114489_, p_114490_, p_114487_);
|
||||
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.fireRenderNameTagEvent(p_114485_, p_114485_.getDisplayName(), this, p_114488_, p_114489_, p_114490_, p_114487_);
|
||||
@@ -12,7 +12,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +_,7 @@
|
||||
@@ -88,7 +_,7 @@
|
||||
|
||||
protected void renderNameTag(T p_114498_, Component p_114499_, PoseStack p_114500_, MultiBufferSource p_114501_, int p_114502_, float p_334448_) {
|
||||
double d0 = this.entityRenderDispatcher.distanceToSqr(p_114498_);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/entity/FishingHookRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/entity/FishingHookRenderer.java
|
||||
@@ -64,7 +_,7 @@
|
||||
@@ -66,7 +_,7 @@
|
||||
private Vec3 getPlayerHandPos(Player p_328037_, float p_328369_, float p_332926_) {
|
||||
int i = p_328037_.getMainArm() == HumanoidArm.RIGHT ? 1 : -1;
|
||||
ItemStack itemstack = p_328037_.getMainHandItem();
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
VertexConsumer vertexconsumer;
|
||||
if (hasAnimatedTexture(p_115144_) && p_115144_.hasFoil()) {
|
||||
PoseStack.Pose posestack$pose = p_115147_.last().copy();
|
||||
@@ -146,9 +_,11 @@
|
||||
@@ -150,9 +_,11 @@
|
||||
vertexconsumer = getFoilBuffer(p_115148_, rendertype, true, p_115144_.hasFoil());
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
}
|
||||
|
||||
p_115147_.popPose();
|
||||
@@ -199,7 +_,7 @@
|
||||
@@ -211,7 +_,7 @@
|
||||
float f1 = (float)FastColor.ARGB32.red(i) / 255.0F;
|
||||
float f2 = (float)FastColor.ARGB32.green(i) / 255.0F;
|
||||
float f3 = (float)FastColor.ARGB32.blue(i) / 255.0F;
|
||||
@@ -51,7 +51,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,5 +_,9 @@
|
||||
@@ -264,5 +_,9 @@
|
||||
@Override
|
||||
public void onResourceManagerReload(ResourceManager p_115105_) {
|
||||
this.itemModelShaper.rebuildCache();
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public class ElytraLayer<T extends LivingEntity, M extends EntityModel<T>> extends RenderLayer<T, M> {
|
||||
+public class ElytraLayer<T extends LivingEntity, M extends EntityModel<T>> extends RenderLayer<T, M> implements net.minecraftforge.client.extensions.IForgeElytraLayer<T> {
|
||||
public static final ResourceLocation WINGS_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/elytra.png");
|
||||
public static final ResourceLocation WINGS_LOCATION = new ResourceLocation("textures/entity/elytra.png");
|
||||
private final ElytraModel<T> elytraModel;
|
||||
|
||||
@@ -45,7 +_,7 @@
|
||||
|
||||
Loaded 100 of 1028 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user