diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts index 7b084db234..8b65073f36 100644 --- a/.teamcity/settings.kts +++ b/.teamcity/settings.kts @@ -33,7 +33,7 @@ project { params { text("docker_jdk_version", "17", label = "Gradle version", description = "The version of the JDK to use during execution of tasks in a JDK.", display = ParameterDisplay.HIDDEN, allowEmpty = false) - text("docker_gradle_version", "7.3", label = "Gradle version", description = "The version of Gradle to use during execution of Gradle tasks.", display = ParameterDisplay.HIDDEN, allowEmpty = false) + text("docker_gradle_version", "7.4", label = "Gradle version", description = "The version of Gradle to use during execution of Gradle tasks.", display = ParameterDisplay.HIDDEN, allowEmpty = false) text("git_main_branch", "1.18.x", label = "Git Main Branch", description = "The git main or default branch to use in VCS operations.", display = ParameterDisplay.HIDDEN, allowEmpty = false) text("git_branch_spec", """ +:refs/heads/(main*) diff --git a/build.gradle b/build.gradle index bd20113671..159ea54f41 100644 --- a/build.gradle +++ b/build.gradle @@ -44,9 +44,9 @@ ext { ] } MAPPING_CHANNEL = 'official' - MAPPING_VERSION = '1.18.1' - MC_VERSION = '1.18.1' - MCP_VERSION = '20211210.034407' + MAPPING_VERSION = '1.18.2' + MC_VERSION = '1.18.2' + MCP_VERSION = '20220228.144236' SPI_VERSION = '4.0.10' ACCESSTRANSFORMERS_VERSION = '8.0.4' COREMODS_VERSION = '5.0.1' @@ -76,10 +76,14 @@ println('Version: ' + VERSION + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ')' + ' Arch: ' + System.getProperty('os.arch')) +changelog { + fromTag MIN_TAG_FOR_CHANGELOG +} + def extraTxts = [ rootProject.file('CREDITS.txt'), rootProject.file('LICENSE.txt'), - rootProject.file('build/changelog.txt') //Now gets generated on build. + rootProject.tasks.createChangelog.outputFile ] task downloadVersionManifest(type: Download) { @@ -262,19 +266,12 @@ def sharedDeps = { installer 'com.electronwill.night-config:core:3.6.4' installer 'com.electronwill.night-config:toml:3.6.4' installer 'org.apache.maven:maven-artifact:3.6.3' - installer 'org.apache.commons:commons-lang3:3.12.0' installer 'net.jodah:typetools:0.8.3' - installer 'org.apache.logging.log4j:log4j-api:2.15.0' //TODO: Unpin in 1.18.1 or when Mojang bumps the Log4J version - installer 'org.apache.logging.log4j:log4j-core:2.15.0' //TODO: Unpin in 1.18.1 or when Mojang bumps the Log4J version - installer 'org.apache.logging.log4j:log4j-slf4j18-impl:2.15.0' //TODO: Unpin in 1.18.1 or when Mojang bumps the Log4J version installer 'net.minecrell:terminalconsoleappender:1.2.0' installer 'org.jline:jline-reader:3.12.+' //Dep of TerminaalConsoleeAppender installer 'org.jline:jline-terminal:3.12.+' //Dep of TerminaalConsoleeAppender - installer 'net.sf.jopt-simple:jopt-simple:5.0.4' installer "org.spongepowered:mixin:${MIXIN_VERSION}" installer 'org.openjdk.nashorn:nashorn-core:15.3' - installer 'com.google.guava:guava:31.0.1-jre' - installer 'com.google.code.gson:gson:2.8.8' /* installer 'org.lwjgl:lwjgl:3.2.2' @@ -429,7 +426,7 @@ def sharedFmlonlyForge = { Project prj -> // SecureJarHandler bootstrap values. run.property 'ignoreList', prj.configurations.moduleonly.files.collect {it.name.replaceAll(/([-_]([.\d]*\d+)|\.jar$)/, '') }.join(',') + ",client-extra,fmlcore,javafmllanguage,mclanguage,${prj.name}-" - run.property 'mergeModules', 'jna-5.8.0.jar,jna-platform-58.0.jar,java-objc-bridge-1.0.0.jar' + //run.property 'mergeModules', 'jna-5.10.0.jar,jna-platform-5.10.0.jar,java-objc-bridge-1.0.0.jar' if (userdevRuns.contains(run)) { run.property 'legacyClassPath.file', '{minecraft_classpath_file}' run.jvmArgs '-p', '{modules}' @@ -622,7 +619,7 @@ project(':fmlonly') { '--fml.forgeGroup', project.group, '--fml.mcpVersion', MCP_VERSION], jvm: ["-DignoreList=${fmlonly_client.properties.ignoreList},\${version_name}.jar", - "-DmergeModules=${fmlonly_client.properties.mergeModules}", + //"-DmergeModules=${fmlonly_client.properties.mergeModules}", '-DlibraryDirectory=${library_directory}', '-p', Util.getArtifacts(project, configurations.moduleonly, false).values().collect{"\${library_directory}/${it.downloads.artifact.path}"}.join('${classpath_separator}'), '--add-modules', 'ALL-MODULE-PATH', @@ -916,6 +913,7 @@ project(':forge') { implementation project(':fmlloader') implementation project(':javafmllanguage') implementation project(':mclanguage') + runtimeOnly "cpw.mods:bootstraplauncher:${BOOTSTRAPLAUNCHER_VERSION}" } dependencies sharedDeps @@ -1190,7 +1188,7 @@ project(':forge') { '--fml.forgeGroup', project.group, '--fml.mcpVersion', MCP_VERSION], jvm: ["-DignoreList=${forge_client.properties.ignoreList},\${version_name}.jar", - "-DmergeModules=${forge_client.properties.mergeModules}", + //"-DmergeModules=${forge_client.properties.mergeModules}", '-DlibraryDirectory=${library_directory}', '-p', Util.getArtifacts(project, configurations.moduleonly, false).values().collect{'${library_directory}/' + it.downloads.artifact.path}.join('${classpath_separator}'), '--add-modules', 'ALL-MODULE-PATH', @@ -1559,8 +1557,4 @@ if (System.env.TEAMCITY_VERSION) { println "##teamcity[setParameter name='env.PUBLISHED_JAVA_FML_ARTIFACT_VERSION' value='${project(':fmlonly').version}']" } } -} - -changelog { - fromTag MIN_TAG_FOR_CHANGELOG } \ No newline at end of file diff --git a/fmlloader/build.gradle b/fmlloader/build.gradle index 7667c4591f..43076251f0 100644 --- a/fmlloader/build.gradle +++ b/fmlloader/build.gradle @@ -11,23 +11,24 @@ configurations.forEach{ it.transitive = false } dependencies { implementation('net.sf.jopt-simple:jopt-simple:5.0.4') - compileOnly('org.jetbrains:annotations:21.0.0') + compileOnly('org.jetbrains:annotations:23.0.0') api("org.ow2.asm:asm:${ASM_VERSION}") api("org.ow2.asm:asm-tree:${ASM_VERSION}") api("org.ow2.asm:asm-commons:${ASM_VERSION}") api('net.minecraftforge:forgespi:4.0.+') - api('org.apache.logging.log4j:log4j-api:2.14.1') + api('org.apache.logging.log4j:log4j-api:2.17.0') + api('org.slf4j:slf4j-api:1.8.0-beta4') api('com.google.guava:guava:21.0') - api('com.google.code.gson:gson:2.8.0') + api('com.google.code.gson:gson:2.8.9') api('org.apache.maven:maven-artifact:3.8.1') - api('org.apache.commons:commons-lang3:3.8.1') - api('com.electronwill.night-config:core:3.6.3') - api('com.electronwill.night-config:toml:3.6.3') + api('org.apache.commons:commons-lang3:3.12.0') + api('com.electronwill.night-config:core:3.6.4') + api('com.electronwill.night-config:toml:3.6.4') api('cpw.mods:modlauncher:9.0.+') api('net.minecraftforge:coremods:5.0.+') implementation("cpw.mods:securejarhandler:${SECUREJARHANDLER_VERSION}") - implementation('org.apache.logging.log4j:log4j-core:2.14.1') - annotationProcessor('org.apache.logging.log4j:log4j-core:2.14.1') + implementation('org.apache.logging.log4j:log4j-core:2.17.0') + annotationProcessor('org.apache.logging.log4j:log4j-core:2.17.0') implementation('net.minecraftforge:accesstransformers:8.0.4') implementation('net.minecrell:terminalconsoleappender:1.2.0') // implementation('org.jline:jline:3.12.+') diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/log4j/SLF4JFixerLaunchPluginService.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/log4j/SLF4JFixerLaunchPluginService.java new file mode 100644 index 0000000000..1557036341 --- /dev/null +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/log4j/SLF4JFixerLaunchPluginService.java @@ -0,0 +1,37 @@ +package net.minecraftforge.fml.loading.log4j; + +import cpw.mods.modlauncher.api.NamedPath; +import cpw.mods.modlauncher.serviceapi.ILaunchPluginService; +import org.objectweb.asm.Type; +import org.slf4j.LoggerFactory; + +import java.util.EnumSet; + +public class SLF4JFixerLaunchPluginService implements ILaunchPluginService { + private static final EnumSet NO_PHASES = EnumSet.noneOf(Phase.class); + + @Override + public String name() { + return "slf4jfixer"; + } + + @Override + public EnumSet handlesClass(Type classType, boolean isEmpty) { + return NO_PHASES; + } + + @Override + public void initializeLaunch(ITransformerLoader transformerLoader, NamedPath[] specialPaths) { + Thread curThread = Thread.currentThread(); + ClassLoader contextClassLoader = curThread.getContextClassLoader(); + + // Set the CCL of the current thread to MC-BOOTSTRAP ModuleClassLoader + curThread.setContextClassLoader(this.getClass().getClassLoader()); + + // Force SLF4J to bind the service providers while we manually set the context classloader to be correct + LoggerFactory.getILoggerFactory(); + + // Set CCL back to TransformingClassLoader + curThread.setContextClassLoader(contextClassLoader); + } +} diff --git a/fmlloader/src/main/resources/META-INF/services/cpw.mods.modlauncher.serviceapi.ILaunchPluginService b/fmlloader/src/main/resources/META-INF/services/cpw.mods.modlauncher.serviceapi.ILaunchPluginService index 00b38ab624..92c39f2307 100644 --- a/fmlloader/src/main/resources/META-INF/services/cpw.mods.modlauncher.serviceapi.ILaunchPluginService +++ b/fmlloader/src/main/resources/META-INF/services/cpw.mods.modlauncher.serviceapi.ILaunchPluginService @@ -1,3 +1,4 @@ +net.minecraftforge.fml.loading.log4j.SLF4JFixerLaunchPluginService net.minecraftforge.fml.loading.RuntimeDistCleaner net.minecraftforge.fml.common.asm.RuntimeEnumExtender net.minecraftforge.fml.common.asm.ObjectHolderDefinalize diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e750102e09..41dfb87909 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/mdk/src/main/java/com/example/examplemod/ExampleMod.java b/mdk/src/main/java/com/example/examplemod/ExampleMod.java index 27476beb1f..421fd07111 100644 --- a/mdk/src/main/java/com/example/examplemod/ExampleMod.java +++ b/mdk/src/main/java/com/example/examplemod/ExampleMod.java @@ -1,5 +1,6 @@ package com.example.examplemod; +import com.mojang.logging.LogUtils; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraftforge.common.MinecraftForge; @@ -12,8 +13,7 @@ import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; import net.minecraftforge.event.server.ServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import java.util.stream.Collectors; @@ -21,10 +21,11 @@ import java.util.stream.Collectors; @Mod("examplemod") public class ExampleMod { - // Directly reference a log4j logger. - private static final Logger LOGGER = LogManager.getLogger(); + // Directly reference a slf4j logger + private static final Logger LOGGER = LogUtils.getLogger(); - public ExampleMod() { + public ExampleMod() + { // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); // Register the enqueueIMC method for modloading @@ -45,31 +46,35 @@ public class ExampleMod private void enqueueIMC(final InterModEnqueueEvent event) { - // some example code to dispatch IMC to another mod + // Some example code to dispatch IMC to another mod InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); } private void processIMC(final InterModProcessEvent event) { - // some example code to receive and process InterModComms from other mods + // Some example code to receive and process InterModComms from other mods LOGGER.info("Got IMC {}", event.getIMCStream(). map(m->m.messageSupplier().get()). collect(Collectors.toList())); } + // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent - public void onServerStarting(ServerStartingEvent event) { - // do something when the server starts + public void onServerStarting(ServerStartingEvent event) + { + // Do something when the server starts LOGGER.info("HELLO from server starting"); } // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD // Event bus for receiving Registry Events) - @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) - public static class RegistryEvents { + @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) + public static class RegistryEvents + { @SubscribeEvent - public static void onBlocksRegistry(final RegistryEvent.Register blockRegistryEvent) { - // register a new block here + public static void onBlocksRegistry(final RegistryEvent.Register blockRegistryEvent) + { + // Register a new block here LOGGER.info("HELLO from Register Block"); } } diff --git a/mdk/src/main/resources/pack.mcmeta b/mdk/src/main/resources/pack.mcmeta index b18e3cdd12..f335b9f733 100644 --- a/mdk/src/main/resources/pack.mcmeta +++ b/mdk/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { "description": "examplemod resources", - "pack_format": 8 + "pack_format": 9 } } diff --git a/patches/minecraft/com/mojang/blaze3d/vertex/VertexConsumer.java.patch b/patches/minecraft/com/mojang/blaze3d/vertex/VertexConsumer.java.patch index e3b1e278c7..1f91a10192 100644 --- a/patches/minecraft/com/mojang/blaze3d/vertex/VertexConsumer.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/vertex/VertexConsumer.java.patch @@ -1,15 +1,15 @@ --- a/com/mojang/blaze3d/vertex/VertexConsumer.java +++ b/com/mojang/blaze3d/vertex/VertexConsumer.java -@@ -16,7 +_,7 @@ +@@ -14,7 +_,7 @@ import org.lwjgl.system.MemoryStack; @OnlyIn(Dist.CLIENT) -public interface VertexConsumer { +public interface VertexConsumer extends net.minecraftforge.client.extensions.IForgeVertexConsumer { - Logger f_85943_ = LogManager.getLogger(); - VertexConsumer m_5483_(double p_85945_, double p_85946_, double p_85947_); -@@ -105,11 +_,12 @@ + + VertexConsumer m_6122_(int p_85973_, int p_85974_, int p_85975_, int p_85976_); +@@ -101,11 +_,12 @@ f5 = afloat[k] * p_86001_; } diff --git a/patches/minecraft/net/minecraft/SharedConstants.java.patch b/patches/minecraft/net/minecraft/SharedConstants.java.patch index 8b209a421c..69a6ecccb0 100644 --- a/patches/minecraft/net/minecraft/SharedConstants.java.patch +++ b/patches/minecraft/net/minecraft/SharedConstants.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/SharedConstants.java +++ b/net/minecraft/SharedConstants.java -@@ -184,6 +_,7 @@ +@@ -183,6 +_,7 @@ } static { diff --git a/patches/minecraft/net/minecraft/Util.java.patch b/patches/minecraft/net/minecraft/Util.java.patch index ceadaf2afb..8dac1a5ae7 100644 --- a/patches/minecraft/net/minecraft/Util.java.patch +++ b/patches/minecraft/net/minecraft/Util.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/Util.java +++ b/net/minecraft/Util.java -@@ -158,6 +_,9 @@ +@@ -155,6 +_,9 @@ return 255; } @@ -10,7 +10,7 @@ public static ExecutorService m_183988_() { return f_137443_; } -@@ -236,7 +_,7 @@ +@@ -233,7 +_,7 @@ try { type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_183709_().getWorldVersion())).getChoiceType(p_137552_, p_137553_); } catch (IllegalArgumentException illegalargumentexception) { diff --git a/patches/minecraft/net/minecraft/advancements/critereon/ItemPredicate.java.patch b/patches/minecraft/net/minecraft/advancements/critereon/ItemPredicate.java.patch index 2b7a508b6c..88d98aaacf 100644 --- a/patches/minecraft/net/minecraft/advancements/critereon/ItemPredicate.java.patch +++ b/patches/minecraft/net/minecraft/advancements/critereon/ItemPredicate.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/advancements/critereon/ItemPredicate.java +++ b/net/minecraft/advancements/critereon/ItemPredicate.java -@@ -29,6 +_,8 @@ +@@ -28,6 +_,8 @@ import net.minecraft.world.level.ItemLike; public class ItemPredicate { @@ -8,8 +8,8 @@ + private static final Map> unmod_predicates = java.util.Collections.unmodifiableMap(custom_predicates); public static final ItemPredicate f_45028_ = new ItemPredicate(); @Nullable - private final Tag f_45029_; -@@ -108,6 +_,11 @@ + private final TagKey f_45029_; +@@ -107,6 +_,11 @@ public static ItemPredicate m_45051_(@Nullable JsonElement p_45052_) { if (p_45052_ != null && !p_45052_.isJsonNull()) { JsonObject jsonobject = GsonHelper.m_13918_(p_45052_, "item"); @@ -21,7 +21,7 @@ MinMaxBounds.Ints minmaxbounds$ints = MinMaxBounds.Ints.m_55373_(jsonobject.get("count")); MinMaxBounds.Ints minmaxbounds$ints1 = MinMaxBounds.Ints.m_55373_(jsonobject.get("durability")); if (jsonobject.has("data")) { -@@ -219,6 +_,14 @@ +@@ -214,6 +_,14 @@ } else { return new ItemPredicate[0]; } diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index b07167c744..861d7b923e 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/client/Minecraft.java +++ b/net/minecraft/client/Minecraft.java -@@ -254,7 +_,7 @@ - import org.lwjgl.util.tinyfd.TinyFileDialogs; +@@ -252,7 +_,7 @@ + import org.slf4j.Logger; @OnlyIn(Dist.CLIENT) -public class Minecraft extends ReentrantBlockableEventLoop implements WindowEventHandler { +public class Minecraft extends ReentrantBlockableEventLoop implements WindowEventHandler, net.minecraftforge.client.extensions.IForgeMinecraft { private static Minecraft f_90981_; - private static final Logger f_90982_ = LogManager.getLogger(); + private static final Logger f_90982_ = LogUtils.getLogger(); public static final boolean f_91002_ = Util.m_137581_() == Util.OS.OSX; @@ -394,14 +_,13 @@ this.f_91029_ = p_91084_.f_101908_.f_101928_; @@ -44,7 +44,7 @@ @@ -456,6 +_,7 @@ this.f_91042_.m_83931_(0.0F, 0.0F, 0.0F, 0.0F); this.f_91042_.m_83954_(f_91002_); - this.f_91036_ = new SimpleReloadableResourceManager(PackType.CLIENT_RESOURCES); + this.f_91036_ = new ReloadableResourceManager(PackType.CLIENT_RESOURCES); + net.minecraftforge.client.loading.ClientModLoader.begin(this, this.f_91038_, this.f_91036_, this.f_91037_); this.f_91038_.m_10506_(); this.f_91066_.m_92145_(this.f_91038_); @@ -57,17 +57,17 @@ this.f_91036_.m_7217_(this.f_91061_); this.f_91053_ = new PaintingTextureManager(this.f_90987_); this.f_91036_.m_7217_(this.f_91053_); -@@ -511,7 +_,8 @@ - this.f_91036_.m_7217_(this.f_91054_); +@@ -512,7 +_,8 @@ this.f_91047_ = new GpuWarnlistManager(); this.f_91036_.m_7217_(this.f_91047_); + this.f_91036_.m_7217_(this.f_205120_); - this.f_91065_ = new Gui(this); + this.f_91065_ = new net.minecraftforge.client.gui.ForgeIngameGui(this); + this.f_91067_.m_91524_(this.f_90990_.m_85439_()); //Forge: Moved below ingameGUI setting to prevent NPEs in handeler. this.f_91064_ = new DebugRenderer(this); RenderSystem.m_69900_(this::m_91113_); if (this.f_91042_.f_83915_ == this.f_90990_.m_85441_() && this.f_91042_.f_83916_ == this.f_90990_.m_85442_()) { -@@ -529,6 +_,11 @@ +@@ -530,6 +_,11 @@ TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false); } @@ -79,7 +79,7 @@ this.f_90990_.m_85409_(this.f_91066_.f_92041_); this.f_90990_.m_85424_(this.f_91066_.f_92034_); this.f_90990_.m_85426_(); -@@ -544,13 +_,16 @@ +@@ -545,13 +_,16 @@ } this.f_167847_.m_168556_(); @@ -101,7 +101,7 @@ } -@@ -585,6 +_,8 @@ +@@ -594,6 +_,8 @@ private UserApiService m_193585_(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) { try { @@ -110,25 +110,16 @@ return p_193586_.createUserApiService(p_193587_.f_101905_.f_101942_.m_92547_()); } catch (AuthenticationException authenticationexception) { f_90982_.error("Failed to verify authentication", (Throwable)authenticationexception); -@@ -597,7 +_,7 @@ +@@ -606,7 +_,7 @@ } private void m_91239_(Throwable p_91240_) { - if (this.f_91038_.m_10523_().size() > 1) { + if (this.f_91038_.m_10524_().stream().anyMatch(e -> !e.m_10449_())) { //Forge: This caused infinite loop if any resource packs are forced. Such as mod resources. So check if we can disable any. - Component component; - if (p_91240_ instanceof SimpleReloadableResourceManager.ResourcePackLoadingFailure) { - component = new TextComponent(((SimpleReloadableResourceManager.ResourcePackLoadingFailure)p_91240_).m_10921_().m_8017_()); -@@ -691,7 +_,7 @@ - return Stream.of(Registry.f_122827_.m_7981_(p_91317_.m_41720_())); - }); - ReloadableIdSearchTree reloadableidsearchtree = new ReloadableIdSearchTree<>((p_91121_) -> { -- return ItemTags.m_13193_().m_13394_(p_91121_.m_41720_()).stream(); -+ return p_91121_.m_41720_().getTags().stream(); - }); - NonNullList nonnulllist = NonNullList.m_122779_(); - -@@ -761,13 +_,13 @@ + this.m_91241_(p_91240_, (Component)null); + } else { + Util.m_137559_(p_91240_); +@@ -763,13 +_,13 @@ Bootstrap.m_135875_(p_91333_.m_127526_()); if (p_91333_.m_127527_() != null) { Bootstrap.m_135875_("#@!@# Game crashed! Crash report saved to: #@!@# " + p_91333_.m_127527_()); @@ -145,7 +136,7 @@ } } -@@ -877,10 +_,6 @@ +@@ -879,10 +_,6 @@ f_90982_.error("setScreen called from non-game thread"); } @@ -156,7 +147,7 @@ if (p_91153_ == null && this.f_91073_ == null) { p_91153_ = new TitleScreen(); } else if (p_91153_ == null && this.f_91074_.m_21224_()) { -@@ -891,6 +_,15 @@ +@@ -893,6 +_,15 @@ } } @@ -172,7 +163,7 @@ this.f_91080_ = p_91153_; BufferUploader.m_166835_(); if (p_91153_ != null) { -@@ -1019,11 +_,13 @@ +@@ -1022,11 +_,13 @@ RenderSystem.m_69481_(); this.f_91026_.m_7238_(); if (!this.f_91079_) { @@ -186,7 +177,7 @@ } if (this.f_91056_ != null) { -@@ -1129,10 +_,12 @@ +@@ -1132,10 +_,12 @@ this.f_90990_.m_85378_((double)i); if (this.f_91080_ != null) { this.f_91080_.m_6574_(this, this.f_90990_.m_85445_(), this.f_90990_.m_85446_()); @@ -199,7 +190,7 @@ this.f_91063_.m_109097_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_()); this.f_91067_.m_91599_(); } -@@ -1429,11 +_,21 @@ +@@ -1432,11 +_,21 @@ if (p_91387_ && this.f_91077_ != null && this.f_91077_.m_6662_() == HitResult.Type.BLOCK) { BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_; BlockPos blockpos = blockhitresult.m_82425_(); @@ -223,36 +214,36 @@ } } -@@ -1452,6 +_,8 @@ +@@ -1460,6 +_,8 @@ + return false; + } else { + boolean flag = false; ++ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND); ++ if (!inputEvent.isCanceled()) + switch(this.f_91077_.m_6662_()) { + case ENTITY: + this.f_91072_.m_105223_(this.f_91074_, ((EntityHitResult)this.f_91077_).m_82443_()); +@@ -1467,7 +_,7 @@ + case BLOCK: + BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_; + BlockPos blockpos = blockhitresult.m_82425_(); +- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) { ++ if (!this.f_91073_.m_46859_(blockpos)) { + this.f_91072_.m_105269_(blockpos, blockhitresult.m_82434_()); + if (this.f_91073_.m_8055_(blockpos).m_60795_()) { + flag = true; +@@ -1480,8 +_,10 @@ } - } else if (!this.f_91074_.m_108637_()) { -+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND); -+ if (!inputEvent.isCanceled()) - switch(this.f_91077_.m_6662_()) { - case ENTITY: - this.f_91072_.m_105223_(this.f_91074_, ((EntityHitResult)this.f_91077_).m_82443_()); -@@ -1459,7 +_,7 @@ - case BLOCK: - BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_; - BlockPos blockpos = blockhitresult.m_82425_(); -- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) { -+ if (!this.f_91073_.m_46859_(blockpos)) { - this.f_91072_.m_105269_(blockpos, blockhitresult.m_82434_()); - break; - } -@@ -1469,8 +_,10 @@ - } - - this.f_91074_.m_36334_(); -+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.f_91074_); - } - -+ if (inputEvent.shouldSwingHand()) - this.f_91074_.m_6674_(InteractionHand.MAIN_HAND); + this.f_91074_.m_36334_(); ++ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.f_91074_); } + ++ if (inputEvent.shouldSwingHand()) + this.f_91074_.m_6674_(InteractionHand.MAIN_HAND); + return flag; } -@@ -1485,6 +_,11 @@ +@@ -1496,6 +_,11 @@ } for(InteractionHand interactionhand : InteractionHand.values()) { @@ -264,7 +255,7 @@ ItemStack itemstack = this.f_91074_.m_21120_(interactionhand); if (this.f_91077_ != null) { switch(this.f_91077_.m_6662_()) { -@@ -1502,6 +_,7 @@ +@@ -1513,6 +_,7 @@ if (interactionresult.m_19077_()) { if (interactionresult.m_19080_()) { @@ -272,7 +263,7 @@ this.f_91074_.m_6674_(interactionhand); } -@@ -1514,6 +_,7 @@ +@@ -1525,6 +_,7 @@ InteractionResult interactionresult1 = this.f_91072_.m_105262_(this.f_91074_, this.f_91073_, interactionhand, blockhitresult); if (interactionresult1.m_19077_()) { if (interactionresult1.m_19080_()) { @@ -280,7 +271,7 @@ this.f_91074_.m_6674_(interactionhand); if (!itemstack.m_41619_() && (itemstack.m_41613_() != i || this.f_91072_.m_105290_())) { this.f_91063_.f_109055_.m_109320_(interactionhand); -@@ -1529,6 +_,9 @@ +@@ -1540,6 +_,9 @@ } } @@ -290,7 +281,7 @@ if (!itemstack.m_41619_()) { InteractionResult interactionresult2 = this.f_91072_.m_105235_(this.f_91074_, this.f_91073_, interactionhand); if (interactionresult2.m_19077_()) { -@@ -1555,6 +_,8 @@ +@@ -1566,6 +_,8 @@ --this.f_91011_; } @@ -299,7 +290,7 @@ this.f_91026_.m_6180_("gui"); this.f_91065_.m_193832_(this.f_91012_); this.f_91026_.m_7238_(); -@@ -1683,6 +_,8 @@ +@@ -1694,6 +_,8 @@ this.f_91026_.m_6182_("keyboard"); this.f_91068_.m_90931_(); this.f_91026_.m_7238_(); @@ -308,72 +299,73 @@ } private boolean m_91278_() { -@@ -1821,11 +_,12 @@ +@@ -1814,11 +_,11 @@ } public void m_91200_(String p_91201_) { -- this.m_91219_(p_91201_, RegistryAccess.m_123086_(), Minecraft::m_91133_, Minecraft::m_91135_, false, Minecraft.ExperimentalDialogType.BACKUP); -+ // We need to delay the call to RegistryAccess.builtin() as long as possible, in order to allow our world persistence hooks to run. So we pass in null here, and fix it later, only in the case where creating = false -+ this.doLoadLevel(p_91201_, null, Minecraft::m_91133_, Minecraft::m_91135_, false, Minecraft.ExperimentalDialogType.BACKUP, false); +- this.m_205205_(p_91201_, WorldStem.DataPackConfigSupplier::m_206928_, WorldStem.WorldDataSupplier::m_206954_, false, Minecraft.ExperimentalDialogType.BACKUP); ++ this.doLoadLevel(p_91201_, WorldStem.DataPackConfigSupplier::m_206928_, WorldStem.WorldDataSupplier::m_206954_, false, Minecraft.ExperimentalDialogType.BACKUP, false); } - public void m_91202_(String p_91203_, LevelSettings p_91204_, RegistryAccess.RegistryHolder p_91205_, WorldGenSettings p_91206_) { -- this.m_91219_(p_91203_, p_91205_, (p_167869_) -> { -+ this.doLoadLevel(p_91203_, p_91205_, (p_91129_) -> { - return p_91204_.m_46934_(); - }, (p_167886_, p_167887_, p_167888_, p_167889_) -> { - RegistryWriteOps registrywriteops = RegistryWriteOps.m_135767_(JsonOps.INSTANCE, p_91205_); -@@ -1835,10 +_,10 @@ - }); - WorldGenSettings worldgensettings = dataresult.resultOrPartial(Util.m_137489_("Error reading worldgen settings after loading data packs: ", f_90982_::error)).orElse(p_91206_); - return new PrimaryLevelData(p_91204_, worldgensettings, dataresult.lifecycle()); + public void m_205185_(String p_205186_, LevelSettings p_205187_, RegistryAccess p_205188_, WorldGenSettings p_205189_) { +- this.m_205205_(p_205186_, (p_210684_) -> { ++ this.doLoadLevel(p_205186_, (p_210684_) -> { + return p_205187_::m_46934_; + }, (p_210718_) -> { + return (p_210712_, p_210713_) -> { +@@ -1831,10 +_,10 @@ + WorldGenSettings worldgensettings = dataresult.getOrThrow(false, Util.m_137489_("Error reading worldgen settings after loading data packs: ", f_90982_::error)); + return Pair.of(new PrimaryLevelData(p_205187_, worldgensettings, dataresult.lifecycle()), registryaccess$writable.m_203557_()); + }; - }, false, Minecraft.ExperimentalDialogType.CREATE); + }, false, Minecraft.ExperimentalDialogType.CREATE, true); } -- private void m_91219_(String p_91220_, RegistryAccess.RegistryHolder p_91221_, Function p_91222_, Function4 p_91223_, boolean p_91224_, Minecraft.ExperimentalDialogType p_91225_) { -+ private void doLoadLevel(String p_91220_, RegistryAccess.RegistryHolder p_91221_, Function p_91222_, Function4 p_91223_, boolean p_91224_, Minecraft.ExperimentalDialogType p_91225_, boolean creating) { +- private void m_205205_(String p_205206_, Function p_205207_, Function p_205208_, boolean p_205209_, Minecraft.ExperimentalDialogType p_205210_) { ++ private void doLoadLevel(String p_205206_, Function p_205207_, Function p_205208_, boolean p_205209_, Minecraft.ExperimentalDialogType p_205210_, boolean creating) { LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess; try { - levelstoragesource$levelstorageaccess = this.f_91031_.m_78260_(p_91220_); -@@ -1850,12 +_,15 @@ - } + levelstoragesource$levelstorageaccess = this.f_91031_.m_78260_(p_205206_); +@@ -1849,11 +_,18 @@ - Minecraft.ServerStem minecraft$serverstem; -+ final RegistryAccess.RegistryHolder registryHolder; + WorldStem worldstem; try { -- minecraft$serverstem = this.m_91190_(p_91221_, p_91222_, p_91223_, p_91224_, levelstoragesource$levelstorageaccess); -+ if (!creating) levelstoragesource$levelstorageaccess.readAdditionalLevelSaveData(); ++ ++ //TODO-PATCHING: World loading has changed massively. Figure out what calls need to be delayed. ++ /*if (!creating) levelstoragesource$levelstorageaccess.readAdditionalLevelSaveData(); + registryHolder = creating ? p_91221_ : RegistryAccess.m_123086_(); + minecraft$serverstem = this.m_91190_(registryHolder, p_91222_, p_91223_, p_91224_, levelstoragesource$levelstorageaccess); ++*/ ++ + worldstem = this.m_205125_(packrepository, p_205209_, p_205207_.apply(levelstoragesource$levelstorageaccess), p_205208_.apply(levelstoragesource$levelstorageaccess)); } catch (Exception exception) { f_90982_.warn("Failed to load datapacks, can't proceed with server load", (Throwable)exception); this.m_91152_(new DatapackLoadFailureScreen(() -> { -- this.m_91219_(p_91220_, p_91221_, p_91222_, p_91223_, true, p_91225_); -+ this.doLoadLevel(p_91220_, p_91221_, p_91222_, p_91223_, true, p_91225_, creating); +- this.m_205205_(p_205206_, p_205207_, p_205208_, true, p_205210_); ++ this.doLoadLevel(p_205206_, p_205207_, p_205208_, true, p_205210_, creating); })); try { @@ -1875,7 +_,7 @@ - this.f_90999_.set((StoringChunkProgressListener)null); try { -- levelstoragesource$levelstorageaccess.m_78287_(p_91221_, worlddata); -+ levelstoragesource$levelstorageaccess.m_78287_(registryHolder, worlddata); - minecraft$serverstem.m_91433_().m_136179_(); + RegistryAccess.Frozen registryaccess$frozen = worldstem.f_206894_(); +- levelstoragesource$levelstorageaccess.m_78287_(registryaccess$frozen, worlddata); ++ levelstoragesource$levelstorageaccess.m_78287_(registryaccess$frozen, worlddata); //TODO-PATCHING: Figure out what registry access needs to be passed in here. + worldstem.m_206901_(); YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(this.f_91030_); MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService(); @@ -1885,7 +_,7 @@ SkullBlockEntity.m_196700_(gameprofilecache, minecraftsessionservice, this); GameProfileCache.m_11004_(false); - this.f_91007_ = MinecraftServer.m_129872_((p_167898_) -> { -- return new IntegratedServer(p_167898_, this, p_91221_, levelstoragesource$levelstorageaccess, minecraft$serverstem.m_91432_(), minecraft$serverstem.m_91433_(), worlddata, minecraftsessionservice, gameprofilerepository, gameprofilecache, (p_168000_) -> { -+ return new IntegratedServer(p_167898_, this, registryHolder, levelstoragesource$levelstorageaccess, minecraft$serverstem.m_91432_(), minecraft$serverstem.m_91433_(), worlddata, minecraftsessionservice, gameprofilerepository, gameprofilecache, (p_168000_) -> { - StoringChunkProgressListener storingchunkprogresslistener = new StoringChunkProgressListener(p_168000_ + 0); + this.f_91007_ = MinecraftServer.m_129872_((p_210695_) -> { +- return new IntegratedServer(p_210695_, this, levelstoragesource$levelstorageaccess, packrepository, worldstem, minecraftsessionservice, gameprofilerepository, gameprofilecache, (p_210795_) -> { ++ return new IntegratedServer(p_210695_, this, levelstoragesource$levelstorageaccess, packrepository, worldstem, minecraftsessionservice, gameprofilerepository, gameprofilecache, (p_210795_) -> { //TODO-PATCHING: Handle the registry freeze delay again. + StoringChunkProgressListener storingchunkprogresslistener = new StoringChunkProgressListener(p_210795_ + 0); this.f_90999_.set(storingchunkprogresslistener); return ProcessorChunkProgressListener.m_143583_(storingchunkprogresslistener, this.f_91023_::add); @@ -1929,11 +_,16 @@ - connection.m_129505_(new ClientHandshakePacketListenerImpl(connection, this, (Screen)null, (p_167998_) -> { + connection.m_129505_(new ClientHandshakePacketListenerImpl(connection, this, (Screen)null, (p_210793_) -> { })); connection.m_129512_(new ClientIntentionPacket(socketaddress.toString(), 0, ConnectionProtocol.LOGIN)); - connection.m_129512_(new ServerboundHelloPacket(this.m_91094_().m_92548_())); @@ -385,13 +377,13 @@ + connection.m_129512_(new ServerboundHelloPacket(gameProfile)); this.f_91009_ = connection; } else { - this.m_91143_(p_91225_, p_91220_, flag, () -> { -- this.m_91219_(p_91220_, p_91221_, p_91222_, p_91223_, p_91224_, Minecraft.ExperimentalDialogType.NONE); -+ this.doLoadLevel(p_91220_, registryHolder, p_91222_, p_91223_, p_91224_, Minecraft.ExperimentalDialogType.NONE, creating); + this.m_91143_(p_205210_, p_205206_, flag, () -> { +- this.m_205205_(p_205206_, p_205207_, p_205208_, p_205209_, Minecraft.ExperimentalDialogType.NONE); ++ this.doLoadLevel(p_205206_, p_205207_, p_205208_, p_205209_, Minecraft.ExperimentalDialogType.NONE, creating); }); - minecraft$serverstem.close(); + worldstem.close(); -@@ -2021,6 +_,7 @@ +@@ -2026,6 +_,7 @@ } public void m_91156_(ClientLevel p_91157_) { @@ -399,7 +391,7 @@ ProgressScreen progressscreen = new ProgressScreen(true); progressscreen.m_6309_(new TranslatableComponent("connect.joining")); this.m_91362_(progressscreen); -@@ -2053,10 +_,12 @@ +@@ -2058,10 +_,12 @@ IntegratedServer integratedserver = this.f_91007_; this.f_91007_ = null; this.f_91063_.m_109150_(); @@ -412,7 +404,7 @@ if (integratedserver != null) { this.f_91026_.m_6180_("waitForServer"); -@@ -2071,6 +_,7 @@ +@@ -2076,6 +_,7 @@ this.f_91065_.m_93089_(); this.f_91008_ = null; this.f_91010_ = false; @@ -420,7 +412,7 @@ this.f_91004_.m_90740_(); } -@@ -2157,66 +_,9 @@ +@@ -2162,66 +_,9 @@ private void m_91280_() { if (this.f_91077_ != null && this.f_91077_.m_6662_() != HitResult.Type.MISS) { @@ -490,7 +482,7 @@ } } -@@ -2707,7 +_,7 @@ +@@ -2713,7 +_,7 @@ return this.f_90993_; } @@ -499,7 +491,7 @@ int i = p_167938_.m_10374_(); Supplier supplier = p_167937_; if (i <= 3) { -@@ -2718,7 +_,7 @@ +@@ -2724,7 +_,7 @@ supplier = m_91352_(supplier); } @@ -508,7 +500,7 @@ } private static Supplier m_91330_(Supplier p_91331_) { -@@ -2735,6 +_,14 @@ +@@ -2741,6 +_,14 @@ public void m_91312_(int p_91313_) { this.f_91051_.m_119410_(p_91313_); diff --git a/patches/minecraft/net/minecraft/client/MouseHandler.java.patch b/patches/minecraft/net/minecraft/client/MouseHandler.java.patch index eff4a2facb..c3534811e8 100755 --- a/patches/minecraft/net/minecraft/client/MouseHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/MouseHandler.java.patch @@ -63,11 +63,11 @@ @@ -135,6 +_,7 @@ } - this.f_91518_ -= (double)f1; + this.f_91518_ -= (double)i; + if (net.minecraftforge.client.ForgeHooksClient.onMouseScroll(this, d0)) return; if (this.f_91503_.f_91074_.m_5833_()) { if (this.f_91503_.f_91065_.m_93085_().m_94768_()) { - this.f_91503_.f_91065_.m_93085_().m_94769_((double)(-f1)); + this.f_91503_.f_91065_.m_93085_().m_205380_(-i); @@ -203,7 +_,9 @@ double d2 = (p_91563_ - this.f_91507_) * (double)this.f_91503_.m_91268_().m_85445_() / (double)this.f_91503_.m_91268_().m_85443_(); double d3 = (p_91564_ - this.f_91508_) * (double)this.f_91503_.m_91268_().m_85446_() / (double)this.f_91503_.m_91268_().m_85444_(); diff --git a/patches/minecraft/net/minecraft/client/Options.java.patch b/patches/minecraft/net/minecraft/client/Options.java.patch index 50158c589b..826b04f9e0 100644 --- a/patches/minecraft/net/minecraft/client/Options.java.patch +++ b/patches/minecraft/net/minecraft/client/Options.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/Options.java +++ b/net/minecraft/client/Options.java -@@ -187,6 +_,7 @@ +@@ -188,6 +_,7 @@ public boolean f_92076_; public Options(Minecraft p_92138_, File p_92139_) { @@ -8,7 +8,7 @@ this.f_92060_ = p_92138_; this.f_92110_ = new File(p_92139_, "options.txt"); if (p_92138_.m_91103_() && Runtime.getRuntime().maxMemory() >= 1000000000L) { -@@ -300,10 +_,14 @@ +@@ -302,10 +_,14 @@ this.f_193762_ = p_168428_.m_142682_("allowServerListing", this.f_193762_); for(KeyMapping keymapping : this.f_92059_) { @@ -25,7 +25,7 @@ } } -@@ -491,6 +_,7 @@ +@@ -493,6 +_,7 @@ } public void m_92169_() { @@ -33,7 +33,7 @@ try { final PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.f_92110_), StandardCharsets.UTF_8)); -@@ -639,6 +_,23 @@ +@@ -641,6 +_,23 @@ } p_92146_.m_10509_(set); diff --git a/patches/minecraft/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch b/patches/minecraft/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch index 0e0ccb872b..548584b76a 100644 --- a/patches/minecraft/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch @@ -1,28 +1,10 @@ --- a/net/minecraft/client/gui/components/DebugScreenOverlay.java +++ b/net/minecraft/client/gui/components/DebugScreenOverlay.java -@@ -363,7 +_,7 @@ - list.add(this.m_94071_(entry)); - } - -- for(ResourceLocation resourcelocation : this.f_94030_.m_91403_().m_105148_().m_144452_(Registry.f_122901_).m_13394_(blockstate.m_60734_())) { -+ for(ResourceLocation resourcelocation : blockstate.m_60734_().getTags()) { - list.add("#" + resourcelocation); - } - } -@@ -379,7 +_,7 @@ - list.add(this.m_94071_(entry1)); - } - -- for(ResourceLocation resourcelocation1 : this.f_94030_.m_91403_().m_105148_().m_144452_(Registry.f_122899_).m_13394_(fluidstate.m_76152_())) { -+ for(ResourceLocation resourcelocation1 : fluidstate.m_76152_().getTags()) { - list.add("#" + resourcelocation1); - } - } -@@ -389,6 +_,7 @@ +@@ -399,6 +_,7 @@ list.add(""); list.add(ChatFormatting.UNDERLINE + "Targeted Entity"); list.add(String.valueOf((Object)Registry.f_122826_.m_7981_(entity.m_6095_()))); -+ entity.m_6095_().getTags().forEach(t -> list.add("#" + t)); ++ entity.m_6095_().m_204041_().m_203616_().forEach(t -> list.add("#" + t.f_203868_())); } return list; diff --git a/patches/minecraft/net/minecraft/client/gui/screens/Screen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/Screen.java.patch index 2d9a13ab37..4ee57876d2 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/Screen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/Screen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/Screen.java +++ b/net/minecraft/client/gui/screens/Screen.java -@@ -126,7 +_,7 @@ +@@ -127,7 +_,7 @@ } public void m_7379_() { @@ -9,7 +9,7 @@ } protected T m_142416_(T p_169406_) { -@@ -163,15 +_,29 @@ +@@ -164,15 +_,29 @@ this.f_169368_.clear(); } @@ -43,7 +43,7 @@ this.m_169383_(p_169389_, list, p_169392_, p_169393_); } -@@ -184,20 +_,44 @@ +@@ -185,20 +_,44 @@ } public void m_96597_(PoseStack p_96598_, List p_96599_, int p_96600_, int p_96601_) { @@ -90,7 +90,7 @@ if (k > i) { i = k; } -@@ -205,8 +_,8 @@ +@@ -206,8 +_,8 @@ j += clienttooltipcomponent.m_142103_(); } @@ -101,7 +101,7 @@ if (j2 + i > this.f_96543_) { j2 -= 28 + i; } -@@ -227,15 +_,16 @@ +@@ -228,15 +_,16 @@ RenderSystem.m_157427_(GameRenderer::m_172811_); bufferbuilder.m_166779_(VertexFormat.Mode.QUADS, DefaultVertexFormat.f_85815_); Matrix4f matrix4f = p_169384_.m_85850_().m_85861_(); @@ -127,7 +127,7 @@ RenderSystem.m_69482_(); RenderSystem.m_69472_(); RenderSystem.m_69478_(); -@@ -250,7 +_,7 @@ +@@ -251,7 +_,7 @@ for(int i2 = 0; i2 < p_169385_.size(); ++i2) { ClientTooltipComponent clienttooltipcomponent1 = p_169385_.get(i2); @@ -136,7 +136,7 @@ l1 += clienttooltipcomponent1.m_142103_() + (i2 == 0 ? 2 : 0); } -@@ -260,7 +_,7 @@ +@@ -261,7 +_,7 @@ for(int l2 = 0; l2 < p_169385_.size(); ++l2) { ClientTooltipComponent clienttooltipcomponent2 = p_169385_.get(l2); @@ -145,7 +145,7 @@ l1 += clienttooltipcomponent2.m_142103_() + (l2 == 0 ? 2 : 0); } -@@ -354,9 +_,12 @@ +@@ -355,9 +_,12 @@ } public void m_96612_(String p_96613_, boolean p_96614_) { @@ -158,7 +158,7 @@ this.f_96541_.f_91074_.m_108739_(p_96613_); } -@@ -367,11 +_,21 @@ +@@ -368,11 +_,21 @@ this.f_96547_ = p_96607_.f_91062_; this.f_96543_ = p_96608_; this.f_96544_ = p_96609_; @@ -180,7 +180,7 @@ } public List m_6702_() { -@@ -394,6 +_,7 @@ +@@ -395,6 +_,7 @@ public void m_96558_(PoseStack p_96559_, int p_96560_) { if (this.f_96541_.f_91073_ != null) { this.m_93179_(p_96559_, 0, 0, this.f_96543_, this.f_96544_, -1072689136, -804253680); @@ -188,7 +188,7 @@ } else { this.m_96626_(p_96560_); } -@@ -413,6 +_,7 @@ +@@ -414,6 +_,7 @@ bufferbuilder.m_5483_((double)this.f_96543_, 0.0D, 0.0D).m_7421_((float)this.f_96543_ / 32.0F, (float)p_96627_).m_6122_(64, 64, 64, 255).m_5752_(); bufferbuilder.m_5483_(0.0D, 0.0D, 0.0D).m_7421_(0.0F, (float)p_96627_).m_6122_(64, 64, 64, 255).m_5752_(); tesselator.m_85914_(); @@ -196,7 +196,7 @@ } public boolean m_7043_() { -@@ -498,6 +_,10 @@ +@@ -499,6 +_,10 @@ } public void m_7400_(List p_96591_) { diff --git a/patches/minecraft/net/minecraft/client/gui/screens/TitleScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/TitleScreen.java.patch index 5272a7e285..acd4dcb64a 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/TitleScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/TitleScreen.java.patch @@ -1,48 +1,48 @@ --- a/net/minecraft/client/gui/screens/TitleScreen.java +++ b/net/minecraft/client/gui/screens/TitleScreen.java -@@ -64,6 +_,7 @@ - private final PanoramaRenderer f_96729_ = new PanoramaRenderer(f_96716_); - private final boolean f_96714_; - private long f_96715_; +@@ -73,6 +_,7 @@ + private TitleScreen.Warning32Bit f_210857_; + private RealmsClient f_210858_; + private boolean f_210859_ = false; + private net.minecraftforge.client.gui.NotificationModUpdateScreen modUpdateNotification; public TitleScreen() { this(false); -@@ -107,11 +_,16 @@ - this.f_96728_ = this.f_96543_ - this.f_96727_ - 2; - int i = 24; - int j = this.f_96544_ / 4 + 48; +@@ -131,11 +_,16 @@ + int j = this.f_96543_ - i - 2; + int k = 24; + int l = this.f_96544_ / 4 + 48; + Button modButton = null; if (this.f_96541_.m_91402_()) { - this.m_96772_(j, 24); + this.m_96772_(l, 24); } else { - this.m_96763_(j, 24); -+ modButton = this.m_142416_(new Button(this.f_96543_ / 2 - 100, j + 24 * 2, 98, 20, new TranslatableComponent("fml.menu.mods"), button -> { + this.m_96763_(l, 24); ++ modButton = this.m_142416_(new Button(this.f_96543_ / 2 - 100, l + 24 * 2, 98, 20, new TranslatableComponent("fml.menu.mods"), button -> { + this.f_96541_.m_91152_(new net.minecraftforge.client.gui.ModListScreen(this)); + })); } + modUpdateNotification = net.minecraftforge.client.gui.NotificationModUpdateScreen.init(this, modButton); - this.m_142416_(new ImageButton(this.f_96543_ / 2 - 124, j + 72 + 12, 20, 20, 0, 106, 20, Button.f_93617_, 256, 256, (p_96791_) -> { + this.m_142416_(new ImageButton(this.f_96543_ / 2 - 124, l + 72 + 12, 20, 20, 0, 106, 20, Button.f_93617_, 256, 256, (p_96791_) -> { this.f_96541_.m_91152_(new LanguageSelectScreen(this, this.f_96541_.f_91066_, this.f_96541_.m_91102_())); -@@ -159,7 +_,7 @@ +@@ -201,7 +_,7 @@ Screen screen = (Screen)(this.f_96541_.f_91066_.f_92083_ ? new JoinMultiplayerScreen(this) : new SafetyScreen(this)); this.f_96541_.m_91152_(screen); }, button$ontooltip))).f_93623_ = flag; -- (this.m_142416_(new Button(this.f_96543_ / 2 - 100, p_96764_ + p_96765_ * 2, 200, 20, new TranslatableComponent("menu.online"), (p_96776_) -> { +- (this.m_142416_(new Button(this.f_96543_ / 2 - 100, p_96764_ + p_96765_ * 2, 200, 20, new TranslatableComponent("menu.online"), (p_211788_) -> { + (this.m_142416_(new Button(this.f_96543_ / 2 + 2, p_96764_ + p_96765_ * 2, 98, 20, new TranslatableComponent("menu.online"), (p_96771_) -> { this.m_96793_(); }, button$ontooltip))).f_93623_ = flag; } -@@ -284,6 +_,7 @@ +@@ -331,6 +_,7 @@ + this.f_210857_.f_210875_.m_6514_(p_96739_, this.f_210857_.f_210876_, this.f_210857_.f_210877_, 9, 16777215 | l); + } - RenderSystem.m_157456_(0, f_96724_); - m_93133_(p_96739_, j + 88, 67, 0.0F, 0.0F, 98, 14, 128, 16); + net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_96739_, this.f_96547_, this.f_96543_, this.f_96544_, l); if (this.f_96721_ != null) { p_96739_.m_85836_(); p_96739_.m_85837_((double)(this.f_96543_ / 2 + 90), 70.0D, 0.0D); -@@ -306,7 +_,14 @@ +@@ -353,7 +_,14 @@ s = s + I18n.m_118938_("menu.modded"); } @@ -55,10 +55,10 @@ + m_93236_(p_96739_, this.f_96547_, brd, this.f_96543_ - f_96547_.m_92895_(brd), this.f_96544_ - (10 + (brdline + 1) * ( this.f_96547_.f_92710_ + 1)), 16777215 | l) + ); + - m_93236_(p_96739_, this.f_96547_, "Copyright Mojang AB. Do not distribute!", this.f_96728_, this.f_96544_ - 10, 16777215 | l); - if (p_96740_ > this.f_96728_ && p_96740_ < this.f_96728_ + this.f_96727_ && p_96741_ > this.f_96544_ - 10 && p_96741_ < this.f_96544_) { - m_93172_(p_96739_, this.f_96728_, this.f_96544_ - 1, this.f_96728_ + this.f_96727_, this.f_96544_, 16777215 | l); -@@ -322,6 +_,7 @@ + + for(GuiEventListener guieventlistener : this.m_6702_()) { + if (guieventlistener instanceof AbstractWidget) { +@@ -365,6 +_,7 @@ if (this.m_96789_() && f1 >= 1.0F) { this.f_96726_.m_6305_(p_96739_, p_96740_, p_96741_, p_96742_); } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch index 55dc986629..8e2cd08af5 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java +++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java -@@ -91,6 +_,7 @@ +@@ -90,6 +_,7 @@ int i = this.f_97735_; int j = this.f_97736_; this.m_7286_(p_97795_, p_97798_, p_97796_, p_97797_); @@ -8,7 +8,7 @@ RenderSystem.m_69465_(); super.m_6305_(p_97795_, p_97796_, p_97797_, p_97798_); PoseStack posestack = RenderSystem.m_157191_(); -@@ -112,11 +_,12 @@ +@@ -111,11 +_,12 @@ this.f_97734_ = slot; int l = slot.f_40220_; int i1 = slot.f_40221_; @@ -22,7 +22,7 @@ ItemStack itemstack = this.f_97711_.m_41619_() ? this.f_97732_.m_142621_() : this.f_97711_; if (!itemstack.m_41619_()) { int l1 = 8; -@@ -156,9 +_,13 @@ +@@ -155,9 +_,13 @@ } public static void m_169606_(PoseStack p_169607_, int p_169608_, int p_169609_, int p_169610_) { @@ -37,7 +37,7 @@ RenderSystem.m_69444_(true, true, true, true); RenderSystem.m_69482_(); } -@@ -176,8 +_,10 @@ +@@ -175,8 +_,10 @@ RenderSystem.m_157182_(); this.m_93250_(200); this.f_96542_.f_115093_ = 200.0F; @@ -49,7 +49,7 @@ this.m_93250_(0); this.f_96542_.f_115093_ = 0.0F; } -@@ -287,7 +_,8 @@ +@@ -286,7 +_,8 @@ if (super.m_6375_(p_97748_, p_97749_, p_97750_)) { return true; } else { @@ -59,7 +59,7 @@ Slot slot = this.m_97744_(p_97748_, p_97749_); long i = Util.m_137550_(); this.f_97723_ = this.f_97709_ == slot && i - this.f_97721_ < 250L && this.f_97722_ == p_97750_; -@@ -298,6 +_,7 @@ +@@ -297,6 +_,7 @@ int j = this.f_97735_; int k = this.f_97736_; boolean flag1 = this.m_7467_(p_97748_, p_97749_, j, k, p_97750_); @@ -67,7 +67,7 @@ int l = -1; if (slot != null) { l = slot.f_40219_; -@@ -323,7 +_,7 @@ +@@ -322,7 +_,7 @@ } } else if (!this.f_97738_) { if (this.f_97732_.m_142621_().m_41619_()) { @@ -76,7 +76,7 @@ this.m_6597_(slot, l, p_97750_, ClickType.CLONE); } else { boolean flag2 = l != -999 && (InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 340) || InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 344)); -@@ -347,7 +_,7 @@ +@@ -346,7 +_,7 @@ this.f_97717_ = 0; } else if (p_97750_ == 1) { this.f_97717_ = 1; @@ -85,7 +85,7 @@ this.f_97717_ = 2; } } -@@ -416,10 +_,13 @@ +@@ -415,10 +_,13 @@ } public boolean m_6348_(double p_97812_, double p_97813_, int p_97814_) { @@ -99,7 +99,7 @@ int k = -1; if (slot != null) { k = slot.f_40219_; -@@ -433,7 +_,7 @@ +@@ -432,7 +_,7 @@ if (m_96638_()) { if (!this.f_97724_.m_41619_()) { for(Slot slot2 : this.f_97732_.f_38839_) { @@ -108,7 +108,7 @@ this.m_6597_(slot2, slot2.f_40219_, p_97814_, ClickType.QUICK_MOVE); } } -@@ -497,7 +_,7 @@ +@@ -496,7 +_,7 @@ this.m_6597_((Slot)null, -999, AbstractContainerMenu.m_38930_(2, this.f_97717_), ClickType.QUICK_CRAFT); } else if (!this.f_97732_.m_142621_().m_41619_()) { @@ -117,7 +117,7 @@ this.m_6597_(slot, k, p_97814_, ClickType.CLONE); } else { boolean flag1 = k != -999 && (InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 340) || InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 344)); -@@ -539,34 +_,39 @@ +@@ -538,34 +_,39 @@ } public boolean m_7933_(int p_97765_, int p_97766_, int p_97767_) { @@ -164,7 +164,7 @@ this.m_6597_(this.f_97734_, this.f_97734_.f_40219_, i, ClickType.SWAP); return true; } -@@ -601,6 +_,18 @@ +@@ -600,6 +_,18 @@ public T m_6262_() { return this.f_97732_; diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch index 02a7b071c7..457f30e45a 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java +++ b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java -@@ -74,6 +_,8 @@ +@@ -73,6 +_,8 @@ private Slot f_98512_; private CreativeInventoryListener f_98513_; private boolean f_98514_; + private static int tabPage = 0; + private int maxPages = 0; private boolean f_98515_; - private final Map> f_98516_ = Maps.newTreeMap(); + private final Set> f_98516_ = new HashSet<>(); -@@ -233,6 +_,12 @@ +@@ -232,6 +_,12 @@ protected void m_7856_() { if (this.f_96541_.f_91072_.m_105290_()) { super.m_7856_(); @@ -22,7 +22,7 @@ this.f_96541_.f_91068_.m_90926_(true); this.f_98510_ = new EditBox(this.f_96547_, this.f_97735_ + 82, this.f_97736_ + 6, 80, 9, new TranslatableComponent("itemGroup.search")); this.f_98510_.m_94199_(50); -@@ -274,7 +_,7 @@ +@@ -273,7 +_,7 @@ public boolean m_5534_(char p_98521_, int p_98522_) { if (this.f_98514_) { return false; @@ -31,7 +31,7 @@ return false; } else { String s = this.f_98510_.m_94155_(); -@@ -292,7 +_,7 @@ +@@ -291,7 +_,7 @@ public boolean m_7933_(int p_98547_, int p_98548_, int p_98549_) { this.f_98514_ = false; @@ -40,7 +40,7 @@ if (this.f_96541_.f_91066_.f_92098_.m_90832_(p_98547_, p_98548_)) { this.f_98514_ = true; this.m_98560_(CreativeModeTab.f_40754_); -@@ -329,6 +_,32 @@ +@@ -328,6 +_,32 @@ private void m_98630_() { (this.f_97732_).f_98639_.clear(); this.f_98516_.clear(); @@ -73,7 +73,7 @@ String s = this.f_98510_.m_94155_(); if (s.isEmpty()) { for(Item item : Registry.f_122827_) { -@@ -374,9 +_,9 @@ +@@ -372,9 +_,9 @@ protected void m_7027_(PoseStack p_98616_, int p_98617_, int p_98618_) { CreativeModeTab creativemodetab = CreativeModeTab.f_40748_[f_98507_]; @@ -85,7 +85,7 @@ } } -@@ -387,7 +_,7 @@ +@@ -385,7 +_,7 @@ double d1 = p_98532_ - (double)this.f_97736_; for(CreativeModeTab creativemodetab : CreativeModeTab.f_40748_) { @@ -94,7 +94,7 @@ return true; } } -@@ -408,7 +_,7 @@ +@@ -406,7 +_,7 @@ this.f_98509_ = false; for(CreativeModeTab creativemodetab : CreativeModeTab.f_40748_) { @@ -103,7 +103,7 @@ this.m_98560_(creativemodetab); return true; } -@@ -419,12 +_,15 @@ +@@ -417,12 +_,15 @@ } private boolean m_98631_() { @@ -119,7 +119,7 @@ this.f_97737_.clear(); (this.f_97732_).f_98639_.clear(); if (p_98561_ == CreativeModeTab.f_40760_) { -@@ -501,13 +_,15 @@ +@@ -499,13 +_,15 @@ } if (this.f_98510_ != null) { @@ -136,7 +136,7 @@ this.m_98630_(); } else { -@@ -567,16 +_,34 @@ +@@ -565,16 +_,34 @@ this.m_7333_(p_98577_); super.m_6305_(p_98577_, p_98578_, p_98579_, p_98580_); @@ -173,7 +173,7 @@ RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F); this.m_7025_(p_98577_, p_98578_, p_98579_); } -@@ -611,7 +_,7 @@ +@@ -609,7 +_,7 @@ list1.add(1, creativemodetab.m_40786_().m_6881_().m_130940_(ChatFormatting.BLUE)); } @@ -182,7 +182,7 @@ } else { super.m_6057_(p_98590_, p_98591_, p_98592_, p_98593_); } -@@ -622,16 +_,32 @@ +@@ -620,16 +_,32 @@ RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F); CreativeModeTab creativemodetab = CreativeModeTab.f_40748_[f_98507_]; @@ -219,7 +219,7 @@ this.m_93228_(p_98572_, this.f_97735_, this.f_97736_, 0, 0, this.f_97726_, this.f_97727_); this.f_98510_.m_6305_(p_98572_, p_98574_, p_98575_, p_98573_); RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F); -@@ -639,11 +_,14 @@ +@@ -637,11 +_,14 @@ int j = this.f_97736_ + 18; int k = j + 112; RenderSystem.m_157427_(GameRenderer::m_172817_); @@ -235,7 +235,7 @@ this.m_98581_(p_98572_, creativemodetab); if (creativemodetab == CreativeModeTab.f_40761_) { InventoryScreen.m_98850_(this.f_97735_ + 88, this.f_97736_ + 45, 20, (float)(this.f_97735_ + 88 - p_98574_), (float)(this.f_97736_ + 45 - 30 - p_98575_), this.f_96541_.f_91074_); -@@ -652,6 +_,7 @@ +@@ -650,6 +_,7 @@ } protected boolean m_98562_(CreativeModeTab p_98563_, double p_98564_, double p_98565_) { @@ -243,7 +243,7 @@ int i = p_98563_.m_40793_(); int j = 28 * i; int k = 0; -@@ -720,6 +_,7 @@ +@@ -718,6 +_,7 @@ i1 += this.f_97727_ - 4; } @@ -251,7 +251,7 @@ this.m_93228_(p_98582_, l, i1, j, k, 28, 32); this.f_96542_.f_115093_ = 100.0F; l += 6; -@@ -909,6 +_,22 @@ +@@ -907,6 +_,22 @@ public boolean m_8010_(Player p_98665_) { return this.f_98655_.m_8010_(p_98665_); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch index e0215339a6..97391bc335 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java +++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java -@@ -116,7 +_,7 @@ +@@ -106,7 +_,7 @@ - public static CreateWorldScreen m_100898_(@Nullable Screen p_100899_) { - RegistryAccess.RegistryHolder registryaccess$registryholder = RegistryAccess.m_123086_(); -- return new CreateWorldScreen(p_100899_, DataPackConfig.f_45842_, new WorldGenSettingsComponent(registryaccess$registryholder, WorldGenSettings.m_190050_(registryaccess$registryholder), Optional.of(WorldPreset.f_101506_), OptionalLong.empty())); -+ return new CreateWorldScreen(p_100899_, DataPackConfig.f_45842_, new WorldGenSettingsComponent(registryaccess$registryholder, net.minecraftforge.client.ForgeHooksClient.getDefaultWorldPreset().map(type -> type.m_7012_(registryaccess$registryholder, new java.util.Random().nextLong(), true, false)).orElseGet(() -> WorldGenSettings.m_190050_(registryaccess$registryholder)), net.minecraftforge.client.ForgeHooksClient.getDefaultWorldPreset(), OptionalLong.empty())); + public static CreateWorldScreen m_205424_(@Nullable Screen p_205425_) { + RegistryAccess.Frozen registryaccess$frozen = RegistryAccess.f_123049_.get(); +- return new CreateWorldScreen(p_205425_, DataPackConfig.f_45842_, new WorldGenSettingsComponent(registryaccess$frozen, WorldGenSettings.m_190050_(registryaccess$frozen), Optional.of(WorldPreset.f_101506_), OptionalLong.empty())); ++ return new CreateWorldScreen(p_205425_, DataPackConfig.f_45842_, new WorldGenSettingsComponent(registryaccess$frozen, net.minecraftforge.client.ForgeHooksClient.getDefaultWorldPreset().map(type -> type.m_205485_(registryaccess$frozen, new java.util.Random().nextLong(), true, false)).orElseGet(() -> WorldGenSettings.m_190050_(registryaccess$frozen)), net.minecraftforge.client.ForgeHooksClient.getDefaultWorldPreset(), OptionalLong.empty())); } - private CreateWorldScreen(@Nullable Screen p_100861_, DataPackConfig p_100862_, WorldGenSettingsComponent p_100863_) { -@@ -595,6 +_,7 @@ + public static CreateWorldScreen m_205426_(@Nullable Screen p_205427_, WorldStem p_205428_, @Nullable Path p_205429_) { +@@ -625,6 +_,7 @@ File file1 = path.toFile(); if (this.f_100832_ == null) { this.f_100832_ = new PackRepository(PackType.SERVER_DATA, new ServerPacksSource(), new FolderRepositorySource(file1, PackSource.f_10527_)); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.java.patch index 329922f6ea..b69f42adc0 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldGenSettingsComponent.java -@@ -113,6 +_,7 @@ +@@ -107,6 +_,7 @@ this.f_170244_.f_93624_ = false; this.f_101391_ = p_101430_.m_142416_(new Button(j, 120, 150, 20, new TranslatableComponent("selectWorld.customizeType"), (p_170248_) -> { WorldPreset.PresetEditor worldpreset$preseteditor = WorldPreset.f_101509_.get(this.f_101395_); @@ -8,7 +8,7 @@ if (worldpreset$preseteditor != null) { p_101431_.m_91152_(worldpreset$preseteditor.m_101642_(p_101430_, this.f_101394_)); } -@@ -283,7 +_,7 @@ +@@ -273,7 +_,7 @@ } else { this.f_101389_.f_93624_ = p_170288_; this.f_101380_.f_93624_ = p_170288_; diff --git a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldPreset.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldPreset.java.patch index a2a3df0ad0..a4680d8718 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldPreset.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldPreset.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/worldselection/WorldPreset.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldPreset.java -@@ -83,6 +_,9 @@ +@@ -93,6 +_,9 @@ WorldPreset(String p_101519_) { this.f_101516_ = new TranslatableComponent("generator." + p_101519_); } @@ -8,9 +8,9 @@ + this.f_101516_ = displayName; + } - private static WorldGenSettings m_101549_(RegistryAccess p_101550_, WorldGenSettings p_101551_, WorldPreset p_101552_, Biome p_101553_) { - BiomeSource biomesource = new FixedBiomeSource(p_101553_); -@@ -125,4 +_,8 @@ + private static WorldGenSettings m_205493_(RegistryAccess p_205494_, WorldGenSettings p_205495_, Holder p_205496_) { + BiomeSource biomesource = new FixedBiomeSource(p_205496_); +@@ -134,4 +_,8 @@ public interface PresetEditor { Screen m_101642_(CreateWorldScreen p_101643_, WorldGenSettings p_101644_); } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkCache.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkCache.java.patch index 4872fc1ba3..878d20f572 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkCache.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientChunkCache.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/multiplayer/ClientChunkCache.java +++ b/net/minecraft/client/multiplayer/ClientChunkCache.java -@@ -59,6 +_,7 @@ +@@ -60,6 +_,7 @@ int i = this.f_104410_.m_104481_(p_104456_, p_104457_); LevelChunk levelchunk = this.f_104410_.m_104479_(i); if (m_104438_(levelchunk, p_104456_, p_104457_)) { @@ -8,7 +8,7 @@ this.f_104410_.m_104487_(i, levelchunk, (LevelChunk)null); } -@@ -99,6 +_,7 @@ +@@ -100,6 +_,7 @@ } this.f_104411_.m_171649_(chunkpos); diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch index 742219869c..ac0e6033c9 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/client/multiplayer/ClientLevel.java +++ b/net/minecraft/client/multiplayer/ClientLevel.java -@@ -130,6 +_,8 @@ - this.f_194123_ = p_194134_; +@@ -129,6 +_,8 @@ + this.f_194123_ = p_205510_; this.m_46465_(); this.m_46466_(); + this.gatherCapabilities(); @@ -9,7 +9,7 @@ } public void m_194171_(Runnable p_194172_) { -@@ -216,6 +_,7 @@ +@@ -215,6 +_,7 @@ this.m_46473_().m_6521_(() -> { return Registry.f_122826_.m_7981_(p_104640_.m_6095_()).toString(); }); @@ -17,7 +17,7 @@ p_104640_.m_8119_(); this.m_46473_().m_7238_(); -@@ -278,8 +_,10 @@ +@@ -277,8 +_,10 @@ } private void m_104739_(int p_104740_, Entity p_104741_) { @@ -28,7 +28,7 @@ } public void m_171642_(int p_171643_, Entity.RemovalReason p_171644_) { -@@ -410,6 +_,11 @@ +@@ -409,6 +_,11 @@ } public void m_6263_(@Nullable Player p_104645_, double p_104646_, double p_104647_, double p_104648_, SoundEvent p_104649_, SoundSource p_104650_, float p_104651_, float p_104652_) { @@ -40,7 +40,7 @@ if (p_104645_ == this.f_104565_.f_91074_) { this.m_7785_(p_104646_, p_104647_, p_104648_, p_104649_, p_104650_, p_104651_, p_104652_, false); } -@@ -417,6 +_,11 @@ +@@ -416,6 +_,11 @@ } public void m_6269_(@Nullable Player p_104659_, Entity p_104660_, SoundEvent p_104661_, SoundSource p_104662_, float p_104663_, float p_104664_) { @@ -52,7 +52,7 @@ if (p_104659_ == this.f_104565_.f_91074_) { this.f_104565_.m_91106_().m_120367_(new EntityBoundSoundInstance(p_104661_, p_104662_, p_104663_, p_104664_, p_104660_)); } -@@ -879,6 +_,7 @@ +@@ -870,6 +_,7 @@ } public void m_104851_(Difficulty p_104852_) { @@ -60,7 +60,7 @@ this.f_104840_ = p_104852_; } -@@ -921,6 +_,9 @@ +@@ -912,6 +_,9 @@ public void m_141981_(Entity p_171716_) { p_171716_.m_19877_(); ClientLevel.this.f_104566_.remove(p_171716_); diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch index 0505658f70..dd9af031f1 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/multiplayer/ClientPacketListener.java +++ b/net/minecraft/client/multiplayer/ClientPacketListener.java -@@ -357,6 +_,7 @@ +@@ -360,6 +_,7 @@ this.f_104888_.f_91064_.m_113434_(); this.f_104888_.f_91074_.m_172530_(); @@ -8,7 +8,7 @@ int i = p_105030_.f_132360_(); this.f_104888_.f_91074_.m_20234_(i); this.f_104889_.m_104630_(i, this.f_104888_.f_91074_); -@@ -368,6 +_,7 @@ +@@ -371,6 +_,7 @@ this.f_104888_.f_91074_.m_108711_(p_105030_.f_132372_()); this.f_104888_.f_91072_.m_171805_(p_105030_.f_132363_(), p_105030_.f_132364_()); this.f_104888_.f_91066_.m_193770_(p_105030_.f_132370_()); @@ -16,7 +16,7 @@ this.f_104888_.f_91066_.m_92172_(); this.f_104885_.m_129512_(new ServerboundCustomPayloadPacket(ServerboundCustomPayloadPacket.f_133979_, (new FriendlyByteBuf(Unpooled.buffer())).m_130070_(ClientBrandRetriever.m_129629_()))); this.f_104888_.m_91309_().m_90739_(); -@@ -715,7 +_,9 @@ +@@ -712,7 +_,9 @@ public void m_5784_(ClientboundChatPacket p_104986_) { PacketUtils.m_131363_(p_104986_, this, this.f_104888_); @@ -27,7 +27,7 @@ } public void m_7791_(ClientboundAnimatePacket p_104968_) { -@@ -886,8 +_,10 @@ +@@ -894,8 +_,10 @@ localplayer1.m_21204_().m_22159_(localplayer.m_21204_()); } @@ -38,19 +38,19 @@ this.f_104889_.m_104630_(i, localplayer1); localplayer1.m_146922_(-180.0F); localplayer1.f_108618_ = new KeyboardInput(this.f_104888_.f_91066_); -@@ -990,10 +_,7 @@ +@@ -998,10 +_,7 @@ PacketUtils.m_131363_(p_104976_, this, this.f_104888_); BlockPos blockpos = p_104976_.m_131704_(); - this.f_104888_.f_91073_.m_141902_(blockpos, p_104976_.m_195645_()).ifPresent((p_194239_) -> { + this.f_104888_.f_91073_.m_141902_(blockpos, p_104976_.m_195645_()).ifPresent((p_205557_) -> { - CompoundTag compoundtag = p_104976_.m_131708_(); - if (compoundtag != null) { -- p_194239_.m_142466_(compoundtag); +- p_205557_.m_142466_(compoundtag); - } -+ p_194239_.onDataPacket(f_104885_, p_104976_); ++ p_205557_.onDataPacket(f_104885_, p_104976_); - if (p_194239_ instanceof CommandBlockEntity && this.f_104888_.f_91080_ instanceof CommandBlockEditScreen) { + if (p_205557_ instanceof CommandBlockEntity && this.f_104888_.f_91080_ instanceof CommandBlockEditScreen) { ((CommandBlockEditScreen)this.f_104888_.f_91080_).m_98398_(); -@@ -1139,6 +_,7 @@ +@@ -1147,6 +_,7 @@ public void m_7443_(ClientboundCommandsPacket p_104990_) { PacketUtils.m_131363_(p_104990_, this, this.f_104888_); this.f_104899_ = new CommandDispatcher<>(p_104990_.m_131884_()); @@ -58,7 +58,7 @@ } public void m_7183_(ClientboundStopSoundPacket p_105116_) { -@@ -1160,6 +_,7 @@ +@@ -1168,6 +_,7 @@ clientrecipebook.m_90625_(this.f_104900_.m_44051_()); clientrecipebook.m_90639_().forEach(mutablesearchtree::m_8080_); mutablesearchtree.m_7729_(); @@ -66,24 +66,24 @@ } public void m_7244_(ClientboundPlayerLookAtPacket p_105054_) { -@@ -1237,7 +_,7 @@ +@@ -1245,7 +_,7 @@ PacketUtils.m_131363_(p_105130_, this, this.f_104888_); Entity entity = this.f_104889_.m_6815_(p_105130_.m_133622_()); if (entity instanceof LivingEntity) { -- MobEffect mobeffect = MobEffect.m_19453_(p_105130_.m_133623_()); -+ MobEffect mobeffect = MobEffect.m_19453_(p_105130_.m_133623_() & 0xFF); +- MobEffect mobeffect = MobEffect.m_19453_(p_105130_.m_211135_()); ++ MobEffect mobeffect = MobEffect.m_19453_(p_105130_.m_211135_() & 0xFF); if (mobeffect != null) { MobEffectInstance mobeffectinstance = new MobEffectInstance(mobeffect, p_105130_.m_133625_(), p_105130_.m_133624_(), p_105130_.m_133627_(), p_105130_.m_133626_(), p_105130_.m_133628_()); mobeffectinstance.m_19562_(p_105130_.m_133619_()); -@@ -1254,6 +_,7 @@ - f_104883_.warn("Incomplete server tags, disconnecting. Missing: {}", (Object)multimap); - this.f_104885_.m_129507_(new TranslatableComponent("multiplayer.disconnect.missing_tags")); - } else { -+ tagcontainer = net.minecraftforge.common.ForgeTagHandler.reinjectOptionalTags(tagcontainer); - this.f_104895_ = tagcontainer; - if (!this.f_104885_.m_129531_()) { - tagcontainer.m_13431_(); -@@ -1803,7 +_,8 @@ +@@ -1262,6 +_,7 @@ + } + + this.f_104888_.m_91171_(SearchRegistry.f_119942_).m_7729_(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this.f_104903_)); + } + + private void m_205560_(ResourceKey> p_205561_, TagNetworkSerialization.NetworkPayload p_205562_) { +@@ -1815,7 +_,8 @@ int i5 = friendlybytebuf.m_130242_(); this.f_104888_.f_91064_.f_173815_.m_173830_(positionsource, i5); } else { diff --git a/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch b/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch index cfd6f753f0..6910353f99 100644 --- a/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/player/LocalPlayer.java +++ b/net/minecraft/client/player/LocalPlayer.java -@@ -144,6 +_,7 @@ +@@ -145,6 +_,7 @@ } public boolean m_6469_(DamageSource p_108662_, float p_108663_) { @@ -8,7 +8,7 @@ return false; } -@@ -466,6 +_,11 @@ +@@ -461,6 +_,11 @@ } public void m_5496_(SoundEvent p_108651_, float p_108652_, float p_108653_) { @@ -20,7 +20,7 @@ this.f_19853_.m_7785_(this.m_20185_(), this.m_20186_(), this.m_20189_(), p_108651_, this.m_5720_(), p_108652_, p_108653_, false); } -@@ -621,6 +_,7 @@ +@@ -616,6 +_,7 @@ boolean flag2 = this.m_108733_(); this.f_108601_ = !this.m_150110_().f_35935_ && !this.m_6069_() && this.m_20175_(Pose.CROUCHING) && (this.m_6144_() || !this.m_5803_() && !this.m_20175_(Pose.STANDING)); this.f_108618_.m_7606_(this.m_108635_()); @@ -28,7 +28,7 @@ this.f_108619_.m_91301_().m_120586_(this.f_108618_); if (this.m_6117_() && !this.m_20159_()) { this.f_108618_.f_108566_ *= 0.2F; -@@ -693,7 +_,7 @@ +@@ -688,7 +_,7 @@ if (this.f_108618_.f_108572_ && !flag7 && !flag && !this.m_150110_().f_35935_ && !this.m_20159_() && !this.m_6147_()) { ItemStack itemstack = this.m_6844_(EquipmentSlot.CHEST); @@ -37,7 +37,7 @@ this.f_108617_.m_104955_(new ServerboundPlayerCommandPacket(this, ServerboundPlayerCommandPacket.Action.START_FALL_FLYING)); } } -@@ -811,6 +_,7 @@ +@@ -806,6 +_,7 @@ public void m_6083_() { super.m_6083_(); @@ -45,7 +45,7 @@ this.f_108611_ = false; if (this.m_20202_() instanceof Boat) { Boat boat = (Boat)this.m_20202_(); -@@ -1024,6 +_,18 @@ +@@ -1019,6 +_,18 @@ } else { return super.m_7398_(p_108758_); } diff --git a/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch index 2b9cebf8b1..edc1685c7c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/FogRenderer.java +++ b/net/minecraft/client/renderer/FogRenderer.java -@@ -171,21 +_,40 @@ +@@ -173,24 +_,42 @@ if (f_109010_ != 0.0F && f_109011_ != 0.0F && f_109012_ != 0.0F) { float f8 = Math.min(1.0F / f_109010_, Math.min(1.0F / f_109011_, 1.0F / f_109012_)); @@ -33,20 +33,22 @@ + public static void setupFog(Camera p_109025_, FogRenderer.FogMode p_109026_, float p_109027_, boolean p_109028_, float partialTicks) { FogType fogtype = p_109025_.m_167685_(); Entity entity = p_109025_.m_90592_(); -+ // TODO + FogShape fogshape = FogShape.SPHERE; + float f; + float f1; + float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(p_109026_, p_109025_, partialTicks, 0.1F); + if (hook >= 0) { -+ RenderSystem.m_157445_(-8.0F); -+ RenderSystem.m_157443_(hook * 0.5F); ++ f = -8.0f; ++ f1 = hook * 0.5F; + } else - if (fogtype == FogType.WATER) { - float f = 192.0F; - if (entity instanceof LocalPlayer) { -@@ -245,6 +_,7 @@ - - RenderSystem.m_157445_(f2); - RenderSystem.m_157443_(f3); -+ net.minecraftforge.client.ForgeHooksClient.onFogRender(p_109026_, p_109025_, partialTicks, f3); - } - + if (fogtype == FogType.LAVA) { + if (entity.m_5833_()) { + f = -8.0F; +@@ -253,6 +_,7 @@ + RenderSystem.m_157445_(f); + RenderSystem.m_157443_(f1); + RenderSystem.m_202160_(fogshape); ++ net.minecraftforge.client.ForgeHooksClient.onFogRender(p_109026_, p_109025_, partialTicks, f1); } + + public static void m_109036_() { diff --git a/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch index 9f9a446786..6f385c1775 100644 --- a/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/GameRenderer.java +++ b/net/minecraft/client/renderer/GameRenderer.java -@@ -286,6 +_,8 @@ +@@ -288,6 +_,8 @@ this.m_109128_(new ResourceLocation("shaders/post/spider.json")); } else if (p_109107_ instanceof EnderMan) { this.m_109128_(new ResourceLocation("shaders/post/invert.json")); @@ -9,7 +9,7 @@ } } -@@ -542,6 +_,7 @@ +@@ -544,6 +_,7 @@ list1.add(Pair.of(new ShaderInstance(p_172768_, "rendertype_crumbling", DefaultVertexFormat.f_85811_), (p_172733_) -> { f_172607_ = p_172733_; })); @@ -17,7 +17,7 @@ } catch (IOException ioexception) { list1.forEach((p_172772_) -> { p_172772_.getFirst().close(); -@@ -704,7 +_,7 @@ +@@ -706,7 +_,7 @@ d0 *= (double)Mth.m_14179_(this.f_109059_.f_91066_.f_92070_, 1.0F, 0.85714287F); } @@ -26,7 +26,7 @@ } } -@@ -841,11 +_,11 @@ +@@ -843,11 +_,11 @@ Window window = this.f_109059_.m_91268_(); RenderSystem.m_69421_(256, Minecraft.f_91002_); @@ -40,7 +40,7 @@ RenderSystem.m_157182_(); Lighting.m_84931_(); PoseStack posestack1 = new PoseStack(); -@@ -880,7 +_,7 @@ +@@ -882,7 +_,7 @@ } } else if (this.f_109059_.f_91080_ != null) { try { @@ -49,7 +49,7 @@ } catch (Throwable throwable1) { CrashReport crashreport1 = CrashReport.m_127521_(throwable1, "Rendering screen"); CrashReportCategory crashreportcategory1 = crashreport1.m_127514_("Screen render details"); -@@ -1037,6 +_,11 @@ +@@ -1040,6 +_,11 @@ Matrix4f matrix4f = posestack.m_85850_().m_85861_(); this.m_109111_(matrix4f); camera.m_90575_(this.f_109059_.f_91073_, (Entity)(this.f_109059_.m_91288_() == null ? this.f_109059_.f_91074_ : this.f_109059_.m_91288_()), !this.f_109059_.f_91066_.m_92176_().m_90612_(), this.f_109059_.f_91066_.m_92176_().m_90613_(), p_109090_); @@ -61,7 +61,7 @@ p_109092_.m_85845_(Vector3f.f_122223_.m_122240_(camera.m_90589_())); p_109092_.m_85845_(Vector3f.f_122225_.m_122240_(camera.m_90590_() + 180.0F)); Matrix3f matrix3f = p_109092_.m_85850_().m_85864_().m_8183_(); -@@ -1046,6 +_,8 @@ +@@ -1049,6 +_,8 @@ this.f_109059_.f_91060_.m_172961_(p_109092_, camera.m_90583_(), this.m_172716_(Math.max(d0, this.f_109059_.f_91066_.f_92068_))); this.f_109059_.f_91060_.m_109599_(p_109092_, p_109090_, p_109091_, flag, camera, this, this.f_109074_, matrix4f); diff --git a/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch index 3b3f712d7f..6ca654e814 100644 --- a/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/LevelRenderer.java +++ b/net/minecraft/client/renderer/LevelRenderer.java -@@ -257,6 +_,11 @@ +@@ -259,6 +_,11 @@ } private void m_109703_(LightTexture p_109704_, float p_109705_, double p_109706_, double p_109707_, double p_109708_) { @@ -12,7 +12,7 @@ float f = this.f_109461_.f_91073_.m_46722_(p_109705_); if (!(f <= 0.0F)) { p_109704_.m_109896_(); -@@ -377,6 +_,11 @@ +@@ -379,6 +_,11 @@ } public void m_109693_(Camera p_109694_) { @@ -24,14 +24,14 @@ float f = this.f_109461_.f_91073_.m_46722_(1.0F) / (Minecraft.m_91405_() ? 1.0F : 2.0F); if (!(f <= 0.0F)) { Random random = new Random((long)this.f_109477_ * 312987231L); -@@ -1148,20 +_,23 @@ +@@ -1134,20 +_,23 @@ RenderSystem.m_69421_(16640, Minecraft.f_91002_); float f = p_109605_.m_109152_(); boolean flag2 = this.f_109461_.f_91073_.m_104583_().m_5781_(Mth.m_14107_(d0), Mth.m_14107_(d1)) || this.f_109461_.f_91065_.m_93090_().m_93715_(); + FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag2, p_109601_); profilerfiller.m_6182_("sky"); RenderSystem.m_157427_(GameRenderer::m_172808_); - this.m_181409_(p_109600_, p_109607_, p_109601_, () -> { + this.m_202423_(p_109600_, p_109607_, p_109601_, p_109604_, flag2, () -> { - FogRenderer.m_109024_(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag2); + FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag2, p_109601_); }); @@ -50,46 +50,46 @@ this.m_172993_(RenderType.m_110463_(), p_109600_, d0, d1, d2, p_109607_); if (this.f_109465_.m_104583_().m_108885_()) { Lighting.m_84925_(p_109600_.m_85850_().m_85861_()); -@@ -1191,7 +_,7 @@ - MultiBufferSource.BufferSource multibuffersource$buffersource = this.f_109464_.m_110104_(); - +@@ -1179,7 +_,7 @@ for(Entity entity : this.f_109465_.m_104735_()) { -- if ((this.f_109463_.m_114397_(entity, frustum, d0, d1, d2) || entity.m_20367_(this.f_109461_.f_91074_)) && (entity != p_109604_.m_90592_() || p_109604_.m_90594_() || p_109604_.m_90592_() instanceof LivingEntity && ((LivingEntity)p_109604_.m_90592_()).m_5803_()) && (!(entity instanceof LocalPlayer) || p_109604_.m_90592_() == entity)) { -+ if ((this.f_109463_.m_114397_(entity, frustum, d0, d1, d2) || entity.m_20367_(this.f_109461_.f_91074_)) && (entity != p_109604_.m_90592_() || p_109604_.m_90594_() || p_109604_.m_90592_() instanceof LivingEntity && ((LivingEntity)p_109604_.m_90592_()).m_5803_()) && (!(entity instanceof LocalPlayer) || p_109604_.m_90592_() == entity || (entity == f_109461_.f_91074_ && !f_109461_.f_91074_.m_5833_()))) { //FORGE: render local player entity when it is not the renderViewEntity - ++this.f_109439_; - if (entity.f_19797_ == 0) { - entity.f_19790_ = entity.m_20185_(); -@@ -1230,6 +_,7 @@ + if (this.f_109463_.m_114397_(entity, frustum, d0, d1, d2) || entity.m_20367_(this.f_109461_.f_91074_)) { + BlockPos blockpos = entity.m_142538_(); +- if ((this.f_109465_.m_151562_(blockpos.m_123342_()) || this.m_202430_(blockpos)) && (entity != p_109604_.m_90592_() || p_109604_.m_90594_() || p_109604_.m_90592_() instanceof LivingEntity && ((LivingEntity)p_109604_.m_90592_()).m_5803_()) && (!(entity instanceof LocalPlayer) || p_109604_.m_90592_() == entity)) { ++ if ((this.f_109465_.m_151562_(blockpos.m_123342_()) || this.m_202430_(blockpos)) && (entity != p_109604_.m_90592_() || p_109604_.m_90594_() || p_109604_.m_90592_() instanceof LivingEntity && ((LivingEntity)p_109604_.m_90592_()).m_5803_()) && (!(entity instanceof LocalPlayer) || p_109604_.m_90592_() == entity || (entity == f_109461_.f_91074_ && !f_109461_.f_91074_.m_5833_()))) { //FORGE: render local player entity when it is not the renderViewEntity + ++this.f_109439_; + if (entity.f_19797_ == 0) { + entity.f_19790_ = entity.m_20185_(); +@@ -1219,6 +_,7 @@ List list = levelrenderer$renderchunkinfo.f_109839_.m_112835_().m_112773_(); if (!list.isEmpty()) { for(BlockEntity blockentity1 : list) { + if(!frustum.m_113029_(blockentity1.getRenderBoundingBox())) continue; - BlockPos blockpos3 = blockentity1.m_58899_(); + BlockPos blockpos4 = blockentity1.m_58899_(); MultiBufferSource multibuffersource1 = multibuffersource$buffersource; p_109600_.m_85836_(); -@@ -1255,6 +_,7 @@ +@@ -1244,6 +_,7 @@ synchronized(this.f_109468_) { for(BlockEntity blockentity : this.f_109468_) { + if(!frustum.m_113029_(blockentity.getRenderBoundingBox())) continue; - BlockPos blockpos2 = blockentity.m_58899_(); + BlockPos blockpos3 = blockentity.m_58899_(); p_109600_.m_85836_(); - p_109600_.m_85837_((double)blockpos2.m_123341_() - d0, (double)blockpos2.m_123342_() - d1, (double)blockpos2.m_123343_() - d2); -@@ -1306,10 +_,13 @@ + p_109600_.m_85837_((double)blockpos3.m_123341_() - d0, (double)blockpos3.m_123342_() - d1, (double)blockpos3.m_123343_() - d2); +@@ -1295,10 +_,13 @@ profilerfiller.m_6182_("outline"); - BlockPos blockpos = ((BlockHitResult)hitresult).m_82425_(); - BlockState blockstate = this.f_109465_.m_8055_(blockpos); + BlockPos blockpos1 = ((BlockHitResult)hitresult).m_82425_(); + BlockState blockstate = this.f_109465_.m_8055_(blockpos1); + if (!net.minecraftforge.client.ForgeHooksClient.onDrawHighlight(this, p_109604_, hitresult, p_109601_, p_109600_, multibuffersource$buffersource)) - if (!blockstate.m_60795_() && this.f_109465_.m_6857_().m_61937_(blockpos)) { + if (!blockstate.m_60795_() && this.f_109465_.m_6857_().m_61937_(blockpos1)) { VertexConsumer vertexconsumer2 = multibuffersource$buffersource.m_6299_(RenderType.m_110504_()); - this.m_109637_(p_109600_, vertexconsumer2, p_109604_.m_90592_(), d0, d1, d2, blockpos, blockstate); + this.m_109637_(p_109600_, vertexconsumer2, p_109604_.m_90592_(), d0, d1, d2, blockpos1, blockstate); } + } else if (hitresult != null && hitresult.m_6662_() == HitResult.Type.ENTITY) { + net.minecraftforge.client.ForgeHooksClient.onDrawHighlight(this, p_109604_, hitresult, p_109601_, p_109600_, multibuffersource$buffersource); } PoseStack posestack = RenderSystem.m_157191_(); -@@ -1344,7 +_,7 @@ +@@ -1333,7 +_,7 @@ this.f_109415_.m_83945_(this.f_109461_.m_91385_()); RenderStateShard.f_110126_.m_110185_(); profilerfiller.m_6182_("particles"); @@ -98,7 +98,7 @@ RenderStateShard.f_110126_.m_110188_(); } else { profilerfiller.m_6182_("translucent"); -@@ -1358,7 +_,7 @@ +@@ -1347,7 +_,7 @@ profilerfiller.m_6182_("string"); this.m_172993_(RenderType.m_110503_(), p_109600_, d0, d1, d2, p_109607_); profilerfiller.m_6182_("particles"); @@ -107,19 +107,19 @@ } posestack.m_85836_(); -@@ -1790,6 +_,11 @@ +@@ -1783,6 +_,11 @@ - public void m_181409_(PoseStack p_181410_, Matrix4f p_181411_, float p_181412_, Runnable p_181413_) { - p_181413_.run(); + public void m_202423_(PoseStack p_202424_, Matrix4f p_202425_, float p_202426_, Camera p_202427_, boolean p_202428_, Runnable p_202429_) { + p_202429_.run(); + net.minecraftforge.client.ISkyRenderHandler renderHandler = f_109465_.m_104583_().getSkyRenderHandler(); + if (renderHandler != null) { -+ renderHandler.render(f_109477_, p_181412_, p_181410_, f_109465_, f_109461_); ++ renderHandler.render(f_109477_, p_202426_, p_202424_, f_109465_, f_109461_); + return; + } - if (this.f_109461_.f_91073_.m_104583_().m_108883_() == DimensionSpecialEffects.SkyType.END) { - this.m_109780_(p_181410_); - } else if (this.f_109461_.f_91073_.m_104583_().m_108883_() == DimensionSpecialEffects.SkyType.NORMAL) { -@@ -1904,6 +_,11 @@ + if (!p_202428_) { + FogType fogtype = p_202427_.m_167685_(); + if (fogtype != FogType.POWDER_SNOW && fogtype != FogType.LAVA) { +@@ -1910,6 +_,11 @@ } public void m_172954_(PoseStack p_172955_, Matrix4f p_172956_, float p_172957_, double p_172958_, double p_172959_, double p_172960_) { @@ -131,7 +131,7 @@ float f = this.f_109465_.m_104583_().m_108871_(); if (!Float.isNaN(f)) { RenderSystem.m_69464_(); -@@ -2089,7 +_,7 @@ +@@ -2095,7 +_,7 @@ } } else { BlockPos blockpos1 = chunkrenderdispatcher$renderchunk.m_112839_().m_142082_(8, 8, 8); @@ -140,7 +140,7 @@ } if (flag) { -@@ -2387,7 +_,12 @@ +@@ -2393,7 +_,12 @@ this.f_109469_.m_110859_(p_109502_, p_109503_, p_109504_, p_109505_); } @@ -153,7 +153,7 @@ SoundInstance soundinstance = this.f_109410_.get(p_109516_); if (soundinstance != null) { this.f_109461_.m_91106_().m_120399_(soundinstance); -@@ -2395,7 +_,7 @@ +@@ -2401,7 +_,7 @@ } if (p_109515_ != null) { @@ -162,7 +162,7 @@ if (recorditem != null) { this.f_109461_.f_91065_.m_93055_(recorditem.m_43050_()); } -@@ -2547,7 +_,7 @@ +@@ -2553,7 +_,7 @@ break; case 1010: if (Item.m_41445_(p_109536_) instanceof RecordItem) { @@ -171,7 +171,7 @@ } else { this.m_109514_((SoundEvent)null, p_109535_); } -@@ -2717,7 +_,7 @@ +@@ -2723,7 +_,7 @@ case 2001: BlockState blockstate = Block.m_49803_(p_109536_); if (!blockstate.m_60795_()) { @@ -180,7 +180,7 @@ this.f_109465_.m_104677_(p_109535_, soundtype.m_56775_(), SoundSource.BLOCKS, (soundtype.m_56773_() + 1.0F) / 2.0F, soundtype.m_56774_() * 0.8F, false); } -@@ -2882,7 +_,7 @@ +@@ -2888,7 +_,7 @@ } else { int i = p_109538_.m_45517_(LightLayer.SKY, p_109540_); int j = p_109538_.m_45517_(LightLayer.BLOCK, p_109540_); diff --git a/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch index dc73c3b165..f9e15bac95 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch @@ -15,7 +15,7 @@ } if (!p_110719_.f_91074_.m_5833_()) { - if (p_110719_.f_91074_.m_19941_(FluidTags.f_13131_)) { + if (p_110719_.f_91074_.m_204029_(FluidTags.f_13131_)) { + if (!net.minecraftforge.event.ForgeEventFactory.renderWaterOverlay(player, p_110720_)) m_110725_(p_110719_, p_110720_); } diff --git a/patches/minecraft/net/minecraft/client/renderer/ShaderInstance.java.patch b/patches/minecraft/net/minecraft/client/renderer/ShaderInstance.java.patch index 40c17495f7..cb8c9d0839 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ShaderInstance.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ShaderInstance.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/ShaderInstance.java +++ b/net/minecraft/client/renderer/ShaderInstance.java -@@ -94,10 +_,14 @@ +@@ -96,10 +_,14 @@ @Nullable public final Uniform f_173320_; @@ -17,7 +17,7 @@ Resource resource = null; try { -@@ -206,8 +_,9 @@ +@@ -209,8 +_,9 @@ Program program1 = p_173342_.m_85570_().get(p_173343_); Program program; if (program1 == null) { diff --git a/patches/minecraft/net/minecraft/client/renderer/block/LiquidBlockRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/LiquidBlockRenderer.java.patch index 738f973461..c12129af8a 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/LiquidBlockRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/LiquidBlockRenderer.java.patch @@ -1,96 +1,98 @@ --- a/net/minecraft/client/renderer/block/LiquidBlockRenderer.java +++ b/net/minecraft/client/renderer/block/LiquidBlockRenderer.java -@@ -72,9 +_,10 @@ +@@ -68,8 +_,9 @@ - public boolean m_110954_(BlockAndTintGetter p_110955_, BlockPos p_110956_, VertexConsumer p_110957_, FluidState p_110958_) { - boolean flag = p_110958_.m_76153_(FluidTags.f_13132_); + public boolean m_203173_(BlockAndTintGetter p_203174_, BlockPos p_203175_, VertexConsumer p_203176_, BlockState p_203177_, FluidState p_203178_) { + boolean flag = p_203178_.m_205070_(FluidTags.f_13132_); - TextureAtlasSprite[] atextureatlassprite = flag ? this.f_110940_ : this.f_110941_; -+ TextureAtlasSprite[] atextureatlassprite = net.minecraftforge.client.ForgeHooksClient.getFluidSprites(p_110955_, p_110956_, p_110958_); - BlockState blockstate = p_110955_.m_8055_(p_110956_); -- int i = flag ? 16777215 : BiomeColors.m_108811_(p_110955_, p_110956_); -+ int i = p_110958_.m_76152_().getAttributes().getColor(p_110955_, p_110956_); +- int i = flag ? 16777215 : BiomeColors.m_108811_(p_203174_, p_203175_); ++ TextureAtlasSprite[] atextureatlassprite = net.minecraftforge.client.ForgeHooksClient.getFluidSprites(p_203174_, p_203175_, p_203178_); ++ int i = p_203178_.m_76152_().getAttributes().getColor(p_203174_, p_203175_); + float alpha = (float)(i >> 24 & 255) / 255.0F; float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; -@@ -159,15 +_,15 @@ - float f25 = f4 * f; - float f26 = f4 * f1; - float f27 = f4 * f2; -- this.m_110984_(p_110957_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, f13, f17, j); -- this.m_110984_(p_110957_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, f14, f18, j); -- this.m_110984_(p_110957_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, f15, f19, j); -- this.m_110984_(p_110957_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, f16, f20, j); -+ this.vertex(p_110957_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, alpha, f13, f17, j); -+ this.vertex(p_110957_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, alpha, f14, f18, j); -+ this.vertex(p_110957_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, alpha, f15, f19, j); -+ this.vertex(p_110957_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, alpha, f16, f20, j); - if (p_110958_.m_76171_(p_110955_, p_110956_.m_7494_())) { -- this.m_110984_(p_110957_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, f13, f17, j); -- this.m_110984_(p_110957_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, f16, f20, j); -- this.m_110984_(p_110957_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, f15, f19, j); -- this.m_110984_(p_110957_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, f14, f18, j); -+ this.vertex(p_110957_, d0 + 0.0D, d1 + (double)f7, d2 + 0.0D, f25, f26, f27, alpha, f13, f17, j); -+ this.vertex(p_110957_, d0 + 1.0D, d1 + (double)f10, d2 + 0.0D, f25, f26, f27, alpha, f16, f20, j); -+ this.vertex(p_110957_, d0 + 1.0D, d1 + (double)f9, d2 + 1.0D, f25, f26, f27, alpha, f15, f19, j); -+ this.vertex(p_110957_, d0 + 0.0D, d1 + (double)f8, d2 + 1.0D, f25, f26, f27, alpha, f14, f18, j); +@@ -184,15 +_,16 @@ + float f30 = f4 * f; + float f31 = f4 * f1; + float f32 = f4 * f2; +- this.m_110984_(p_203176_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f30, f31, f32, f18, f22, j); +- this.m_110984_(p_203176_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f30, f31, f32, f19, f23, j); +- this.m_110984_(p_203176_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f30, f31, f32, f20, f24, j); +- this.m_110984_(p_203176_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f30, f31, f32, f21, f25, j); ++ ++ this.vertex(p_203176_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f30, f31, f32, alpha, f18, f22, j); ++ this.vertex(p_203176_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f30, f31, f32, alpha, f19, f23, j); ++ this.vertex(p_203176_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f30, f31, f32, alpha, f20, f24, j); ++ this.vertex(p_203176_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f30, f31, f32, alpha, f21, f25, j); + if (p_203178_.m_76171_(p_203174_, p_203175_.m_7494_())) { +- this.m_110984_(p_203176_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f30, f31, f32, f18, f22, j); +- this.m_110984_(p_203176_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f30, f31, f32, f21, f25, j); +- this.m_110984_(p_203176_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f30, f31, f32, f20, f24, j); +- this.m_110984_(p_203176_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f30, f31, f32, f19, f23, j); ++ this.vertex(p_203176_, d1 + 0.0D, d2 + (double)f8, d0 + 0.0D, f30, f31, f32, alpha, f18, f22, j); ++ this.vertex(p_203176_, d1 + 1.0D, d2 + (double)f7, d0 + 0.0D, f30, f31, f32, alpha, f21, f25, j); ++ this.vertex(p_203176_, d1 + 1.0D, d2 + (double)f9, d0 + 1.0D, f30, f31, f32, alpha, f20, f24, j); ++ this.vertex(p_203176_, d1 + 0.0D, d2 + (double)f10, d0 + 1.0D, f30, f31, f32, alpha, f19, f23, j); } } -@@ -180,10 +_,10 @@ - float f41 = f3 * f; - float f42 = f3 * f1; - float f43 = f3 * f2; -- this.m_110984_(p_110957_, d0, d1 + (double)f12, d2 + 1.0D, f41, f42, f43, f35, f39, i1); -- this.m_110984_(p_110957_, d0, d1 + (double)f12, d2, f41, f42, f43, f35, f37, i1); -- this.m_110984_(p_110957_, d0 + 1.0D, d1 + (double)f12, d2, f41, f42, f43, f36, f37, i1); -- this.m_110984_(p_110957_, d0 + 1.0D, d1 + (double)f12, d2 + 1.0D, f41, f42, f43, f36, f39, i1); -+ this.vertex(p_110957_, d0, d1 + (double)f12, d2 + 1.0D, f41, f42, f43, alpha, f35, f39, i1); -+ this.vertex(p_110957_, d0, d1 + (double)f12, d2, f41, f42, f43, alpha, f35, f37, i1); -+ this.vertex(p_110957_, d0 + 1.0D, d1 + (double)f12, d2, f41, f42, f43, alpha, f36, f37, i1); -+ this.vertex(p_110957_, d0 + 1.0D, d1 + (double)f12, d2 + 1.0D, f41, f42, f43, alpha, f36, f39, i1); +@@ -205,10 +_,11 @@ + float f46 = f3 * f; + float f47 = f3 * f1; + float f48 = f3 * f2; +- this.m_110984_(p_203176_, d1, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, f40, f43, l); +- this.m_110984_(p_203176_, d1, d2 + (double)f17, d0, f46, f47, f48, f40, f42, l); +- this.m_110984_(p_203176_, d1 + 1.0D, d2 + (double)f17, d0, f46, f47, f48, f41, f42, l); +- this.m_110984_(p_203176_, d1 + 1.0D, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, f41, f43, l); ++ ++ this.vertex(p_203176_, d1, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, alpha, f40, f43, l); ++ this.vertex(p_203176_, d1, d2 + (double)f17, d0, f46, f47, f48, alpha, f40, f42, l); ++ this.vertex(p_203176_, d1 + 1.0D, d2 + (double)f17, d0, f46, f47, f48, alpha, f41, f42, l); ++ this.vertex(p_203176_, d1 + 1.0D, d2 + (double)f17, d0 + 1.0D, f46, f47, f48, alpha, f41, f43, l); flag7 = true; } -@@ -240,10 +_,9 @@ +@@ -264,10 +_,9 @@ flag7 = true; - BlockPos blockpos = p_110956_.m_142300_(direction); + BlockPos blockpos = p_203175_.m_142300_(direction); TextureAtlasSprite textureatlassprite2 = atextureatlassprite[1]; - if (!flag) { -- Block block = p_110955_.m_8055_(blockpos).m_60734_(); +- Block block = p_203174_.m_8055_(blockpos).m_60734_(); - if (block instanceof HalfTransparentBlock || block instanceof LeavesBlock) { - textureatlassprite2 = this.f_110942_; + if (atextureatlassprite[2] != null) { -+ if (p_110955_.m_8055_(blockpos).shouldDisplayFluidOverlay(p_110955_, blockpos, p_110958_)) { ++ if (p_203174_.m_8055_(blockpos).shouldDisplayFluidOverlay(p_203174_, blockpos, p_203178_)) { + textureatlassprite2 = atextureatlassprite[2]; } } -@@ -256,15 +_,15 @@ - float f32 = f4 * f31 * f; - float f33 = f4 * f31 * f1; - float f34 = f4 * f31 * f2; -- this.m_110984_(p_110957_, d3, d1 + (double)f38, d4, f32, f33, f34, f49, f28, k); -- this.m_110984_(p_110957_, d5, d1 + (double)f40, d6, f32, f33, f34, f50, f29, k); -- this.m_110984_(p_110957_, d5, d1 + (double)f12, d6, f32, f33, f34, f50, f30, k); -- this.m_110984_(p_110957_, d3, d1 + (double)f12, d4, f32, f33, f34, f49, f30, k); -+ this.vertex(p_110957_, d3, d1 + (double)f38, d4, f32, f33, f34, alpha, f49, f28, k); -+ this.vertex(p_110957_, d5, d1 + (double)f40, d6, f32, f33, f34, alpha, f50, f29, k); -+ this.vertex(p_110957_, d5, d1 + (double)f12, d6, f32, f33, f34, alpha, f50, f30, k); -+ this.vertex(p_110957_, d3, d1 + (double)f12, d4, f32, f33, f34, alpha, f49, f30, k); +@@ -280,15 +_,16 @@ + float f37 = f4 * f36 * f; + float f38 = f4 * f36 * f1; + float f39 = f4 * f36 * f2; +- this.m_110984_(p_203176_, d3, d2 + (double)f44, d4, f37, f38, f39, f54, f33, k); +- this.m_110984_(p_203176_, d5, d2 + (double)f45, d6, f37, f38, f39, f55, f34, k); +- this.m_110984_(p_203176_, d5, d2 + (double)f17, d6, f37, f38, f39, f55, f35, k); +- this.m_110984_(p_203176_, d3, d2 + (double)f17, d4, f37, f38, f39, f54, f35, k); ++ ++ this.vertex(p_203176_, d3, d2 + (double)f44, d4, f37, f38, f39, alpha, f54, f33, k); ++ this.vertex(p_203176_, d5, d2 + (double)f45, d6, f37, f38, f39, alpha, f55, f34, k); ++ this.vertex(p_203176_, d5, d2 + (double)f17, d6, f37, f38, f39, alpha, f55, f35, k); ++ this.vertex(p_203176_, d3, d2 + (double)f17, d4, f37, f38, f39, alpha, f54, f35, k); if (textureatlassprite2 != this.f_110942_) { -- this.m_110984_(p_110957_, d3, d1 + (double)f12, d4, f32, f33, f34, f49, f30, k); -- this.m_110984_(p_110957_, d5, d1 + (double)f12, d6, f32, f33, f34, f50, f30, k); -- this.m_110984_(p_110957_, d5, d1 + (double)f40, d6, f32, f33, f34, f50, f29, k); -- this.m_110984_(p_110957_, d3, d1 + (double)f38, d4, f32, f33, f34, f49, f28, k); -+ this.vertex(p_110957_, d3, d1 + (double)f12, d4, f32, f33, f34, alpha, f49, f30, k); -+ this.vertex(p_110957_, d5, d1 + (double)f12, d6, f32, f33, f34, alpha, f50, f30, k); -+ this.vertex(p_110957_, d5, d1 + (double)f40, d6, f32, f33, f34, alpha, f50, f29, k); -+ this.vertex(p_110957_, d3, d1 + (double)f38, d4, f32, f33, f34, alpha, f49, f28, k); +- this.m_110984_(p_203176_, d3, d2 + (double)f17, d4, f37, f38, f39, f54, f35, k); +- this.m_110984_(p_203176_, d5, d2 + (double)f17, d6, f37, f38, f39, f55, f35, k); +- this.m_110984_(p_203176_, d5, d2 + (double)f45, d6, f37, f38, f39, f55, f34, k); +- this.m_110984_(p_203176_, d3, d2 + (double)f44, d4, f37, f38, f39, f54, f33, k); ++ this.vertex(p_203176_, d3, d2 + (double)f17, d4, f37, f38, f39, alpha, f54, f35, k); ++ this.vertex(p_203176_, d5, d2 + (double)f17, d6, f37, f38, f39, alpha, f55, f35, k); ++ this.vertex(p_203176_, d5, d2 + (double)f45, d6, f37, f38, f39, alpha, f55, f34, k); ++ this.vertex(p_203176_, d3, d2 + (double)f44, d4, f37, f38, f39, alpha, f54, f33, k); } } } -@@ -273,8 +_,8 @@ +@@ -343,8 +_,8 @@ } } diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch index 16fa9f96fc..1a00e0a5a9 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java +++ b/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java -@@ -72,12 +_,15 @@ +@@ -73,12 +_,15 @@ private Vec3 f_112683_ = Vec3.f_82478_; public ChunkRenderDispatcher(ClientLevel p_194405_, LevelRenderer p_194406_, Executor p_194407_, boolean p_194408_, ChunkBufferBuilderPack p_194409_) { @@ -17,7 +17,7 @@ this.f_112678_ = p_194409_; List list = Lists.newArrayListWithExpectedSize(l); -@@ -415,7 +_,7 @@ +@@ -420,7 +_,7 @@ if (!chunkrenderdispatcher$compiledchunk.f_112750_.contains(p_112810_)) { return false; } else { @@ -26,16 +26,16 @@ p_112811_.m_112709_(this.f_112788_); return true; } -@@ -443,7 +_,7 @@ - BlockPos blockpos = this.f_112793_.m_7949_(); - int i = 1; - RenderChunkRegion renderchunkregion = p_200438_.m_200465_(ChunkRenderDispatcher.this.f_112681_, blockpos.m_142082_(-1, -1, -1), blockpos.m_142082_(16, 16, 16), 1); -- this.f_112787_ = new ChunkRenderDispatcher.RenderChunk.RebuildTask(this.m_112832_(), renderchunkregion, flag || this.f_112784_.get() != ChunkRenderDispatcher.CompiledChunk.f_112748_); +@@ -452,7 +_,7 @@ + this.f_202433_.incrementAndGet(); + } + +- this.f_112787_ = new ChunkRenderDispatcher.RenderChunk.RebuildTask(this.m_112832_(), renderchunkregion, !flag1 || this.f_202433_.get() > 2); + this.f_112787_ = new ChunkRenderDispatcher.RenderChunk.RebuildTask(new net.minecraft.world.level.ChunkPos(m_112839_()), this.m_112832_(), renderchunkregion, flag || this.f_112784_.get() != ChunkRenderDispatcher.CompiledChunk.f_112748_); return this.f_112787_; } -@@ -476,10 +_,20 @@ +@@ -485,10 +_,20 @@ protected final double f_112847_; protected final AtomicBoolean f_112848_ = new AtomicBoolean(false); protected final boolean f_194420_; @@ -56,7 +56,7 @@ } public abstract CompletableFuture m_5869_(ChunkBufferBuilderPack p_112853_); -@@ -491,6 +_,10 @@ +@@ -500,6 +_,10 @@ public int compareTo(ChunkRenderDispatcher.RenderChunk.ChunkCompileTask p_112855_) { return Doubles.compare(this.f_112847_, p_112855_.f_112847_); } @@ -67,7 +67,7 @@ } @OnlyIn(Dist.CLIENT) -@@ -498,8 +_,13 @@ +@@ -507,8 +_,13 @@ @Nullable protected RenderChunkRegion f_112858_; @@ -82,10 +82,10 @@ this.f_112858_ = p_194428_; } -@@ -580,8 +_,10 @@ - } +@@ -591,8 +_,10 @@ - FluidState fluidstate = renderchunkregion.m_6425_(blockpos2); + BlockState blockstate1 = renderchunkregion.m_8055_(blockpos2); + FluidState fluidstate = blockstate1.m_60819_(); - if (!fluidstate.m_76178_()) { - RenderType rendertype = ItemBlockRenderTypes.m_109287_(fluidstate); + net.minecraftforge.client.model.data.IModelData modelData = getModelData(blockpos2); @@ -95,7 +95,7 @@ BufferBuilder bufferbuilder = p_112870_.m_108839_(rendertype); if (p_112869_.f_112750_.add(rendertype)) { RenderChunk.this.m_112805_(bufferbuilder); -@@ -593,8 +_,8 @@ +@@ -604,8 +_,8 @@ } } @@ -106,7 +106,7 @@ BufferBuilder bufferbuilder2 = p_112870_.m_108839_(rendertype1); if (p_112869_.f_112750_.add(rendertype1)) { RenderChunk.this.m_112805_(bufferbuilder2); -@@ -602,14 +_,16 @@ +@@ -613,14 +_,16 @@ posestack.m_85836_(); posestack.m_85837_((double)(blockpos2.m_123341_() & 15), (double)(blockpos2.m_123342_() & 15), (double)(blockpos2.m_123343_() & 15)); @@ -124,7 +124,7 @@ if (p_112869_.f_112749_.contains(RenderType.m_110466_())) { BufferBuilder bufferbuilder1 = p_112870_.m_108839_(RenderType.m_110466_()); -@@ -628,10 +_,10 @@ +@@ -639,10 +_,10 @@ private void m_112877_(ChunkRenderDispatcher.CompiledChunk p_112878_, Set p_112879_, E p_112880_) { BlockEntityRenderer blockentityrenderer = Minecraft.m_91087_().m_167982_().m_112265_(p_112880_); if (blockentityrenderer != null) { @@ -136,7 +136,7 @@ } } -@@ -649,8 +_,13 @@ +@@ -660,8 +_,13 @@ class ResortTransparencyTask extends ChunkRenderDispatcher.RenderChunk.ChunkCompileTask { private final ChunkRenderDispatcher.CompiledChunk f_112886_; diff --git a/patches/minecraft/net/minecraft/client/server/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/client/server/IntegratedServer.java.patch index a4e07ced49..8b3c098056 100644 --- a/patches/minecraft/net/minecraft/client/server/IntegratedServer.java.patch +++ b/patches/minecraft/net/minecraft/client/server/IntegratedServer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/server/IntegratedServer.java +++ b/net/minecraft/client/server/IntegratedServer.java -@@ -62,9 +_,10 @@ +@@ -60,9 +_,10 @@ this.m_129997_(true); this.m_129999_(true); this.m_129793_(); @@ -12,7 +12,7 @@ } public void m_5705_(BooleanSupplier p_120049_) { -@@ -181,6 +_,7 @@ +@@ -179,6 +_,7 @@ } public void m_7570_(boolean p_120053_) { diff --git a/patches/minecraft/net/minecraft/commands/Commands.java.patch b/patches/minecraft/net/minecraft/commands/Commands.java.patch index f7d327c2ee..7a95572e3b 100644 --- a/patches/minecraft/net/minecraft/commands/Commands.java.patch +++ b/patches/minecraft/net/minecraft/commands/Commands.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java -@@ -175,7 +_,7 @@ +@@ -177,7 +_,7 @@ JfrCommand.m_183645_(this.f_82090_); } @@ -9,7 +9,7 @@ TestCommand.m_127946_(this.f_82090_); } -@@ -199,6 +_,7 @@ +@@ -201,6 +_,7 @@ if (p_82093_.f_82144_) { PublishCommand.m_138184_(this.f_82090_); } @@ -17,7 +17,7 @@ this.f_82090_.findAmbiguities((p_82108_, p_82109_, p_82110_, p_82111_) -> { f_82089_.warn("Ambiguity between arguments {} and {} with inputs: {}", this.f_82090_.getPath(p_82109_), this.f_82090_.getPath(p_82110_), p_82111_); -@@ -218,7 +_,15 @@ +@@ -220,7 +_,15 @@ try { try { diff --git a/patches/minecraft/net/minecraft/commands/arguments/ObjectiveArgument.java.patch b/patches/minecraft/net/minecraft/commands/arguments/ObjectiveArgument.java.patch index bb927b88fc..2d60f5d589 100644 --- a/patches/minecraft/net/minecraft/commands/arguments/ObjectiveArgument.java.patch +++ b/patches/minecraft/net/minecraft/commands/arguments/ObjectiveArgument.java.patch @@ -9,12 +9,12 @@ Objective objective = scoreboard.m_83477_(s); if (objective == null) { throw f_101953_.create(s); -@@ -55,7 +_,7 @@ - - public CompletableFuture listSuggestions(CommandContext p_101974_, SuggestionsBuilder p_101975_) { - if (p_101974_.getSource() instanceof CommandSourceStack) { -- return SharedSuggestionProvider.m_82970_(((CommandSourceStack)p_101974_.getSource()).m_81377_().m_129896_().m_83474_(), p_101975_); -+ return SharedSuggestionProvider.m_82970_(((CommandSourceStack)p_101974_.getSource()).getScoreboard().m_83474_(), p_101975_); - } else if (p_101974_.getSource() instanceof SharedSuggestionProvider) { - SharedSuggestionProvider sharedsuggestionprovider = (SharedSuggestionProvider)p_101974_.getSource(); - return sharedsuggestionprovider.m_5497_((CommandContext)p_101974_, p_101975_); +@@ -57,7 +_,7 @@ + S s = p_101974_.getSource(); + if (s instanceof CommandSourceStack) { + CommandSourceStack commandsourcestack = (CommandSourceStack)s; +- return SharedSuggestionProvider.m_82970_(commandsourcestack.m_81377_().m_129896_().m_83474_(), p_101975_); ++ return SharedSuggestionProvider.m_82970_(commandsourcestack.getScoreboard().m_83474_(), p_101975_); + } else if (s instanceof SharedSuggestionProvider) { + SharedSuggestionProvider sharedsuggestionprovider = (SharedSuggestionProvider)s; + return sharedsuggestionprovider.m_212155_(p_101974_); diff --git a/patches/minecraft/net/minecraft/commands/arguments/ResourceLocationArgument.java.patch b/patches/minecraft/net/minecraft/commands/arguments/ResourceLocationArgument.java.patch index 9f755247ee..468f7de99f 100644 --- a/patches/minecraft/net/minecraft/commands/arguments/ResourceLocationArgument.java.patch +++ b/patches/minecraft/net/minecraft/commands/arguments/ResourceLocationArgument.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/commands/arguments/ResourceLocationArgument.java +++ b/net/minecraft/commands/arguments/ResourceLocationArgument.java -@@ -44,7 +_,7 @@ +@@ -39,7 +_,7 @@ public static Advancement m_106987_(CommandContext p_106988_, String p_106989_) throws CommandSyntaxException { - ResourceLocation resourcelocation = p_106988_.getArgument(p_106989_, ResourceLocation.class); + ResourceLocation resourcelocation = m_107011_(p_106988_, p_106989_); - Advancement advancement = p_106988_.getSource().m_81377_().m_129889_().m_136041_(resourcelocation); + Advancement advancement = p_106988_.getSource().getAdvancement(resourcelocation); if (advancement == null) { throw f_106978_.create(resourcelocation); } else { -@@ -53,7 +_,7 @@ +@@ -48,7 +_,7 @@ } public static Recipe m_106994_(CommandContext p_106995_, String p_106996_) throws CommandSyntaxException { - RecipeManager recipemanager = p_106995_.getSource().m_81377_().m_129894_(); + RecipeManager recipemanager = p_106995_.getSource().getRecipeManager(); - ResourceLocation resourcelocation = p_106995_.getArgument(p_106996_, ResourceLocation.class); + ResourceLocation resourcelocation = m_107011_(p_106995_, p_106996_); return recipemanager.m_44043_(resourcelocation).orElseThrow(() -> { return f_106979_.create(resourcelocation); diff --git a/patches/minecraft/net/minecraft/commands/synchronization/ArgumentTypes.java.patch b/patches/minecraft/net/minecraft/commands/synchronization/ArgumentTypes.java.patch index 8c3131b2fa..619bc05248 100644 --- a/patches/minecraft/net/minecraft/commands/synchronization/ArgumentTypes.java.patch +++ b/patches/minecraft/net/minecraft/commands/synchronization/ArgumentTypes.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/commands/synchronization/ArgumentTypes.java +++ b/net/minecraft/commands/synchronization/ArgumentTypes.java -@@ -118,7 +_,7 @@ - m_121601_("dimension", DimensionArgument.class, new EmptyArgumentSerializer<>(DimensionArgument::m_88805_)); - m_121601_("time", TimeArgument.class, new EmptyArgumentSerializer<>(TimeArgument::m_113037_)); +@@ -122,7 +_,7 @@ m_121601_("uuid", UuidArgument.class, new EmptyArgumentSerializer<>(UuidArgument::m_113850_)); + m_121601_("resource", m_211031_(ResourceKeyArgument.class), new ResourceKeyArgument.Serializer()); + m_121601_("resource_or_tag", m_211031_(ResourceOrTagLocationArgument.class), new ResourceOrTagLocationArgument.Serializer()); - if (SharedConstants.f_136183_) { + if (net.minecraftforge.gametest.ForgeGameTestHooks.isGametestEnabled()) { m_121601_("test_argument", TestFunctionArgument.class, new EmptyArgumentSerializer<>(TestFunctionArgument::m_128088_)); m_121601_("test_class", TestClassNameArgument.class, new EmptyArgumentSerializer<>(TestClassNameArgument::m_127917_)); } -@@ -256,5 +_,9 @@ - this.f_121619_ = p_121623_; - this.f_121620_ = p_121624_; +@@ -262,5 +_,9 @@ + this.f_121619_ = p_211034_; + this.f_121620_ = p_211035_; } + } + @javax.annotation.Nullable public static ResourceLocation getId(ArgumentType type) { diff --git a/patches/minecraft/net/minecraft/core/MappedRegistry.java.patch b/patches/minecraft/net/minecraft/core/MappedRegistry.java.patch index 9477d6c111..1a316297e3 100644 --- a/patches/minecraft/net/minecraft/core/MappedRegistry.java.patch +++ b/patches/minecraft/net/minecraft/core/MappedRegistry.java.patch @@ -1,15 +1,16 @@ --- a/net/minecraft/core/MappedRegistry.java +++ b/net/minecraft/core/MappedRegistry.java -@@ -218,9 +_,10 @@ +@@ -279,6 +_,13 @@ + return this.f_205842_.containsKey(p_175392_); } - public static Codec> m_122756_(ResourceKey> p_122757_, Lifecycle p_122758_, Codec p_122759_) { -- return Codec.unboundedMap(ResourceLocation.f_135803_.xmap(ResourceKey.m_135797_(p_122757_), ResourceKey::m_135782_), p_122759_).xmap((p_194547_) -> { -+ // FORGE: Fix MC-197860 -+ return new net.minecraftforge.common.LenientUnboundedMapCodec<>(ResourceLocation.f_135803_.xmap(ResourceKey.m_135797_(p_122757_), ResourceKey::m_135782_), p_122759_).xmap((p_122726_) -> { - MappedRegistry mappedregistry = new MappedRegistry<>(p_122757_, p_122758_); -- p_194547_.forEach((p_194536_, p_194537_) -> { -+ p_122726_.forEach((p_194536_, p_194537_) -> { - mappedregistry.m_7135_(p_194536_, p_194537_, p_122758_); - }); - return mappedregistry; ++ // Forge: For internal use only. Use the Register events when registering values. ++ public void unfreeze() { ++ this.f_205845_ = false; ++ if (this.f_205846_ != null && this.f_205847_ == null) ++ this.f_205847_ = new IdentityHashMap<>(); ++ } ++ + public Registry m_203521_() { + this.f_205845_ = true; + List list = this.f_205842_.entrySet().stream().filter((p_211055_) -> { diff --git a/patches/minecraft/net/minecraft/core/Registry.java.patch b/patches/minecraft/net/minecraft/core/Registry.java.patch index 1e0da88454..7d1e99bab6 100644 --- a/patches/minecraft/net/minecraft/core/Registry.java.patch +++ b/patches/minecraft/net/minecraft/core/Registry.java.patch @@ -1,195 +1,195 @@ --- a/net/minecraft/core/Registry.java +++ b/net/minecraft/core/Registry.java -@@ -106,6 +_,10 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -116,6 +_,10 @@ + import org.apache.commons.lang3.Validate; + import org.slf4j.Logger; +/* + * Attention Modders: This SHOULD NOT be used, you should use ForgeRegistries instead. As it has a cleaner modder facing API. + * We will be wrapping all of these in our API as necessary for syncing and management. + */ public abstract class Registry implements Keyable, IdMap { - protected static final Logger f_122894_ = LogManager.getLogger(); + private static final Logger f_122894_ = LogUtils.getLogger(); private static final Map> f_122834_ = Maps.newLinkedHashMap(); -@@ -153,43 +_,43 @@ - public static final DefaultedRegistry f_175412_ = m_122995_(f_175423_, "step", () -> { +@@ -163,43 +_,43 @@ + public static final DefaultedRegistry f_175412_ = m_206031_(f_175423_, "step", GameEvent::m_204530_, (p_206044_) -> { return GameEvent.f_157785_; }); -- public static final Registry f_122821_ = m_122999_(f_122898_, () -> { -+ @Deprecated public static final Registry f_122821_ = forge(f_122898_, () -> { +- public static final Registry f_122821_ = m_206008_(f_122898_, (p_206042_) -> { ++ @Deprecated public static final Registry f_122821_ = forge(f_122898_, (registry) -> { return SoundEvents.f_12019_; }); -- public static final DefaultedRegistry f_122822_ = m_122995_(f_122899_, "empty", () -> { -+ @Deprecated public static final DefaultedRegistry f_122822_ = forge(f_122899_, "empty", () -> { +- public static final DefaultedRegistry f_122822_ = m_206031_(f_122899_, "empty", Fluid::m_205069_, (p_206040_) -> { ++ @Deprecated public static final DefaultedRegistry f_122822_ = forge(f_122899_, "empty", (registry) -> { return Fluids.f_76191_; }); -- public static final Registry f_122823_ = m_122999_(f_122900_, () -> { -+ @Deprecated public static final Registry f_122823_ = forge(f_122900_, () -> { +- public static final Registry f_122823_ = m_206008_(f_122900_, (p_205982_) -> { ++ @Deprecated public static final Registry f_122823_ = forge(f_122900_, (registry) -> { return MobEffects.f_19621_; }); -- public static final DefaultedRegistry f_122824_ = m_122995_(f_122901_, "air", () -> { -+ @Deprecated public static final DefaultedRegistry f_122824_ = forge(f_122901_, "air", () -> { +- public static final DefaultedRegistry f_122824_ = m_206031_(f_122901_, "air", Block::m_204297_, (p_205980_) -> { ++ @Deprecated public static final DefaultedRegistry f_122824_ = forge(f_122901_, "air", (registry) -> { return Blocks.f_50016_; }); -- public static final Registry f_122825_ = m_122999_(f_122902_, () -> { -+ @Deprecated public static final Registry f_122825_ = forge(f_122902_, () -> { +- public static final Registry f_122825_ = m_206008_(f_122902_, (p_205978_) -> { ++ @Deprecated public static final Registry f_122825_ = forge(f_122902_, (registry) -> { return Enchantments.f_44987_; }); -- public static final DefaultedRegistry> f_122826_ = m_122995_(f_122903_, "pig", () -> { -+ @Deprecated public static final DefaultedRegistry> f_122826_ = forge(f_122903_, "pig", () -> { +- public static final DefaultedRegistry> f_122826_ = m_206031_(f_122903_, "pig", EntityType::m_204041_, (p_205976_) -> { ++ @Deprecated public static final DefaultedRegistry> f_122826_ = forge(f_122903_, "pig", (registry) -> { return EntityType.f_20510_; }); -- public static final DefaultedRegistry f_122827_ = m_122995_(f_122904_, "air", () -> { -+ @Deprecated public static final DefaultedRegistry f_122827_ = forge(f_122904_, "air", () -> { +- public static final DefaultedRegistry f_122827_ = m_206031_(f_122904_, "air", Item::m_204114_, (p_205974_) -> { ++ @Deprecated public static final DefaultedRegistry f_122827_ = forge(f_122904_, "air", (registry) -> { return Items.f_41852_; }); -- public static final DefaultedRegistry f_122828_ = m_122995_(f_122905_, "empty", () -> { -+ @Deprecated public static final DefaultedRegistry f_122828_ = forge(f_122905_, "empty", () -> { +- public static final DefaultedRegistry f_122828_ = m_206027_(f_122905_, "empty", (p_205972_) -> { ++ @Deprecated public static final DefaultedRegistry f_122828_ = forge(f_122905_, "empty", (registry) -> { return Potions.f_43598_; }); -- public static final Registry> f_122829_ = m_122999_(f_122906_, () -> { -+ @Deprecated public static final Registry> f_122829_ = forge(f_122906_, () -> { +- public static final Registry> f_122829_ = m_206008_(f_122906_, (p_205970_) -> { ++ @Deprecated public static final Registry> f_122829_ = forge(f_122906_, (registry) -> { return ParticleTypes.f_123794_; }); -- public static final Registry> f_122830_ = m_122999_(f_122907_, () -> { -+ @Deprecated public static final Registry> f_122830_ = forge(f_122907_, () -> { +- public static final Registry> f_122830_ = m_206008_(f_122907_, (p_205968_) -> { ++ @Deprecated public static final Registry> f_122830_ = forge(f_122907_, (registry) -> { return BlockEntityType.f_58917_; }); -- public static final DefaultedRegistry f_122831_ = m_122995_(f_122908_, "kebab", () -> { -+ @Deprecated public static final DefaultedRegistry f_122831_ = forge(f_122908_, "kebab", () -> { +- public static final DefaultedRegistry f_122831_ = m_206027_(f_122908_, "kebab", (p_205966_) -> { ++ @Deprecated public static final DefaultedRegistry f_122831_ = forge(f_122908_, "kebab", (registry) -> { return Motive.f_31866_; }); - public static final Registry f_122832_ = m_122999_(f_122909_, () -> { + public static final Registry f_122832_ = m_206008_(f_122909_, (p_205964_) -> { return Stats.f_12926_; }); -- public static final DefaultedRegistry f_122833_ = m_122995_(f_122910_, "empty", () -> { -+ @Deprecated public static final DefaultedRegistry f_122833_ = forge(f_122910_, "empty", () -> { +- public static final DefaultedRegistry f_122833_ = m_206027_(f_122910_, "empty", (p_205962_) -> { ++ @Deprecated public static final DefaultedRegistry f_122833_ = forge(f_122910_, "empty", (registry) -> { return ChunkStatus.f_62314_; }); - public static final Registry> f_122861_ = m_122999_(f_122911_, () -> { -@@ -198,43 +_,43 @@ - public static final Registry> f_122862_ = m_122999_(f_122912_, () -> { + public static final Registry> f_122861_ = m_206008_(f_122911_, (p_205960_) -> { +@@ -208,43 +_,43 @@ + public static final Registry> f_122862_ = m_206008_(f_122912_, (p_205958_) -> { return PosRuleTestType.f_74205_; }); -- public static final Registry> f_122863_ = m_122999_(f_122913_, () -> { -+ @Deprecated public static final Registry> f_122863_ = forge(f_122913_, () -> { +- public static final Registry> f_122863_ = m_206008_(f_122913_, (p_205956_) -> { ++ @Deprecated public static final Registry> f_122863_ = forge(f_122913_, (registry) -> { return MenuType.f_39964_; }); - public static final Registry> f_122864_ = m_122999_(f_122914_, () -> { + public static final Registry> f_122864_ = m_206008_(f_122914_, (p_205954_) -> { return RecipeType.f_44107_; }); -- public static final Registry> f_122865_ = m_122999_(f_122915_, () -> { -+ @Deprecated public static final Registry> f_122865_ = forge(f_122915_, () -> { +- public static final Registry> f_122865_ = m_206008_(f_122915_, (p_205952_) -> { ++ @Deprecated public static final Registry> f_122865_ = forge(f_122915_, (registry) -> { return RecipeSerializer.f_44077_; }); -- public static final Registry f_122866_ = m_122999_(f_122916_, () -> { -+ @Deprecated public static final Registry f_122866_ = forge(f_122916_, () -> { +- public static final Registry f_122866_ = m_206008_(f_122916_, (p_205950_) -> { ++ @Deprecated public static final Registry f_122866_ = forge(f_122916_, (registry) -> { return Attributes.f_22286_; }); - public static final Registry> f_175420_ = m_122999_(f_175408_, () -> { + public static final Registry> f_175420_ = m_206008_(f_175408_, (p_205948_) -> { return PositionSourceType.f_157871_; }); -- public static final Registry> f_122867_ = m_122999_(f_122917_, () -> { -+ @Deprecated public static final Registry> f_122867_ = forge(f_122917_, () -> { +- public static final Registry> f_122867_ = m_206008_(f_122917_, (p_205946_) -> { ++ @Deprecated public static final Registry> f_122867_ = forge(f_122917_, (registry) -> { return Stats.f_12982_; }); - public static final DefaultedRegistry f_122868_ = m_122995_(f_122808_, "plains", () -> { + public static final DefaultedRegistry f_122868_ = m_206027_(f_122808_, "plains", (p_205944_) -> { return VillagerType.f_35821_; }); -- public static final DefaultedRegistry f_122869_ = m_122995_(f_122809_, "none", () -> { -+ @Deprecated public static final DefaultedRegistry f_122869_ = forge(f_122809_, "none", () -> { +- public static final DefaultedRegistry f_122869_ = m_206027_(f_122809_, "none", (p_205942_) -> { ++ @Deprecated public static final DefaultedRegistry f_122869_ = forge(f_122809_, "none", (registry) -> { return VillagerProfession.f_35585_; }); -- public static final DefaultedRegistry f_122870_ = m_122995_(f_122810_, "unemployed", () -> { -+ @Deprecated public static final DefaultedRegistry f_122870_ = forge(f_122810_, "unemployed", () -> { +- public static final DefaultedRegistry f_122870_ = m_206027_(f_122810_, "unemployed", (p_205940_) -> { ++ @Deprecated public static final DefaultedRegistry f_122870_ = forge(f_122810_, "unemployed", (registry) -> { return PoiType.f_27331_; }); -- public static final DefaultedRegistry> f_122871_ = m_122995_(f_122811_, "dummy", () -> { -+ @Deprecated public static final DefaultedRegistry> f_122871_ = forge(f_122811_, "dummy", () -> { +- public static final DefaultedRegistry> f_122871_ = m_206027_(f_122811_, "dummy", (p_205938_) -> { ++ @Deprecated public static final DefaultedRegistry> f_122871_ = forge(f_122811_, "dummy", (registry) -> { return MemoryModuleType.f_26349_; }); -- public static final DefaultedRegistry> f_122872_ = m_122995_(f_122812_, "dummy", () -> { -+ @Deprecated public static final DefaultedRegistry> f_122872_ = forge(f_122812_, "dummy", () -> { +- public static final DefaultedRegistry> f_122872_ = m_206027_(f_122812_, "dummy", (p_205936_) -> { ++ @Deprecated public static final DefaultedRegistry> f_122872_ = forge(f_122812_, "dummy", (registry) -> { return SensorType.f_26809_; }); -- public static final Registry f_122873_ = m_122999_(f_122813_, () -> { -+ @Deprecated public static final Registry f_122873_ = forge(f_122813_, () -> { +- public static final Registry f_122873_ = m_206008_(f_122813_, (p_205934_) -> { ++ @Deprecated public static final Registry f_122873_ = forge(f_122813_, (registry) -> { return Schedule.f_38012_; }); -- public static final Registry f_122874_ = m_122999_(f_122814_, () -> { -+ @Deprecated public static final Registry f_122874_ = forge(f_122814_, () -> { +- public static final Registry f_122874_ = m_206008_(f_122814_, (p_205932_) -> { ++ @Deprecated public static final Registry f_122874_ = forge(f_122814_, (registry) -> { return Activity.f_37979_; }); - public static final Registry f_122875_ = m_122999_(f_122815_, () -> { -@@ -281,15 +_,15 @@ - public static final ResourceKey> f_122885_ = m_122978_("worldgen/biome"); + public static final Registry f_122875_ = m_206008_(f_122815_, (p_206133_) -> { +@@ -293,15 +_,15 @@ public static final ResourceKey> f_194568_ = m_122978_("worldgen/noise"); + public static final ResourceKey> f_211074_ = m_122978_("worldgen/density_function"); public static final ResourceKey>> f_122836_ = m_122978_("worldgen/carver"); -- public static final Registry> f_122837_ = m_122999_(f_122836_, () -> { -+ @Deprecated public static final Registry> f_122837_ = forge(f_122836_, () -> { +- public static final Registry> f_122837_ = m_206008_(f_122836_, (p_206112_) -> { ++ @Deprecated public static final Registry> f_122837_ = forge(f_122836_, (registry) -> { return WorldCarver.f_64974_; }); public static final ResourceKey>> f_122838_ = m_122978_("worldgen/feature"); -- public static final Registry> f_122839_ = m_122999_(f_122838_, () -> { -+ @Deprecated public static final Registry> f_122839_ = forge(f_122838_, () -> { +- public static final Registry> f_122839_ = m_206008_(f_122838_, (p_206109_) -> { ++ @Deprecated public static final Registry> f_122839_ = forge(f_122838_, (registry) -> { return Feature.f_65731_; }); public static final ResourceKey>> f_122840_ = m_122978_("worldgen/structure_feature"); -- public static final Registry> f_122841_ = m_122999_(f_122840_, () -> { -+ @Deprecated public static final Registry> f_122841_ = forge(f_122840_, () -> { +- public static final Registry> f_122841_ = m_206008_(f_122840_, (p_206107_) -> { ++ @Deprecated public static final Registry> f_122841_ = forge(f_122840_, (registry) -> { return StructureFeature.f_67014_; }); - public static final ResourceKey> f_122842_ = m_122978_("worldgen/structure_piece"); -@@ -311,16 +_,16 @@ - public static final ResourceKey>> f_194572_ = m_122978_("worldgen/material_rule"); + public static final ResourceKey>> f_205929_ = m_122978_("worldgen/structure_placement"); +@@ -328,16 +_,16 @@ + public static final ResourceKey>> f_211075_ = m_122978_("worldgen/density_function_type"); public static final ResourceKey>> f_122854_ = m_122978_("worldgen/structure_processor"); public static final ResourceKey>> f_122855_ = m_122978_("worldgen/structure_pool_element"); -- public static final Registry> f_122856_ = m_122999_(f_122846_, () -> { -+ @Deprecated public static final Registry> f_122856_ = forge(f_122846_, () -> { +- public static final Registry> f_122856_ = m_206008_(f_122846_, (p_206098_) -> { ++ @Deprecated public static final Registry> f_122856_ = forge(f_122846_, (registry) -> { return BlockStateProviderType.f_68752_; }); -- public static final Registry> f_122858_ = m_122999_(f_122848_, () -> { -+ @Deprecated public static final Registry> f_122858_ = forge(f_122848_, () -> { +- public static final Registry> f_122858_ = m_206008_(f_122848_, (p_206092_) -> { ++ @Deprecated public static final Registry> f_122858_ = forge(f_122848_, (registry) -> { return FoliagePlacerType.f_68591_; }); - public static final Registry> f_122859_ = m_122999_(f_122849_, () -> { + public static final Registry> f_122859_ = m_206008_(f_122849_, (p_206086_) -> { return TrunkPlacerType.f_70315_; }); -- public static final Registry> f_122860_ = m_122999_(f_122850_, () -> { -+ @Deprecated public static final Registry> f_122860_ = forge(f_122850_, () -> { +- public static final Registry> f_122860_ = m_206008_(f_122850_, (p_206078_) -> { ++ @Deprecated public static final Registry> f_122860_ = forge(f_122850_, (registry) -> { return TreeDecoratorType.f_70043_; }); - public static final Registry> f_122888_ = m_122999_(f_122851_, () -> { -@@ -365,16 +_,32 @@ - return m_122981_(p_123000_, Lifecycle.experimental(), p_123001_); + public static final Registry> f_122888_ = m_206008_(f_122851_, (p_206072_) -> { +@@ -383,16 +_,32 @@ + return m_205999_(p_206009_, Lifecycle.experimental(), p_206010_); } -+ private static > Registry forge(ResourceKey> key, Supplier def) { ++ private static > Registry forge(ResourceKey> key, Registry.RegistryBootstrap def) { + return forge(key, Lifecycle.experimental(), def); + } + - private static DefaultedRegistry m_122995_(ResourceKey> p_122996_, String p_122997_, Supplier p_122998_) { - return m_122990_(p_122996_, p_122997_, Lifecycle.experimental(), p_122998_); + private static DefaultedRegistry m_206027_(ResourceKey> p_206028_, String p_206029_, Registry.RegistryBootstrap p_206030_) { + return m_206016_(p_206028_, p_206029_, Lifecycle.experimental(), p_206030_); } -+ private static > DefaultedRegistry forge(ResourceKey> key, String defKey, Supplier def) { ++ private static > DefaultedRegistry forge(ResourceKey> key, String defKey, Registry.RegistryBootstrap def) { + return forge(key, defKey, Lifecycle.experimental(), def); + } + - private static Registry m_122981_(ResourceKey> p_122982_, Lifecycle p_122983_, Supplier p_122984_) { - return m_122985_(p_122982_, new MappedRegistry<>(p_122982_, p_122983_), p_122984_, p_122983_); + private static DefaultedRegistry m_206031_(ResourceKey> p_206032_, String p_206033_, Function> p_206034_, Registry.RegistryBootstrap p_206035_) { + return m_206021_(p_206032_, p_206033_, Lifecycle.experimental(), p_206034_, p_206035_); } -+ private static > Registry forge(ResourceKey> key, Lifecycle cycle, Supplier def) { -+ return m_122985_(key, net.minecraftforge.registries.GameData.getWrapper(key, cycle), def, cycle); ++ private static > Registry forge(ResourceKey> key, Lifecycle cycle, Registry.RegistryBootstrap def) { ++ return m_206011_(key, net.minecraftforge.registries.GameData.getWrapper(key, cycle), def, cycle); + } + - private static DefaultedRegistry m_122990_(ResourceKey> p_122991_, String p_122992_, Lifecycle p_122993_, Supplier p_122994_) { - return m_122985_(p_122991_, new DefaultedRegistry<>(p_122992_, p_122991_, p_122993_), p_122994_, p_122993_); + private static Registry m_205999_(ResourceKey> p_206000_, Lifecycle p_206001_, Registry.RegistryBootstrap p_206002_) { + return m_206011_(p_206000_, new MappedRegistry<>(p_206000_, p_206001_, (Function>)null), p_206002_, p_206001_); + } + -+ private static > DefaultedRegistry forge(ResourceKey> key, String defKey, Lifecycle cycle, Supplier def) { -+ return m_122985_(key, net.minecraftforge.registries.GameData.getWrapper(key, cycle, defKey), def, cycle); ++ private static > DefaultedRegistry forge(ResourceKey> key, String defKey, Lifecycle cycle, Registry.RegistryBootstrap def) { ++ return m_206011_(key, net.minecraftforge.registries.GameData.getWrapper(key, cycle, defKey), def, cycle); } - private static > R m_122985_(ResourceKey> p_122986_, R p_122987_, Supplier p_122988_, Lifecycle p_122989_) { + private static Registry m_206003_(ResourceKey> p_206004_, Lifecycle p_206005_, Function> p_206006_, Registry.RegistryBootstrap p_206007_) { diff --git a/patches/minecraft/net/minecraft/core/RegistryAccess.java.patch b/patches/minecraft/net/minecraft/core/RegistryAccess.java.patch index fbeb3f8c69..54e8728c62 100644 --- a/patches/minecraft/net/minecraft/core/RegistryAccess.java.patch +++ b/patches/minecraft/net/minecraft/core/RegistryAccess.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/core/RegistryAccess.java +++ b/net/minecraft/core/RegistryAccess.java -@@ -109,6 +_,8 @@ - ResourceKey> resourcekey = p_194617_.f_123101_(); - boolean flag = !resourcekey.equals(Registry.f_122878_) && !resourcekey.equals(Registry.f_122818_); - Registry registry = f_123049_.m_175515_(resourcekey); +@@ -185,6 +_,8 @@ + private static void m_211081_(RegistryResourceAccess.InMemoryStorage p_211082_, RegistryAccess.RegistryData p_211083_) { + ResourceKey> resourcekey = p_211083_.f_123101_(); + Registry registry = BuiltinRegistries.f_206379_.m_175515_(resourcekey); + if (!resourcekey.equals(Registry.f_122818_)) + registry = ((Registry>)BuiltinRegistries.f_123858_).m_6246_((ResourceKey>)resourcekey); - WritableRegistry writableregistry = p_194615_.m_175512_(resourcekey); for(Entry, E> entry : registry.m_6579_()) { + ResourceKey resourcekey1 = entry.getKey(); diff --git a/patches/minecraft/net/minecraft/core/RegistryCodecs.java.patch b/patches/minecraft/net/minecraft/core/RegistryCodecs.java.patch new file mode 100644 index 0000000000..aa101f2f2d --- /dev/null +++ b/patches/minecraft/net/minecraft/core/RegistryCodecs.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/core/RegistryCodecs.java ++++ b/net/minecraft/core/RegistryCodecs.java +@@ -95,7 +_,8 @@ + } + + private static Codec, T>> m_206315_(ResourceKey> p_206316_, Codec p_206317_) { +- return Codec.unboundedMap(ResourceLocation.f_135803_.xmap(ResourceKey.m_135797_(p_206316_), ResourceKey::m_135782_), p_206317_); ++ // FORGE: Fix MC-197860 ++ return new net.minecraftforge.common.LenientUnboundedMapCodec<>(ResourceLocation.f_135803_.xmap(ResourceKey.m_135797_(p_206316_), ResourceKey::m_135782_), p_206317_); + } + + public static Codec> m_206279_(ResourceKey> p_206280_, Codec p_206281_) { diff --git a/patches/minecraft/net/minecraft/data/BuiltinRegistries.java.patch b/patches/minecraft/net/minecraft/data/BuiltinRegistries.java.patch index b05904a008..355a636232 100644 --- a/patches/minecraft/net/minecraft/data/BuiltinRegistries.java.patch +++ b/patches/minecraft/net/minecraft/data/BuiltinRegistries.java.patch @@ -1,22 +1,22 @@ --- a/net/minecraft/data/BuiltinRegistries.java +++ b/net/minecraft/data/BuiltinRegistries.java -@@ -44,7 +_,7 @@ +@@ -52,7 +_,7 @@ return ProcessorLists.f_127199_; }); - public static final Registry f_123864_ = m_123893_(Registry.f_122884_, Pools::m_127189_); -- public static final Registry f_123865_ = m_123893_(Registry.f_122885_, () -> { -+ @Deprecated public static final Registry f_123865_ = forge(Registry.f_122885_, () -> { - return Biomes.f_127321_; - }); - public static final Registry f_123866_ = m_123893_(Registry.f_122878_, NoiseGeneratorSettings::m_64488_); -@@ -52,6 +_,10 @@ + public static final Registry f_123864_ = m_123893_(Registry.f_122884_, Pools::m_206434_); +- public static final Registry f_123865_ = m_123893_(Registry.f_122885_, Biomes::m_206462_); ++ @Deprecated public static final Registry f_123865_ = forge(Registry.f_122885_, Biomes::m_206462_); + public static final Registry f_194654_ = m_123893_(Registry.f_194568_, NoiseData::m_206433_); + public static final Registry f_211085_ = m_123893_(Registry.f_211074_, NoiseRouterData::m_209468_); + public static final Registry f_123866_ = m_123893_(Registry.f_122878_, NoiseGeneratorSettings::m_204599_); +@@ -60,6 +_,10 @@ - private static Registry m_123893_(ResourceKey> p_123894_, Supplier p_123895_) { + private static Registry m_123893_(ResourceKey> p_123894_, Supplier> p_123895_) { return m_123884_(p_123894_, Lifecycle.stable(), p_123895_); + } + -+ private static > Registry forge(ResourceKey> key, Supplier def) { -+ return m_123888_(key, net.minecraftforge.registries.GameData.getWrapper(key, Lifecycle.stable()), def, Lifecycle.stable()); ++ private static > Registry forge(ResourceKey> key, Supplier> holderSupplier) { ++ return m_123888_(key, net.minecraftforge.registries.GameData.getWrapper(key, Lifecycle.stable()), holderSupplier, Lifecycle.stable()); } - private static Registry m_123884_(ResourceKey> p_123885_, Lifecycle p_123886_, Supplier p_123887_) { + private static Registry m_123884_(ResourceKey> p_123885_, Lifecycle p_123886_, Supplier> p_123887_) { diff --git a/patches/minecraft/net/minecraft/data/Main.java.patch b/patches/minecraft/net/minecraft/data/Main.java.patch index e714ed32d6..75cbbeb35a 100644 --- a/patches/minecraft/net/minecraft/data/Main.java.patch +++ b/patches/minecraft/net/minecraft/data/Main.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/Main.java +++ b/net/minecraft/data/Main.java -@@ -41,8 +_,15 @@ +@@ -43,8 +_,15 @@ OptionSpec optionspec6 = optionparser.accepts("all", "Include all generators"); OptionSpec optionspec7 = optionparser.accepts("output", "Output folder").withRequiredArg().defaultsTo("generated"); OptionSpec optionspec8 = optionparser.accepts("input", "Input folder").withRequiredArg(); @@ -17,7 +17,7 @@ Path path = Paths.get(optionspec7.value(optionset)); boolean flag = optionset.has(optionspec6); boolean flag1 = flag || optionset.has(optionspec2); -@@ -50,10 +_,14 @@ +@@ -52,10 +_,14 @@ boolean flag3 = flag || optionset.has(optionspec3); boolean flag4 = flag || optionset.has(optionspec4); boolean flag5 = flag || optionset.has(optionspec5); diff --git a/patches/minecraft/net/minecraft/data/tags/BlockTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/BlockTagsProvider.java.patch index e9c41c8774..087f0bbab8 100644 --- a/patches/minecraft/net/minecraft/data/tags/BlockTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/BlockTagsProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/tags/BlockTagsProvider.java +++ b/net/minecraft/data/tags/BlockTagsProvider.java -@@ -9,8 +_,12 @@ +@@ -7,8 +_,12 @@ import net.minecraft.world.level.block.Blocks; public class BlockTagsProvider extends TagsProvider { diff --git a/patches/minecraft/net/minecraft/data/tags/EntityTypeTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/EntityTypeTagsProvider.java.patch index c0c6b50559..618c5cf79f 100644 --- a/patches/minecraft/net/minecraft/data/tags/EntityTypeTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/EntityTypeTagsProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/tags/EntityTypeTagsProvider.java +++ b/net/minecraft/data/tags/EntityTypeTagsProvider.java -@@ -8,8 +_,12 @@ +@@ -6,8 +_,12 @@ import net.minecraft.world.entity.EntityType; public class EntityTypeTagsProvider extends TagsProvider> { diff --git a/patches/minecraft/net/minecraft/data/tags/FluidTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/FluidTagsProvider.java.patch index ba31267ce7..7a3dc27ab0 100644 --- a/patches/minecraft/net/minecraft/data/tags/FluidTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/FluidTagsProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/tags/FluidTagsProvider.java +++ b/net/minecraft/data/tags/FluidTagsProvider.java -@@ -9,8 +_,12 @@ +@@ -7,8 +_,12 @@ import net.minecraft.world.level.material.Fluids; public class FluidTagsProvider extends TagsProvider { diff --git a/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch index e5f564a96e..0cef54a6d7 100644 --- a/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/tags/GameEventTagsProvider.java +++ b/net/minecraft/data/tags/GameEventTagsProvider.java -@@ -8,8 +_,12 @@ +@@ -6,8 +_,12 @@ import net.minecraft.world.level.gameevent.GameEvent; public class GameEventTagsProvider extends TagsProvider { diff --git a/patches/minecraft/net/minecraft/data/tags/ItemTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/ItemTagsProvider.java.patch index f600a55238..5fb099ec47 100644 --- a/patches/minecraft/net/minecraft/data/tags/ItemTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/ItemTagsProvider.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/data/tags/ItemTagsProvider.java +++ b/net/minecraft/data/tags/ItemTagsProvider.java -@@ -15,8 +_,13 @@ +@@ -14,8 +_,13 @@ public class ItemTagsProvider extends TagsProvider { - private final Function, Tag.Builder> f_126528_; + private final Function, Tag.Builder> f_126528_; + @Deprecated public ItemTagsProvider(DataGenerator p_126530_, BlockTagsProvider p_126531_) { super(p_126530_, Registry.f_122827_); -+ this.f_126528_ = p_126531_::m_126562_; ++ this.f_126528_ = p_126531_::m_206426_; + } + public ItemTagsProvider(DataGenerator p_126530_, BlockTagsProvider p_126531_, String modId, @javax.annotation.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { + super(p_126530_, Registry.f_122827_, modId, existingFileHelper); - this.f_126528_ = p_126531_::m_126562_; + this.f_126528_ = p_126531_::m_206426_; } diff --git a/patches/minecraft/net/minecraft/data/tags/TagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/TagsProvider.java.patch index dffa2031a1..064d7722e4 100644 --- a/patches/minecraft/net/minecraft/data/tags/TagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/TagsProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/tags/TagsProvider.java +++ b/net/minecraft/data/tags/TagsProvider.java -@@ -29,10 +_,29 @@ +@@ -32,10 +_,29 @@ protected final DataGenerator f_126539_; protected final Registry f_126540_; protected final Map f_126543_ = Maps.newLinkedHashMap(); @@ -30,11 +30,11 @@ } protected abstract void m_6577_(); -@@ -43,12 +_,13 @@ +@@ -46,12 +_,13 @@ this.f_126543_.forEach((p_176835_, p_176836_) -> { List list = p_176836_.m_13330_().filter((p_176832_) -> { - return !p_176832_.m_13347_().m_142746_(this.f_126540_::m_7804_, this.f_126543_::containsKey); -- }).collect(Collectors.toList()); + return !p_176832_.f_13338_().m_142746_(this.f_126540_::m_7804_, this.f_126543_::containsKey); +- }).toList(); + }).filter(this::missing).collect(Collectors.toList()); // Forge: Add validation via existing resources if (!list.isEmpty()) { throw new IllegalArgumentException(String.format("Couldn't define tag %s as it is missing following references: %s", p_176835_, list.stream().map(Objects::toString).collect(Collectors.joining(",")))); @@ -45,30 +45,35 @@ try { String s = f_126542_.toJson((JsonElement)jsonobject); -@@ -85,20 +_,31 @@ +@@ -88,6 +_,18 @@ }); } + private boolean missing(Tag.BuilderEntry reference) { -+ Tag.Entry entry = reference.m_13347_(); ++ Tag.Entry entry = reference.f_13338_(); + // We only care about non-optional tag entries, this is the only type that can reference a resource and needs validation + // Optional tags should not be validated ++ ++ //TODO-PATCHING:Figure out optional tag data. + if (entry instanceof Tag.TagEntry) { + return existingFileHelper == null || !existingFileHelper.exists(((Tag.TagEntry)entry).getId(), resourceType); + } + return false; + } + - protected abstract Path m_6648_(ResourceLocation p_126561_); + protected Path m_6648_(ResourceLocation p_126561_) { + ResourceKey> resourcekey = this.f_126540_.m_123023_(); + return this.f_126539_.m_123916_().resolve("data/" + p_126561_.m_135827_() + "/" + TagManager.m_203918_(resourcekey) + "/" + p_126561_.m_135815_() + ".json"); +@@ -95,16 +_,17 @@ - protected TagsProvider.TagAppender m_126548_(Tag.Named p_126549_) { - Tag.Builder tag$builder = this.m_126562_(p_126549_); + protected TagsProvider.TagAppender m_206424_(TagKey p_206425_) { + Tag.Builder tag$builder = this.m_206426_(p_206425_); - return new TagsProvider.TagAppender<>(tag$builder, this.f_126540_, "vanilla"); + return new TagsProvider.TagAppender<>(tag$builder, this.f_126540_, modId); } - protected Tag.Builder m_126562_(Tag.Named p_126563_) { - return this.f_126543_.computeIfAbsent(p_126563_.m_6979_(), (p_176838_) -> { + protected Tag.Builder m_206426_(TagKey p_206427_) { + return this.f_126543_.computeIfAbsent(p_206427_.f_203868_(), (p_176838_) -> { + existingFileHelper.trackGenerated(p_176838_, resourceType); return new Tag.Builder(); }); @@ -79,25 +84,7 @@ private final Tag.Builder f_126568_; public final Registry f_126569_; private final String f_126570_; -@@ -114,7 +_,7 @@ - return this; - } - -- public TagsProvider.TagAppender m_176839_(ResourceLocation p_176840_) { -+ public TagsProvider.TagAppender addOptional(ResourceLocation p_176840_) { - this.f_126568_.m_144379_(p_176840_, this.f_126570_); - return this; - } -@@ -124,7 +_,7 @@ - return this; - } - -- public TagsProvider.TagAppender m_176841_(ResourceLocation p_176842_) { -+ public TagsProvider.TagAppender addOptionalTag(ResourceLocation p_176842_) { - this.f_126568_.m_144382_(p_176842_, this.f_126570_); - return this; - } -@@ -135,6 +_,19 @@ +@@ -150,6 +_,19 @@ this.f_126568_.m_13327_(p_126587_, this.f_126570_); }); return this; diff --git a/patches/minecraft/net/minecraft/gametest/framework/GameTestServer.java.patch b/patches/minecraft/net/minecraft/gametest/framework/GameTestServer.java.patch index a32a9c02de..30374a1f6c 100644 --- a/patches/minecraft/net/minecraft/gametest/framework/GameTestServer.java.patch +++ b/patches/minecraft/net/minecraft/gametest/framework/GameTestServer.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/gametest/framework/GameTestServer.java +++ b/net/minecraft/gametest/framework/GameTestServer.java -@@ -69,12 +_,13 @@ +@@ -93,12 +_,13 @@ public boolean m_7038_() { - this.m_129823_(new PlayerList(this, this.f_129746_, this.f_129745_, 1) { + this.m_129823_(new PlayerList(this, this.m_206579_(), this.f_129745_, 1) { }); + if (!net.minecraftforge.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false; this.m_130006_(); diff --git a/patches/minecraft/net/minecraft/nbt/NbtIo.java.patch b/patches/minecraft/net/minecraft/nbt/NbtIo.java.patch index 91c534df34..9dd2128154 100644 --- a/patches/minecraft/net/minecraft/nbt/NbtIo.java.patch +++ b/patches/minecraft/net/minecraft/nbt/NbtIo.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/nbt/NbtIo.java +++ b/net/minecraft/nbt/NbtIo.java -@@ -218,10 +_,12 @@ +@@ -268,10 +_,12 @@ private static Tag m_128930_(DataInput p_128931_, int p_128932_, NbtAccounter p_128933_) throws IOException { byte b0 = p_128931_.readByte(); diff --git a/patches/minecraft/net/minecraft/network/Connection.java.patch b/patches/minecraft/net/minecraft/network/Connection.java.patch index 59430eefb3..af42de5f43 100644 --- a/patches/minecraft/net/minecraft/network/Connection.java.patch +++ b/patches/minecraft/net/minecraft/network/Connection.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/network/Connection.java +++ b/net/minecraft/network/Connection.java -@@ -77,6 +_,7 @@ +@@ -87,6 +_,7 @@ private float f_129477_; private int f_129478_; private boolean f_129479_; @@ -8,7 +8,7 @@ public Connection(PacketFlow p_129482_) { this.f_129466_ = p_129482_; -@@ -86,6 +_,7 @@ +@@ -96,6 +_,7 @@ super.channelActive(p_129525_); this.f_129468_ = p_129525_.channel(); this.f_129469_ = this.f_129468_.remoteAddress(); @@ -16,7 +16,7 @@ try { this.m_129498_(ConnectionProtocol.HANDSHAKING); -@@ -179,7 +_,7 @@ +@@ -191,7 +_,7 @@ ++this.f_129475_; if (connectionprotocol1 != connectionprotocol) { f_129465_.debug("Disabled auto read"); @@ -25,7 +25,7 @@ } if (this.f_129468_.eventLoop().inEventLoop()) { -@@ -277,7 +_,9 @@ +@@ -289,7 +_,9 @@ } public static Connection m_178300_(InetSocketAddress p_178301_, boolean p_178302_) { @@ -35,7 +35,7 @@ Class oclass; LazyLoadedValue lazyloadedvalue; if (Epoll.isAvailable() && p_178302_) { -@@ -303,6 +_,7 @@ +@@ -315,6 +_,7 @@ public static Connection m_129493_(SocketAddress p_129494_) { final Connection connection = new Connection(PacketFlow.CLIENTBOUND); @@ -43,7 +43,7 @@ (new Bootstrap()).group(f_129464_.m_13971_()).handler(new ChannelInitializer() { protected void initChannel(Channel p_129557_) { p_129557_.pipeline().addLast("packet_handler", connection); -@@ -389,6 +_,14 @@ +@@ -401,6 +_,14 @@ public float m_129543_() { return this.f_129477_; diff --git a/patches/minecraft/net/minecraft/network/PacketEncoder.java.patch b/patches/minecraft/net/minecraft/network/PacketEncoder.java.patch deleted file mode 100644 index 4002cd3316..0000000000 --- a/patches/minecraft/net/minecraft/network/PacketEncoder.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/network/PacketEncoder.java -+++ b/net/minecraft/network/PacketEncoder.java -@@ -48,7 +_,7 @@ - JvmProfiler.f_185340_.m_183508_(k, integer, p_130545_.channel().remoteAddress(), j); - } - } catch (Throwable throwable) { -- f_130538_.error(throwable); -+ f_130538_.error("Error encoding packet", throwable); // Forge: Get Minecraft to spit out more information about the Throwable we got. - if (p_130546_.m_6588_()) { - throw new SkipPacketException(throwable); - } else { diff --git a/patches/minecraft/net/minecraft/resources/RegistryResourceAccess.java.patch b/patches/minecraft/net/minecraft/resources/RegistryResourceAccess.java.patch index 2e974710e7..d9c66ccf91 100644 --- a/patches/minecraft/net/minecraft/resources/RegistryResourceAccess.java.patch +++ b/patches/minecraft/net/minecraft/resources/RegistryResourceAccess.java.patch @@ -8,11 +8,12 @@ optional = Optional.of(p_195896_.parse(p_195893_, jsonelement).map(RegistryResourceAccess.ParsedEntry::m_195956_)); } catch (Throwable throwable2) { try { -@@ -138,6 +_,7 @@ +@@ -138,6 +_,8 @@ public Optional>> m_183313_(DynamicOps p_195917_, ResourceKey> p_195918_, ResourceKey p_195919_, Decoder p_195920_) { RegistryResourceAccess.InMemoryStorage.Entry registryresourceaccess$inmemorystorage$entry = this.f_195913_.get(p_195919_); -+ if (registryresourceaccess$inmemorystorage$entry != null && registryresourceaccess$inmemorystorage$entry.f_195936_ != null) registryresourceaccess$inmemorystorage$entry.f_195936_.getAsJsonObject().addProperty("forge:registry_name", p_195919_.m_135782_().toString()); ++ if (registryresourceaccess$inmemorystorage$entry != null && registryresourceaccess$inmemorystorage$entry.f_195936_ != null && registryresourceaccess$inmemorystorage$entry.f_195936_.isJsonObject()) ++ registryresourceaccess$inmemorystorage$entry.f_195936_.getAsJsonObject().addProperty("forge:registry_name", p_195919_.m_135782_().toString()); return registryresourceaccess$inmemorystorage$entry == null ? Optional.of(DataResult.error("Unknown element: " + p_195919_)) : Optional.of(p_195920_.parse(p_195917_, registryresourceaccess$inmemorystorage$entry.f_195936_).setLifecycle(registryresourceaccess$inmemorystorage$entry.f_195938_).map((p_195930_) -> { return RegistryResourceAccess.ParsedEntry.m_195958_(p_195930_, registryresourceaccess$inmemorystorage$entry.f_195937_); })); diff --git a/patches/minecraft/net/minecraft/resources/ResourceKey.java.patch b/patches/minecraft/net/minecraft/resources/ResourceKey.java.patch index 0840199a2a..10d491de1e 100644 --- a/patches/minecraft/net/minecraft/resources/ResourceKey.java.patch +++ b/patches/minecraft/net/minecraft/resources/ResourceKey.java.patch @@ -9,7 +9,7 @@ private static final Map> f_135775_ = Collections.synchronizedMap(Maps.newIdentityHashMap()); private final ResourceLocation f_135776_; private final ResourceLocation f_135777_; -@@ -59,5 +_,23 @@ +@@ -63,5 +_,23 @@ return (p_195974_) -> { return m_135785_(p_135798_, p_195974_); }; diff --git a/patches/minecraft/net/minecraft/server/Bootstrap.java.patch b/patches/minecraft/net/minecraft/server/Bootstrap.java.patch index e43f122cf5..78168a045f 100644 --- a/patches/minecraft/net/minecraft/server/Bootstrap.java.patch +++ b/patches/minecraft/net/minecraft/server/Bootstrap.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/server/Bootstrap.java +++ b/net/minecraft/server/Bootstrap.java -@@ -56,6 +_,8 @@ +@@ -55,6 +_,8 @@ CauldronInteraction.m_175649_(); ArgumentTypes.m_121586_(); - StaticTags.m_13282_(); + Registry.m_206101_(); + net.minecraftforge.registries.GameData.vanillaSnapshot(); + if (false) // skip redirectOutputToLog, Forge already redirects stdout and stderr output to log so that they print with more context m_135890_(); } } -@@ -129,7 +_,6 @@ +@@ -128,7 +_,6 @@ m_197757_(); } diff --git a/patches/minecraft/net/minecraft/server/Main.java.patch b/patches/minecraft/net/minecraft/server/Main.java.patch index b54d688330..f1e4cabcb3 100644 --- a/patches/minecraft/net/minecraft/server/Main.java.patch +++ b/patches/minecraft/net/minecraft/server/Main.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/Main.java +++ b/net/minecraft/server/Main.java -@@ -76,6 +_,15 @@ +@@ -77,6 +_,15 @@ OptionSpec optionspec12 = optionparser.accepts("serverId").withRequiredArg(); OptionSpec optionspec13 = optionparser.accepts("jfrProfile"); OptionSpec optionspec14 = optionparser.nonOptions(); @@ -16,7 +16,7 @@ try { OptionSet optionset = optionparser.parse(p_129699_); -@@ -83,6 +_,13 @@ +@@ -84,6 +_,13 @@ optionparser.printHelpOn(System.err); return; } @@ -30,13 +30,12 @@ CrashReport.m_127529_(); if (optionset.has(optionspec13)) { -@@ -92,30 +_,30 @@ +@@ -93,29 +_,29 @@ Bootstrap.m_135870_(); Bootstrap.m_135889_(); Util.m_137584_(); -- RegistryAccess.RegistryHolder registryaccess$registryholder = RegistryAccess.m_123086_(); + if (!optionset.has(optionspec1)) net.minecraftforge.server.loading.ServerModLoader.load(); // Load mods before we load almost anything else anymore. Single spot now. Only loads if they haven't passed the initserver param -+ RegistryAccess.RegistryHolder registryaccess$registryholder; // RegistryAccess.builtin(); // Delay initialization until after we read additional save data ++ //TODO-PATCHING: Figure out how to handle the delayed initialization. Path path = Paths.get("server.properties"); DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(path); dedicatedserversettings.m_139780_(); @@ -65,34 +64,24 @@ LevelStorageSource levelstoragesource = LevelStorageSource.m_78242_(file1.toPath()); LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess = levelstoragesource.m_78260_(s); + levelstoragesource$levelstorageaccess.readAdditionalLevelSaveData(); -+ registryaccess$registryholder = RegistryAccess.m_123086_(); LevelSummary levelsummary = levelstoragesource$levelstorageaccess.m_78308_(); if (levelsummary != null) { if (levelsummary.m_193020_()) { -@@ -164,6 +_,8 @@ - worldgensettings = optionset.has(optionspec3) ? dedicatedserverproperties.m_180927_(registryaccess$registryholder).m_64671_() : dedicatedserverproperties.m_180927_(registryaccess$registryholder); - } - -+ // Forge: Deserialize the DimensionGeneratorSettings to ensure modded dims are loaded on first server load (see SimpleRegistryCodec#decode). Vanilla behaviour only loads from the server.properties and deserializes only after the 2nd server load. -+ worldgensettings = WorldGenSettings.f_64600_.encodeStart(net.minecraft.resources.RegistryWriteOps.m_135767_(NbtOps.f_128958_, registryaccess$registryholder), worldgensettings).flatMap(nbt -> WorldGenSettings.f_64600_.parse(registryreadops, nbt)).getOrThrow(false, errorMsg->{}); - worlddata = new PrimaryLevelData(levelsettings, worldgensettings, Lifecycle.stable()); +@@ -181,22 +_,34 @@ } -@@ -175,22 +_,33 @@ - - levelstoragesource$levelstorageaccess.m_78287_(registryaccess$registryholder, worlddata); - WorldData worlddata1 = worlddata; -- final DedicatedServer dedicatedserver = MinecraftServer.m_129872_((p_129697_) -> { -- DedicatedServer dedicatedserver1 = new DedicatedServer(p_129697_, registryaccess$registryholder, levelstoragesource$levelstorageaccess, packrepository, serverresources, worlddata1, dedicatedserversettings, DataFixers.m_14512_(), minecraftsessionservice, gameprofilerepository, gameprofilecache, LoggerChunkProgressListener::new); + levelstoragesource$levelstorageaccess.m_78287_(registryaccess$frozen, worlddata); +- final DedicatedServer dedicatedserver = MinecraftServer.m_129872_((p_206536_) -> { +- DedicatedServer dedicatedserver1 = new DedicatedServer(p_206536_, levelstoragesource$levelstorageaccess, packrepository, worldstem, dedicatedserversettings, DataFixers.m_14512_(), minecraftsessionservice, gameprofilerepository, gameprofilecache, LoggerChunkProgressListener::new); + final MinecraftServer dedicatedserver = MinecraftServer.m_129872_((p_129697_) -> { + MinecraftServer dedicatedserver1; + if (gametestEnabled) { + net.minecraftforge.gametest.ForgeGameTestHooks.registerGametests(); + java.util.Collection testBatches = net.minecraft.gametest.framework.GameTestRunner.m_127724_(net.minecraft.gametest.framework.GameTestRegistry.m_127658_()); + net.minecraft.core.BlockPos spawnPos = optionset.valueOf(spawnPosOpt); -+ dedicatedserver1 = new net.minecraft.gametest.framework.GameTestServer(p_129697_, levelstoragesource$levelstorageaccess, packrepository, serverresources, testBatches, spawnPos, registryaccess$registryholder); ++ dedicatedserver1 = new net.minecraft.gametest.framework.GameTestServer(p_129697_, levelstoragesource$levelstorageaccess, packrepository, worldstem, testBatches, spawnPos); + } else { -+ dedicatedserver1 = new DedicatedServer(p_129697_, registryaccess$registryholder, levelstoragesource$levelstorageaccess, packrepository, serverresources, worlddata1, dedicatedserversettings, DataFixers.m_14512_(), minecraftsessionservice, gameprofilerepository, gameprofilecache, LoggerChunkProgressListener::new); ++ dedicatedserver1 = new DedicatedServer(p_129697_, levelstoragesource$levelstorageaccess, packrepository, worldstem, dedicatedserversettings, DataFixers.m_14512_(), minecraftsessionservice, gameprofilerepository, gameprofilecache, LoggerChunkProgressListener::new); + } dedicatedserver1.m_129981_(optionset.valueOf(optionspec8)); dedicatedserver1.m_129801_(optionset.valueOf(optionspec11)); @@ -112,7 +101,8 @@ + // FORGE: Halting as GameTestServer will cause issues as it always calls System#exit on both crash and normal exit, so skip it + if (!(dedicatedserver instanceof net.minecraft.gametest.framework.GameTestServer)) dedicatedserver.m_7570_(true); -+ LogManager.shutdown(); // we're manually managing the logging shutdown on the server. Make sure we do it here at the end. ++ //TODO-PATCHING: Figure out what needs to be done here after the logging update. ++ //LogManager.shutdown(); // we're manually managing the logging shutdown on the server. Make sure we do it here at the end. } }; thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(f_129670_)); diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index 7d6c9324fd..68c3dff78d 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -254,7 +_,7 @@ +@@ -257,7 +_,7 @@ public static S m_129872_(Function p_129873_) { AtomicReference atomicreference = new AtomicReference<>(); @@ -9,7 +9,7 @@ atomicreference.get().m_130011_(); }, "Server thread"); thread.setUncaughtExceptionHandler((p_177909_, p_177910_) -> { -@@ -355,6 +_,7 @@ +@@ -358,6 +_,7 @@ this.m_129841_(dimensiondatastorage); this.f_129732_ = new CommandStorage(dimensiondatastorage); WorldBorder worldborder = serverlevel.m_6857_(); @@ -17,15 +17,15 @@ if (!serverleveldata.m_6535_()) { try { m_177896_(serverlevel, serverleveldata, worldgensettings.m_64660_(), flag); -@@ -391,6 +_,7 @@ - ServerLevel serverlevel1 = new ServerLevel(this, this.f_129738_, this.f_129744_, derivedleveldata, resourcekey1, dimensiontype1, p_129816_, chunkgenerator1, flag, j, ImmutableList.of(), false); +@@ -394,6 +_,7 @@ + ServerLevel serverlevel1 = new ServerLevel(this, this.f_129738_, this.f_129744_, derivedleveldata, resourcekey1, holder1, p_129816_, chunkgenerator1, flag, j, ImmutableList.of(), false); worldborder.m_61929_(new BorderChangeListener.DelegateBorderChangeListener(serverlevel1.m_6857_())); this.f_129762_.put(resourcekey1, serverlevel1); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(f_129762_.get(resourcekey))); } } -@@ -402,6 +_,7 @@ +@@ -405,6 +_,7 @@ p_177898_.m_7250_(BlockPos.f_121853_.m_6630_(80), 0.0F); } else { ChunkGenerator chunkgenerator = p_177897_.m_7726_().m_8481_(); @@ -33,15 +33,7 @@ ChunkPos chunkpos = new ChunkPos(chunkgenerator.m_183403_().m_183230_()); int i = chunkgenerator.m_142051_(p_177897_); if (i < p_177897_.m_141937_()) { -@@ -455,6 +_,7 @@ - } - - private void m_129940_(ChunkProgressListener p_129941_) { -+ net.minecraftforge.common.world.StructureSpawnManager.gatherEntitySpawns(); - ServerLevel serverlevel = this.m_129783_(); - f_129750_.info("Preparing start region for dimension {}", (Object)serverlevel.m_46472_().m_135782_()); - BlockPos blockpos = serverlevel.m_8900_(); -@@ -482,6 +_,7 @@ +@@ -485,6 +_,7 @@ ChunkPos chunkpos = new ChunkPos(i); serverlevel1.m_7726_().m_6692_(chunkpos, true); } @@ -49,15 +41,15 @@ } } -@@ -591,6 +_,7 @@ - for(ServerLevel serverlevel1 : this.m_129785_()) { - if (serverlevel1 != null) { +@@ -609,6 +_,7 @@ + for(ServerLevel serverlevel2 : this.m_129785_()) { + if (serverlevel2 != null) { try { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(serverlevel1)); - serverlevel1.close(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(serverlevel2)); + serverlevel2.close(); } catch (IOException ioexception1) { f_129750_.error("Exception closing the level", (Throwable)ioexception1); -@@ -636,6 +_,7 @@ +@@ -654,6 +_,7 @@ protected void m_130011_() { try { if (this.m_7038_()) { @@ -65,7 +57,7 @@ this.f_129726_ = Util.m_137550_(); this.f_129757_.m_134908_(new TextComponent(this.f_129709_)); this.f_129757_.m_134912_(new ServerStatus.Version(SharedConstants.m_183709_().getName(), SharedConstants.m_183709_().getProtocolVersion())); -@@ -668,7 +_,10 @@ +@@ -686,7 +_,10 @@ this.f_129717_ = true; JvmProfiler.f_185340_.m_183597_(this.f_129737_); } @@ -76,7 +68,7 @@ this.m_7268_((CrashReport)null); } } catch (Throwable throwable1) { -@@ -688,6 +_,7 @@ +@@ -700,6 +_,7 @@ f_129750_.error("We were unable to save this crash report to disk."); } @@ -84,7 +76,7 @@ this.m_7268_(crashreport); } finally { try { -@@ -700,6 +_,7 @@ +@@ -712,6 +_,7 @@ this.f_129723_.m_196559_(); } @@ -92,7 +84,7 @@ this.m_6988_(); } -@@ -791,6 +_,7 @@ +@@ -826,6 +_,7 @@ public void m_5705_(BooleanSupplier p_129871_) { long i = Util.m_137569_(); @@ -100,7 +92,7 @@ ++this.f_129766_; this.m_5703_(p_129871_); if (i - this.f_129724_ >= 5000000000L) { -@@ -812,6 +_,7 @@ +@@ -847,6 +_,7 @@ Collections.shuffle(Arrays.asList(agameprofile)); this.f_129757_.m_134914_().m_134924_(agameprofile); } @@ -108,7 +100,7 @@ } if (this.f_129766_ % 6000 == 0) { -@@ -828,6 +_,7 @@ +@@ -863,6 +_,7 @@ long i1 = Util.m_137569_(); this.f_129735_.m_13755_(i1 - i); this.f_129754_.m_7238_(); @@ -116,7 +108,7 @@ } public void m_5703_(BooleanSupplier p_129954_) { -@@ -835,7 +_,8 @@ +@@ -870,7 +_,8 @@ this.m_129890_().m_136128_(); this.f_129754_.m_6182_("levels"); @@ -126,7 +118,7 @@ this.f_129754_.m_6521_(() -> { return serverlevel + " " + serverlevel.m_46472_().m_135782_(); }); -@@ -846,6 +_,7 @@ +@@ -881,6 +_,7 @@ } this.f_129754_.m_6180_("tick"); @@ -134,7 +126,7 @@ try { serverlevel.m_8793_(p_129954_); -@@ -854,16 +_,18 @@ +@@ -889,16 +_,18 @@ serverlevel.m_6026_(crashreport); throw new ReportedException(crashreport); } @@ -154,7 +146,7 @@ GameTestTicker.f_177648_.m_127790_(); } -@@ -931,7 +_,7 @@ +@@ -966,7 +_,7 @@ @DontObfuscate public String m_130001_() { @@ -163,23 +155,23 @@ } public SystemReport m_177935_(SystemReport p_177936_) { -@@ -947,6 +_,7 @@ +@@ -982,6 +_,7 @@ p_177936_.m_143522_("Data Packs", () -> { StringBuilder stringbuilder = new StringBuilder(); -+ LogManager.shutdown(); // we're manually managing the logging shutdown on the server. Make sure we do it here at the end. ++ //TODO-PATCHING:Figure out how to stop the logger here. for(Pack pack : this.f_129730_.m_10524_()) { if (stringbuilder.length() > 0) { stringbuilder.append(", "); -@@ -1261,6 +_,7 @@ +@@ -1316,6 +_,7 @@ this.m_6846_().m_11315_(); - this.f_129734_.m_136120_(this.f_129740_.m_136157_()); - this.f_129741_.m_74335_(this.f_129740_.m_136178_()); + this.f_129734_.m_136120_(this.f_129740_.f_206585_.m_206860_()); + this.f_129741_.m_74335_(this.f_129740_.f_206584_); + this.m_6846_().m_11314_().forEach(this.m_6846_()::m_11289_); //Forge: Fix newly added/modified commands not being sent to the client when commands reload. }, this); if (this.m_18695_()) { this.m_18701_(completablefuture::isDone); -@@ -1270,10 +_,13 @@ +@@ -1325,10 +_,13 @@ } public static DataPackConfig m_129819_(PackRepository p_129820_, DataPackConfig p_129821_, boolean p_129822_) { @@ -195,7 +187,7 @@ } else { Set set = Sets.newLinkedHashSet(); -@@ -1428,6 +_,31 @@ +@@ -1479,6 +_,31 @@ public abstract boolean m_7779_(GameProfile p_129840_); @@ -227,14 +219,14 @@ public void m_142116_(Path p_177911_) throws IOException { } -@@ -1681,6 +_,10 @@ +@@ -1732,6 +_,10 @@ public WorldData m_129910_() { return this.f_129749_; + } + -+ public ServerResources getServerResources() { ++ public MinecraftServer.ReloadableResources getServerResources() { + return f_129740_; } - public RegistryAccess m_129911_() { + public RegistryAccess.Frozen m_206579_() { diff --git a/patches/minecraft/net/minecraft/server/ReloadableServerResources.java.patch b/patches/minecraft/net/minecraft/server/ReloadableServerResources.java.patch new file mode 100644 index 0000000000..a6fb1261b2 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/ReloadableServerResources.java.patch @@ -0,0 +1,21 @@ +--- a/net/minecraft/server/ReloadableServerResources.java ++++ b/net/minecraft/server/ReloadableServerResources.java +@@ -76,7 +_,9 @@ + + public static CompletableFuture m_206861_(ResourceManager p_206862_, RegistryAccess.Frozen p_206863_, Commands.CommandSelection p_206864_, int p_206865_, Executor p_206866_, Executor p_206867_) { + ReloadableServerResources reloadableserverresources = new ReloadableServerResources(p_206863_, p_206864_, p_206865_); +- return SimpleReloadInstance.m_203834_(p_206862_, reloadableserverresources.m_206890_(), p_206866_, p_206867_, f_206846_, f_206845_.isDebugEnabled()).m_7237_().thenApply((p_206880_) -> { ++ List listeners = new java.util.ArrayList<>(reloadableserverresources.m_206890_()); ++ listeners.addAll(net.minecraftforge.event.ForgeEventFactory.onResourceReload()); ++ return SimpleReloadInstance.m_203834_(p_206862_, listeners, p_206866_, p_206867_, f_206846_, f_206845_.isDebugEnabled()).m_7237_().thenApply((p_206880_) -> { + return reloadableserverresources; + }); + } +@@ -86,6 +_,7 @@ + m_206870_(p_206869_, p_206884_); + }); + Blocks.m_50758_(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(p_206869_)); + } + + private static void m_206870_(RegistryAccess p_206871_, TagManager.LoadResult p_206872_) { diff --git a/patches/minecraft/net/minecraft/server/ServerResources.java.patch b/patches/minecraft/net/minecraft/server/ServerResources.java.patch deleted file mode 100644 index f20067c7f9..0000000000 --- a/patches/minecraft/net/minecraft/server/ServerResources.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/server/ServerResources.java -+++ b/net/minecraft/server/ServerResources.java -@@ -41,6 +_,7 @@ - this.f_136145_.m_7217_(this.f_180000_); - this.f_136145_.m_7217_(this.f_136152_); - this.f_136145_.m_7217_(this.f_136151_); -+ net.minecraftforge.event.ForgeEventFactory.onResourceReload(this).forEach(f_136145_::m_7217_); - } - - public ServerFunctionLibrary m_136157_() { diff --git a/patches/minecraft/net/minecraft/server/commands/LocateCommand.java.patch b/patches/minecraft/net/minecraft/server/commands/LocateCommand.java.patch deleted file mode 100644 index 2ec91d1e80..0000000000 --- a/patches/minecraft/net/minecraft/server/commands/LocateCommand.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/server/commands/LocateCommand.java -+++ b/net/minecraft/server/commands/LocateCommand.java -@@ -25,11 +_,18 @@ - return p_137861_.m_6761_(2); - }); - -+ if (false) - for(Entry> entry : StructureFeature.f_67012_.entrySet()) { - literalargumentbuilder = literalargumentbuilder.then(Commands.m_82127_(entry.getKey()).executes((p_137876_) -> { - return m_137862_(p_137876_.getSource(), entry.getValue()); - })); - } -+ else { -+ for (StructureFeature structurefeatureFeature : net.minecraftforge.registries.ForgeRegistries.STRUCTURE_FEATURES) { -+ String name = structurefeatureFeature.getRegistryName().toString().replace("minecraft:", ""); -+ literalargumentbuilder = literalargumentbuilder.then(Commands.m_82127_(name) -+ .executes(ctx -> m_137862_(ctx.getSource(), structurefeatureFeature))); -+ }} - - p_137859_.register(literalargumentbuilder); - } diff --git a/patches/minecraft/net/minecraft/server/commands/SpreadPlayersCommand.java.patch b/patches/minecraft/net/minecraft/server/commands/SpreadPlayersCommand.java.patch index 382172e7d6..854f4c8778 100644 --- a/patches/minecraft/net/minecraft/server/commands/SpreadPlayersCommand.java.patch +++ b/patches/minecraft/net/minecraft/server/commands/SpreadPlayersCommand.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/commands/SpreadPlayersCommand.java +++ b/net/minecraft/server/commands/SpreadPlayersCommand.java -@@ -163,7 +_,8 @@ +@@ -173,7 +_,8 @@ spreadplayerscommand$position = p_138732_[i++]; } diff --git a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index 8dcdda1d24..71f5b32e71 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -91,6 +_,7 @@ +@@ -89,6 +_,7 @@ public boolean m_7038_() throws IOException { Thread thread = new Thread("Server console handler") { public void run() { @@ -8,7 +8,7 @@ BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)); String s1; -@@ -169,11 +_,13 @@ +@@ -167,11 +_,13 @@ long i = Util.m_137569_(); SkullBlockEntity.m_196700_(this.m_129927_(), this.m_129925_(), this); GameProfileCache.m_11004_(this.m_129797_()); @@ -22,7 +22,7 @@ if (dedicatedserverproperties.f_139744_ != null) { this.m_129900_().m_46170_(GameRules.f_46153_).m_46246_(dedicatedserverproperties.f_139744_, this); } -@@ -197,12 +_,13 @@ +@@ -195,12 +_,13 @@ } Items.f_41852_.m_6787_(CreativeModeTab.f_40754_, NonNullList.m_122779_()); @@ -37,7 +37,7 @@ } } -@@ -545,6 +_,11 @@ +@@ -543,6 +_,11 @@ public boolean m_7779_(GameProfile p_139642_) { return false; diff --git a/patches/minecraft/net/minecraft/server/level/ChunkHolder.java.patch b/patches/minecraft/net/minecraft/server/level/ChunkHolder.java.patch index 40e50446e4..3b9d8c5b72 100644 --- a/patches/minecraft/net/minecraft/server/level/ChunkHolder.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ChunkHolder.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ChunkHolder.java +++ b/net/minecraft/server/level/ChunkHolder.java -@@ -64,6 +_,7 @@ +@@ -67,6 +_,7 @@ private final ChunkHolder.PlayerProvider f_140016_; private boolean f_140017_; private boolean f_140018_; diff --git a/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch b/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch index d3db6cf8fd..1f03caf5c5 100644 --- a/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java -@@ -440,6 +_,7 @@ - if (this.f_140131_.remove(p_140182_, p_140183_) && p_198809_ != null) { - if (p_198809_ instanceof LevelChunk) { - ((LevelChunk)p_198809_).m_62913_(false); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Unload((LevelChunk)p_198809_)); +@@ -476,6 +_,7 @@ + if (this.f_140131_.remove(p_140182_, p_140183_) && p_203002_ != null) { + if (p_203002_ instanceof LevelChunk) { + ((LevelChunk)p_203002_).m_62913_(false); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Unload(p_203002_)); } - this.m_140258_(p_198809_); -@@ -621,8 +_,14 @@ + this.m_140258_(p_203002_); +@@ -658,8 +_,14 @@ levelchunk.m_62952_(); if (this.f_140132_.add(chunkpos.m_45588_())) { levelchunk.m_62913_(true); @@ -23,7 +23,7 @@ } return levelchunk; -@@ -712,6 +_,7 @@ +@@ -762,6 +_,7 @@ this.f_140133_.m_46473_().m_6174_("chunkSave"); CompoundTag compoundtag = ChunkSerializer.m_63454_(this.f_140133_, p_140259_); @@ -31,7 +31,7 @@ this.m_63502_(chunkpos, compoundtag); this.m_140229_(chunkpos, chunkstatus.m_62494_()); return true; -@@ -768,6 +_,7 @@ +@@ -818,6 +_,7 @@ protected void m_183754_(ServerPlayer p_183755_, ChunkPos p_183756_, MutableObject p_183757_, boolean p_183758_, boolean p_183759_) { if (p_183755_.f_19853_ == this.f_140133_) { @@ -39,7 +39,7 @@ if (p_183759_ && !p_183758_) { ChunkHolder chunkholder = this.m_140327_(p_183756_.m_45588_()); if (chunkholder != null) { -@@ -1020,7 +_,7 @@ +@@ -1070,7 +_,7 @@ } protected void m_140199_(Entity p_140200_) { diff --git a/patches/minecraft/net/minecraft/server/level/DistanceManager.java.patch b/patches/minecraft/net/minecraft/server/level/DistanceManager.java.patch index 16d0279b36..f46c0f1d6d 100644 --- a/patches/minecraft/net/minecraft/server/level/DistanceManager.java.patch +++ b/patches/minecraft/net/minecraft/server/level/DistanceManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/DistanceManager.java +++ b/net/minecraft/server/level/DistanceManager.java -@@ -58,6 +_,8 @@ +@@ -59,6 +_,8 @@ private long f_140771_; private int f_183902_ = 10; @@ -9,7 +9,7 @@ protected DistanceManager(Executor p_140774_, Executor p_140775_) { ProcessorHandle processorhandle = ProcessorHandle.m_18714_("player ticket throttler", p_140775_::execute); ChunkTaskPriorityQueueSorter chunktaskpriorityqueuesorter = new ChunkTaskPriorityQueueSorter(ImmutableList.of(processorhandle), p_140774_, 4); -@@ -163,6 +_,10 @@ +@@ -164,6 +_,10 @@ this.f_140762_.m_140715_(p_140785_, p_140786_.m_9433_(), true); } @@ -20,7 +20,7 @@ } void m_140818_(long p_140819_, Ticket p_140820_) { -@@ -175,6 +_,13 @@ +@@ -176,6 +_,13 @@ } this.f_140762_.m_140715_(p_140819_, m_140797_(sortedarrayset), false); @@ -34,7 +34,7 @@ } public void m_140792_(TicketType p_140793_, ChunkPos p_140794_, int p_140795_, T p_140796_) { -@@ -200,6 +_,14 @@ +@@ -201,6 +_,14 @@ this.f_183901_.m_184165_(i, ticket); } @@ -49,7 +49,7 @@ private SortedArraySet> m_140857_(long p_140858_) { return this.f_140761_.computeIfAbsent(p_140858_, (p_183923_) -> { return SortedArraySet.m_14246_(4); -@@ -285,6 +_,11 @@ +@@ -286,6 +_,11 @@ public String m_140837_() { return this.f_140766_.m_140558_(); diff --git a/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch b/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch index d7745e5422..0132ede911 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -163,6 +_,7 @@ +@@ -160,6 +_,7 @@ if (chunkholder == null) { return null; } else { @@ -12,8 +12,8 @@ for(ServerChunkCache.ChunkAndHolder serverchunkcache$chunkandholder : list) { LevelChunk levelchunk1 = serverchunkcache$chunkandholder.f_184028_; ChunkPos chunkpos = levelchunk1.m_7697_(); -- if (this.f_8329_.m_143275_(chunkpos) && this.f_8325_.m_183879_(chunkpos)) { -+ if ((this.f_8329_.m_143275_(chunkpos) && this.f_8325_.m_183879_(chunkpos)) || this.f_8327_.shouldForceTicks(chunkpos.m_45588_())) { +- if (this.f_8329_.m_201916_(chunkpos) && this.f_8325_.m_183879_(chunkpos)) { ++ if ((this.f_8329_.m_201916_(chunkpos) && this.f_8325_.m_183879_(chunkpos)) || this.f_8327_.shouldForceTicks(chunkpos.m_45588_())) { levelchunk1.m_187632_(j); if (flag2 && (this.f_8335_ || this.f_8336_) && this.f_8329_.m_6857_().m_61927_(chunkpos)) { NaturalSpawner.m_47029_(this.f_8329_, levelchunk1, naturalspawner$spawnstate, this.f_8336_, this.f_8335_, flag1); diff --git a/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch b/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch index 95c4cebad0..64d25f03ee 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -179,10 +_,11 @@ +@@ -181,10 +_,11 @@ private final List f_8558_; @Nullable private final EndDragonFight f_8559_; @@ -11,9 +11,9 @@ private final boolean f_8561_; + private net.minecraftforge.common.util.WorldCapabilityData capabilityData; - public ServerLevel(MinecraftServer p_8571_, Executor p_8572_, LevelStorageSource.LevelStorageAccess p_8573_, ServerLevelData p_8574_, ResourceKey p_8575_, DimensionType p_8576_, ChunkProgressListener p_8577_, ChunkGenerator p_8578_, boolean p_8579_, long p_8580_, List p_8581_, boolean p_8582_) { - super(p_8574_, p_8575_, p_8576_, p_8571_::m_129905_, false, p_8579_, p_8580_); -@@ -220,6 +_,7 @@ + public ServerLevel(MinecraftServer p_203762_, Executor p_203763_, LevelStorageSource.LevelStorageAccess p_203764_, ServerLevelData p_203765_, ResourceKey p_203766_, Holder p_203767_, ChunkProgressListener p_203768_, ChunkGenerator p_203769_, boolean p_203770_, long p_203771_, List p_203772_, boolean p_203773_) { + super(p_203765_, p_203766_, p_203767_, p_203762_::m_129905_, false, p_203770_, p_203771_); +@@ -223,6 +_,7 @@ } this.f_143245_ = new SleepStatus(); @@ -21,7 +21,7 @@ } public void m_8606_(int p_8607_, int p_8608_, boolean p_8609_, boolean p_8610_) { -@@ -248,8 +_,8 @@ +@@ -251,8 +_,8 @@ int i = this.m_46469_().m_46215_(GameRules.f_151486_); if (this.f_143245_.m_144002_(i) && this.f_143245_.m_144004_(i, this.f_8546_)) { if (this.m_46469_().m_46207_(GameRules.f_46140_)) { @@ -32,7 +32,7 @@ } this.m_8804_(); -@@ -278,7 +_,7 @@ +@@ -281,7 +_,7 @@ this.m_8807_(); this.f_8557_ = false; profilerfiller.m_7238_(); @@ -41,7 +41,7 @@ if (flag) { this.m_8886_(); } -@@ -310,7 +_,9 @@ +@@ -313,7 +_,9 @@ } profilerfiller.m_6180_("tick"); @@ -52,15 +52,15 @@ profilerfiller.m_7238_(); } } -@@ -399,6 +_,7 @@ +@@ -402,6 +_,7 @@ BlockPos blockpos2 = this.m_5452_(Heightmap.Types.MOTION_BLOCKING, this.m_46496_(i, 0, j, 15)); BlockPos blockpos3 = blockpos2.m_7495_(); - Biome biome = this.m_46857_(blockpos2); + Biome biome = this.m_204166_(blockpos2).m_203334_(); + if (this.isAreaLoaded(blockpos2, 1)) // Forge: check area to avoid loading neighbors in unloaded chunks if (biome.m_47477_(this, blockpos3)) { this.m_46597_(blockpos3, Blocks.f_50126_.m_49966_()); } -@@ -589,15 +_,19 @@ +@@ -592,15 +_,19 @@ this.f_8548_.m_6846_().m_11270_(new ClientboundGameEventPacket(ClientboundGameEventPacket.f_132161_, this.f_46440_), this.m_46472_()); } @@ -84,7 +84,7 @@ } } -@@ -653,9 +_,10 @@ +@@ -656,9 +_,10 @@ ++p_8664_.f_19797_; ProfilerFiller profilerfiller = this.m_46473_(); profilerfiller.m_6521_(() -> { @@ -96,7 +96,7 @@ p_8664_.m_6083_(); profilerfiller.m_7238_(); -@@ -692,6 +_,7 @@ +@@ -695,6 +_,7 @@ this.f_143244_.m_157554_(); } @@ -104,7 +104,7 @@ } } -@@ -764,7 +_,55 @@ +@@ -767,7 +_,55 @@ this.m_8853_(p_8846_); } @@ -160,7 +160,7 @@ Entity entity = this.m_142646_().m_142694_(p_8854_.m_142081_()); if (entity != null) { f_8566_.warn("Force-added player with duplicate UUID {}", (Object)p_8854_.m_142081_().toString()); -@@ -772,7 +_,8 @@ +@@ -775,7 +_,8 @@ this.m_143261_((ServerPlayer)entity, Entity.RemovalReason.DISCARDED); } @@ -170,7 +170,7 @@ } private boolean m_8872_(Entity p_8873_) { -@@ -780,7 +_,12 @@ +@@ -783,7 +_,12 @@ f_8566_.warn("Tried to add entity {} but it was marked as removed already", (Object)EntityType.m_20613_(p_8873_.m_6095_())); return false; } else { @@ -184,7 +184,7 @@ } } -@@ -817,10 +_,20 @@ +@@ -820,10 +_,20 @@ } public void m_6263_(@Nullable Player p_8675_, double p_8676_, double p_8677_, double p_8678_, SoundEvent p_8679_, SoundSource p_8680_, float p_8681_, float p_8682_) { @@ -205,7 +205,7 @@ this.f_8548_.m_6846_().m_11241_(p_8689_, p_8690_.m_20185_(), p_8690_.m_20186_(), p_8690_.m_20189_(), p_8693_ > 1.0F ? (double)(16.0F * p_8693_) : 16.0D, this.m_46472_(), new ClientboundSoundEntityPacket(p_8691_, p_8692_, p_8690_, p_8693_, p_8694_)); } -@@ -837,6 +_,7 @@ +@@ -840,6 +_,7 @@ } public void m_142346_(@Nullable Entity p_143268_, GameEvent p_143269_, BlockPos p_143270_) { @@ -213,7 +213,7 @@ this.m_151513_(p_143268_, p_143269_, p_143270_, p_143269_.m_157827_()); } -@@ -882,6 +_,7 @@ +@@ -885,6 +_,7 @@ public Explosion m_7703_(@Nullable Entity p_8653_, @Nullable DamageSource p_8654_, @Nullable ExplosionDamageCalculator p_8655_, double p_8656_, double p_8657_, double p_8658_, float p_8659_, boolean p_8660_, Explosion.BlockInteraction p_8661_) { Explosion explosion = new Explosion(this, p_8653_, p_8654_, p_8655_, p_8656_, p_8657_, p_8658_, p_8659_, p_8660_, p_8661_); @@ -221,7 +221,7 @@ explosion.m_46061_(); explosion.m_46075_(false); if (p_8661_ == Explosion.BlockInteraction.NONE) { -@@ -1409,6 +_,12 @@ +@@ -1412,6 +_,12 @@ }); } @@ -234,7 +234,7 @@ public LevelEntityGetter m_142646_() { return this.f_143244_.m_157567_(); } -@@ -1490,10 +_,8 @@ +@@ -1497,10 +_,8 @@ ServerLevel.this.f_143246_.add(mob); } @@ -247,7 +247,7 @@ ServerLevel.this.f_143247_.put(enderdragonpart.m_142049_(), enderdragonpart); } } -@@ -1518,10 +_,8 @@ +@@ -1525,10 +_,8 @@ ServerLevel.this.f_143246_.remove(mob); } @@ -260,7 +260,7 @@ ServerLevel.this.f_143247_.remove(enderdragonpart.m_142049_()); } } -@@ -1531,6 +_,8 @@ +@@ -1538,6 +_,8 @@ gameeventlistenerregistrar.m_157854_(p_143375_.f_19853_); } diff --git a/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch b/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch index c90ef2e28e..2172f947a7 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch @@ -175,7 +175,7 @@ + } else if (net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_9000_.m_46472_())) { ServerLevel serverlevel = this.m_183503_(); LevelData leveldata = p_9000_.m_6106_(); - this.f_8906_.m_141995_(new ClientboundRespawnPacket(p_9000_.m_6042_(), p_9000_.m_46472_(), BiomeManager.m_47877_(p_9000_.m_7328_()), this.f_8941_.m_9290_(), this.f_8941_.m_9293_(), p_9000_.m_46659_(), p_9000_.m_8584_(), true)); + this.f_8906_.m_141995_(new ClientboundRespawnPacket(p_9000_.m_204156_(), p_9000_.m_46472_(), BiomeManager.m_47877_(p_9000_.m_7328_()), this.f_8941_.m_9290_(), this.f_8941_.m_9293_(), p_9000_.m_46659_(), p_9000_.m_8584_(), true)); this.f_8906_.m_141995_(new ClientboundChangeDifficultyPacket(leveldata.m_5472_(), leveldata.m_5474_())); this.f_8924_.m_6846_().m_11289_(this); serverlevel.m_143261_(this, Entity.RemovalReason.CHANGED_DIMENSION); diff --git a/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch b/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch index e002f571d3..393df678b0 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -123,7 +_,15 @@ +@@ -125,7 +_,15 @@ double d1 = this.f_9245_.m_20186_() - ((double)p_9282_.m_123342_() + 0.5D) + 1.5D; double d2 = this.f_9245_.m_20189_() - ((double)p_9282_.m_123343_() + 0.5D); double d3 = d0 * d0 + d1 * d1 + d2 * d2; @@ -14,10 +14,10 @@ + } + dist *= dist; + if (d3 > dist) { - this.f_9245_.f_8906_.m_141995_(new ClientboundBlockBreakAckPacket(p_9282_, this.f_9244_.m_8055_(p_9282_), p_9283_, false, "too far")); - } else if (p_9282_.m_123342_() >= p_9285_) { - this.f_9245_.f_8906_.m_141995_(new ClientboundBlockBreakAckPacket(p_9282_, this.f_9244_.m_8055_(p_9282_), p_9283_, false, "too high")); -@@ -148,6 +_,7 @@ + BlockState blockstate1; + if (this.f_9245_.f_19853_.m_142572_() != null && this.f_9245_.m_146902_().m_45594_(new ChunkPos(p_9282_)) < this.f_9245_.f_19853_.m_142572_().m_6846_().m_11312_()) { + blockstate1 = this.f_9244_.m_8055_(p_9282_); +@@ -157,6 +_,7 @@ float f = 1.0F; BlockState blockstate = this.f_9244_.m_8055_(p_9282_); if (!blockstate.m_60795_()) { @@ -25,7 +25,7 @@ blockstate.m_60686_(this.f_9244_, p_9282_, this.f_9245_); f = blockstate.m_60625_(this.f_9245_, this.f_9245_.f_19853_, p_9282_); } -@@ -215,7 +_,8 @@ +@@ -224,7 +_,8 @@ public boolean m_9280_(BlockPos p_9281_) { BlockState blockstate = this.f_9244_.m_8055_(p_9281_); @@ -35,7 +35,7 @@ return false; } else { BlockEntity blockentity = this.f_9244_.m_7702_(p_9281_); -@@ -223,30 +_,42 @@ +@@ -232,30 +_,42 @@ if (block instanceof GameMasterBlock && !this.f_9245_.m_36337_()) { this.f_9244_.m_7260_(p_9281_, blockstate, blockstate, 3); return false; @@ -85,7 +85,7 @@ } public InteractionResult m_6261_(ServerPlayer p_9262_, Level p_9263_, ItemStack p_9264_, InteractionHand p_9265_) { -@@ -255,6 +_,8 @@ +@@ -264,6 +_,8 @@ } else if (p_9262_.m_36335_().m_41519_(p_9264_.m_41720_())) { return InteractionResult.PASS; } else { @@ -94,7 +94,7 @@ int i = p_9264_.m_41613_(); int j = p_9264_.m_41773_(); InteractionResultHolder interactionresultholder = p_9264_.m_41682_(p_9263_, p_9262_, p_9265_); -@@ -288,6 +_,8 @@ +@@ -297,6 +_,8 @@ public InteractionResult m_7179_(ServerPlayer p_9266_, Level p_9267_, ItemStack p_9268_, InteractionHand p_9269_, BlockHitResult p_9270_) { BlockPos blockpos = p_9270_.m_82425_(); BlockState blockstate = p_9267_.m_8055_(blockpos); @@ -103,7 +103,7 @@ if (this.f_9247_ == GameType.SPECTATOR) { MenuProvider menuprovider = blockstate.m_60750_(p_9267_, blockpos); if (menuprovider != null) { -@@ -297,10 +_,15 @@ +@@ -306,10 +_,15 @@ return InteractionResult.PASS; } } else { @@ -121,7 +121,7 @@ InteractionResult interactionresult = blockstate.m_60664_(p_9267_, p_9266_, p_9269_, p_9270_); if (interactionresult.m_19077_()) { CriteriaTriggers.f_10562_.m_45482_(p_9266_, blockpos, itemstack); -@@ -308,8 +_,8 @@ +@@ -317,8 +_,8 @@ } } diff --git a/patches/minecraft/net/minecraft/server/network/ServerConnectionListener.java.patch b/patches/minecraft/net/minecraft/server/network/ServerConnectionListener.java.patch index ec06d026ff..354010850e 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerConnectionListener.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerConnectionListener.java.patch @@ -3,7 +3,7 @@ @@ -50,11 +_,12 @@ public class ServerConnectionListener { - private static final Logger f_9701_ = LogManager.getLogger(); + private static final Logger f_9701_ = LogUtils.getLogger(); + private static final int READ_TIMEOUT = Integer.parseInt(System.getProperty("forge.readTimeout", "30")); public static final LazyLoadedValue f_9698_ = new LazyLoadedValue<>(() -> { - return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).build()); diff --git a/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch index 532d349ec8..023b4eab07 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -380,9 +_,11 @@ +@@ -386,9 +_,11 @@ } entity.m_19890_(d3, d4, d5, f, f1); + this.f_9743_.m_19890_(d3, d4, d5, this.f_9743_.m_146908_(), this.f_9743_.m_146909_()); // Forge - Resync player position on vehicle moving - boolean flag2 = serverlevel.m_45756_(entity, entity.m_142469_().m_82406_(0.0625D)); - if (flag && (flag1 || !flag2)) { + boolean flag3 = serverlevel.m_45756_(entity, entity.m_142469_().m_82406_(0.0625D)); + if (flag && (flag2 || !flag3)) { entity.m_19890_(d0, d1, d2, f, f1); + this.f_9743_.m_19890_(d3, d4, d5, this.f_9743_.m_146908_(), this.f_9743_.m_146909_()); // Forge - Resync player position on vehicle moving this.f_9742_.m_129512_(new ClientboundMoveVehiclePacket(entity)); return; } -@@ -399,7 +_,7 @@ +@@ -405,7 +_,7 @@ } private boolean m_9793_(Entity p_9794_) { @@ -21,18 +21,18 @@ } public void m_7376_(ServerboundAcceptTeleportationPacket p_9835_) { -@@ -967,7 +_,9 @@ - this.f_9743_.m_9243_(); - int i = this.f_9743_.f_19853_.m_151558_(); - if (blockpos.m_123342_() < i) { -- if (this.f_9766_ == null && this.f_9743_.m_20275_((double)blockpos.m_123341_() + 0.5D, (double)blockpos.m_123342_() + 0.5D, (double)blockpos.m_123343_() + 0.5D) < 64.0D && serverlevel.m_7966_(this.f_9743_, blockpos)) { -+ double dist = f_9743_.m_21051_(net.minecraftforge.common.ForgeMod.REACH_DISTANCE.get()).m_22135_() + 3; -+ dist *= dist; -+ if (this.f_9766_ == null && this.f_9743_.m_20275_((double)blockpos.m_123341_() + 0.5D, (double)blockpos.m_123342_() + 0.5D, (double)blockpos.m_123343_() + 0.5D) < dist && serverlevel.m_7966_(this.f_9743_, blockpos)) { - InteractionResult interactionresult = this.f_9743_.f_8941_.m_7179_(this.f_9743_, serverlevel, itemstack, interactionhand, blockhitresult); - if (direction == Direction.UP && !interactionresult.m_19077_() && blockpos.m_123342_() >= i - 1 && m_9790_(this.f_9743_, itemstack)) { - Component component = (new TranslatableComponent("build.tooHigh", i - 1)).m_130940_(ChatFormatting.RED); -@@ -1081,7 +_,7 @@ +@@ -979,7 +_,9 @@ + this.f_9743_.m_9243_(); + int i = this.f_9743_.f_19853_.m_151558_(); + if (blockpos.m_123342_() < i) { +- if (this.f_9766_ == null && this.f_9743_.m_20275_((double)blockpos.m_123341_() + 0.5D, (double)blockpos.m_123342_() + 0.5D, (double)blockpos.m_123343_() + 0.5D) < 64.0D && serverlevel.m_7966_(this.f_9743_, blockpos)) { ++ double dist = f_9743_.m_21051_(net.minecraftforge.common.ForgeMod.REACH_DISTANCE.get()).m_22135_() + 3; ++ dist *= dist; ++ if (this.f_9766_ == null && this.f_9743_.m_20275_((double)blockpos.m_123341_() + 0.5D, (double)blockpos.m_123342_() + 0.5D, (double)blockpos.m_123343_() + 0.5D) < dist && serverlevel.m_7966_(this.f_9743_, blockpos)) { + InteractionResult interactionresult = this.f_9743_.f_8941_.m_7179_(this.f_9743_, serverlevel, itemstack, interactionhand, blockhitresult); + if (direction == Direction.UP && !interactionresult.m_19077_() && blockpos.m_123342_() >= i - 1 && m_9790_(this.f_9743_, itemstack)) { + Component component = (new TranslatableComponent("build.tooHigh", i - 1)).m_130940_(ChatFormatting.RED); +@@ -1099,7 +_,7 @@ } public void m_7388_(ServerboundChatPacket p_9841_) { @@ -41,7 +41,7 @@ for(int i = 0; i < s.length(); ++i) { if (!SharedConstants.m_136188_(s.charAt(i))) { -@@ -1111,8 +_,10 @@ +@@ -1129,8 +_,10 @@ String s1 = p_143629_.m_143722_(); Component component = s1.isEmpty() ? null : new TranslatableComponent("chat.type.text", this.f_9743_.m_5446_(), s1); Component component1 = new TranslatableComponent("chat.type.text", this.f_9743_.m_5446_(), s); @@ -53,7 +53,7 @@ }, ChatType.CHAT, this.f_9743_.m_142081_()); } -@@ -1204,6 +_,7 @@ +@@ -1222,6 +_,7 @@ private void m_143678_(InteractionHand p_143679_, ServerGamePacketListenerImpl.EntityInteraction p_143680_) { ItemStack itemstack = ServerGamePacketListenerImpl.this.f_9743_.m_21120_(p_143679_).m_41777_(); InteractionResult interactionresult = p_143680_.m_143694_(ServerGamePacketListenerImpl.this.f_9743_, entity, p_143679_); @@ -61,7 +61,7 @@ if (interactionresult.m_19077_()) { CriteriaTriggers.f_10565_.m_61494_(ServerGamePacketListenerImpl.this.f_9743_, itemstack, entity); if (interactionresult.m_19080_()) { -@@ -1405,6 +_,8 @@ +@@ -1430,6 +_,8 @@ } public void m_7423_(ServerboundCustomPayloadPacket p_9860_) { diff --git a/patches/minecraft/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch index 35b6a358b2..e075a6541c 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch @@ -15,7 +15,7 @@ this.m_10055_(); } else if (this.f_10019_ == ServerLoginPacketListenerImpl.State.DELAY_ACCEPT) { ServerPlayer serverplayer = this.f_10018_.m_6846_().m_11259_(this.f_10021_.getId()); -@@ -147,7 +_,7 @@ +@@ -148,7 +_,7 @@ this.f_10019_ = ServerLoginPacketListenerImpl.State.KEY; this.f_10013_.m_129512_(new ClientboundHelloPacket("", this.f_10018_.m_129790_().getPublic().getEncoded(), this.f_10017_)); } else { @@ -24,7 +24,7 @@ } } -@@ -172,7 +_,7 @@ +@@ -179,7 +_,7 @@ throw new IllegalStateException("Protocol error", cryptexception); } @@ -33,7 +33,7 @@ public void run() { GameProfile gameprofile = ServerLoginPacketListenerImpl.this.f_10021_; -@@ -180,11 +_,11 @@ +@@ -187,11 +_,11 @@ ServerLoginPacketListenerImpl.this.f_10021_ = ServerLoginPacketListenerImpl.this.f_10018_.m_129925_().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s, this.m_10064_()); if (ServerLoginPacketListenerImpl.this.f_10021_ != null) { ServerLoginPacketListenerImpl.f_10015_.info("UUID of player {} is {}", ServerLoginPacketListenerImpl.this.f_10021_.getName(), ServerLoginPacketListenerImpl.this.f_10021_.getId()); @@ -47,7 +47,7 @@ } else { ServerLoginPacketListenerImpl.this.m_10053_(new TranslatableComponent("multiplayer.disconnect.unverified_username")); ServerLoginPacketListenerImpl.f_10015_.error("Username '{}' tried to join with an invalid session", (Object)gameprofile.getName()); -@@ -193,7 +_,7 @@ +@@ -200,7 +_,7 @@ if (ServerLoginPacketListenerImpl.this.f_10018_.m_129792_()) { ServerLoginPacketListenerImpl.f_10015_.warn("Authentication servers are down but will let them in anyway!"); ServerLoginPacketListenerImpl.this.f_10021_ = ServerLoginPacketListenerImpl.this.m_10038_(gameprofile); @@ -56,7 +56,7 @@ } else { ServerLoginPacketListenerImpl.this.m_10053_(new TranslatableComponent("multiplayer.disconnect.authservers_down")); ServerLoginPacketListenerImpl.f_10015_.error("Couldn't verify username because servers are unavailable"); -@@ -213,6 +_,7 @@ +@@ -220,6 +_,7 @@ } public void m_7223_(ServerboundCustomQueryPacket p_10045_) { diff --git a/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch b/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch index ba2877bde5..c30daf656e 100644 --- a/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch +++ b/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -117,6 +_,7 @@ +@@ -118,6 +_,7 @@ private boolean f_11209_; private static final boolean f_143988_ = false; private int f_11210_; + private final List playersView = java.util.Collections.unmodifiableList(f_11196_); - public PlayerList(MinecraftServer p_11213_, RegistryAccess.RegistryHolder p_11214_, PlayerDataStorage p_11215_, int p_11216_) { - this.f_11195_ = p_11213_; -@@ -152,6 +_,7 @@ + public PlayerList(MinecraftServer p_203842_, RegistryAccess.Frozen p_203843_, PlayerDataStorage p_203844_, int p_203845_) { + this.f_11195_ = p_203842_; +@@ -153,6 +_,7 @@ LevelData leveldata = serverlevel1.m_6106_(); p_11263_.m_143427_(compoundtag); ServerGamePacketListenerImpl servergamepacketlistenerimpl = new ServerGamePacketListenerImpl(this.f_11195_, p_11262_, p_11263_); @@ -16,15 +16,15 @@ GameRules gamerules = serverlevel1.m_46469_(); boolean flag = gamerules.m_46207_(GameRules.f_46156_); boolean flag1 = gamerules.m_46207_(GameRules.f_46145_); -@@ -160,6 +_,7 @@ +@@ -161,6 +_,7 @@ servergamepacketlistenerimpl.m_141995_(new ClientboundChangeDifficultyPacket(leveldata.m_5472_(), leveldata.m_5474_())); servergamepacketlistenerimpl.m_141995_(new ClientboundPlayerAbilitiesPacket(p_11263_.m_150110_())); servergamepacketlistenerimpl.m_141995_(new ClientboundSetCarriedItemPacket(p_11263_.m_150109_().f_35977_)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.OnDatapackSyncEvent(this, p_11263_)); servergamepacketlistenerimpl.m_141995_(new ClientboundUpdateRecipesPacket(this.f_11195_.m_129894_().m_44051_())); - servergamepacketlistenerimpl.m_141995_(new ClientboundUpdateTagsPacket(this.f_11195_.m_129895_().m_144442_(this.f_11206_))); + servergamepacketlistenerimpl.m_141995_(new ClientboundUpdateTagsPacket(TagNetworkSerialization.m_203950_(this.f_11206_))); this.m_11289_(p_11263_); -@@ -176,7 +_,7 @@ +@@ -177,7 +_,7 @@ this.m_11264_(mutablecomponent.m_130940_(ChatFormatting.YELLOW), ChatType.SYSTEM, Util.f_137441_); servergamepacketlistenerimpl.m_9774_(p_11263_.m_20185_(), p_11263_.m_20186_(), p_11263_.m_20189_(), p_11263_.m_146908_(), p_11263_.m_146909_()); @@ -33,7 +33,7 @@ this.f_11197_.put(p_11263_.m_142081_(), p_11263_); this.m_11268_(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, p_11263_)); -@@ -231,6 +_,7 @@ +@@ -232,6 +_,7 @@ } p_11263_.m_143429_(); @@ -41,7 +41,7 @@ } protected void m_11273_(ServerScoreboard p_11274_, ServerPlayer p_11275_) { -@@ -291,6 +_,7 @@ +@@ -292,6 +_,7 @@ compoundtag1 = compoundtag; p_11225_.m_20258_(compoundtag); f_11188_.debug("loading single player"); @@ -49,7 +49,7 @@ } else { compoundtag1 = this.f_11204_.m_78435_(p_11225_); } -@@ -299,6 +_,7 @@ +@@ -300,6 +_,7 @@ } protected void m_6765_(ServerPlayer p_11277_) { @@ -57,7 +57,7 @@ this.f_11204_.m_78433_(p_11277_); ServerStatsCounter serverstatscounter = this.f_11202_.get(p_11277_.m_142081_()); if (serverstatscounter != null) { -@@ -313,6 +_,7 @@ +@@ -314,6 +_,7 @@ } public void m_11286_(ServerPlayer p_11287_) { @@ -65,7 +65,7 @@ ServerLevel serverlevel = p_11287_.m_183503_(); p_11287_.m_36220_(Stats.f_12989_); this.m_6765_(p_11287_); -@@ -449,10 +_,11 @@ +@@ -450,10 +_,11 @@ this.m_11229_(serverplayer, serverlevel1); this.m_11289_(serverplayer); serverlevel1.m_8845_(serverplayer); @@ -78,7 +78,7 @@ if (flag2) { serverplayer.f_8906_.m_141995_(new ClientboundSoundPacket(SoundEvents.f_12377_, SoundSource.BLOCKS, (double)blockpos.m_123341_(), (double)blockpos.m_123342_(), (double)blockpos.m_123343_(), 1.0F, 1.0F)); } -@@ -537,6 +_,7 @@ +@@ -538,6 +_,7 @@ } public void m_5749_(GameProfile p_11254_) { @@ -86,7 +86,7 @@ this.f_11200_.m_11381_(new ServerOpListEntry(p_11254_, this.f_11195_.m_7022_(), this.f_11200_.m_11351_(p_11254_))); ServerPlayer serverplayer = this.m_11259_(p_11254_.getId()); if (serverplayer != null) { -@@ -546,6 +_,7 @@ +@@ -547,6 +_,7 @@ } public void m_5750_(GameProfile p_11281_) { @@ -94,7 +94,7 @@ this.f_11200_.m_11393_(p_11281_); ServerPlayer serverplayer = this.m_11259_(p_11281_.getId()); if (serverplayer != null) { -@@ -733,13 +_,6 @@ +@@ -734,13 +_,6 @@ if (serverstatscounter == null) { File file1 = this.f_11195_.m_129843_(LevelResource.f_78175_).toFile(); File file2 = new File(file1, uuid + ".json"); @@ -108,7 +108,7 @@ serverstatscounter = new ServerStatsCounter(this.f_11195_, file2); this.f_11202_.put(uuid, serverstatscounter); -@@ -758,6 +_,8 @@ +@@ -759,6 +_,8 @@ this.f_11203_.put(uuid, playeradvancements); } @@ -117,7 +117,7 @@ playeradvancements.m_135979_(p_11297_); return playeradvancements; } -@@ -787,7 +_,7 @@ +@@ -788,7 +_,7 @@ } public List m_11314_() { @@ -126,15 +126,15 @@ } @Nullable -@@ -804,6 +_,7 @@ +@@ -805,6 +_,7 @@ playeradvancements.m_135981_(this.f_11195_.m_129889_()); } + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.OnDatapackSyncEvent(this, null)); - this.m_11268_(new ClientboundUpdateTagsPacket(this.f_11195_.m_129895_().m_144442_(this.f_11206_))); + this.m_11268_(new ClientboundUpdateTagsPacket(TagNetworkSerialization.m_203950_(this.f_11206_))); ClientboundUpdateRecipesPacket clientboundupdaterecipespacket = new ClientboundUpdateRecipesPacket(this.f_11195_.m_129894_().m_44051_()); -@@ -816,5 +_,13 @@ +@@ -817,5 +_,13 @@ public boolean m_11316_() { return this.f_11209_; diff --git a/patches/minecraft/net/minecraft/tags/BlockTags.java.patch b/patches/minecraft/net/minecraft/tags/BlockTags.java.patch index 22c4c268d2..e03c797aaf 100644 --- a/patches/minecraft/net/minecraft/tags/BlockTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/BlockTags.java.patch @@ -1,17 +1,11 @@ --- a/net/minecraft/tags/BlockTags.java +++ b/net/minecraft/tags/BlockTags.java -@@ -145,6 +_,14 @@ - return f_13053_.m_13244_(p_13117_); +@@ -145,4 +_,8 @@ + private static TagKey m_203846_(String p_203847_) { + return TagKey.m_203882_(Registry.f_122901_, new ResourceLocation(p_203847_)); } - -+ public static net.minecraftforge.common.Tags.IOptionalNamedTag createOptional(net.minecraft.resources.ResourceLocation name) { -+ return createOptional(name, null); -+ } + -+ public static net.minecraftforge.common.Tags.IOptionalNamedTag createOptional(net.minecraft.resources.ResourceLocation name, @javax.annotation.Nullable java.util.Set> defaults) { -+ return f_13053_.createOptional(name, defaults); ++ public static TagKey create(ResourceLocation name) { ++ return TagKey.m_203882_(Registry.f_122901_, name); + } -+ - public static TagCollection m_13115_() { - return f_13053_.m_13246_(); - } + } diff --git a/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch b/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch deleted file mode 100644 index 0a1c07ad5c..0000000000 --- a/patches/minecraft/net/minecraft/tags/EntityTypeTags.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/net/minecraft/tags/EntityTypeTags.java -+++ b/net/minecraft/tags/EntityTypeTags.java -@@ -23,6 +_,14 @@ - return f_13119_.m_13244_(p_13128_); - } - -+ public static net.minecraftforge.common.Tags.IOptionalNamedTag> createOptional(net.minecraft.resources.ResourceLocation name) { -+ return createOptional(name, null); -+ } -+ -+ public static net.minecraftforge.common.Tags.IOptionalNamedTag> createOptional(net.minecraft.resources.ResourceLocation name, @javax.annotation.Nullable java.util.Set>> defaults) { -+ return f_13119_.createOptional(name, defaults); -+ } -+ - public static TagCollection> m_13126_() { - return f_13119_.m_13246_(); - } diff --git a/patches/minecraft/net/minecraft/tags/FluidTags.java.patch b/patches/minecraft/net/minecraft/tags/FluidTags.java.patch index 6b7a6a30ac..c6601f56da 100644 --- a/patches/minecraft/net/minecraft/tags/FluidTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/FluidTags.java.patch @@ -1,15 +1,11 @@ --- a/net/minecraft/tags/FluidTags.java +++ b/net/minecraft/tags/FluidTags.java -@@ -29,4 +_,12 @@ - public static List> m_144300_() { - return f_144297_; +@@ -14,4 +_,8 @@ + private static TagKey m_203850_(String p_203851_) { + return TagKey.m_203882_(Registry.f_122899_, new ResourceLocation(p_203851_)); } + -+ public static net.minecraftforge.common.Tags.IOptionalNamedTag createOptional(net.minecraft.resources.ResourceLocation name) { -+ return createOptional(name, null); -+ } -+ -+ public static net.minecraftforge.common.Tags.IOptionalNamedTag createOptional(net.minecraft.resources.ResourceLocation name, @javax.annotation.Nullable java.util.Set> defaults) { -+ return f_13130_.createOptional(name, defaults); ++ public static TagKey create(ResourceLocation name) { ++ return TagKey.m_203882_(Registry.f_122899_, name); + } } diff --git a/patches/minecraft/net/minecraft/tags/GameEventTags.java.patch b/patches/minecraft/net/minecraft/tags/GameEventTags.java.patch deleted file mode 100644 index 214cfa4661..0000000000 --- a/patches/minecraft/net/minecraft/tags/GameEventTags.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/net/minecraft/tags/GameEventTags.java -+++ b/net/minecraft/tags/GameEventTags.java -@@ -12,6 +_,14 @@ - return f_144301_.m_13244_(p_144308_); - } - -+ public static net.minecraftforge.common.Tags.IOptionalNamedTag createOptional(net.minecraft.resources.ResourceLocation name) { -+ return createOptional(name, null); -+ } -+ -+ public static net.minecraftforge.common.Tags.IOptionalNamedTag createOptional(net.minecraft.resources.ResourceLocation name, @javax.annotation.Nullable java.util.Set> defaults) { -+ return f_144301_.createOptional(name, defaults); -+ } -+ - public static TagCollection m_144306_() { - return f_144301_.m_13246_(); - } diff --git a/patches/minecraft/net/minecraft/tags/ItemTags.java.patch b/patches/minecraft/net/minecraft/tags/ItemTags.java.patch index 2c3e390140..bce41f12f0 100644 --- a/patches/minecraft/net/minecraft/tags/ItemTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/ItemTags.java.patch @@ -1,17 +1,11 @@ --- a/net/minecraft/tags/ItemTags.java +++ b/net/minecraft/tags/ItemTags.java -@@ -84,6 +_,14 @@ - return f_13163_.m_13244_(p_13195_); +@@ -83,4 +_,8 @@ + private static TagKey m_203854_(String p_203855_) { + return TagKey.m_203882_(Registry.f_122904_, new ResourceLocation(p_203855_)); } - -+ public static net.minecraftforge.common.Tags.IOptionalNamedTag createOptional(net.minecraft.resources.ResourceLocation name) { -+ return createOptional(name, null); -+ } + -+ public static net.minecraftforge.common.Tags.IOptionalNamedTag createOptional(net.minecraft.resources.ResourceLocation name, @javax.annotation.Nullable java.util.Set> defaults) { -+ return f_13163_.createOptional(name, defaults); ++ public static TagKey create(final ResourceLocation name) { ++ return TagKey.m_203882_(Registry.f_122904_, name); + } -+ - public static TagCollection m_13193_() { - return f_13163_.m_13246_(); - } + } diff --git a/patches/minecraft/net/minecraft/tags/StaticTagHelper.java.patch b/patches/minecraft/net/minecraft/tags/StaticTagHelper.java.patch deleted file mode 100644 index 6600528918..0000000000 --- a/patches/minecraft/net/minecraft/tags/StaticTagHelper.java.patch +++ /dev/null @@ -1,134 +0,0 @@ ---- a/net/minecraft/tags/StaticTagHelper.java -+++ b/net/minecraft/tags/StaticTagHelper.java -@@ -17,6 +_,7 @@ - private final String f_144327_; - private TagCollection f_13227_ = TagCollection.m_13410_(); - private final List> f_13228_ = Lists.newArrayList(); -+ @Nullable private static java.util.Map>> toAdd = com.google.common.collect.Maps.newHashMap(); - - public StaticTagHelper(ResourceKey> p_144329_, String p_144330_) { - this.f_144326_ = p_144329_; -@@ -24,9 +_,60 @@ - } - - public Tag.Named m_13244_(String p_13245_) { -- StaticTagHelper.Wrapper wrapper = new StaticTagHelper.Wrapper<>(new ResourceLocation(p_13245_)); -- this.f_13228_.add(wrapper); -- return wrapper; -+ return add(new StaticTagHelper.Wrapper<>(new ResourceLocation(p_13245_))); -+ } -+ -+ public net.minecraftforge.common.Tags.IOptionalNamedTag createOptional(ResourceLocation key, @Nullable Set> defaults) { -+ return add(new StaticTagHelper.OptionalNamedTag<>(key, defaults)); -+ } -+ -+ /** Call via ForgeTagHandler#makeWrapperTag to avoid any exceptions due to calling this after it is safe to call {@link #bind(String)} */ -+ public static Tag.Named createDelayedTag(ResourceLocation tagRegistry, ResourceLocation name) { -+ return delayedAdd(tagRegistry, new StaticTagHelper.Wrapper<>(name)); -+ } -+ -+ /** Call via ForgeTagHandler#createOptionalTag to avoid any exceptions due to calling this after it is safe to call {@link #createOptional(ResourceLocation, Set)} */ -+ public static net.minecraftforge.common.Tags.IOptionalNamedTag createDelayedOptional(ResourceLocation tagRegistry, ResourceLocation key, @Nullable Set> defaults) { -+ return delayedAdd(tagRegistry, new StaticTagHelper.OptionalNamedTag<>(key, defaults)); -+ } -+ -+ private static synchronized > R delayedAdd(ResourceLocation tagRegistry, R tag) { -+ if (toAdd == null) throw new RuntimeException("Creating delayed tags or optional tags, is only supported before custom tag types have been added."); -+ toAdd.computeIfAbsent(tagRegistry, registry -> Lists.newArrayList()).add(tag); -+ return tag; -+ } -+ -+ public static void performDelayedAdd() { -+ if (toAdd != null) { -+ for (java.util.Map.Entry>> entry : toAdd.entrySet()) { -+ StaticTagHelper tagRegistry = StaticTags.get(entry.getKey()); -+ if (tagRegistry == null) throw new RuntimeException("A mod attempted to add a delayed tag for a registry that doesn't have custom tag support."); -+ for (StaticTagHelper.Wrapper tag : entry.getValue()) { -+ tagRegistry.add((StaticTagHelper.Wrapper) tag); -+ } -+ } -+ toAdd = null; -+ } -+ } -+ -+ private > R add(R namedtag) { -+ namedtag.m_13260_(f_13227_::m_13404_); -+ this.f_13228_.add(namedtag); -+ return namedtag; -+ } -+ -+ public TagCollection reinjectOptionalTags(TagCollection tagCollection) { -+ java.util.Map> currentTags = tagCollection.m_5643_(); -+ java.util.Map> missingOptionals = this.f_13228_.stream().filter(e -> e instanceof OptionalNamedTag && !currentTags.containsKey(e.m_6979_())).collect(Collectors.toMap(Wrapper::m_6979_, namedTag -> { -+ OptionalNamedTag optionalNamedTag = (OptionalNamedTag) namedTag; -+ optionalNamedTag.defaulted = true; -+ return optionalNamedTag.resolveDefaulted(); -+ }, (existingTag, newTag) -> SetTag.m_13222_(ImmutableSet.builder().addAll(existingTag.m_6497_()).addAll(newTag.m_6497_()).build()))); -+ if (!missingOptionals.isEmpty()) { -+ missingOptionals.putAll(currentTags); -+ return TagCollection.m_13396_(missingOptionals); -+ } -+ return tagCollection; - } - - public void m_13232_() { -@@ -53,7 +_,7 @@ - - public Set m_13247_(TagContainer p_13248_) { - TagCollection tagcollection = p_13248_.m_144452_(this.f_144326_); -- Set set = this.f_13228_.stream().map(StaticTagHelper.Wrapper::m_6979_).collect(Collectors.toSet()); -+ Set set = this.f_13228_.stream().filter(e -> !(e instanceof OptionalNamedTag)).map(StaticTagHelper.Wrapper::m_6979_).collect(Collectors.toSet()); - ImmutableSet immutableset = ImmutableSet.copyOf(tagcollection.m_13406_()); - return Sets.difference(set, immutableset); - } -@@ -67,7 +_,7 @@ - } - - protected void m_144336_(TagContainer.Builder p_144337_) { -- p_144337_.m_144486_(this.f_144326_, TagCollection.m_13396_(this.f_13228_.stream().collect(Collectors.toMap(Tag.Named::m_6979_, (p_144332_) -> { -+ p_144337_.m_144486_(this.f_144326_, TagCollection.m_13396_(this.f_13228_.stream().distinct().collect(Collectors.toMap(Tag.Named::m_6979_, (p_144332_) -> { - return p_144332_; - })))); - } -@@ -103,6 +_,41 @@ - - public List m_6497_() { - return this.m_13263_().m_6497_(); -+ } -+ -+ @Override -+ public String toString() { -+ return "NamedTag[" + m_6979_() + ']'; -+ } -+ @Override public boolean equals(Object o) { return (o == this) || (o instanceof Tag.Named && java.util.Objects.equals(this.m_6979_(), ((Tag.Named)o).m_6979_())); } -+ @Override public int hashCode() { return m_6979_().hashCode(); } -+ } -+ -+ private static class OptionalNamedTag extends Wrapper implements net.minecraftforge.common.Tags.IOptionalNamedTag { -+ @Nullable -+ private final Set> defaults; -+ private boolean defaulted = false; -+ -+ private OptionalNamedTag(ResourceLocation name, @Nullable Set> defaults) { -+ super(name); -+ this.defaults = defaults; -+ } -+ -+ @Override -+ public boolean isDefaulted() { -+ return defaulted; -+ } -+ -+ SetTag resolveDefaulted() { -+ if (defaults == null || defaults.isEmpty()) { -+ return SetTag.m_13216_(); -+ } -+ return SetTag.m_13222_(ImmutableSet.copyOf(defaults.stream().map(java.util.function.Supplier::get).collect(Collectors.toSet()))); -+ } -+ -+ @Override -+ public String toString() { -+ return "OptionalNamedTag[" + m_6979_() + ']'; - } - } - } diff --git a/patches/minecraft/net/minecraft/tags/StaticTags.java.patch b/patches/minecraft/net/minecraft/tags/StaticTags.java.patch deleted file mode 100644 index b921050664..0000000000 --- a/patches/minecraft/net/minecraft/tags/StaticTags.java.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- a/net/minecraft/tags/StaticTags.java -+++ b/net/minecraft/tags/StaticTags.java -@@ -14,15 +_,16 @@ - import net.minecraft.resources.ResourceLocation; - - public class StaticTags { -- private static final Set> f_144340_ = Sets.newHashSet(); -- private static final List> f_13264_ = Lists.newArrayList(); -+ private static final java.util.Map, StaticTagHelper> HELPER_MAP = new java.util.HashMap<>(); // Forge: Minecraft separates this for no reason, lets make it a map again! -+ private static final Set> f_144340_ = HELPER_MAP.keySet(); -+ private static final java.util.Collection> f_13264_ = HELPER_MAP.values(); - - public static StaticTagHelper m_144351_(ResourceKey> p_144352_, String p_144353_) { -- if (!f_144340_.add(p_144352_)) { -+ if (f_144340_.contains(p_144352_)) { - throw new IllegalStateException("Duplicate entry for static tag collection: " + p_144352_); - } else { - StaticTagHelper statictaghelper = new StaticTagHelper<>(p_144352_, p_144353_); -- f_13264_.add(statictaghelper); -+ HELPER_MAP.put(p_144352_, statictaghelper); - return statictaghelper; - } - } -@@ -54,10 +_,16 @@ - } - - private static void m_144356_() { -+ if (true) { m_144355_(); return; } //FORGE this check is unnecessary as the 2 collections are patched back into a map above. Still need to 'clinit' them though. - Set> set = m_144355_().stream().map(StaticTagHelper::m_144338_).collect(Collectors.toSet()); - if (!Sets.difference(f_144340_, set).isEmpty()) { - throw new IllegalStateException("Missing helper registrations"); - } -+ } -+ -+ @javax.annotation.Nullable -+ public static StaticTagHelper get(ResourceLocation rl) { -+ return HELPER_MAP.get(ResourceKey.m_135788_(rl)); - } - - public static void m_144349_(Consumer> p_144350_) { diff --git a/patches/minecraft/net/minecraft/tags/Tag.java.patch b/patches/minecraft/net/minecraft/tags/Tag.java.patch index 50e2cc3d9b..616c8621c9 100644 --- a/patches/minecraft/net/minecraft/tags/Tag.java.patch +++ b/patches/minecraft/net/minecraft/tags/Tag.java.patch @@ -1,24 +1,24 @@ --- a/net/minecraft/tags/Tag.java +++ b/net/minecraft/tags/Tag.java -@@ -47,8 +_,16 @@ - return SetTag.m_13222_(p_13301_); +@@ -31,8 +_,16 @@ + return (Tag)f_203856_; } - public static class Builder { + public static class Builder implements net.minecraftforge.common.extensions.IForgeRawTagBuilder { -+ private final List removeEntries = Lists.newArrayList(); // FORGE: internal field for tracking "remove" entries ++ private final List removeEntries = new java.util.ArrayList<>(); // FORGE: internal field for tracking "remove" entries + /** FORGE: Gets a view of this builder's "remove" entries (only used during datagen) **/ + public Stream getRemoveEntries() { return this.removeEntries.stream(); } + public Tag.Builder remove(final Tag.BuilderEntry proxy) { // internal forge method for adding remove entries + this.removeEntries.add(proxy); + return this; + } - private final List f_13302_ = Lists.newArrayList(); + private final List f_13302_ = new ArrayList<>(); + private boolean replace = false; public static Tag.Builder m_13304_() { return new Tag.Builder(); -@@ -79,6 +_,15 @@ +@@ -63,6 +_,15 @@ return this.m_13307_(new Tag.OptionalTagEntry(p_144383_), p_144384_); } @@ -33,8 +33,8 @@ + public Either, Tag> m_144371_(Function> p_144372_, Function p_144373_) { ImmutableSet.Builder builder = ImmutableSet.builder(); - List list = Lists.newArrayList(); -@@ -120,6 +_,7 @@ + List list = new ArrayList<>(); +@@ -104,6 +_,7 @@ this.f_13302_.clear(); } @@ -42,8 +42,8 @@ list.forEach((p_13319_) -> { this.f_13302_.add(new Tag.BuilderEntry(p_13319_, p_13314_)); }); -@@ -155,8 +_,9 @@ - tag$builderentry.m_13347_().m_6383_(jsonarray); +@@ -139,8 +_,9 @@ + tag$builderentry.f_13338_().m_6383_(jsonarray); } - jsonobject.addProperty("replace", false); @@ -53,7 +53,7 @@ return jsonobject; } } -@@ -211,6 +_,7 @@ +@@ -179,6 +_,7 @@ public String toString() { return this.f_13349_.toString(); } @@ -61,7 +61,7 @@ } public interface Entry { -@@ -323,6 +_,8 @@ +@@ -287,6 +_,8 @@ public String toString() { return "#" + this.f_13383_; } diff --git a/patches/minecraft/net/minecraft/tags/TagContainer.java.patch b/patches/minecraft/net/minecraft/tags/TagContainer.java.patch deleted file mode 100644 index 493640da04..0000000000 --- a/patches/minecraft/net/minecraft/tags/TagContainer.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/net/minecraft/tags/TagContainer.java -+++ b/net/minecraft/tags/TagContainer.java -@@ -74,6 +_,7 @@ - public void m_13431_() { - StaticTags.m_13269_(this); - Blocks.m_50758_(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this)); - } - - public Map>, TagCollection.NetworkPayload> m_144442_(final RegistryAccess p_144443_) { -@@ -81,6 +_,7 @@ - this.m_144436_(new TagContainer.CollectionConsumer() { - public void m_142574_(ResourceKey> p_144481_, TagCollection p_144482_) { - Optional> optional = p_144443_.m_6632_(p_144481_); -+ optional = net.minecraftforge.common.ForgeTagHandler.getWrapperRegistry(p_144481_, optional); - if (optional.isPresent()) { - map.put(p_144481_, p_144482_.m_144411_(optional.get())); - } else { -@@ -102,6 +_,7 @@ - - private static void m_144444_(RegistryAccess p_144445_, TagContainer.Builder p_144446_, ResourceKey> p_144447_, TagCollection.NetworkPayload p_144448_) { - Optional> optional = p_144445_.m_6632_(p_144447_); -+ optional = net.minecraftforge.common.ForgeTagHandler.getWrapperRegistry((ResourceKey>) p_144447_, (Optional>) optional); - if (optional.isPresent()) { - p_144446_.m_144486_(p_144447_, TagCollection.m_144408_(p_144448_, optional.get())); - } else { diff --git a/patches/minecraft/net/minecraft/tags/TagManager.java.patch b/patches/minecraft/net/minecraft/tags/TagManager.java.patch index a31d15fc54..a67693a22a 100644 --- a/patches/minecraft/net/minecraft/tags/TagManager.java.patch +++ b/patches/minecraft/net/minecraft/tags/TagManager.java.patch @@ -1,27 +1,10 @@ --- a/net/minecraft/tags/TagManager.java +++ b/net/minecraft/tags/TagManager.java -@@ -21,6 +_,7 @@ +@@ -17,6 +_,7 @@ public class TagManager implements PreparableReloadListener { - private static final Logger f_144568_ = LogManager.getLogger(); + private static final Map>, String> f_203902_ = Map.of(Registry.f_122901_, "tags/blocks", Registry.f_122903_, "tags/entity_types", Registry.f_122899_, "tags/fluids", Registry.f_175423_, "tags/game_events", Registry.f_122904_, "tags/items"); private final RegistryAccess f_144569_; + protected java.util.Map> customTagTypeReaders = net.minecraftforge.common.ForgeTagHandler.createCustomTagTypeReaders(); - private TagContainer f_13478_ = TagContainer.f_13420_; + private List> f_203903_ = List.of(); public TagManager(RegistryAccess p_144572_) { -@@ -56,6 +_,7 @@ - return p_144596_.getKey() + ":" + p_144596_.getValue(); - }).sorted().collect(Collectors.joining(","))); - } else { -+ tagcontainer = net.minecraftforge.common.ForgeTagHandler.reinjectOptionalTags(tagcontainer); - SerializationTags.m_13202_(tagcontainer); - this.f_13478_ = tagcontainer; - } -@@ -73,6 +_,8 @@ - }, p_144577_); - return new TagManager.LoaderInfo<>(p_144578_, completablefuture); - } else { -+ if (net.minecraftforge.common.ForgeTagHandler.getCustomTagTypeNames().contains(p_144578_.m_144338_().m_135782_())) -+ return new TagManager.LoaderInfo<>(p_144578_, CompletableFuture.supplyAsync(() -> ((TagLoader) customTagTypeReaders.get(p_144578_.m_144338_().m_135782_())).m_144544_(p_144576_), p_144577_)); - f_144568_.warn("Can't find registry for {}", (Object)p_144578_.m_144338_()); - return null; - } diff --git a/patches/minecraft/net/minecraft/world/effect/MobEffect.java.patch b/patches/minecraft/net/minecraft/world/effect/MobEffect.java.patch index b5f747689f..1200d5a53b 100644 --- a/patches/minecraft/net/minecraft/world/effect/MobEffect.java.patch +++ b/patches/minecraft/net/minecraft/world/effect/MobEffect.java.patch @@ -17,22 +17,12 @@ } public void m_6742_(LivingEntity p_19467_, int p_19468_) { -@@ -179,4 +_,39 @@ +@@ -179,4 +_,29 @@ public boolean m_19486_() { return this.f_19447_ == MobEffectCategory.BENEFICIAL; } + + // FORGE START -+ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, () -> net.minecraft.tags.SerializationTags.m_13199_().m_144452_(Registry.f_122900_)); -+ -+ public java.util.Set getTags() { -+ return reverseTags.getTagNames(); -+ } -+ -+ public boolean is(net.minecraft.tags.Tag tag) { -+ return tag.m_8110_(this); -+ } -+ + private Object effectRenderer; + + /* diff --git a/patches/minecraft/net/minecraft/world/effect/MobEffectInstance.java.patch b/patches/minecraft/net/minecraft/world/effect/MobEffectInstance.java.patch index 66ccd9483b..8f9c5ba6ae 100644 --- a/patches/minecraft/net/minecraft/world/effect/MobEffectInstance.java.patch +++ b/patches/minecraft/net/minecraft/world/effect/MobEffectInstance.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/effect/MobEffectInstance.java +++ b/net/minecraft/world/effect/MobEffectInstance.java @@ -7,7 +_,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; + import net.minecraft.world.entity.LivingEntity; + import org.slf4j.Logger; -public class MobEffectInstance implements Comparable { +public class MobEffectInstance implements Comparable, net.minecraftforge.common.extensions.IForgeMobEffectInstance { - private static final Logger f_19501_ = LogManager.getLogger(); + private static final Logger f_19501_ = LogUtils.getLogger(); private final MobEffect f_19502_; private int f_19503_; @@ -60,6 +_,7 @@ diff --git a/patches/minecraft/net/minecraft/world/entity/Entity.java.patch b/patches/minecraft/net/minecraft/world/entity/Entity.java.patch index d18660af80..6fb9e296dc 100644 --- a/patches/minecraft/net/minecraft/world/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/Entity.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -114,7 +_,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -116,7 +_,7 @@ + import net.minecraft.world.scores.Team; + import org.slf4j.Logger; -public abstract class Entity implements Nameable, EntityAccess, CommandSource { +public abstract class Entity extends net.minecraftforge.common.capabilities.CapabilityProvider implements Nameable, EntityAccess, CommandSource, net.minecraftforge.common.extensions.IForgeEntity { - protected static final Logger f_19849_ = LogManager.getLogger(); + private static final Logger f_19849_ = LogUtils.getLogger(); public static final String f_146815_ = "id"; public static final String f_146816_ = "Passengers"; -@@ -133,6 +_,7 @@ +@@ -135,6 +_,7 @@ private static final double f_146812_ = 0.0023333333333333335D; public static final String f_146824_ = "UUID"; private static double f_19846_ = 1.0D; @@ -17,7 +17,7 @@ private final EntityType f_19847_; private int f_19848_ = f_19843_.incrementAndGet(); public boolean f_19850_; -@@ -227,6 +_,7 @@ +@@ -229,6 +_,7 @@ private BlockState f_185934_ = null; public Entity(EntityType p_19870_, Level p_19871_) { @@ -25,7 +25,7 @@ this.f_19847_ = p_19870_; this.f_19853_ = p_19871_; this.f_19815_ = p_19870_.m_20680_(); -@@ -245,7 +_,11 @@ +@@ -247,7 +_,11 @@ this.f_19804_.m_135372_(f_146800_, 0); this.m_8097_(); this.m_6034_(0.0D, 0.0D, 0.0D); @@ -38,7 +38,7 @@ } public boolean m_20039_(BlockPos p_20040_, BlockState p_20041_) { -@@ -341,6 +_,7 @@ +@@ -343,6 +_,7 @@ if (p_146834_ == Entity.RemovalReason.KILLED) { this.m_146850_(GameEvent.f_157809_); } @@ -46,30 +46,30 @@ } -@@ -612,13 +_,13 @@ - double d0 = vec3.f_82479_; - double d1 = vec3.f_82480_; - double d2 = vec3.f_82481_; -- this.f_146794_ = (float)((double)this.f_146794_ + vec3.m_82553_() * 0.6D); +@@ -621,13 +_,13 @@ + double d1 = vec3.f_82479_; + double d2 = vec3.f_82480_; + double d3 = vec3.f_82481_; +- this.f_146794_ += (float)(vec3.m_82553_() * 0.6D); + this.f_146794_ = (float) ((double) this.f_146794_ + vec3.m_82553_() * 0.6D); - if (!blockstate.m_60620_(BlockTags.f_13082_) && !blockstate.m_60713_(Blocks.f_152499_)) { - d1 = 0.0D; + if (!blockstate.m_204336_(BlockTags.f_13082_) && !blockstate.m_60713_(Blocks.f_152499_)) { + d2 = 0.0D; } - this.f_19787_ += (float)vec3.m_165924_() * 0.6F; -- this.f_19788_ += (float)Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 0.6F; +- this.f_19788_ += (float)Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3) * 0.6F; + this.f_19787_ += (float) vec3.m_165924_() * 0.6F; + this.f_19788_ += (float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 0.6F; if (this.f_19788_ > this.f_19829_ && !blockstate.m_60795_()) { this.f_19829_ = this.m_6059_(); if (this.m_20069_()) { -@@ -650,25 +_,23 @@ +@@ -659,25 +_,23 @@ this.m_146872_(); float f2 = this.m_6041_(); - this.m_20256_(this.m_20184_().m_82542_((double)f2, 1.0D, (double)f2)); - if (this.f_19853_.m_46847_(this.m_142469_().m_82406_(1.0E-6D)).noneMatch((p_20127_) -> { -- return p_20127_.m_60620_(BlockTags.f_13076_) || p_20127_.m_60713_(Blocks.f_49991_); +- return p_20127_.m_204336_(BlockTags.f_13076_) || p_20127_.m_60713_(Blocks.f_49991_); - })) { - if (this.f_19831_ <= 0) { - this.m_7311_(-this.m_6101_()); @@ -83,7 +83,7 @@ - if (this.m_6060_() && (this.f_146808_ || this.m_20071_())) { + this.m_20256_(this.m_20184_().m_82542_((double) f2, 1.0D, (double) f2)); + } -+ if (this.f_19853_.m_46847_(this.m_142469_().m_82406_(1.0E-6D)).noneMatch((p_20127_) -> p_20127_.m_60620_(BlockTags.f_13076_) || p_20127_.m_60713_(Blocks.f_49991_))) { ++ if (this.f_19853_.m_46847_(this.m_142469_().m_82406_(1.0E-6D)).noneMatch((p_20127_) -> p_20127_.m_204336_(BlockTags.f_13076_) || p_20127_.m_60713_(Blocks.f_49991_))) { + if (this.f_19831_ <= 0) { this.m_7311_(-this.m_6101_()); } @@ -103,7 +103,7 @@ } } -@@ -706,10 +_,10 @@ +@@ -715,10 +_,10 @@ int j = Mth.m_14107_(this.f_19825_.f_82480_ - (double)0.2F); int k = Mth.m_14107_(this.f_19825_.f_82481_); BlockPos blockpos = new BlockPos(i, j, k); @@ -111,21 +111,21 @@ + if (this.f_19853_.m_46859_(blockpos)) { BlockPos blockpos1 = blockpos.m_7495_(); BlockState blockstate = this.f_19853_.m_8055_(blockpos1); -- if (blockstate.m_60620_(BlockTags.f_13039_) || blockstate.m_60620_(BlockTags.f_13032_) || blockstate.m_60734_() instanceof FenceGateBlock) { +- if (blockstate.m_204336_(BlockTags.f_13039_) || blockstate.m_204336_(BlockTags.f_13032_) || blockstate.m_60734_() instanceof FenceGateBlock) { + if (blockstate.collisionExtendsVertically(this.f_19853_, blockpos1, this)) { return blockpos1; } } -@@ -920,7 +_,7 @@ +@@ -929,7 +_,7 @@ protected void m_7355_(BlockPos p_20135_, BlockState p_20136_) { if (!p_20136_.m_60767_().m_76332_()) { BlockState blockstate = this.f_19853_.m_8055_(p_20135_.m_7494_()); -- SoundType soundtype = blockstate.m_60620_(BlockTags.f_144271_) ? blockstate.m_60827_() : p_20136_.m_60827_(); +- SoundType soundtype = blockstate.m_204336_(BlockTags.f_144271_) ? blockstate.m_60827_() : p_20136_.m_60827_(); + SoundType soundtype = blockstate.m_60713_(Blocks.f_50125_) ? blockstate.getSoundType(f_19853_, p_20135_, this) : p_20136_.getSoundType(f_19853_, p_20135_, this); this.m_5496_(soundtype.m_56776_(), soundtype.m_56773_() * 0.15F, soundtype.m_56774_()); } } -@@ -1142,9 +_,10 @@ +@@ -1144,9 +_,10 @@ int k = Mth.m_14107_(this.m_20189_()); BlockPos blockpos = new BlockPos(i, j, k); BlockState blockstate = this.f_19853_.m_8055_(blockpos); @@ -137,7 +137,7 @@ } } -@@ -1465,6 +_,7 @@ +@@ -1467,6 +_,7 @@ if (this.f_146813_) { p_20241_.m_128379_("HasVisualFire", this.f_146813_); } @@ -145,7 +145,7 @@ if (!this.f_19841_.isEmpty()) { ListTag listtag = new ListTag(); -@@ -1476,6 +_,10 @@ +@@ -1478,6 +_,10 @@ p_20241_.m_128365_("Tags", listtag); } @@ -156,7 +156,7 @@ this.m_7380_(p_20241_); if (this.m_20160_()) { ListTag listtag1 = new ListTag(); -@@ -1550,6 +_,9 @@ +@@ -1552,6 +_,9 @@ this.m_146915_(p_20259_.m_128471_("Glowing")); this.m_146917_(p_20259_.m_128451_("TicksFrozen")); this.f_146813_ = p_20259_.m_128471_("HasVisualFire"); @@ -166,7 +166,7 @@ if (p_20259_.m_128425_("Tags", 9)) { this.f_19841_.clear(); ListTag listtag3 = p_20259_.m_128437_("Tags", 8); -@@ -1638,6 +_,8 @@ +@@ -1640,6 +_,8 @@ } else { ItemEntity itementity = new ItemEntity(this.f_19853_, this.m_20185_(), this.m_20186_() + (double)p_19986_, this.m_20189_(), p_19985_); itementity.m_32060_(); @@ -175,7 +175,7 @@ this.f_19853_.m_7967_(itementity); return itementity; } -@@ -1675,6 +_,7 @@ +@@ -1676,6 +_,7 @@ public void m_6083_() { this.m_20256_(Vec3.f_82478_); @@ -183,7 +183,7 @@ this.m_8119_(); if (this.m_20159_()) { this.m_20202_().m_7332_(this); -@@ -1721,6 +_,7 @@ +@@ -1722,6 +_,7 @@ } } @@ -191,7 +191,7 @@ if (p_19967_ || this.m_7341_(p_19966_) && p_19966_.m_7310_(this)) { if (this.m_20159_()) { this.m_8127_(); -@@ -1759,6 +_,7 @@ +@@ -1760,6 +_,7 @@ public void m_6038_() { if (this.f_19824_ != null) { Entity entity = this.f_19824_; @@ -199,7 +199,7 @@ this.f_19824_ = null; entity.m_20351_(this); } -@@ -1924,6 +_,7 @@ +@@ -1936,6 +_,7 @@ return !this.f_19823_.isEmpty(); } @@ -207,7 +207,7 @@ public boolean m_6146_() { return true; } -@@ -2081,7 +_,7 @@ +@@ -2093,7 +_,7 @@ this.m_20254_(8); } @@ -216,7 +216,7 @@ } public void m_6845_(boolean p_20313_) { -@@ -2169,7 +_,7 @@ +@@ -2181,7 +_,7 @@ } protected Component m_5677_() { @@ -225,7 +225,7 @@ } public boolean m_7306_(Entity p_20356_) { -@@ -2225,14 +_,19 @@ +@@ -2237,14 +_,19 @@ @Nullable public Entity m_5489_(ServerLevel p_20118_) { @@ -246,7 +246,7 @@ this.f_19853_.m_46473_().m_6182_("reloading"); Entity entity = this.m_6095_().m_20615_(p_20118_); if (entity != null) { -@@ -2240,17 +_,19 @@ +@@ -2252,17 +_,19 @@ entity.m_7678_(portalinfo.f_77676_.f_82479_, portalinfo.f_77676_.f_82480_, portalinfo.f_77676_.f_82481_, portalinfo.f_77678_, entity.m_146909_()); entity.m_20256_(portalinfo.f_77677_); p_20118_.m_143334_(entity); @@ -268,7 +268,7 @@ } } else { return null; -@@ -2451,8 +_,10 @@ +@@ -2463,8 +_,10 @@ EntityDimensions entitydimensions = this.f_19815_; Pose pose = this.m_20089_(); EntityDimensions entitydimensions1 = this.m_6972_(pose); @@ -280,7 +280,7 @@ this.m_20090_(); boolean flag = (double)entitydimensions1.f_20377_ <= 4.0D && (double)entitydimensions1.f_20378_ <= 4.0D; if (!this.f_19853_.f_46443_ && !this.f_19803_ && !this.f_19794_ && flag && (entitydimensions1.f_20377_ > entitydimensions.f_20377_ || entitydimensions1.f_20378_ > entitydimensions.f_20378_) && !(this instanceof Player)) { -@@ -2460,8 +_,9 @@ +@@ -2472,8 +_,9 @@ double d0 = (double)Math.max(0.0F, entitydimensions1.f_20377_ - entitydimensions.f_20377_) + 1.0E-6D; double d1 = (double)Math.max(0.0F, entitydimensions1.f_20378_ - entitydimensions.f_20378_) + 1.0E-6D; VoxelShape voxelshape = Shapes.m_83064_(AABB.m_165882_(vec3, d0, d1, d0)); @@ -291,7 +291,7 @@ }); } -@@ -2938,6 +_,7 @@ +@@ -2950,6 +_,7 @@ gameeventlistenerregistrar.m_157862_(this.f_19853_); } } @@ -299,7 +299,7 @@ } -@@ -3045,6 +_,76 @@ +@@ -3061,6 +_,76 @@ public boolean m_142265_(Level p_146843_, BlockPos p_146844_) { return true; } diff --git a/patches/minecraft/net/minecraft/world/entity/EntityType.java.patch b/patches/minecraft/net/minecraft/world/entity/EntityType.java.patch index d09dc6b02d..0489d37b8a 100644 --- a/patches/minecraft/net/minecraft/world/entity/EntityType.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/EntityType.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/entity/EntityType.java +++ b/net/minecraft/world/entity/EntityType.java -@@ -146,7 +_,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -148,7 +_,7 @@ + import net.minecraft.world.phys.shapes.VoxelShape; + import org.slf4j.Logger; -public class EntityType implements EntityTypeTest { +public class EntityType extends net.minecraftforge.registries.ForgeRegistryEntry> implements EntityTypeTest { - private static final Logger f_20534_ = LogManager.getLogger(); + private static final Logger f_20534_ = LogUtils.getLogger(); public static final String f_147037_ = "EntityTag"; - private static final float f_147038_ = 1.3964844F; -@@ -280,6 +_,12 @@ + private final Holder.Reference> f_204038_ = Registry.f_122826_.m_203693_(this); +@@ -283,6 +_,11 @@ private ResourceLocation f_20546_; private final EntityDimensions f_20547_; @@ -17,12 +17,11 @@ + private final java.util.function.ToIntFunction> trackingRangeSupplier; + private final java.util.function.ToIntFunction> updateIntervalSupplier; + private final java.util.function.BiFunction customClientFactory; -+ private final net.minecraftforge.common.util.ReverseTagWrapper> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.EntityTypeTags::m_13126_); + private static EntityType m_20634_(String p_20635_, EntityType.Builder p_20636_) { return Registry.m_122961_(Registry.f_122826_, p_20635_, p_20636_.m_20712_(p_20635_)); } -@@ -293,6 +_,9 @@ +@@ -296,6 +_,9 @@ } public EntityType(EntityType.EntityFactory p_20574_, MobCategory p_20575_, boolean p_20576_, boolean p_20577_, boolean p_20578_, boolean p_20579_, ImmutableSet p_20580_, EntityDimensions p_20581_, int p_20582_, int p_20583_) { @@ -32,7 +31,7 @@ this.f_20535_ = p_20574_; this.f_20536_ = p_20575_; this.f_20541_ = p_20579_; -@@ -303,6 +_,10 @@ +@@ -306,6 +_,10 @@ this.f_20547_ = p_20581_; this.f_20542_ = p_20582_; this.f_20543_ = p_20583_; @@ -43,7 +42,7 @@ } @Nullable -@@ -314,6 +_,7 @@ +@@ -317,6 +_,7 @@ public T m_20600_(ServerLevel p_20601_, @Nullable CompoundTag p_20602_, @Nullable Component p_20603_, @Nullable Player p_20604_, BlockPos p_20605_, MobSpawnType p_20606_, boolean p_20607_, boolean p_20608_) { T t = this.m_20655_(p_20601_, p_20602_, p_20603_, p_20604_, p_20605_, p_20606_, p_20607_, p_20608_); if (t != null) { @@ -51,7 +50,7 @@ p_20601_.m_47205_(t); } -@@ -541,14 +_,23 @@ +@@ -544,14 +_,23 @@ } public int m_20681_() { @@ -75,27 +74,20 @@ return this != f_20532_ && this != f_20467_ && this != f_20496_ && this != f_20549_ && this != f_20462_ && this != f_147033_ && this != f_20464_ && this != f_20506_ && this != f_20564_ && this != f_20569_; } -@@ -565,6 +_,19 @@ - return Entity.class; +@@ -574,6 +_,12 @@ + return this.f_204038_; } + public T customClientSpawn(net.minecraftforge.network.PlayMessages.SpawnEntity packet, Level world) { + if (customClientFactory == null) return this.m_20615_(world); + return customClientFactory.apply(packet, world); + } -+ -+ /** -+ * Retrieves a list of tags names this is known to be associated with. -+ * This should be used in favor of TagCollection.getOwningTags, as this caches the result and automatically updates when the TagCollection changes. -+ */ -+ public java.util.Set getTags() { -+ return reverseTags.getTagNames(); -+ } ++ public Stream>> getTags() {return this.m_204041_().m_203616_();} + public static class Builder { private final EntityType.EntityFactory f_20685_; private final MobCategory f_20686_; -@@ -577,6 +_,11 @@ +@@ -586,6 +_,11 @@ private int f_20693_ = 3; private EntityDimensions f_20694_ = EntityDimensions.m_20395_(0.6F, 1.8F); @@ -107,7 +99,7 @@ private Builder(EntityType.EntityFactory p_20696_, MobCategory p_20697_) { this.f_20685_ = p_20696_; this.f_20686_ = p_20697_; -@@ -633,12 +_,36 @@ +@@ -642,12 +_,36 @@ return this; } diff --git a/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch b/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch index 9d714c3720..9d4c9301cf 100644 --- a/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch @@ -17,8 +17,8 @@ + if (this.f_19853_.f_46443_ || this.m_146910_()) return false; //Forge: Fixes MC-53850 if (this.m_6673_(p_20785_)) { return false; - } else { -@@ -197,6 +_,7 @@ + } else if (this.f_19853_.f_46443_) { +@@ -199,6 +_,7 @@ public void m_6123_(Player p_20792_) { if (!this.f_19853_.f_46443_) { if (p_20792_.f_36101_ == 0) { @@ -26,7 +26,7 @@ p_20792_.f_36101_ = 2; p_20792_.m_7938_(this, 1); int i = this.m_147092_(p_20792_, this.f_20770_); -@@ -217,7 +_,7 @@ +@@ -219,7 +_,7 @@ Entry entry = EnchantmentHelper.m_44839_(Enchantments.f_44962_, p_147093_, ItemStack::m_41768_); if (entry != null) { ItemStack itemstack = entry.getValue(); diff --git a/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch index 8d34067a9c..e067c4055e 100644 --- a/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -118,7 +_,9 @@ +@@ -122,7 +_,9 @@ private static final UUID f_20929_ = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); private static final UUID f_20959_ = UUID.fromString("87f46a96-686f-4796-b035-22e16ee9e038"); private static final UUID f_147184_ = UUID.fromString("1eaf83ff-7207-4596-b37a-d7a07b3ec4ce"); @@ -10,7 +10,7 @@ public static final int f_147166_ = 2; public static final int f_147167_ = 4; public static final int f_147168_ = 98; -@@ -268,7 +_,7 @@ +@@ -272,7 +_,7 @@ } public static AttributeSupplier.Builder m_21183_() { @@ -19,7 +19,7 @@ } protected void m_7840_(double p_20990_, boolean p_20991_, BlockState p_20992_, BlockPos p_20993_) { -@@ -286,7 +_,8 @@ +@@ -290,7 +_,8 @@ if (!p_20992_.m_60795_()) { double d0 = Math.min((double)(0.2F + f / 15.0F), 2.5D); int i = (int)(150.0D * d0); @@ -29,7 +29,7 @@ } } -@@ -350,7 +_,7 @@ +@@ -354,7 +_,7 @@ } } @@ -38,7 +38,7 @@ this.m_8127_(); } } else if (this.m_20146_() < this.m_6062_()) { -@@ -714,7 +_,7 @@ +@@ -718,7 +_,7 @@ if (!mobeffectinstance.m_19552_(this, () -> { this.m_141973_(mobeffectinstance, true, (Entity)null); })) { @@ -47,7 +47,7 @@ iterator.remove(); this.m_7285_(mobeffectinstance); } -@@ -764,8 +_,10 @@ +@@ -768,8 +_,10 @@ this.m_6842_(false); } else { Collection collection = this.f_20945_.values(); @@ -60,7 +60,7 @@ this.m_6842_(this.m_21023_(MobEffects.f_19609_)); } -@@ -801,7 +_,7 @@ +@@ -805,7 +_,7 @@ d0 *= 0.5D; } } @@ -69,7 +69,7 @@ return d0; } -@@ -844,7 +_,9 @@ +@@ -848,7 +_,9 @@ boolean flag; for(flag = false; iterator.hasNext(); flag = true) { @@ -80,7 +80,7 @@ iterator.remove(); } -@@ -878,6 +_,7 @@ +@@ -882,6 +_,7 @@ return false; } else { MobEffectInstance mobeffectinstance = this.f_20945_.get(p_147208_.m_19544_()); @@ -88,7 +88,7 @@ if (mobeffectinstance == null) { this.f_20945_.put(p_147208_.m_19544_(), p_147208_); this.m_142540_(p_147208_, p_147209_); -@@ -892,6 +_,9 @@ +@@ -896,6 +_,9 @@ } public boolean m_7301_(MobEffectInstance p_21197_) { @@ -98,7 +98,7 @@ if (this.m_6336_() == MobType.f_21641_) { MobEffect mobeffect = p_21197_.m_19544_(); if (mobeffect == MobEffects.f_19605_ || mobeffect == MobEffects.f_19614_) { -@@ -924,6 +_,7 @@ +@@ -928,6 +_,7 @@ } public boolean m_21195_(MobEffect p_21196_) { @@ -106,7 +106,7 @@ MobEffectInstance mobeffectinstance = this.m_6234_(p_21196_); if (mobeffectinstance != null) { this.m_7285_(mobeffectinstance); -@@ -960,6 +_,8 @@ +@@ -964,6 +_,8 @@ } public void m_5634_(float p_21116_) { @@ -115,7 +115,7 @@ float f = this.m_21223_(); if (f > 0.0F) { this.m_21153_(f + p_21116_); -@@ -980,6 +_,7 @@ +@@ -984,6 +_,7 @@ } public boolean m_6469_(DamageSource p_21016_, float p_21017_) { @@ -123,7 +123,7 @@ if (this.m_6673_(p_21016_)) { return false; } else if (this.f_19853_.f_46443_) { -@@ -998,9 +_,11 @@ +@@ -1002,9 +_,11 @@ boolean flag = false; float f1 = 0.0F; if (p_21017_ > 0.0F && this.m_21275_(p_21016_)) { @@ -138,7 +138,7 @@ if (!p_21016_.m_19360_()) { Entity entity = p_21016_.m_7640_(); if (entity instanceof LivingEntity) { -@@ -1010,6 +_,7 @@ +@@ -1014,6 +_,7 @@ flag = true; } @@ -146,7 +146,7 @@ this.f_20924_ = 1.5F; boolean flag1 = true; -@@ -1044,11 +_,11 @@ +@@ -1048,11 +_,11 @@ if (entity1 instanceof Player) { this.f_20889_ = 100; this.f_20888_ = (Player)entity1; @@ -162,7 +162,7 @@ if (livingentity != null && livingentity.m_6095_() == EntityType.f_20532_) { this.f_20888_ = (Player)livingentity; } else { -@@ -1121,7 +_,7 @@ +@@ -1125,7 +_,7 @@ if (this instanceof ServerPlayer) { CriteriaTriggers.f_10574_.m_35174_((ServerPlayer)this, p_21016_, f, p_21017_, flag); if (f1 > 0.0F && f1 < 3.4028235E37F) { @@ -171,7 +171,7 @@ } } -@@ -1159,7 +_,7 @@ +@@ -1163,7 +_,7 @@ if (itemstack != null) { if (this instanceof ServerPlayer) { ServerPlayer serverplayer = (ServerPlayer)this; @@ -180,7 +180,7 @@ CriteriaTriggers.f_10551_.m_74431_(serverplayer, itemstack); } -@@ -1229,6 +_,7 @@ +@@ -1233,6 +_,7 @@ } public void m_6667_(DamageSource p_21014_) { @@ -188,7 +188,7 @@ if (!this.m_146910_() && !this.f_20890_) { Entity entity = p_21014_.m_7639_(); LivingEntity livingentity = this.m_21232_(); -@@ -1264,10 +_,10 @@ +@@ -1268,10 +_,10 @@ if (!this.f_19853_.f_46443_) { boolean flag = false; if (p_21269_ instanceof WitherBoss) { @@ -201,7 +201,7 @@ this.f_19853_.m_7731_(blockpos, blockstate, 3); flag = true; } -@@ -1284,12 +_,9 @@ +@@ -1288,12 +_,9 @@ protected void m_6668_(DamageSource p_21192_) { Entity entity = p_21192_.m_7639_(); @@ -217,7 +217,7 @@ boolean flag = this.f_20889_ > 0; if (this.m_6125_() && this.f_19853_.m_46469_().m_46207_(GameRules.f_46135_)) { -@@ -1299,6 +_,10 @@ +@@ -1303,6 +_,10 @@ this.m_5907_(); this.m_21226_(); @@ -228,7 +228,7 @@ } protected void m_5907_() { -@@ -1306,7 +_,8 @@ +@@ -1310,7 +_,8 @@ protected void m_21226_() { if (this.f_19853_ instanceof ServerLevel && (this.m_6124_() || this.f_20889_ > 0 && this.m_6149_() && this.f_19853_.m_46469_().m_46207_(GameRules.f_46135_))) { @@ -238,7 +238,7 @@ } } -@@ -1322,7 +_,8 @@ +@@ -1326,7 +_,8 @@ ResourceLocation resourcelocation = this.m_5743_(); LootTable loottable = this.f_19853_.m_142572_().m_129898_().m_79217_(resourcelocation); LootContext.Builder lootcontext$builder = this.m_7771_(p_21022_, p_21021_); @@ -248,7 +248,7 @@ } protected LootContext.Builder m_7771_(boolean p_21105_, DamageSource p_21106_) { -@@ -1335,6 +_,11 @@ +@@ -1339,6 +_,11 @@ } public void m_147240_(double p_147241_, double p_147242_, double p_147243_) { @@ -260,11 +260,11 @@ p_147241_ *= 1.0D - this.m_21133_(Attributes.f_22278_); if (!(p_147241_ <= 0.0D)) { this.f_19812_ = true; -@@ -1388,15 +_,9 @@ +@@ -1392,15 +_,9 @@ } else { BlockPos blockpos = this.m_142538_(); BlockState blockstate = this.m_146900_(); -- if (blockstate.m_60620_(BlockTags.f_13082_)) { +- if (blockstate.m_204336_(BlockTags.f_13082_)) { - this.f_20957_ = Optional.of(blockpos); - return true; - } else if (blockstate.m_60734_() instanceof TrapDoorBlock && this.m_21176_(blockpos, blockstate)) { @@ -279,7 +279,7 @@ } } -@@ -1416,6 +_,11 @@ +@@ -1420,6 +_,11 @@ } public boolean m_142535_(float p_147187_, float p_147188_, DamageSource p_147189_) { @@ -291,7 +291,7 @@ boolean flag = super.m_142535_(p_147187_, p_147188_, p_147189_); int i = this.m_5639_(p_147187_, p_147188_); if (i > 0) { -@@ -1439,9 +_,10 @@ +@@ -1443,9 +_,10 @@ int i = Mth.m_14107_(this.m_20185_()); int j = Mth.m_14107_(this.m_20186_() - (double)0.2F); int k = Mth.m_14107_(this.m_20189_()); @@ -304,7 +304,7 @@ this.m_5496_(soundtype.m_56779_(), soundtype.m_56773_() * 0.5F, soundtype.m_56774_() * 0.75F); } -@@ -1489,9 +_,9 @@ +@@ -1493,9 +_,9 @@ float f2 = f1 - p_21194_; if (f2 > 0.0F && f2 < 3.4028235E37F) { if (this instanceof ServerPlayer) { @@ -316,7 +316,7 @@ } } } -@@ -1511,19 +_,22 @@ +@@ -1515,19 +_,22 @@ protected void m_6475_(DamageSource p_21240_, float p_21241_) { if (!this.m_6673_(p_21240_)) { @@ -341,7 +341,7 @@ this.m_7911_(this.m_6103_() - f2); this.m_146852_(GameEvent.f_157808_, p_21240_.m_7639_()); } -@@ -1578,6 +_,8 @@ +@@ -1582,6 +_,8 @@ } public void m_21011_(InteractionHand p_21012_, boolean p_21013_) { @@ -350,7 +350,7 @@ if (!this.f_20911_ || this.f_20913_ >= this.m_21304_() / 2 || this.f_20913_ < 0) { this.f_20913_ = -1; this.f_20911_ = true; -@@ -1937,14 +_,15 @@ +@@ -1941,14 +_,15 @@ } this.f_19812_ = true; @@ -362,13 +362,13 @@ + this.m_20256_(this.m_20184_().m_82520_(0.0D, (double)-0.04F * this.m_21051_(net.minecraftforge.common.ForgeMod.SWIM_SPEED.get()).m_22135_(), 0.0D)); } - protected void m_6197_(net.minecraft.tags.Tag p_21158_) { + protected void m_203347_(TagKey p_204043_) { - this.m_20256_(this.m_20184_().m_82520_(0.0D, (double)0.04F, 0.0D)); + this.m_20256_(this.m_20184_().m_82520_(0.0D, (double)0.04F * this.m_21051_(net.minecraftforge.common.ForgeMod.SWIM_SPEED.get()).m_22135_(), 0.0D)); } protected float m_6108_() { -@@ -1958,11 +_,15 @@ +@@ -1962,11 +_,15 @@ public void m_7023_(Vec3 p_21280_) { if (this.m_6142_() || this.m_6109_()) { double d0 = 0.08D; @@ -384,25 +384,25 @@ + d0 = gravity.m_22135_(); FluidState fluidstate = this.f_19853_.m_6425_(this.m_142538_()); - if (this.m_20069_() && this.m_6129_() && !this.m_7479_(fluidstate.m_76152_())) { -@@ -1987,6 +_,7 @@ - f5 = 0.96F; + if (this.m_20069_() && this.m_6129_() && !this.m_203441_(fluidstate)) { +@@ -1991,6 +_,7 @@ + f4 = 0.96F; } + f6 *= (float)this.m_21051_(net.minecraftforge.common.ForgeMod.SWIM_SPEED.get()).m_22135_(); - this.m_19920_(f6, p_21280_); + this.m_19920_(f5, p_21280_); this.m_6478_(MoverType.SELF, this.m_20184_()); Vec3 vec36 = this.m_20184_(); -@@ -2065,7 +_,7 @@ +@@ -2069,7 +_,7 @@ } } else { BlockPos blockpos = this.m_20099_(); -- float f3 = this.f_19853_.m_8055_(blockpos).m_60734_().m_49958_(); -+ float f3 = this.f_19853_.m_8055_(this.m_20099_()).getFriction(f_19853_, this.m_20099_(), this); - float f4 = this.f_19861_ ? f3 * 0.91F : 0.91F; - Vec3 vec35 = this.m_21074_(p_21280_, f3); +- float f2 = this.f_19853_.m_8055_(blockpos).m_60734_().m_49958_(); ++ float f2 = this.f_19853_.m_8055_(this.m_20099_()).getFriction(f_19853_, this.m_20099_(), this); + float f3 = this.f_19861_ ? f2 * 0.91F : 0.91F; + Vec3 vec35 = this.m_21074_(p_21280_, f2); double d2 = vec35.f_82480_; -@@ -2141,7 +_,7 @@ +@@ -2145,7 +_,7 @@ double d0 = Mth.m_14008_(p_21298_.f_82479_, (double)-0.15F, (double)0.15F); double d1 = Mth.m_14008_(p_21298_.f_82481_, (double)-0.15F, (double)0.15F); double d2 = Math.max(p_21298_.f_82480_, (double)-0.15F); @@ -411,7 +411,7 @@ d2 = 0.0D; } -@@ -2169,6 +_,7 @@ +@@ -2173,6 +_,7 @@ } public void m_8119_() { @@ -419,7 +419,7 @@ super.m_8119_(); this.m_21329_(); this.m_21333_(); -@@ -2317,6 +_,7 @@ +@@ -2321,6 +_,7 @@ ItemStack itemstack1 = this.m_6844_(equipmentslot); if (!ItemStack.m_41728_(itemstack1, itemstack)) { @@ -427,7 +427,7 @@ if (map == null) { map = Maps.newEnumMap(EquipmentSlot.class); } -@@ -2540,6 +_,8 @@ +@@ -2544,6 +_,8 @@ boolean flag = this.m_20291_(7); if (flag && !this.f_19861_ && !this.m_20159_() && !this.m_21023_(MobEffects.f_19620_)) { ItemStack itemstack = this.m_6844_(EquipmentSlot.CHEST); @@ -436,7 +436,7 @@ if (itemstack.m_150930_(Items.f_42741_) && ElytraItem.m_41140_(itemstack)) { flag = true; int i = this.f_20937_ + 1; -@@ -2783,8 +_,16 @@ +@@ -2775,8 +_,16 @@ private void m_21329_() { if (this.m_6117_()) { @@ -455,7 +455,7 @@ this.m_142106_(this.f_20935_); } else { this.m_5810_(); -@@ -2837,8 +_,10 @@ +@@ -2829,8 +_,10 @@ public void m_6672_(InteractionHand p_21159_) { ItemStack itemstack = this.m_21120_(p_21159_); if (!itemstack.m_41619_() && !this.m_6117_()) { @@ -467,7 +467,7 @@ if (!this.f_19853_.f_46443_) { this.m_21155_(1, true); this.m_21155_(2, p_21159_ == InteractionHand.OFF_HAND); -@@ -2898,6 +_,9 @@ +@@ -2890,6 +_,9 @@ vec31 = vec31.m_82496_(-this.m_146909_() * ((float)Math.PI / 180F)); vec31 = vec31.m_82524_(-this.m_146908_() * ((float)Math.PI / 180F)); vec31 = vec31.m_82520_(this.m_20185_(), this.m_20188_(), this.m_20189_()); @@ -477,7 +477,7 @@ this.f_19853_.m_7106_(new ItemParticleOption(ParticleTypes.f_123752_, p_21061_), vec31.f_82479_, vec31.f_82480_, vec31.f_82481_, vec3.f_82479_, vec3.f_82480_ + 0.05D, vec3.f_82481_); } -@@ -2911,7 +_,8 @@ +@@ -2903,7 +_,8 @@ } else { if (!this.f_20935_.m_41619_() && this.m_6117_()) { this.m_21137_(this.f_20935_, 16); @@ -487,7 +487,7 @@ if (itemstack != this.f_20935_) { this.m_21008_(interactionhand, itemstack); } -@@ -2937,7 +_,11 @@ +@@ -2929,7 +_,11 @@ public void m_21253_() { if (!this.f_20935_.m_41619_()) { @@ -499,7 +499,7 @@ if (this.f_20935_.m_41781_()) { this.m_21329_(); } -@@ -3084,8 +_,8 @@ +@@ -3076,8 +_,8 @@ } BlockState blockstate = this.f_19853_.m_8055_(p_21141_); @@ -510,7 +510,7 @@ } this.m_20124_(Pose.SLEEPING); -@@ -3101,15 +_,15 @@ +@@ -3093,15 +_,15 @@ private boolean m_21334_() { return this.m_21257_().map((p_147236_) -> { @@ -529,7 +529,7 @@ Vec3 vec31 = BedBlock.m_49458_(this.m_6095_(), this.f_19853_, p_147228_, this.m_146908_()).orElseGet(() -> { BlockPos blockpos = p_147228_.m_7494_(); return new Vec3((double)blockpos.m_123341_() + 0.5D, (double)blockpos.m_123342_() + 0.1D, (double)blockpos.m_123343_() + 0.5D); -@@ -3131,7 +_,9 @@ +@@ -3123,7 +_,9 @@ @Nullable public Direction m_21259_() { BlockPos blockpos = this.m_21257_().orElse((BlockPos)null); @@ -540,7 +540,7 @@ } public boolean m_5830_() { -@@ -3204,6 +_,64 @@ +@@ -3196,6 +_,64 @@ this.m_21166_(p_21191_ == InteractionHand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND); } @@ -605,7 +605,7 @@ public AABB m_6921_() { if (this.m_6844_(EquipmentSlot.HEAD).m_150930_(Items.f_42683_)) { float f = 0.5F; -@@ -3214,6 +_,8 @@ +@@ -3206,6 +_,8 @@ } public static EquipmentSlot m_147233_(ItemStack p_147234_) { @@ -614,7 +614,7 @@ Item item = p_147234_.m_41720_(); if (!p_147234_.m_150930_(Items.f_42047_) && (!(item instanceof BlockItem) || !(((BlockItem)item).m_40614_() instanceof AbstractSkullBlock))) { if (item instanceof ArmorItem) { -@@ -3221,7 +_,7 @@ +@@ -3213,7 +_,7 @@ } else if (p_147234_.m_150930_(Items.f_42741_)) { return EquipmentSlot.CHEST; } else { diff --git a/patches/minecraft/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java.patch index 7c04f291de..c26f6f14bf 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java.patch @@ -4,9 +4,9 @@ super.m_7638_(); } else { if (this.f_26578_ != null) { -- if (!this.f_26578_.m_123306_(this.f_26494_.m_20182_(), (double)this.f_26494_.m_20205_()) && (!(this.f_26494_.m_20186_() > (double)this.f_26578_.m_123342_()) || !(new BlockPos((double)this.f_26578_.m_123341_(), this.f_26494_.m_20186_(), (double)this.f_26578_.m_123343_())).m_123306_(this.f_26494_.m_20182_(), (double)this.f_26494_.m_20205_()))) { +- if (!this.f_26578_.m_203195_(this.f_26494_.m_20182_(), (double)this.f_26494_.m_20205_()) && (!(this.f_26494_.m_20186_() > (double)this.f_26578_.m_123342_()) || !(new BlockPos((double)this.f_26578_.m_123341_(), this.f_26494_.m_20186_(), (double)this.f_26578_.m_123343_())).m_203195_(this.f_26494_.m_20182_(), (double)this.f_26494_.m_20205_()))) { + // FORGE: Fix MC-94054 -+ if (!this.f_26578_.m_123306_(this.f_26494_.m_20182_(), Math.max((double)this.f_26494_.m_20205_(), 1.0D)) && (!(this.f_26494_.m_20186_() > (double)this.f_26578_.m_123342_()) || !(new BlockPos((double)this.f_26578_.m_123341_(), this.f_26494_.m_20186_(), (double)this.f_26578_.m_123343_())).m_123306_(this.f_26494_.m_20182_(), Math.max((double)this.f_26494_.m_20205_(), 1.0D)))) { ++ if (!this.f_26578_.m_203195_(this.f_26494_.m_20182_(), Math.max((double)this.f_26494_.m_20205_(), 1.0D)) && (!(this.f_26494_.m_20186_() > (double)this.f_26578_.m_123342_()) || !(new BlockPos((double)this.f_26578_.m_123341_(), this.f_26494_.m_20186_(), (double)this.f_26578_.m_123343_())).m_203195_(this.f_26494_.m_20182_(), Math.max((double)this.f_26494_.m_20205_(), 1.0D)))) { this.f_26494_.m_21566_().m_6849_((double)this.f_26578_.m_123341_(), (double)this.f_26578_.m_123342_(), (double)this.f_26578_.m_123343_(), this.f_26497_); } else { this.f_26578_ = null; diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Cat.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Cat.java.patch index bf6583b841..097ec27358 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Cat.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Cat.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Cat.java +++ b/net/minecraft/world/entity/animal/Cat.java -@@ -416,7 +_,7 @@ +@@ -425,7 +_,7 @@ } } else if (this.m_6898_(itemstack)) { this.m_142075_(p_28153_, p_28154_, itemstack); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Fox.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Fox.java.patch index 079b4f4982..2f94f28ad1 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Fox.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Fox.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Fox.java +++ b/net/minecraft/world/entity/animal/Fox.java -@@ -646,13 +_,16 @@ +@@ -649,13 +_,16 @@ } protected void m_6668_(DamageSource p_28536_) { @@ -18,7 +18,7 @@ } public static boolean m_28471_(Fox p_28472_, LivingEntity p_28473_) { -@@ -802,6 +_,17 @@ +@@ -805,6 +_,17 @@ protected void m_8026_() { ServerLevel serverlevel = (ServerLevel)this.f_25114_; Fox fox = (Fox)this.f_25113_.m_142606_(serverlevel, this.f_25115_); @@ -36,7 +36,7 @@ if (fox != null) { ServerPlayer serverplayer = this.f_25113_.m_27592_(); ServerPlayer serverplayer1 = this.f_25115_.m_27592_(); -@@ -873,7 +_,7 @@ +@@ -876,7 +_,7 @@ } protected void m_28686_() { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Rabbit.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Rabbit.java.patch index c2f1dc15b8..591314a3c1 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Rabbit.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Rabbit.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Rabbit.java +++ b/net/minecraft/world/entity/animal/Rabbit.java -@@ -507,7 +_,7 @@ +@@ -510,7 +_,7 @@ public boolean m_8036_() { if (this.f_25600_ <= 0) { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Wolf.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Wolf.java.patch index bbf3145e35..6c639d5883 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Wolf.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Wolf.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Wolf.java +++ b/net/minecraft/world/entity/animal/Wolf.java -@@ -353,7 +_,7 @@ +@@ -361,7 +_,7 @@ itemstack.m_41774_(1); } diff --git a/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch b/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch index 8353cf3faa..792699ea1e 100644 --- a/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch @@ -16,8 +16,8 @@ BlockPos blockpos = new BlockPos(k1, l1, i2); BlockState blockstate = this.f_19853_.m_8055_(blockpos); if (!blockstate.m_60795_() && blockstate.m_60767_() != Material.f_76309_) { -- if (this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_) && !blockstate.m_60620_(BlockTags.f_13069_)) { -+ if (net.minecraftforge.common.ForgeHooks.canEntityDestroy(this.f_19853_, blockpos, this) && !BlockTags.f_13069_.m_8110_(blockstate.m_60734_())) { +- if (this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_) && !blockstate.m_204336_(BlockTags.f_13069_)) { ++ if (net.minecraftforge.common.ForgeHooks.canEntityDestroy(this.f_19853_, blockpos, this) && !blockstate.m_204336_(BlockTags.f_13069_)) { flag1 = this.f_19853_.m_7471_(blockpos, false) || flag1; } else { flag = true; diff --git a/patches/minecraft/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch b/patches/minecraft/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch index f3d5a0a698..ad247522a9 100644 --- a/patches/minecraft/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch @@ -33,5 +33,5 @@ + @Deprecated //Forge: DO NOT USE use BlockState.canEntityDestroy public static boolean m_31491_(BlockState p_31492_) { - return !p_31492_.m_60795_() && !p_31492_.m_60620_(BlockTags.f_13070_); + return !p_31492_.m_60795_() && !p_31492_.m_204336_(BlockTags.f_13070_); } diff --git a/patches/minecraft/net/minecraft/world/entity/item/ItemEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/item/ItemEntity.java.patch index a6a9c124cf..328ea52edd 100644 --- a/patches/minecraft/net/minecraft/world/entity/item/ItemEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/item/ItemEntity.java.patch @@ -69,7 +69,7 @@ if (this.m_6673_(p_32013_)) { return false; } else if (!this.m_32055_().m_41619_() && this.m_32055_().m_150930_(Items.f_42686_) && p_32013_.m_19372_()) { -@@ -248,7 +_,7 @@ +@@ -250,7 +_,7 @@ this.f_31987_ = (int)((float)this.f_31987_ - p_32014_); this.m_146852_(GameEvent.f_157808_, p_32013_.m_7639_()); if (this.f_31987_ <= 0) { @@ -78,7 +78,7 @@ this.m_146870_(); } -@@ -260,6 +_,7 @@ +@@ -262,6 +_,7 @@ p_32050_.m_128376_("Health", (short)this.f_31987_); p_32050_.m_128376_("Age", (short)this.f_31985_); p_32050_.m_128376_("PickupDelay", (short)this.f_31986_); @@ -86,7 +86,7 @@ if (this.m_32057_() != null) { p_32050_.m_128362_("Thrower", this.m_32057_()); } -@@ -280,6 +_,7 @@ +@@ -282,6 +_,7 @@ if (p_32034_.m_128441_("PickupDelay")) { this.f_31986_ = p_32034_.m_128448_("PickupDelay"); } @@ -94,7 +94,7 @@ if (p_32034_.m_128403_("Owner")) { this.f_31982_ = p_32034_.m_128342_("Owner"); -@@ -299,10 +_,18 @@ +@@ -301,10 +_,18 @@ public void m_6123_(Player p_32040_) { if (!this.f_19853_.f_46443_) { @@ -114,7 +114,7 @@ p_32040_.m_7938_(this, i); if (itemstack.m_41619_()) { this.m_146870_(); -@@ -326,8 +_,8 @@ +@@ -328,8 +_,8 @@ } @Nullable @@ -125,7 +125,7 @@ if (!this.f_19853_.f_46443_ && entity instanceof ItemEntity) { ((ItemEntity)entity).m_32069_(); } -@@ -403,7 +_,7 @@ +@@ -405,7 +_,7 @@ public void m_32065_() { this.m_32062_(); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/EnderMan.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/EnderMan.java.patch index df1f87c774..b6d10bf364 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/EnderMan.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/EnderMan.java.patch @@ -27,7 +27,7 @@ Vec3 vec3 = p_32535_.m_20252_(1.0F).m_82541_(); @@ -273,7 +_,9 @@ boolean flag = blockstate.m_60767_().m_76334_(); - boolean flag1 = blockstate.m_60819_().m_76153_(FluidTags.f_13131_); + boolean flag1 = blockstate.m_60819_().m_205070_(FluidTags.f_13131_); if (flag && !flag1) { - boolean flag2 = this.m_20984_(p_32544_, p_32545_, p_32546_, true); + net.minecraftforge.event.entity.EntityTeleportEvent.EnderEntity event = net.minecraftforge.event.ForgeEventFactory.onEnderTeleport(this, p_32544_, p_32545_, p_32546_); @@ -59,7 +59,7 @@ private boolean m_32558_(Level p_32559_, BlockPos p_32560_, BlockState p_32561_, BlockState p_32562_, BlockState p_32563_, BlockPos p_32564_) { - return p_32562_.m_60795_() && !p_32563_.m_60795_() && !p_32563_.m_60713_(Blocks.f_50752_) && p_32563_.m_60838_(p_32559_, p_32564_) && p_32561_.m_60710_(p_32559_, p_32560_) && p_32559_.m_45933_(this.f_32554_, AABB.m_82333_(Vec3.m_82528_(p_32560_))).isEmpty(); -+ return p_32562_.m_60795_() && !p_32563_.m_60795_() && !p_32563_.m_60713_(Blocks.f_50752_) && !p_32563_.m_60620_(net.minecraftforge.common.Tags.Blocks.ENDERMAN_PLACE_ON_BLACKLIST) && p_32563_.m_60838_(p_32559_, p_32564_) && p_32561_.m_60710_(p_32559_, p_32560_) && p_32559_.m_45933_(this.f_32554_, AABB.m_82333_(Vec3.m_82528_(p_32560_))).isEmpty(); ++ return p_32562_.m_60795_() && !p_32563_.m_60795_() && !p_32563_.m_60713_(Blocks.f_50752_) && !p_32563_.m_204336_(net.minecraftforge.common.Tags.Blocks.ENDERMAN_PLACE_ON_BLACKLIST) && p_32563_.m_60838_(p_32559_, p_32564_) && p_32561_.m_60710_(p_32559_, p_32560_) && p_32559_.m_45933_(this.f_32554_, AABB.m_82333_(Vec3.m_82528_(p_32560_))).isEmpty(); } } diff --git a/patches/minecraft/net/minecraft/world/entity/monster/MagmaCube.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/MagmaCube.java.patch index 841fa75ce1..9bb81b916b 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/MagmaCube.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/MagmaCube.java.patch @@ -7,4 +7,4 @@ + net.minecraftforge.common.ForgeHooks.onLivingJump(this); } - protected void m_6197_(Tag p_32988_) { + protected void m_203347_(TagKey p_204065_) { diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Silverfish.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Silverfish.java.patch index 8e64cf7ab8..4a75bfc894 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Silverfish.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Silverfish.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Silverfish.java +++ b/net/minecraft/world/entity/monster/Silverfish.java -@@ -138,7 +_,7 @@ +@@ -140,7 +_,7 @@ return false; } else { Random random = this.f_25725_.m_21187_(); @@ -9,7 +9,7 @@ this.f_33555_ = Direction.m_122404_(random); BlockPos blockpos = (new BlockPos(this.f_25725_.m_20185_(), this.f_25725_.m_20186_() + 0.5D, this.f_25725_.m_20189_())).m_142300_(this.f_33555_); BlockState blockstate = this.f_25725_.f_19853_.m_8055_(blockpos); -@@ -207,7 +_,7 @@ +@@ -209,7 +_,7 @@ BlockState blockstate = level.m_8055_(blockpos1); Block block = blockstate.m_60734_(); if (block instanceof InfestedBlock) { diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Slime.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Slime.java.patch index b7666e8aa4..16a5008b9f 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Slime.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Slime.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Slime.java +++ b/net/minecraft/world/entity/monster/Slime.java -@@ -125,6 +_,7 @@ +@@ -123,6 +_,7 @@ if (this.f_19861_ && !this.f_33583_) { int i = this.m_33632_(); @@ -8,7 +8,7 @@ for(int j = 0; j < i * 8; ++j) { float f = this.f_19796_.nextFloat() * ((float)Math.PI * 2F); float f1 = this.f_19796_.nextFloat() * 0.5F + 0.5F; -@@ -321,6 +_,12 @@ +@@ -319,6 +_,12 @@ public EntityDimensions m_6972_(Pose p_33597_) { return super.m_6972_(p_33597_).m_20388_(0.255F * (float)this.m_33632_()); } diff --git a/patches/minecraft/net/minecraft/world/entity/monster/ZombieVillager.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/ZombieVillager.java.patch index 100504f861..fba7462190 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/ZombieVillager.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/ZombieVillager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/ZombieVillager.java +++ b/net/minecraft/world/entity/monster/ZombieVillager.java -@@ -122,7 +_,7 @@ +@@ -127,7 +_,7 @@ if (!this.f_19853_.f_46443_ && this.m_6084_() && this.m_34408_()) { int i = this.m_34410_(); this.f_34365_ -= i; @@ -9,7 +9,7 @@ this.m_34398_((ServerLevel)this.f_19853_); } } -@@ -224,7 +_,7 @@ +@@ -229,7 +_,7 @@ if (!this.m_20067_()) { p_34399_.m_5898_((Player)null, 1027, this.m_142538_(), 0); } diff --git a/patches/minecraft/net/minecraft/world/entity/npc/CatSpawner.java.patch b/patches/minecraft/net/minecraft/world/entity/npc/CatSpawner.java.patch index 7f5072f5b3..e9c4bbf4b8 100644 --- a/patches/minecraft/net/minecraft/world/entity/npc/CatSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/npc/CatSpawner.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/npc/CatSpawner.java +++ b/net/minecraft/world/entity/npc/CatSpawner.java -@@ -84,8 +_,9 @@ +@@ -90,8 +_,9 @@ if (cat == null) { return 0; } else { diff --git a/patches/minecraft/net/minecraft/world/entity/npc/Villager.java.patch b/patches/minecraft/net/minecraft/world/entity/npc/Villager.java.patch index 1d01d54e54..72ea9082f5 100644 --- a/patches/minecraft/net/minecraft/world/entity/npc/Villager.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/npc/Villager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/npc/Villager.java +++ b/net/minecraft/world/entity/npc/Villager.java -@@ -251,7 +_,7 @@ +@@ -254,7 +_,7 @@ public InteractionResult m_6071_(Player p_35472_, InteractionHand p_35473_) { ItemStack itemstack = p_35472_.m_21120_(p_35473_); @@ -9,7 +9,7 @@ if (this.m_6162_()) { this.m_35518_(); return InteractionResult.m_19078_(this.f_19853_.f_46443_); -@@ -655,7 +_,8 @@ +@@ -658,7 +_,8 @@ } protected Component m_5677_() { @@ -19,16 +19,16 @@ } public void m_7822_(byte p_35391_) { -@@ -707,7 +_,7 @@ +@@ -710,7 +_,7 @@ } public void m_8038_(ServerLevel p_35409_, LightningBolt p_35410_) { - if (p_35409_.m_46791_() != Difficulty.PEACEFUL) { + if (p_35409_.m_46791_() != Difficulty.PEACEFUL && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.f_20495_, (timer) -> {})) { - f_19849_.info("Villager {} was struck by lightning {}.", this, p_35410_); + f_201976_.info("Villager {} was struck by lightning {}.", this, p_35410_); Witch witch = EntityType.f_20495_.m_20615_(p_35409_); witch.m_7678_(this.m_20185_(), this.m_20186_(), this.m_20189_(), this.m_146908_(), this.m_146909_()); -@@ -719,6 +_,7 @@ +@@ -722,6 +_,7 @@ } witch.m_21530_(); diff --git a/patches/minecraft/net/minecraft/world/entity/player/Inventory.java.patch b/patches/minecraft/net/minecraft/world/entity/player/Inventory.java.patch index 35a90b411b..49386b80e3 100644 --- a/patches/minecraft/net/minecraft/world/entity/player/Inventory.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/player/Inventory.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/player/Inventory.java +++ b/net/minecraft/world/entity/player/Inventory.java -@@ -184,7 +_,8 @@ +@@ -178,7 +_,8 @@ int i = p_36049_.m_41613_(); ItemStack itemstack = this.m_8020_(p_36048_); if (itemstack.m_41619_()) { @@ -10,7 +10,7 @@ if (p_36049_.m_41782_()) { itemstack.m_41751_(p_36049_.m_41783_().m_6426_()); } -@@ -235,7 +_,7 @@ +@@ -229,7 +_,7 @@ } } } @@ -19,7 +19,7 @@ } public boolean m_36054_(ItemStack p_36055_) { -@@ -284,6 +_,8 @@ +@@ -278,6 +_,8 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.m_127521_(throwable, "Adding item to inventory"); CrashReportCategory crashreportcategory = crashreport.m_127514_("Item being added"); diff --git a/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch b/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch index 6f92962750..41b4daecb6 100644 --- a/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java -@@ -111,6 +_,7 @@ +@@ -112,6 +_,7 @@ import net.minecraft.world.scores.Team; public abstract class Player extends LivingEntity { @@ -8,7 +8,7 @@ public static final String f_150081_ = "OfflinePlayer:"; public static final int f_150082_ = 16; public static final int f_150083_ = 20; -@@ -161,6 +_,9 @@ +@@ -162,6 +_,9 @@ private final ItemCooldowns f_36087_ = this.m_7478_(); @Nullable public FishingHook f_36083_; @@ -18,7 +18,7 @@ public Player(Level p_36114_, BlockPos p_36115_, float p_36116_, GameProfile p_36117_) { super(EntityType.f_20532_, p_36114_); -@@ -186,7 +_,7 @@ +@@ -187,7 +_,7 @@ } public static AttributeSupplier.Builder m_36340_() { @@ -27,7 +27,7 @@ } protected void m_8097_() { -@@ -200,6 +_,7 @@ +@@ -201,6 +_,7 @@ } public void m_8119_() { @@ -35,7 +35,7 @@ this.f_19794_ = this.m_5833_(); if (this.m_5833_()) { this.f_19861_ = false; -@@ -215,7 +_,7 @@ +@@ -216,7 +_,7 @@ this.f_36110_ = 100; } @@ -44,7 +44,7 @@ this.m_6145_(false, true); } } else if (this.f_36110_ > 0) { -@@ -270,6 +_,7 @@ +@@ -271,6 +_,7 @@ this.m_36372_(); this.f_36087_.m_41518_(); this.m_7594_(); @@ -52,7 +52,7 @@ } public boolean m_36341_() { -@@ -345,6 +_,10 @@ +@@ -346,6 +_,10 @@ } protected void m_7594_() { @@ -63,7 +63,7 @@ if (this.m_20175_(Pose.SWIMMING)) { Pose pose; if (this.m_21255_()) { -@@ -559,6 +_,7 @@ +@@ -569,6 +_,7 @@ } public void m_6667_(DamageSource p_36152_) { @@ -71,7 +71,7 @@ super.m_6667_(p_36152_); this.m_20090_(); if (!this.m_5833_()) { -@@ -615,7 +_,7 @@ +@@ -625,7 +_,7 @@ @Nullable public ItemEntity m_36176_(ItemStack p_36177_, boolean p_36178_) { @@ -80,7 +80,7 @@ } @Nullable -@@ -653,7 +_,12 @@ +@@ -663,7 +_,12 @@ } } @@ -93,7 +93,7 @@ float f = this.f_36093_.m_36020_(p_36282_); if (f > 1.0F) { int i = EnchantmentHelper.m_44926_(this); -@@ -695,11 +_,12 @@ +@@ -705,11 +_,12 @@ f /= 5.0F; } @@ -107,7 +107,7 @@ } public void m_7378_(CompoundTag p_36215_) { -@@ -776,6 +_,7 @@ +@@ -786,6 +_,7 @@ } public boolean m_6469_(DamageSource p_36154_, float p_36155_) { @@ -115,7 +115,7 @@ if (this.m_6673_(p_36154_)) { return false; } else if (this.f_36077_.f_35934_ && !p_36154_.m_19378_()) { -@@ -807,7 +_,7 @@ +@@ -820,7 +_,7 @@ protected void m_6728_(LivingEntity p_36295_) { super.m_6728_(p_36295_); @@ -124,7 +124,7 @@ this.m_36384_(true); } -@@ -836,7 +_,7 @@ +@@ -849,7 +_,7 @@ } protected void m_7909_(float p_36383_) { @@ -133,7 +133,7 @@ if (!this.f_19853_.f_46443_) { this.m_36246_(Stats.f_12982_.m_12902_(this.f_20935_.m_41720_())); } -@@ -846,6 +_,7 @@ +@@ -859,6 +_,7 @@ InteractionHand interactionhand = this.m_7655_(); this.f_20935_.m_41622_(i, this, (p_36149_) -> { p_36149_.m_21190_(interactionhand); @@ -141,7 +141,7 @@ }); if (this.f_20935_.m_41619_()) { if (interactionhand == InteractionHand.MAIN_HAND) { -@@ -864,10 +_,13 @@ +@@ -877,10 +_,13 @@ protected void m_6475_(DamageSource p_36312_, float p_36313_) { if (!this.m_6673_(p_36312_)) { @@ -155,7 +155,7 @@ float f = p_36313_ - f2; if (f > 0.0F && f < 3.4028235E37F) { this.m_36222_(Stats.f_12933_, Math.round(f * 10.0F)); -@@ -876,8 +_,8 @@ +@@ -889,8 +_,8 @@ if (f2 != 0.0F) { this.m_36399_(p_36312_.m_19377_()); float f1 = this.m_21223_(); @@ -165,7 +165,7 @@ if (f2 < 3.4028235E37F) { this.m_36222_(Stats.f_12931_, Math.round(f2 * 10.0F)); } -@@ -926,6 +_,8 @@ +@@ -939,6 +_,8 @@ return InteractionResult.PASS; } else { @@ -174,7 +174,7 @@ ItemStack itemstack = this.m_21120_(p_36159_); ItemStack itemstack1 = itemstack.m_41777_(); InteractionResult interactionresult = p_36158_.m_6096_(this, p_36159_); -@@ -934,6 +_,9 @@ +@@ -947,6 +_,9 @@ itemstack.m_41764_(itemstack1.m_41613_()); } @@ -184,7 +184,7 @@ return interactionresult; } else { if (!itemstack.m_41619_() && p_36158_ instanceof LivingEntity) { -@@ -944,6 +_,7 @@ +@@ -957,6 +_,7 @@ InteractionResult interactionresult1 = itemstack.m_41647_(this, (LivingEntity)p_36158_, p_36159_); if (interactionresult1.m_19077_()) { if (itemstack.m_41619_() && !this.f_36077_.f_35937_) { @@ -192,7 +192,7 @@ this.m_21008_(p_36159_, ItemStack.f_41583_); } -@@ -1028,6 +_,7 @@ +@@ -1041,6 +_,7 @@ } public void m_5706_(Entity p_36347_) { @@ -200,7 +200,7 @@ if (p_36347_.m_6097_()) { if (!p_36347_.m_7313_(this)) { float f = (float)this.m_21133_(Attributes.f_22281_); -@@ -1045,7 +_,7 @@ +@@ -1058,7 +_,7 @@ if (f > 0.0F || f1 > 0.0F) { boolean flag = f2 > 0.9F; boolean flag1 = false; @@ -209,7 +209,7 @@ i += EnchantmentHelper.m_44894_(this); if (this.m_20142_() && flag) { this.f_19853_.m_6263_((Player)null, this.m_20185_(), this.m_20186_(), this.m_20189_(), SoundEvents.f_12314_, this.m_5720_(), 1.0F, 1.0F); -@@ -1055,8 +_,10 @@ +@@ -1068,8 +_,10 @@ boolean flag2 = flag && this.f_19789_ > 0.0F && !this.f_19861_ && !this.m_6147_() && !this.m_20069_() && !this.m_21023_(MobEffects.f_19610_) && !this.m_20159_() && p_36347_ instanceof LivingEntity; flag2 = flag2 && !this.m_20142_(); @@ -221,7 +221,7 @@ } f += f1; -@@ -1064,9 +_,7 @@ +@@ -1077,9 +_,7 @@ double d0 = (double)(this.f_19787_ - this.f_19867_); if (flag && !flag2 && !flag1 && this.f_19861_ && d0 < (double)this.m_6113_()) { ItemStack itemstack = this.m_21120_(InteractionHand.MAIN_HAND); @@ -232,7 +232,7 @@ } float f4 = 0.0F; -@@ -1097,7 +_,7 @@ +@@ -1110,7 +_,7 @@ if (flag3) { float f3 = 1.0F + EnchantmentHelper.m_44821_(this) * f; @@ -241,7 +241,7 @@ if (livingentity != this && livingentity != p_36347_ && !this.m_7307_(livingentity) && (!(livingentity instanceof ArmorStand) || !((ArmorStand)livingentity).m_31677_()) && this.m_20280_(livingentity) < 9.0D) { livingentity.m_147240_((double)0.4F, (double)Mth.m_14031_(this.m_146908_() * ((float)Math.PI / 180F)), (double)(-Mth.m_14089_(this.m_146908_() * ((float)Math.PI / 180F)))); livingentity.m_6469_(DamageSource.m_19344_(this), f3); -@@ -1139,13 +_,15 @@ +@@ -1152,13 +_,15 @@ EnchantmentHelper.m_44896_(this, p_36347_); ItemStack itemstack1 = this.m_21205_(); Entity entity = p_36347_; @@ -259,7 +259,7 @@ this.m_21008_(InteractionHand.MAIN_HAND, ItemStack.f_41583_); } } -@@ -1187,7 +_,7 @@ +@@ -1200,7 +_,7 @@ } if (this.f_19796_.nextFloat() < f) { @@ -268,7 +268,7 @@ this.m_5810_(); this.f_19853_.m_7605_(this, (byte)30); } -@@ -1247,6 +_,7 @@ +@@ -1260,6 +_,7 @@ } public void m_6145_(boolean p_36226_, boolean p_36227_) { @@ -276,7 +276,7 @@ super.m_5796_(); if (this.f_19853_ instanceof ServerLevel && p_36227_) { ((ServerLevel)this.f_19853_).m_8878_(); -@@ -1272,7 +_,7 @@ +@@ -1285,7 +_,7 @@ } else if (block instanceof BedBlock && BedBlock.m_49488_(p_36131_)) { return BedBlock.m_49458_(EntityType.f_20532_, p_36131_, p_36132_, p_36133_); } else if (!p_36134_) { @@ -285,7 +285,7 @@ } else { boolean flag = block.m_5568_(); boolean flag1 = p_36131_.m_8055_(p_36132_.m_7494_()).m_60734_().m_5568_(); -@@ -1452,6 +_,7 @@ +@@ -1465,6 +_,7 @@ public boolean m_142535_(float p_150093_, float p_150094_, DamageSource p_150095_) { if (this.f_36077_.f_35936_) { @@ -293,7 +293,7 @@ return false; } else { if (p_150093_ >= 2.0F) { -@@ -1465,7 +_,7 @@ +@@ -1478,7 +_,7 @@ public boolean m_36319_() { if (!this.f_19861_ && !this.m_21255_() && !this.m_20069_() && !this.m_21023_(MobEffects.f_19620_)) { ItemStack itemstack = this.m_6844_(EquipmentSlot.CHEST); @@ -302,7 +302,7 @@ this.m_36320_(); return true; } -@@ -1506,6 +_,10 @@ +@@ -1519,6 +_,10 @@ } public void m_6756_(int p_36291_) { @@ -313,7 +313,7 @@ this.m_36401_(p_36291_); this.f_36080_ += (float)p_36291_ / (float)this.m_36323_(); this.f_36079_ = Mth.m_14045_(this.f_36079_ + p_36291_, 0, Integer.MAX_VALUE); -@@ -1534,7 +_,7 @@ +@@ -1547,7 +_,7 @@ } public void m_7408_(ItemStack p_36172_, int p_36173_) { @@ -322,7 +322,7 @@ if (this.f_36078_ < 0) { this.f_36078_ = 0; this.f_36080_ = 0.0F; -@@ -1545,6 +_,10 @@ +@@ -1558,6 +_,10 @@ } public void m_6749_(int p_36276_) { @@ -333,7 +333,7 @@ this.f_36078_ += p_36276_; if (this.f_36078_ < 0) { this.f_36078_ = 0; -@@ -1732,7 +_,11 @@ +@@ -1745,7 +_,11 @@ } public Component m_5446_() { @@ -346,7 +346,7 @@ return this.m_36218_(mutablecomponent); } -@@ -1978,5 +_,63 @@ +@@ -1991,5 +_,63 @@ public Component m_36423_() { return this.f_36413_; } diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch index 4e693e9ffe..10fb4d333e 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -@@ -147,6 +_,13 @@ +@@ -151,6 +_,13 @@ } diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/FishingHook.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/FishingHook.java.patch index 805b050f35..e43d47a4d3 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/FishingHook.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/FishingHook.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/FishingHook.java +++ b/net/minecraft/world/entity/projectile/FishingHook.java -@@ -237,7 +_,7 @@ +@@ -240,7 +_,7 @@ private void m_37171_() { HitResult hitresult = ProjectileUtil.m_37294_(this, this::m_5603_); @@ -9,7 +9,7 @@ } protected boolean m_5603_(Entity p_37135_) { -@@ -292,7 +_,7 @@ +@@ -295,7 +_,7 @@ double d1 = (double)((float)Mth.m_14107_(this.m_20186_()) + 1.0F); double d2 = this.m_20189_() + (double)(f2 * (float)this.f_37091_ * 0.1F); BlockState blockstate = serverlevel.m_8055_(new BlockPos(d0, d1 - 1.0D, d2)); @@ -18,16 +18,16 @@ if (this.f_19796_.nextFloat() < 0.15F) { serverlevel.m_8767_(ParticleTypes.f_123795_, d0, d1 - (double)0.1F, d2, 1, (double)f1, 0.1D, (double)f2, 0.0D); } -@@ -328,7 +_,7 @@ +@@ -331,7 +_,7 @@ double d5 = (double)((float)Mth.m_14107_(this.m_20186_()) + 1.0F); - double d6 = this.m_20189_() + (double)(Mth.m_14089_(f6) * f7 * 0.1F); + double d6 = this.m_20189_() + (double)(Mth.m_14089_(f6) * f7) * 0.1D; BlockState blockstate1 = serverlevel.m_8055_(new BlockPos(d4, d5 - 1.0D, d6)); - if (blockstate1.m_60713_(Blocks.f_49990_)) { + if (serverlevel.m_8055_(new BlockPos(d4, d5 - 1.0D, d6)).m_60767_() == net.minecraft.world.level.material.Material.f_76305_) { serverlevel.m_8767_(ParticleTypes.f_123769_, d4, d5, d6, 2 + this.f_19796_.nextInt(2), (double)0.1F, 0.0D, (double)0.1F, 0.0D); } } -@@ -399,6 +_,7 @@ +@@ -402,6 +_,7 @@ Player player = this.m_37168_(); if (!this.f_19853_.f_46443_ && player != null && !this.m_37136_(player)) { int i = 0; @@ -35,7 +35,7 @@ if (this.f_37094_ != null) { this.m_150155_(this.f_37094_); CriteriaTriggers.f_10553_.m_40416_((ServerPlayer)player, p_37157_, this, Collections.emptyList()); -@@ -406,8 +_,15 @@ +@@ -409,8 +_,15 @@ i = this.f_37094_ instanceof ItemEntity ? 3 : 5; } else if (this.f_37089_ > 0) { LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerLevel)this.f_19853_)).m_78972_(LootContextParams.f_81460_, this.m_20182_()).m_78972_(LootContextParams.f_81463_, p_37157_).m_78972_(LootContextParams.f_81455_, this).m_78977_(this.f_19796_).m_78963_((float)this.f_37096_ + player.m_36336_()); @@ -51,7 +51,7 @@ CriteriaTriggers.f_10553_.m_40416_((ServerPlayer)player, p_37157_, this, list); for(ItemStack itemstack : list) { -@@ -432,7 +_,7 @@ +@@ -435,7 +_,7 @@ } this.m_146870_(); diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch index dfa84dac4f..c69b722d30 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch @@ -249,7 +249,7 @@ + if (!canUseRail()) return m_7097_(); + BlockPos pos = this.getCurrentRailPosition(); + BlockState state = this.f_19853_.m_8055_(pos); -+ if (!state.m_60620_(BlockTags.f_13034_)) return m_7097_(); ++ if (!state.m_204336_(BlockTags.f_13034_)) return m_7097_(); + + float railMaxSpeed = ((BaseRailBlock)state.m_60734_()).getRailMaxSpeed(state, this.f_19853_, pos, this); + return Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); diff --git a/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch index e61619fa6a..edc6d74c42 100644 --- a/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/net/minecraft/world/inventory/AbstractContainerMenu.java -@@ -204,9 +_,11 @@ +@@ -211,9 +_,11 @@ private void m_150407_(int p_150408_, ItemStack p_150409_, Supplier p_150410_) { ItemStack itemstack = this.f_38841_.get(p_150408_); if (!ItemStack.m_41728_(itemstack, p_150409_)) { @@ -12,7 +12,7 @@ for(ContainerListener containerlistener : this.f_38848_) { containerlistener.m_7934_(this, p_150408_, itemstack1); } -@@ -592,14 +_,15 @@ +@@ -603,14 +_,15 @@ ItemStack itemstack = slot.m_7993_(); if (!itemstack.m_41619_() && ItemStack.m_150942_(p_38904_, itemstack)) { int j = itemstack.m_41613_() + p_38904_.m_41613_(); @@ -32,7 +32,7 @@ slot.m_6654_(); flag = true; } -@@ -699,7 +_,7 @@ +@@ -710,7 +_,7 @@ p_38925_.m_41764_(1); break; case 2: diff --git a/patches/minecraft/net/minecraft/world/inventory/AnvilMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/AnvilMenu.java.patch index a30261c7ed..bc7c335bfe 100644 --- a/patches/minecraft/net/minecraft/world/inventory/AnvilMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/AnvilMenu.java.patch @@ -13,8 +13,8 @@ this.f_39002_.m_6422_(0); this.f_39770_.m_39292_((p_150479_, p_150480_) -> { BlockState blockstate = p_150479_.m_8055_(p_150480_); -- if (!p_150474_.m_150110_().f_35937_ && blockstate.m_60620_(BlockTags.f_13033_) && p_150474_.m_21187_().nextFloat() < 0.12F) { -+ if (!p_150474_.m_150110_().f_35937_ && blockstate.m_60620_(BlockTags.f_13033_) && p_150474_.m_21187_().nextFloat() < breakChance) { +- if (!p_150474_.m_150110_().f_35937_ && blockstate.m_204336_(BlockTags.f_13033_) && p_150474_.m_21187_().nextFloat() < 0.12F) { ++ if (!p_150474_.m_150110_().f_35937_ && blockstate.m_204336_(BlockTags.f_13033_) && p_150474_.m_21187_().nextFloat() < breakChance) { BlockState blockstate1 = AnvilBlock.m_48824_(blockstate); if (blockstate1 == null) { p_150479_.m_7471_(p_150480_, false); diff --git a/patches/minecraft/net/minecraft/world/inventory/EnchantmentMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/EnchantmentMenu.java.patch index 5241d95915..cb0b93bd2f 100644 --- a/patches/minecraft/net/minecraft/world/inventory/EnchantmentMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/EnchantmentMenu.java.patch @@ -1,87 +1,48 @@ --- a/net/minecraft/world/inventory/EnchantmentMenu.java +++ b/net/minecraft/world/inventory/EnchantmentMenu.java -@@ -52,7 +_,7 @@ +@@ -55,7 +_,7 @@ }); this.m_38897_(new Slot(this.f_39449_, 1, 35, 47) { public boolean m_5857_(ItemStack p_39517_) { - return p_39517_.m_150930_(Items.f_42534_); -+ return p_39517_.m_150922_(net.minecraftforge.common.Tags.Items.ENCHANTING_FUELS); ++ return p_39517_.m_204117_(net.minecraftforge.common.Tags.Items.ENCHANTING_FUELS); } }); -@@ -78,40 +_,28 @@ - this.m_38895_(DataSlot.m_39406_(this.f_39448_, 2)); - } - -+ private float getPower(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) { -+ return world.m_8055_(pos).getEnchantPowerBonus(world, pos); -+ } -+ - public void m_6199_(Container p_39461_) { - if (p_39461_ == this.f_39449_) { +@@ -86,23 +_,24 @@ ItemStack itemstack = p_39461_.m_8020_(0); if (!itemstack.m_41619_() && itemstack.m_41792_()) { this.f_39450_.m_39292_((p_39485_, p_39486_) -> { - int j = 0; -+ int power = 0; ++ float j = 0; - for(int k = -1; k <= 1; ++k) { - for(int l = -1; l <= 1; ++l) { - if ((k != 0 || l != 0) && p_39485_.m_46859_(p_39486_.m_142082_(l, 0, k)) && p_39485_.m_46859_(p_39486_.m_142082_(l, 1, k))) { -- if (p_39485_.m_8055_(p_39486_.m_142082_(l * 2, 0, k * 2)).m_60713_(Blocks.f_50078_)) { -- ++j; -- } -- -- if (p_39485_.m_8055_(p_39486_.m_142082_(l * 2, 1, k * 2)).m_60713_(Blocks.f_50078_)) { -- ++j; -- } -+ power += getPower(p_39485_, p_39486_.m_142082_(l * 2, 0, k * 2)); -+ power += getPower(p_39485_, p_39486_.m_142082_(l * 2, 1, k * 2)); - - if (l != 0 && k != 0) { -- if (p_39485_.m_8055_(p_39486_.m_142082_(l * 2, 0, k)).m_60713_(Blocks.f_50078_)) { -- ++j; -- } -- -- if (p_39485_.m_8055_(p_39486_.m_142082_(l * 2, 1, k)).m_60713_(Blocks.f_50078_)) { -- ++j; -- } -- -- if (p_39485_.m_8055_(p_39486_.m_142082_(l, 0, k * 2)).m_60713_(Blocks.f_50078_)) { -- ++j; -- } -- -- if (p_39485_.m_8055_(p_39486_.m_142082_(l, 1, k * 2)).m_60713_(Blocks.f_50078_)) { -- ++j; -- } -+ power += getPower(p_39485_, p_39486_.m_142082_(l * 2, 0, k)); -+ power += getPower(p_39485_, p_39486_.m_142082_(l * 2, 1, k)); -+ power += getPower(p_39485_, p_39486_.m_142082_(l, 0, k * 2)); -+ power += getPower(p_39485_, p_39486_.m_142082_(l, 1, k * 2)); - } - } + for(BlockPos blockpos : EnchantmentTableBlock.f_207902_) { + if (EnchantmentTableBlock.m_207909_(p_39485_, p_39486_, blockpos)) { +- ++j; ++ j += p_39485_.m_8055_(p_39486_.m_141952_(blockpos)).getEnchantPowerBonus(p_39485_, p_39486_.m_141952_(blockpos)); } -@@ -120,12 +_,13 @@ - this.f_39451_.setSeed((long)this.f_39452_.m_6501_()); - - for(int i1 = 0; i1 < 3; ++i1) { -- this.f_39446_[i1] = EnchantmentHelper.m_44872_(this.f_39451_, i1, j, itemstack); -+ this.f_39446_[i1] = EnchantmentHelper.m_44872_(this.f_39451_, i1, (int)power, itemstack); - this.f_39447_[i1] = -1; - this.f_39448_[i1] = -1; - if (this.f_39446_[i1] < i1 + 1) { - this.f_39446_[i1] = 0; - } -+ this.f_39446_[i1] = net.minecraftforge.event.ForgeEventFactory.onEnchantmentLevelSet(p_39485_, p_39486_, i1, (int)power, itemstack, f_39446_[i1]); } - for(int j1 = 0; j1 < 3; ++j1) { -@@ -253,7 +_,7 @@ + this.f_39451_.setSeed((long)this.f_39452_.m_6501_()); + + for(int k = 0; k < 3; ++k) { +- this.f_39446_[k] = EnchantmentHelper.m_44872_(this.f_39451_, k, j, itemstack); ++ this.f_39446_[k] = EnchantmentHelper.m_44872_(this.f_39451_, k, (int)j, itemstack); + this.f_39447_[k] = -1; + this.f_39448_[k] = -1; + if (this.f_39446_[k] < k + 1) { + this.f_39446_[k] = 0; + } ++ this.f_39446_[k] = net.minecraftforge.event.ForgeEventFactory.onEnchantmentLevelSet(p_39485_, p_39486_, k, (int)j, itemstack, f_39446_[k]); + } + + for(int l = 0; l < 3; ++l) { +@@ -235,7 +_,7 @@ if (!this.m_38903_(itemstack1, 2, 38, true)) { return ItemStack.f_41583_; } - } else if (itemstack1.m_150930_(Items.f_42534_)) { -+ } else if (itemstack1.m_150922_(net.minecraftforge.common.Tags.Items.ENCHANTING_FUELS)) { ++ } else if (itemstack1.m_204117_(net.minecraftforge.common.Tags.Items.ENCHANTING_FUELS)) { if (!this.m_38903_(itemstack1, 1, 2, true)) { return ItemStack.f_41583_; } diff --git a/patches/minecraft/net/minecraft/world/item/BoneMealItem.java.patch b/patches/minecraft/net/minecraft/world/item/BoneMealItem.java.patch index fbe8f04505..c0e42868be 100644 --- a/patches/minecraft/net/minecraft/world/item/BoneMealItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/BoneMealItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/BoneMealItem.java +++ b/net/minecraft/world/item/BoneMealItem.java -@@ -34,7 +_,7 @@ +@@ -33,7 +_,7 @@ Level level = p_40637_.m_43725_(); BlockPos blockpos = p_40637_.m_8083_(); BlockPos blockpos1 = blockpos.m_142300_(p_40637_.m_43719_()); @@ -9,7 +9,7 @@ if (!level.f_46443_) { level.m_46796_(1505, blockpos, 0); } -@@ -55,8 +_,17 @@ +@@ -54,8 +_,17 @@ } } diff --git a/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch b/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch index 5cef1a5a0d..2cedb784d6 100644 --- a/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch @@ -60,9 +60,9 @@ } protected void m_7718_(@Nullable Player p_40696_, LevelAccessor p_40697_, BlockPos p_40698_) { -- SoundEvent soundevent = this.f_40687_.m_76108_(FluidTags.f_13132_) ? SoundEvents.f_11780_ : SoundEvents.f_11778_; +- SoundEvent soundevent = this.f_40687_.m_205067_(FluidTags.f_13132_) ? SoundEvents.f_11780_ : SoundEvents.f_11778_; + SoundEvent soundevent = this.f_40687_.getAttributes().getEmptySound(); -+ if(soundevent == null) soundevent = this.f_40687_.m_76108_(FluidTags.f_13132_) ? SoundEvents.f_11780_ : SoundEvents.f_11778_; ++ if(soundevent == null) soundevent = this.f_40687_.m_205067_(FluidTags.f_13132_) ? SoundEvents.f_11780_ : SoundEvents.f_11778_; p_40697_.m_5594_(p_40696_, p_40698_, soundevent, SoundSource.BLOCKS, 1.0F, 1.0F); p_40697_.m_142346_(p_40696_, GameEvent.f_157769_, p_40698_); + } diff --git a/patches/minecraft/net/minecraft/world/item/DiggerItem.java.patch b/patches/minecraft/net/minecraft/world/item/DiggerItem.java.patch index 5e55b7f321..4ab9035fc3 100644 --- a/patches/minecraft/net/minecraft/world/item/DiggerItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/DiggerItem.java.patch @@ -7,20 +7,20 @@ + @Deprecated // FORGE: Use stack sensitive variant below public boolean m_8096_(BlockState p_150816_) { + if (net.minecraftforge.common.TierSortingRegistry.isTierSorted(m_43314_())) { -+ return net.minecraftforge.common.TierSortingRegistry.isCorrectTierForDrops(m_43314_(), p_150816_) && p_150816_.m_60620_(this.f_40979_); ++ return net.minecraftforge.common.TierSortingRegistry.isCorrectTierForDrops(m_43314_(), p_150816_) && p_150816_.m_204336_(this.f_40979_); + } int i = this.m_43314_().m_6604_(); - if (i < 3 && p_150816_.m_60620_(BlockTags.f_144284_)) { + if (i < 3 && p_150816_.m_204336_(BlockTags.f_144284_)) { return false; @@ -70,5 +_,11 @@ } else { - return i < 1 && p_150816_.m_60620_(BlockTags.f_144286_) ? false : p_150816_.m_60620_(this.f_40979_); + return i < 1 && p_150816_.m_204336_(BlockTags.f_144286_) ? false : p_150816_.m_204336_(this.f_40979_); } + } + + // FORGE START + @Override + public boolean isCorrectToolForDrops(ItemStack stack, BlockState state) { -+ return state.m_60620_(f_40979_) && net.minecraftforge.common.TierSortingRegistry.isCorrectTierForDrops(m_43314_(), state); ++ return state.m_204336_(f_40979_) && net.minecraftforge.common.TierSortingRegistry.isCorrectTierForDrops(m_43314_(), state); } } diff --git a/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch b/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch index 4738cc5da6..9498e22656 100644 --- a/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch +++ b/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch @@ -4,7 +4,7 @@ private final MaterialColor f_41036_; private final float[] f_41039_; private final int f_41040_; -+ private final net.minecraftforge.common.Tags.IOptionalNamedTag tag; ++ private final net.minecraft.tags.TagKey tag; private final int f_41041_; private DyeColor(int p_41046_, String p_41047_, int p_41048_, MaterialColor p_41049_, int p_41050_, int p_41051_) { @@ -12,7 +12,7 @@ int i = (p_41048_ & 16711680) >> 16; int j = (p_41048_ & '\uff00') >> 8; int k = (p_41048_ & 255) >> 0; -+ this.tag = net.minecraft.tags.ItemTags.createOptional(new net.minecraft.resources.ResourceLocation("forge", "dyes/" + p_41047_)); ++ this.tag = net.minecraft.tags.ItemTags.create(new net.minecraft.resources.ResourceLocation("forge", "dyes/" + p_41047_)); this.f_41039_ = new float[]{(float)i / 255.0F, (float)j / 255.0F, (float)k / 255.0F}; this.f_41040_ = p_41050_; } @@ -22,7 +22,7 @@ return this.f_41035_; + } + -+ public net.minecraftforge.common.Tags.IOptionalNamedTag getTag() { ++ public net.minecraft.tags.TagKey getTag() { + return tag; + } + @@ -32,7 +32,7 @@ + return ((DyeItem)stack.m_41720_()).m_41089_(); + + for (DyeColor color : f_41032_) { -+ if (stack.m_150922_(color.getTag())) ++ if (stack.m_204117_(color.getTag())) + return color; + } + diff --git a/patches/minecraft/net/minecraft/world/item/Item.java.patch b/patches/minecraft/net/minecraft/world/item/Item.java.patch index 2c2300d081..927118f7bd 100644 --- a/patches/minecraft/net/minecraft/world/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/world/item/Item.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/world/item/Item.java +++ b/net/minecraft/world/item/Item.java -@@ -46,9 +_,9 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -47,9 +_,9 @@ + import net.minecraft.world.phys.Vec3; + import org.slf4j.Logger; -public class Item implements ItemLike { +public class Item extends net.minecraftforge.registries.ForgeRegistryEntry implements ItemLike, net.minecraftforge.common.extensions.IForgeItem { - private static final Logger f_150883_ = LogManager.getLogger(); + private static final Logger f_150883_ = LogUtils.getLogger(); - public static final Map f_41373_ = Maps.newHashMap(); + public static final Map f_41373_ = net.minecraftforge.registries.GameData.getBlockItemMap(); protected static final UUID f_41374_ = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); protected static final UUID f_41375_ = UUID.fromString("FA233E1C-4180-4865-B01B-BCCE9785ACA3"); public static final int f_150884_ = 64; -@@ -95,12 +_,15 @@ +@@ -97,7 +_,8 @@ f_150883_.error("Item classes should end with Item and {} doesn't.", (Object)s); } } @@ -21,15 +21,17 @@ + initClient(); } - public void m_5929_(Level p_41428_, LivingEntity p_41429_, ItemStack p_41430_, int p_41431_) { + /** @deprecated */ +@@ -106,6 +_,8 @@ + return this.f_204113_; } + /** @deprecated Forge: Use damage source sensitive version */ + @Deprecated - public void m_142023_(ItemEntity p_150887_) { + public void m_5929_(Level p_41428_, LivingEntity p_41429_, ItemStack p_41430_, int p_41431_) { } -@@ -141,10 +_,12 @@ +@@ -149,10 +_,12 @@ return this.m_41472_() ? p_41411_.m_5584_(p_41410_, p_41409_) : p_41409_; } @@ -42,7 +44,7 @@ public final int m_41462_() { return this.f_41371_; } -@@ -219,10 +_,12 @@ +@@ -227,10 +_,12 @@ } @Nullable @@ -55,7 +57,7 @@ public boolean m_41470_() { return this.f_41378_ != null; } -@@ -285,7 +_,7 @@ +@@ -293,7 +_,7 @@ } public boolean m_8120_(ItemStack p_41456_) { @@ -64,7 +66,7 @@ } protected static BlockHitResult m_41435_(Level p_41436_, Player p_41437_, ClipContext.Fluid p_41438_) { -@@ -298,8 +_,8 @@ +@@ -306,8 +_,8 @@ float f5 = Mth.m_14031_(-f * ((float)Math.PI / 180F)); float f6 = f3 * f4; float f7 = f2 * f4; @@ -75,7 +77,7 @@ return p_41436_.m_45547_(new ClipContext(vec3, vec31, ClipContext.Block.OUTLINE, p_41438_, p_41437_)); } -@@ -315,6 +_,7 @@ +@@ -323,6 +_,7 @@ } protected boolean m_41389_(CreativeModeTab p_41390_) { @@ -83,7 +85,7 @@ CreativeModeTab creativemodetab = this.m_41471_(); return creativemodetab != null && (p_41390_ == CreativeModeTab.f_40754_ || p_41390_ == creativemodetab); } -@@ -328,12 +_,26 @@ +@@ -336,12 +_,20 @@ return false; } @@ -92,18 +94,12 @@ return ImmutableMultimap.of(); } -+ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.ItemTags::m_13193_); + protected final boolean canRepair; + + @Override + public boolean isRepairable(ItemStack stack) { + return canRepair && isDamageable(stack); + } -+ -+ @Override -+ public java.util.Set getTags() { -+ return reverseTags.getTagNames(); -+ } + public boolean m_41463_(ItemStack p_41464_) { - return false; @@ -111,7 +107,7 @@ } public ItemStack m_7968_() { -@@ -374,6 +_,32 @@ +@@ -382,6 +_,32 @@ return true; } @@ -144,7 +140,7 @@ public static class Properties { int f_41478_ = 64; int f_41479_; -@@ -385,6 +_,7 @@ +@@ -393,6 +_,7 @@ @Nullable FoodProperties f_41483_; boolean f_41484_; @@ -152,7 +148,7 @@ public Item.Properties m_41489_(FoodProperties p_41490_) { this.f_41483_ = p_41490_; -@@ -427,6 +_,11 @@ +@@ -435,6 +_,11 @@ public Item.Properties m_41486_() { this.f_41484_ = true; diff --git a/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch index 1d53d44d3b..db2b603388 100644 --- a/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch @@ -1,25 +1,25 @@ --- a/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java -@@ -70,7 +_,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -72,7 +_,7 @@ + import net.minecraft.world.level.block.state.pattern.BlockInWorld; + import org.slf4j.Logger; -public final class ItemStack { +public final class ItemStack extends net.minecraftforge.common.capabilities.CapabilityProvider implements net.minecraftforge.common.extensions.IForgeItemStack { public static final Codec f_41582_ = RecordCodecBuilder.create((p_41697_) -> { return p_41697_.group(Registry.f_122827_.m_194605_().fieldOf("id").forGetter((p_150946_) -> { return p_150946_.f_41589_; -@@ -80,6 +_,9 @@ +@@ -82,6 +_,9 @@ return Optional.ofNullable(p_150939_.f_41590_); })).apply(p_41697_, ItemStack::new); }); + private final net.minecraftforge.registries.IRegistryDelegate delegate; + private CompoundTag capNBT; + - private static final Logger f_41585_ = LogManager.getLogger(); + private static final Logger f_41585_ = LogUtils.getLogger(); public static final ItemStack f_41583_ = new ItemStack((Item)null); public static final DecimalFormat f_41584_ = Util.m_137469_(new DecimalFormat("#.##"), (p_41704_) -> { -@@ -126,10 +_,15 @@ +@@ -132,10 +_,15 @@ p_41606_.ifPresent(this::m_41751_); } @@ -39,7 +39,7 @@ this.m_41721_(this.m_41773_()); } -@@ -142,14 +_,19 @@ +@@ -148,14 +_,19 @@ } private ItemStack(CompoundTag p_41608_) { @@ -60,7 +60,7 @@ this.m_41721_(this.m_41773_()); } -@@ -184,7 +_,7 @@ +@@ -190,7 +_,7 @@ } public Item m_41720_() { @@ -68,8 +68,8 @@ + return this.f_41591_ || this.delegate == null ? Items.f_41852_ : this.delegate.get(); } - public boolean m_150922_(Tag p_150923_) { -@@ -196,6 +_,15 @@ + public boolean m_204117_(TagKey p_204118_) { +@@ -206,6 +_,15 @@ } public InteractionResult m_41661_(UseOnContext p_41662_) { @@ -85,7 +85,7 @@ Player player = p_41662_.m_43723_(); BlockPos blockpos = p_41662_.m_8083_(); BlockInWorld blockinworld = new BlockInWorld(p_41662_.m_43725_(), blockpos, false); -@@ -203,7 +_,7 @@ +@@ -213,7 +_,7 @@ return InteractionResult.PASS; } else { Item item = this.m_41720_(); @@ -94,7 +94,7 @@ if (player != null && interactionresult.m_146666_()) { player.m_36246_(Stats.f_12982_.m_12902_(item)); } -@@ -232,11 +_,15 @@ +@@ -242,11 +_,15 @@ p_41740_.m_128365_("tag", this.f_41590_.m_6426_()); } @@ -111,7 +111,7 @@ } public boolean m_41753_() { -@@ -244,7 +_,7 @@ +@@ -254,7 +_,7 @@ } public boolean m_41763_() { @@ -120,7 +120,7 @@ CompoundTag compoundtag = this.m_41783_(); return compoundtag == null || !compoundtag.m_128471_("Unbreakable"); } else { -@@ -253,19 +_,19 @@ +@@ -263,19 +_,19 @@ } public boolean m_41768_() { @@ -144,7 +144,7 @@ } public boolean m_41629_(int p_41630_, Random p_41631_, @Nullable ServerPlayer p_41632_) { -@@ -301,6 +_,7 @@ +@@ -311,6 +_,7 @@ public void m_41622_(int p_41623_, T p_41624_, Consumer p_41625_) { if (!p_41624_.f_19853_.f_46443_ && (!(p_41624_ instanceof Player) || !((Player)p_41624_).m_150110_().f_35937_)) { if (this.m_41763_()) { @@ -152,7 +152,7 @@ if (this.m_41629_(p_41623_, p_41624_.m_21187_(), p_41624_ instanceof ServerPlayer ? (ServerPlayer)p_41624_ : null)) { p_41625_.accept(p_41624_); Item item = this.m_41720_(); -@@ -353,7 +_,7 @@ +@@ -363,7 +_,7 @@ } public boolean m_41735_(BlockState p_41736_) { @@ -161,7 +161,7 @@ } public InteractionResult m_41647_(Player p_41648_, LivingEntity p_41649_, InteractionHand p_41650_) { -@@ -364,7 +_,7 @@ +@@ -374,7 +_,7 @@ if (this.m_41619_()) { return f_41583_; } else { @@ -170,7 +170,7 @@ itemstack.m_41754_(this.m_41612_()); if (this.f_41590_ != null) { itemstack.f_41590_ = this.f_41590_.m_6426_(); -@@ -381,7 +_,7 @@ +@@ -391,7 +_,7 @@ if (p_41659_.f_41590_ == null && p_41660_.f_41590_ != null) { return false; } else { @@ -179,7 +179,7 @@ } } else { return false; -@@ -404,7 +_,7 @@ +@@ -414,7 +_,7 @@ } else if (this.f_41590_ == null && p_41745_.f_41590_ != null) { return false; } else { @@ -188,7 +188,7 @@ } } -@@ -528,7 +_,7 @@ +@@ -538,7 +_,7 @@ public void m_41751_(@Nullable CompoundTag p_41752_) { this.f_41590_ = p_41752_; @@ -197,7 +197,7 @@ this.m_41721_(this.m_41773_()); } -@@ -728,6 +_,7 @@ +@@ -738,6 +_,7 @@ } } @@ -205,7 +205,7 @@ return list; } -@@ -736,7 +_,7 @@ +@@ -746,7 +_,7 @@ } private int m_41618_() { @@ -214,7 +214,7 @@ } public void m_41654_(ItemStack.TooltipPart p_41655_) { -@@ -865,9 +_,10 @@ +@@ -874,9 +_,10 @@ } } } else { @@ -226,7 +226,7 @@ return multimap; } -@@ -948,12 +_,31 @@ +@@ -957,12 +_,31 @@ this.m_41720_().m_5929_(p_41732_, p_41733_, this, p_41734_); } diff --git a/patches/minecraft/net/minecraft/world/item/MinecartItem.java.patch b/patches/minecraft/net/minecraft/world/item/MinecartItem.java.patch index 947ba6084e..00bbb14d68 100644 --- a/patches/minecraft/net/minecraft/world/item/MinecartItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/MinecartItem.java.patch @@ -7,7 +7,7 @@ - RailShape railshape = blockstate.m_60734_() instanceof BaseRailBlock ? blockstate.m_61143_(((BaseRailBlock)blockstate.m_60734_()).m_7978_()) : RailShape.NORTH_SOUTH; + RailShape railshape = blockstate.m_60734_() instanceof BaseRailBlock ? ((BaseRailBlock)blockstate.m_60734_()).getRailDirection(blockstate, level, blockpos, null) : RailShape.NORTH_SOUTH; double d3; - if (blockstate.m_60620_(BlockTags.f_13034_)) { + if (blockstate.m_204336_(BlockTags.f_13034_)) { if (railshape.m_61745_()) { @@ -81,7 +_,7 @@ } else { diff --git a/patches/minecraft/net/minecraft/world/item/Tier.java.patch b/patches/minecraft/net/minecraft/world/item/Tier.java.patch index 0b6b3b1dda..75fb95b65d 100644 --- a/patches/minecraft/net/minecraft/world/item/Tier.java.patch +++ b/patches/minecraft/net/minecraft/world/item/Tier.java.patch @@ -11,5 +11,5 @@ Ingredient m_6282_(); + -+ @javax.annotation.Nullable default net.minecraft.tags.Tag getTag() { return null; } ++ @javax.annotation.Nullable default net.minecraft.tags.TagKey getTag() { return null; } } diff --git a/patches/minecraft/net/minecraft/world/item/Tiers.java.patch b/patches/minecraft/net/minecraft/world/item/Tiers.java.patch index 588cab692e..4db0e19ad3 100644 --- a/patches/minecraft/net/minecraft/world/item/Tiers.java.patch +++ b/patches/minecraft/net/minecraft/world/item/Tiers.java.patch @@ -5,5 +5,5 @@ return this.f_43326_.m_13971_(); } + -+ @javax.annotation.Nullable public net.minecraft.tags.Tag getTag() { return net.minecraftforge.common.ForgeHooks.getTagFromVanillaTier(this); } ++ @javax.annotation.Nullable public net.minecraft.tags.TagKey getTag() { return net.minecraftforge.common.ForgeHooks.getTagFromVanillaTier(this); } } diff --git a/patches/minecraft/net/minecraft/world/item/alchemy/Potion.java.patch b/patches/minecraft/net/minecraft/world/item/alchemy/Potion.java.patch index 0b7b0c0114..c4ade9013f 100644 --- a/patches/minecraft/net/minecraft/world/item/alchemy/Potion.java.patch +++ b/patches/minecraft/net/minecraft/world/item/alchemy/Potion.java.patch @@ -1,28 +1,11 @@ --- a/net/minecraft/world/item/alchemy/Potion.java +++ b/net/minecraft/world/item/alchemy/Potion.java -@@ -7,8 +_,9 @@ +@@ -7,7 +_,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.effect.MobEffectInstance; -public class Potion { - @Nullable +public class Potion extends net.minecraftforge.registries.ForgeRegistryEntry { -+ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, () -> net.minecraft.tags.SerializationTags.m_13199_().m_144452_(Registry.f_122905_)); + @Nullable private final String f_43481_; private final ImmutableList f_43482_; - -@@ -23,6 +_,14 @@ - public Potion(@Nullable String p_43484_, MobEffectInstance... p_43485_) { - this.f_43481_ = p_43484_; - this.f_43482_ = ImmutableList.copyOf(p_43485_); -+ } -+ -+ public java.util.Set getTags() { -+ return reverseTags.getTagNames(); -+ } -+ -+ public boolean is(net.minecraft.tags.Tag tag) { -+ return tag.m_8110_(this); - } - - public String m_43492_(String p_43493_) { diff --git a/patches/minecraft/net/minecraft/world/item/crafting/Ingredient.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/Ingredient.java.patch index 2ab8077a74..0846175fd3 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/Ingredient.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/Ingredient.java.patch @@ -104,7 +104,7 @@ if (p_43918_.isJsonObject()) { return m_43938_(Stream.of(m_43919_(p_43918_.getAsJsonObject()))); } else if (p_43918_.isJsonArray()) { -@@ -184,6 +_,12 @@ +@@ -182,6 +_,12 @@ } } @@ -117,12 +117,12 @@ public static class ItemValue implements Ingredient.Value { private final ItemStack f_43951_; -@@ -216,6 +_,9 @@ - list.add(new ItemStack(item)); +@@ -214,6 +_,9 @@ + list.add(new ItemStack(holder)); } + if (list.size() == 0 && !net.minecraftforge.common.ForgeConfig.SERVER.treatEmptyTagsAsAir.get()) { -+ list.add(new ItemStack(net.minecraft.world.level.block.Blocks.f_50375_).m_41714_(new net.minecraft.network.chat.TextComponent("Empty Tag: " + SerializationTags.m_13199_().m_144454_(Registry.f_122904_, this.f_43959_, () -> new IllegalStateException("Unrecognized tag"))))); ++ list.add(new ItemStack(net.minecraft.world.level.block.Blocks.f_50375_).m_41714_(new net.minecraft.network.chat.TextComponent("Empty Tag: " + this.f_43959_.f_203868_()))); + } return list; } diff --git a/patches/minecraft/net/minecraft/world/item/crafting/RecipeManager.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/RecipeManager.java.patch index c4655f205e..e477d21882 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/RecipeManager.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/RecipeManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/crafting/RecipeManager.java +++ b/net/minecraft/world/item/crafting/RecipeManager.java -@@ -50,9 +_,18 @@ +@@ -49,9 +_,18 @@ for(Entry entry : p_44037_.entrySet()) { ResourceLocation resourcelocation = entry.getKey(); diff --git a/patches/minecraft/net/minecraft/world/item/crafting/ShulkerBoxColoring.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/ShulkerBoxColoring.java.patch index f72a8f704e..51f3a55ae4 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/ShulkerBoxColoring.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/ShulkerBoxColoring.java.patch @@ -5,7 +5,7 @@ ++i; } else { - if (!(itemstack.m_41720_() instanceof DyeItem)) { -+ if (!itemstack.m_150922_(net.minecraftforge.common.Tags.Items.DYES)) { ++ if (!itemstack.m_204117_(net.minecraftforge.common.Tags.Items.DYES)) { return false; } diff --git a/patches/minecraft/net/minecraft/world/item/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/world/item/enchantment/Enchantment.java.patch index b57e79c3ab..8ab593bf7a 100644 --- a/patches/minecraft/net/minecraft/world/item/enchantment/Enchantment.java.patch +++ b/patches/minecraft/net/minecraft/world/item/enchantment/Enchantment.java.patch @@ -1,30 +1,14 @@ --- a/net/minecraft/world/item/enchantment/Enchantment.java +++ b/net/minecraft/world/item/enchantment/Enchantment.java -@@ -16,7 +_,8 @@ +@@ -16,7 +_,7 @@ import net.minecraft.world.entity.MobType; import net.minecraft.world.item.ItemStack; -public abstract class Enchantment { +public abstract class Enchantment extends net.minecraftforge.registries.ForgeRegistryEntry { -+ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, () -> net.minecraft.tags.SerializationTags.m_13199_().m_144452_(net.minecraftforge.registries.ForgeRegistries.Keys.ENCHANTMENTS)); private final EquipmentSlot[] f_44671_; private final Enchantment.Rarity f_44674_; public final EnchantmentCategory f_44672_; -@@ -34,6 +_,14 @@ - this.f_44671_ = p_44678_; - } - -+ public java.util.Set getTags() { -+ return reverseTags.getTagNames(); -+ } -+ -+ public boolean is(net.minecraft.tags.Tag tag) { -+ return tag.m_8110_(this); -+ } -+ - public Map m_44684_(LivingEntity p_44685_) { - Map map = Maps.newEnumMap(EquipmentSlot.class); - @@ -111,7 +_,7 @@ } diff --git a/patches/minecraft/net/minecraft/world/level/ClipContext.java.patch b/patches/minecraft/net/minecraft/world/level/ClipContext.java.patch index 2ccd824150..a9fdcd5458 100644 --- a/patches/minecraft/net/minecraft/world/level/ClipContext.java.patch +++ b/patches/minecraft/net/minecraft/world/level/ClipContext.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/ClipContext.java +++ b/net/minecraft/world/level/ClipContext.java -@@ -18,12 +_,12 @@ +@@ -20,12 +_,12 @@ private final ClipContext.Fluid f_45685_; private final CollisionContext f_45686_; diff --git a/patches/minecraft/net/minecraft/world/level/Level.java.patch b/patches/minecraft/net/minecraft/world/level/Level.java.patch index 670a145f9a..04fb97be5e 100644 --- a/patches/minecraft/net/minecraft/world/level/Level.java.patch +++ b/patches/minecraft/net/minecraft/world/level/Level.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -65,7 +_,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -63,7 +_,7 @@ + import net.minecraft.world.phys.AABB; + import net.minecraft.world.scores.Scoreboard; -public abstract class Level implements LevelAccessor, AutoCloseable { +public abstract class Level extends net.minecraftforge.common.capabilities.CapabilityProvider implements LevelAccessor, AutoCloseable, net.minecraftforge.common.extensions.IForgeLevel { - protected static final Logger f_46426_ = LogManager.getLogger(); public static final Codec> f_46427_ = ResourceLocation.f_135803_.xmap(ResourceKey.m_135797_(Registry.f_122819_), ResourceKey::m_135782_); public static final ResourceKey f_46428_ = ResourceKey.m_135785_(Registry.f_122819_, new ResourceLocation("overworld")); -@@ -100,8 +_,14 @@ + public static final ResourceKey f_46429_ = ResourceKey.m_135785_(Registry.f_122819_, new ResourceLocation("the_nether")); +@@ -98,8 +_,14 @@ private final BiomeManager f_46420_; private final ResourceKey f_46421_; private long f_186455_; @@ -19,12 +19,12 @@ + private final java.util.ArrayList freshBlockEntities = new java.util.ArrayList<>(); + private final java.util.ArrayList pendingFreshBlockEntities = new java.util.ArrayList<>(); - protected Level(WritableLevelData p_46450_, ResourceKey p_46451_, final DimensionType p_46452_, Supplier p_46453_, boolean p_46454_, boolean p_46455_, long p_46456_) { + protected Level(WritableLevelData p_204149_, ResourceKey p_204150_, Holder p_204151_, Supplier p_204152_, boolean p_204153_, boolean p_204154_, long p_204155_) { + super(Level.class); - this.f_46446_ = p_46453_; - this.f_46442_ = p_46450_; - this.f_46445_ = p_46452_; -@@ -181,17 +_,45 @@ + this.f_46446_ = p_204152_; + this.f_46442_ = p_204149_; + this.f_204147_ = p_204151_; +@@ -180,17 +_,45 @@ } else { LevelChunk levelchunk = this.m_46745_(p_46605_); Block block = p_46606_.m_60734_(); @@ -71,7 +71,7 @@ if (blockstate1 == p_46606_) { if (blockstate != blockstate1) { this.m_6550_(p_46605_, blockstate, blockstate1); -@@ -217,8 +_,6 @@ +@@ -216,8 +_,6 @@ this.m_6559_(p_46605_, blockstate, blockstate1); } @@ -80,7 +80,7 @@ } } } -@@ -268,6 +_,8 @@ +@@ -267,6 +_,8 @@ } public void m_46672_(BlockPos p_46673_, Block p_46674_) { @@ -89,7 +89,7 @@ this.m_46586_(p_46673_.m_142125_(), p_46674_, p_46673_); this.m_46586_(p_46673_.m_142126_(), p_46674_, p_46673_); this.m_46586_(p_46673_.m_7495_(), p_46674_, p_46673_); -@@ -277,6 +_,11 @@ +@@ -276,6 +_,11 @@ } public void m_46590_(BlockPos p_46591_, Block p_46592_, Direction p_46593_) { @@ -101,7 +101,7 @@ if (p_46593_ != Direction.WEST) { this.m_46586_(p_46591_.m_142125_(), p_46592_, p_46591_); } -@@ -314,9 +_,9 @@ +@@ -313,9 +_,9 @@ CrashReportCategory crashreportcategory = crashreport.m_127514_("Block being updated"); crashreportcategory.m_128165_("Source block type", () -> { try { @@ -113,7 +113,7 @@ } }); CrashReportCategory.m_178950_(crashreportcategory, this, p_46587_, blockstate); -@@ -402,10 +_,26 @@ +@@ -401,10 +_,26 @@ (this.f_151504_ ? this.f_151503_ : this.f_151512_).add(p_151526_); } @@ -140,7 +140,7 @@ if (!this.f_151503_.isEmpty()) { this.f_151512_.addAll(this.f_151503_); this.f_151503_.clear(); -@@ -428,12 +_,15 @@ +@@ -427,12 +_,15 @@ public void m_46653_(Consumer p_46654_, T p_46655_) { try { @@ -156,7 +156,7 @@ } } -@@ -455,6 +_,7 @@ +@@ -454,6 +_,7 @@ public Explosion m_7703_(@Nullable Entity p_46526_, @Nullable DamageSource p_46527_, @Nullable ExplosionDamageCalculator p_46528_, double p_46529_, double p_46530_, double p_46531_, float p_46532_, boolean p_46533_, Explosion.BlockInteraction p_46534_) { Explosion explosion = new Explosion(this, p_46526_, p_46527_, p_46528_, p_46529_, p_46530_, p_46531_, p_46532_, p_46533_, p_46534_); @@ -164,7 +164,7 @@ explosion.m_46061_(); explosion.m_46075_(true); return explosion; -@@ -482,6 +_,7 @@ +@@ -481,6 +_,7 @@ if (!this.m_151570_(p_46748_)) { this.m_46745_(p_46748_).m_8114_(p_46748_); } @@ -172,7 +172,7 @@ } public boolean m_46749_(BlockPos p_46750_) { -@@ -539,8 +_,8 @@ +@@ -538,8 +_,8 @@ list.add(p_151522_); } @@ -183,7 +183,7 @@ if (p_151522_ != p_46536_ && p_46538_.test(enderdragonpart)) { list.add(enderdragonpart); } -@@ -559,10 +_,8 @@ +@@ -558,10 +_,8 @@ list.add(p_151539_); } @@ -196,7 +196,7 @@ T t = p_151528_.m_141992_(enderdragonpart); if (t != null && p_151530_.test(t)) { list.add(t); -@@ -582,6 +_,7 @@ +@@ -581,6 +_,7 @@ this.m_46745_(p_151544_).m_8092_(true); } @@ -204,7 +204,7 @@ } public int m_5736_() { -@@ -626,7 +_,7 @@ +@@ -625,7 +_,7 @@ public int m_46681_(BlockPos p_46682_, Direction p_46683_) { BlockState blockstate = this.m_8055_(p_46682_); int i = blockstate.m_60746_(this, p_46682_, p_46683_); @@ -213,7 +213,7 @@ } public boolean m_46753_(BlockPos p_46754_) { -@@ -779,16 +_,15 @@ +@@ -778,16 +_,15 @@ public abstract Scoreboard m_6188_(); public void m_46717_(BlockPos p_46718_, Block p_46719_) { @@ -234,7 +234,7 @@ blockstate.m_60690_(this, blockpos, p_46719_, p_46718_, false); } } -@@ -867,6 +_,18 @@ +@@ -868,6 +_,18 @@ public BiomeManager m_7062_() { return this.f_46420_; diff --git a/patches/minecraft/net/minecraft/world/level/LevelReader.java.patch b/patches/minecraft/net/minecraft/world/level/LevelReader.java.patch index ff9d22898a..8a07965cde 100644 --- a/patches/minecraft/net/minecraft/world/level/LevelReader.java.patch +++ b/patches/minecraft/net/minecraft/world/level/LevelReader.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/LevelReader.java +++ b/net/minecraft/world/level/LevelReader.java -@@ -175,6 +_,10 @@ +@@ -176,6 +_,10 @@ } /** @deprecated */ diff --git a/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch b/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch index aeb450cb6b..96aac8b492 100644 --- a/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java -@@ -45,6 +_,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -47,6 +_,7 @@ + import net.minecraft.world.phys.Vec3; + import org.slf4j.Logger; +// TODO: ForgeEventFactory.getPotentialSpawns, ForgeHooks.canEntitySpawn public final class NaturalSpawner { - private static final Logger f_46977_ = LogManager.getLogger(); + private static final Logger f_46977_ = LogUtils.getLogger(); private static final int f_151589_ = 24; -@@ -81,7 +_,7 @@ +@@ -83,7 +_,7 @@ mob = (Mob)entity; } while(mob.m_21532_() || mob.m_8023_()); @@ -17,14 +17,14 @@ if (mobcategory != MobCategory.MISC) { Entity entity_f = entity; BlockPos blockpos = entity.m_142538_(); -@@ -177,13 +_,15 @@ +@@ -179,13 +_,15 @@ } mob.m_7678_(d0, (double)i, d1, p_47040_.f_46441_.nextFloat() * 360.0F, 0.0F); - if (m_46991_(p_47040_, mob, d2)) { + int canSpawn = net.minecraftforge.common.ForgeHooks.canEntitySpawn(mob, p_47040_, d0, i, d1, null, MobSpawnType.NATURAL); + if (canSpawn != -1 && (canSpawn == 1 || m_46991_(p_47040_, mob, d2))) { -+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mob, p_47040_, (float)d0, (float)i, (float)d1, null, MobSpawnType.NATURAL)) ++ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(mob, (LevelAccessor) p_47040_, (float)d0, (float)i, (float)d1, null, MobSpawnType.NATURAL)) spawngroupdata = mob.m_6518_(p_47040_, p_47040_.m_6436_(mob.m_142538_()), MobSpawnType.NATURAL, spawngroupdata, (CompoundTag)null); ++j; ++l1; @@ -35,16 +35,7 @@ return; } -@@ -263,7 +_,7 @@ - } - - private static WeightedRandomList m_151591_(ServerLevel p_151592_, StructureFeatureManager p_151593_, ChunkGenerator p_151594_, MobCategory p_151595_, BlockPos p_151596_, @Nullable Biome p_151597_) { -- return m_186529_(p_151596_, p_151592_, p_151595_, p_151593_) ? NetherFortressFeature.f_66381_ : p_151594_.m_142184_(p_151597_ != null ? p_151597_ : p_151592_.m_46857_(p_151596_), p_151593_, p_151595_, p_151596_); -+ return m_186529_(p_151596_, p_151592_, p_151595_, p_151593_) ? StructureFeature.f_67025_.getSpawnList(MobCategory.MONSTER) : p_151594_.m_142184_(p_151597_ != null ? p_151597_ : p_151592_.m_46857_(p_151596_), p_151593_, p_151595_, p_151596_); - } - - public static boolean m_186529_(BlockPos p_186530_, ServerLevel p_186531_, MobCategory p_186532_, StructureFeatureManager p_186533_) { -@@ -297,6 +_,13 @@ +@@ -304,6 +_,13 @@ if (p_47052_ == SpawnPlacements.Type.NO_RESTRICTIONS) { return true; } else if (p_47055_ != null && p_47053_.m_6857_().m_61937_(p_47054_)) { @@ -58,7 +49,7 @@ BlockState blockstate = p_47053_.m_8055_(p_47054_); FluidState fluidstate = p_47053_.m_6425_(p_47054_); BlockPos blockpos = p_47054_.m_7494_(); -@@ -309,14 +_,12 @@ +@@ -316,14 +_,12 @@ case ON_GROUND: default: BlockState blockstate1 = p_47053_.m_8055_(blockpos1); @@ -74,11 +65,11 @@ } } -@@ -362,6 +_,7 @@ - entity.m_7678_(d0, (double)blockpos.m_123342_(), d1, p_151620_.nextFloat() * 360.0F, 0.0F); +@@ -369,6 +_,7 @@ + entity.m_7678_(d0, (double)blockpos.m_123342_(), d1, p_204179_.nextFloat() * 360.0F, 0.0F); if (entity instanceof Mob) { Mob mob = (Mob)entity; -+ if (net.minecraftforge.common.ForgeHooks.canEntitySpawn(mob, p_151617_, d0, blockpos.m_123342_(), d1, null, MobSpawnType.CHUNK_GENERATION) == -1) continue; - if (mob.m_5545_(p_151617_, MobSpawnType.CHUNK_GENERATION) && mob.m_6914_(p_151617_)) { - spawngroupdata = mob.m_6518_(p_151617_, p_151617_.m_6436_(mob.m_142538_()), MobSpawnType.CHUNK_GENERATION, spawngroupdata, (CompoundTag)null); - p_151617_.m_47205_(mob); ++ if (net.minecraftforge.common.ForgeHooks.canEntitySpawn(mob, p_204176_, d0, blockpos.m_123342_(), d1, null, MobSpawnType.CHUNK_GENERATION) == -1) continue; + if (mob.m_5545_(p_204176_, MobSpawnType.CHUNK_GENERATION) && mob.m_6914_(p_204176_)) { + spawngroupdata = mob.m_6518_(p_204176_, p_204176_.m_6436_(mob.m_142538_()), MobSpawnType.CHUNK_GENERATION, spawngroupdata, (CompoundTag)null); + p_204176_.m_47205_(mob); diff --git a/patches/minecraft/net/minecraft/world/level/biome/Biome.java.patch b/patches/minecraft/net/minecraft/world/level/biome/Biome.java.patch index 4b16a12bed..6e93b0ec00 100644 --- a/patches/minecraft/net/minecraft/world/level/biome/Biome.java.patch +++ b/patches/minecraft/net/minecraft/world/level/biome/Biome.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/world/level/biome/Biome.java +++ b/net/minecraft/world/level/biome/Biome.java -@@ -37,7 +_,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -34,7 +_,7 @@ + import net.minecraft.world.level.material.FluidState; + import net.minecraft.world.level.material.Fluids; -public final class Biome { +public final class Biome extends net.minecraftforge.registries.ForgeRegistryEntry.UncheckedRegistryEntry { - public static final Logger f_47428_ = LogManager.getLogger(); public static final Codec f_47429_ = RecordCodecBuilder.create((p_186636_) -> { return p_186636_.group(Biome.ClimateSettings.f_47679_.forGetter((p_151717_) -> { -@@ -50,7 +_,9 @@ + return p_151717_.f_47437_; +@@ -46,7 +_,9 @@ return p_186642_.f_47438_; }), MobSpawnSettings.f_48327_.forGetter((p_186640_) -> { return p_186640_.f_47439_; - })).apply(p_186636_, Biome::new); -+ }), ResourceLocation.f_135803_.optionalFieldOf("forge:registry_name").forGetter(b -> Optional.ofNullable(b.getRegistryName()))) ++ }), net.minecraft.resources.ResourceLocation.f_135803_.optionalFieldOf("forge:registry_name").forGetter(b -> Optional.ofNullable(b.getRegistryName()))) + .apply(p_186636_, (climate, category, effects, gen, spawns, name) -> + net.minecraftforge.common.ForgeHooks.enhanceBiome(name.orElse(null), climate, category, effects, gen, spawns, p_186636_, Biome::new)); }); diff --git a/patches/minecraft/net/minecraft/world/level/biome/BiomeGenerationSettings.java.patch b/patches/minecraft/net/minecraft/world/level/biome/BiomeGenerationSettings.java.patch index b6fcd83f28..92028737c5 100644 --- a/patches/minecraft/net/minecraft/world/level/biome/BiomeGenerationSettings.java.patch +++ b/patches/minecraft/net/minecraft/world/level/biome/BiomeGenerationSettings.java.patch @@ -1,22 +1,22 @@ --- a/net/minecraft/world/level/biome/BiomeGenerationSettings.java +++ b/net/minecraft/world/level/biome/BiomeGenerationSettings.java -@@ -37,6 +_,7 @@ +@@ -38,6 +_,7 @@ })).apply(p_186655_, BiomeGenerationSettings::new); }); - private final Map>>> f_47780_; + private final Map>> f_47780_; + private final java.util.Set carversView; - private final List>> f_47781_; - private final List> f_47783_; - private final Set f_186648_; -@@ -48,10 +_,15 @@ - return p_186657_.f_65377_ == Feature.f_65761_; - }).collect(ImmutableList.toImmutableList()); - this.f_186648_ = p_186651_.stream().flatMap(Collection::stream).map(Supplier::get).collect(Collectors.toSet()); + private final List> f_47781_; + private final Supplier>> f_47783_; + private final Supplier> f_186648_; +@@ -53,10 +_,15 @@ + this.f_186648_ = Suppliers.memoize(() -> { + return p_186651_.stream().flatMap(HolderSet::m_203614_).map(Holder::m_203334_).collect(Collectors.toSet()); + }); + this.carversView = java.util.Collections.unmodifiableSet(f_47780_.keySet()); } - public List>> m_47799_(GenerationStep.Carving p_47800_) { - return this.f_47780_.getOrDefault(p_47800_, ImmutableList.of()); + public Iterable>> m_204187_(GenerationStep.Carving p_204188_) { + return Objects.requireNonNullElseGet(this.f_47780_.get(p_204188_), List::of); + } + + public java.util.Set getCarvingStages() { diff --git a/patches/minecraft/net/minecraft/world/level/block/BeehiveBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/BeehiveBlock.java.patch index 8adbb3f278..48bd9108bf 100644 --- a/patches/minecraft/net/minecraft/world/level/block/BeehiveBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/BeehiveBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/BeehiveBlock.java +++ b/net/minecraft/world/level/block/BeehiveBlock.java -@@ -72,6 +_,9 @@ +@@ -70,6 +_,9 @@ public int m_6782_(BlockState p_49620_, Level p_49621_, BlockPos p_49622_) { return p_49620_.m_61143_(f_49564_); } @@ -10,7 +10,7 @@ public void m_6240_(Level p_49584_, Player p_49585_, BlockPos p_49586_, BlockState p_49587_, @Nullable BlockEntity p_49588_, ItemStack p_49589_) { super.m_6240_(p_49584_, p_49585_, p_49586_, p_49587_, p_49588_, p_49589_); -@@ -92,6 +_,7 @@ +@@ -90,6 +_,7 @@ List list = p_49650_.m_45976_(Bee.class, (new AABB(p_49651_)).m_82377_(8.0D, 6.0D, 8.0D)); if (!list.isEmpty()) { List list1 = p_49650_.m_45976_(Player.class, (new AABB(p_49651_)).m_82377_(8.0D, 6.0D, 8.0D)); @@ -18,7 +18,7 @@ int i = list1.size(); for(Bee bee : list) { -@@ -113,7 +_,7 @@ +@@ -111,7 +_,7 @@ boolean flag = false; if (i >= 5) { Item item = itemstack.m_41720_(); diff --git a/patches/minecraft/net/minecraft/world/level/block/Block.java.patch b/patches/minecraft/net/minecraft/world/level/block/Block.java.patch index eea6b73e53..abd7eb903a 100644 --- a/patches/minecraft/net/minecraft/world/level/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/Block.java.patch @@ -1,19 +1,20 @@ --- a/net/minecraft/world/level/block/Block.java +++ b/net/minecraft/world/level/block/Block.java -@@ -61,9 +_,10 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -62,10 +_,11 @@ + import net.minecraft.world.phys.shapes.VoxelShape; + import org.slf4j.Logger; -public class Block extends BlockBehaviour implements ItemLike { +public class Block extends BlockBehaviour implements ItemLike, net.minecraftforge.common.extensions.IForgeBlock { - protected static final Logger f_49790_ = LogManager.getLogger(); + private static final Logger f_49790_ = LogUtils.getLogger(); + private final Holder.Reference f_204296_ = Registry.f_122824_.m_203693_(this); - public static final IdMapper f_49791_ = new IdMapper<>(); + @Deprecated //Forge: Do not use, use GameRegistry + public static final IdMapper f_49791_ = net.minecraftforge.registries.GameData.getBlockStateIDMap(); private static final LoadingCache f_49785_ = CacheBuilder.newBuilder().maximumSize(512L).weakKeys().build(new CacheLoader() { public Boolean load(VoxelShape p_49972_) { return !Shapes.m_83157_(Shapes.m_83144_(), p_49972_, BooleanOp.f_82687_); -@@ -176,7 +_,7 @@ +@@ -178,7 +_,7 @@ f_49790_.error("Block classes should end with Block and {} doesn't.", (Object)s); } } @@ -22,7 +23,7 @@ } public static boolean m_152463_(BlockState p_152464_) { -@@ -322,7 +_,7 @@ +@@ -324,7 +_,7 @@ } private static void m_152440_(Level p_152441_, Supplier p_152442_, ItemStack p_152443_) { @@ -31,7 +32,7 @@ ItemEntity itementity = p_152442_.get(); itementity.m_32060_(); p_152441_.m_7967_(itementity); -@@ -330,12 +_,13 @@ +@@ -332,12 +_,13 @@ } public void m_49805_(ServerLevel p_49806_, BlockPos p_49807_, int p_49808_) { @@ -46,7 +47,7 @@ public float m_7325_() { return this.f_60444_; } -@@ -382,8 +_,10 @@ +@@ -384,8 +_,10 @@ public void m_5548_(BlockGetter p_49821_, Entity p_49822_) { p_49822_.m_20256_(p_49822_.m_20184_().m_82542_(1.0D, 0.0D, 1.0D)); @@ -57,7 +58,7 @@ public ItemStack m_7397_(BlockGetter p_49823_, BlockPos p_49824_, BlockState p_49825_) { return new ItemStack(this); } -@@ -420,6 +_,7 @@ +@@ -422,6 +_,7 @@ public void m_141997_(BlockState p_152450_, Level p_152451_, BlockPos p_152452_, Biome.Precipitation p_152453_) { } @@ -65,7 +66,7 @@ public boolean m_6903_(Explosion p_49826_) { return true; } -@@ -455,6 +_,7 @@ +@@ -457,6 +_,7 @@ return p_152456_.m_61124_(p_152457_, p_152455_.m_61143_(p_152457_)); } @@ -73,7 +74,7 @@ public SoundType m_49962_(BlockState p_49963_) { return this.f_60446_; } -@@ -464,7 +_,7 @@ +@@ -466,7 +_,7 @@ this.f_49788_ = Item.m_41439_(this); } @@ -82,7 +83,7 @@ } public boolean m_49967_() { -@@ -472,7 +_,7 @@ +@@ -474,7 +_,7 @@ } public String toString() { @@ -91,14 +92,13 @@ } public void m_5871_(ItemStack p_49816_, @Nullable BlockGetter p_49817_, List p_49818_, TooltipFlag p_49819_) { -@@ -485,6 +_,82 @@ +@@ -487,6 +_,76 @@ protected ImmutableMap m_152458_(Function p_152459_) { return this.f_49792_.m_61056_().stream().collect(ImmutableMap.toImmutableMap(Function.identity(), p_152459_)); } + + /* ======================================== FORGE START =====================================*/ + protected Random RANDOM = new Random(); -+ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, BlockTags::m_13115_); + private Object renderProperties; + + /* @@ -146,17 +146,17 @@ + } else if (net.minecraftforge.common.PlantType.CAVE.equals(type)) { + return state.m_60783_(world, pos, Direction.UP); + } else if (net.minecraftforge.common.PlantType.PLAINS.equals(type)) { -+ return this == Blocks.f_50440_ || BlockTags.f_144274_.m_8110_(this) || this == Blocks.f_50093_; ++ return this == Blocks.f_50440_ || this.m_49966_().m_204336_(BlockTags.f_144274_) || this == Blocks.f_50093_; + } else if (net.minecraftforge.common.PlantType.WATER.equals(type)) { + return state.m_60767_() == net.minecraft.world.level.material.Material.f_76305_; //&& state.getValue(BlockLiquidWrapper) + } else if (net.minecraftforge.common.PlantType.BEACH.equals(type)) { -+ boolean isBeach = state.m_60713_(Blocks.f_50440_) || BlockTags.f_144274_.m_8110_(this) || state.m_60713_(Blocks.f_49992_) || state.m_60713_(Blocks.f_49993_); ++ boolean isBeach = state.m_60713_(Blocks.f_50440_) || this.m_49966_().m_204336_(BlockTags.f_144274_) || state.m_60713_(Blocks.f_49992_) || state.m_60713_(Blocks.f_49993_); + boolean hasWater = false; + for (Direction face : Direction.Plane.HORIZONTAL) { + BlockState blockState = world.m_8055_(pos.m_142300_(face)); + net.minecraft.world.level.material.FluidState fluidState = world.m_6425_(pos.m_142300_(face)); + hasWater |= blockState.m_60713_(Blocks.f_50449_); -+ hasWater |= fluidState.m_76153_(net.minecraft.tags.FluidTags.f_13131_); ++ hasWater |= fluidState.m_205070_(net.minecraft.tags.FluidTags.f_13131_); + if (hasWater) + break; //No point continuing. + } @@ -165,12 +165,7 @@ + return false; + } + -+ @Override -+ public final java.util.Set getTags() { -+ return reverseTags.getTagNames(); -+ } -+ + /* ========================================= FORGE END ======================================*/ - public static final class BlockStatePairKey { - private final BlockState f_49980_; + /** @deprecated */ + @Deprecated diff --git a/patches/minecraft/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch index daa464dd1e..ba1af1343b 100644 --- a/patches/minecraft/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/EnchantmentTableBlock.java +++ b/net/minecraft/world/level/block/EnchantmentTableBlock.java -@@ -55,7 +_,7 @@ - if (p_52984_.nextInt(16) == 0) { - for(int k = 0; k <= 1; ++k) { - BlockPos blockpos = p_52983_.m_142082_(i, k, j); -- if (p_52982_.m_8055_(blockpos).m_60713_(Blocks.f_50078_)) { -+ if (p_52982_.m_8055_(blockpos).getEnchantPowerBonus(p_52982_, blockpos) > 0) { - if (!p_52982_.m_46859_(p_52983_.m_142082_(i / 2, 0, j / 2))) { - break; - } +@@ -40,7 +_,7 @@ + } + + public static boolean m_207909_(Level p_207910_, BlockPos p_207911_, BlockPos p_207912_) { +- return p_207910_.m_8055_(p_207911_.m_141952_(p_207912_)).m_60713_(Blocks.f_50078_) && p_207910_.m_46859_(p_207911_.m_142082_(p_207912_.m_123341_() / 2, p_207912_.m_123342_(), p_207912_.m_123343_() / 2)); ++ return p_207910_.m_8055_(p_207911_.m_141952_(p_207912_)).getEnchantPowerBonus(p_207910_, p_207911_.m_141952_(p_207912_)) != 0 && p_207910_.m_46859_(p_207911_.m_142082_(p_207912_.m_123341_() / 2, p_207912_.m_123342_(), p_207912_.m_123343_() / 2)); + } + + public boolean m_7923_(BlockState p_52997_) { diff --git a/patches/minecraft/net/minecraft/world/level/block/FireBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/FireBlock.java.patch index 0363473c71..917255bdd5 100644 --- a/patches/minecraft/net/minecraft/world/level/block/FireBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/FireBlock.java.patch @@ -20,7 +20,7 @@ } BlockState blockstate = p_53450_.m_8055_(p_53451_.m_7495_()); -- boolean flag = blockstate.m_60620_(p_53450_.m_6042_().m_63968_()); +- boolean flag = blockstate.m_204336_(p_53450_.m_6042_().m_204517_()); + boolean flag = blockstate.isFireSource(p_53450_, p_53451_, Direction.UP); int i = p_53449_.m_61143_(f_53408_); if (!flag && p_53450_.m_46471_() && this.m_53428_(p_53450_, p_53451_) && p_53452_.nextFloat() < 0.2F + (float)i * 0.03F) { diff --git a/patches/minecraft/net/minecraft/world/level/block/LiquidBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/LiquidBlock.java.patch index d99a32b03f..4655eaeee8 100644 --- a/patches/minecraft/net/minecraft/world/level/block/LiquidBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/LiquidBlock.java.patch @@ -45,7 +45,7 @@ @@ -120,13 +_,13 @@ BlockPos blockpos = p_54698_.m_142300_(direction.m_122424_()); - if (p_54697_.m_6425_(blockpos).m_76153_(FluidTags.f_13131_)) { + if (p_54697_.m_6425_(blockpos).m_205070_(FluidTags.f_13131_)) { Block block = p_54697_.m_6425_(p_54698_).m_76170_() ? Blocks.f_50080_ : Blocks.f_50652_; - p_54697_.m_46597_(p_54698_, block.m_49966_()); + p_54697_.m_46597_(p_54698_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_54697_, p_54698_, p_54698_, block.m_49966_())); diff --git a/patches/minecraft/net/minecraft/world/level/block/MushroomBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/MushroomBlock.java.patch index 39d6e6a210..c3362162c9 100644 --- a/patches/minecraft/net/minecraft/world/level/block/MushroomBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/MushroomBlock.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/block/MushroomBlock.java +++ b/net/minecraft/world/level/block/MushroomBlock.java -@@ -69,7 +_,7 @@ - if (blockstate.m_60620_(BlockTags.f_13057_)) { +@@ -70,7 +_,7 @@ + if (blockstate.m_204336_(BlockTags.f_13057_)) { return true; } else { - return p_54881_.m_45524_(p_54882_, 0) < 13 && this.m_6266_(blockstate, p_54881_, blockpos); diff --git a/patches/minecraft/net/minecraft/world/level/block/StemBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/StemBlock.java.patch index 73a27c49ae..36f47c2bf9 100644 --- a/patches/minecraft/net/minecraft/world/level/block/StemBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/StemBlock.java.patch @@ -18,7 +18,7 @@ Direction direction = Direction.Plane.HORIZONTAL.m_122560_(p_57045_); BlockPos blockpos = p_57044_.m_142300_(direction); BlockState blockstate = p_57043_.m_8055_(blockpos.m_7495_()); -- if (p_57043_.m_8055_(blockpos).m_60795_() && (blockstate.m_60713_(Blocks.f_50093_) || blockstate.m_60620_(BlockTags.f_144274_))) { +- if (p_57043_.m_8055_(blockpos).m_60795_() && (blockstate.m_60713_(Blocks.f_50093_) || blockstate.m_204336_(BlockTags.f_144274_))) { + Block block = blockstate.m_60734_(); + if (p_57043_.m_46859_(blockpos) && (blockstate.canSustainPlant(p_57043_, blockpos.m_7495_(), Direction.UP, this) || block == Blocks.f_50093_ || block == Blocks.f_50493_ || block == Blocks.f_50546_ || block == Blocks.f_50599_ || block == Blocks.f_50440_)) { p_57043_.m_46597_(blockpos, this.f_57015_.m_49966_()); diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch index 17883d7955..d834d61b5f 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -105,6 +_,7 @@ +@@ -107,6 +_,7 @@ this.f_58312_ = p_154994_; } @@ -8,7 +8,7 @@ public static Map m_58423_() { Map map = Maps.newLinkedHashMap(); m_58374_(map, Items.f_42448_, 20000); -@@ -204,9 +_,9 @@ +@@ -206,9 +_,9 @@ super.m_142466_(p_155025_); this.f_58310_ = NonNullList.m_122780_(this.m_6643_(), ItemStack.f_41583_); ContainerHelper.m_18980_(p_155025_, this.f_58310_); @@ -21,7 +21,7 @@ this.f_58317_ = this.m_7743_(this.f_58310_.get(1)); CompoundTag compoundtag = p_155025_.m_128469_("RecipesUsed"); -@@ -218,9 +_,9 @@ +@@ -220,9 +_,9 @@ protected void m_183515_(CompoundTag p_187452_) { super.m_183515_(p_187452_); @@ -34,7 +34,7 @@ ContainerHelper.m_18973_(p_187452_, this.f_58310_); CompoundTag compoundtag = new CompoundTag(); this.f_58320_.forEach((p_187449_, p_187450_) -> { -@@ -238,34 +_,35 @@ +@@ -240,34 +_,35 @@ ItemStack itemstack = p_155017_.f_58310_.get(1); if (p_155017_.m_58425_() || !itemstack.m_41619_() && !p_155017_.f_58310_.get(0).m_41619_()) { @@ -77,7 +77,7 @@ } } else { p_155017_.f_58318_ = 0; -@@ -286,9 +_,9 @@ +@@ -288,9 +_,9 @@ } @@ -89,7 +89,7 @@ if (itemstack.m_41619_()) { return false; } else { -@@ -297,10 +_,10 @@ +@@ -299,10 +_,10 @@ return true; } else if (!itemstack1.m_41656_(itemstack)) { return false; @@ -102,7 +102,7 @@ } } } else { -@@ -308,15 +_,15 @@ +@@ -310,15 +_,15 @@ } } @@ -122,7 +122,7 @@ } if (itemstack.m_150930_(Blocks.f_50057_.m_5456_()) && !p_155028_.get(1).m_41619_() && p_155028_.get(1).m_150930_(Items.f_42446_)) { -@@ -335,7 +_,7 @@ +@@ -337,7 +_,7 @@ return 0; } else { Item item = p_58343_.m_41720_(); @@ -131,7 +131,7 @@ } } -@@ -344,7 +_,7 @@ +@@ -346,7 +_,7 @@ } public static boolean m_58399_(ItemStack p_58400_) { @@ -140,7 +140,7 @@ } public int[] m_7071_(Direction p_58363_) { -@@ -424,7 +_,7 @@ +@@ -426,7 +_,7 @@ return true; } else { ItemStack itemstack = this.f_58310_.get(1); @@ -149,7 +149,7 @@ } } -@@ -482,5 +_,34 @@ +@@ -484,5 +_,34 @@ p_58342_.m_36491_(itemstack); } diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch index ff2f4ed518..5b54e0e019 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/net/minecraft/world/level/block/entity/BlockEntity.java @@ -15,7 +_,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; + import net.minecraft.world.level.block.state.BlockState; + import org.slf4j.Logger; -public abstract class BlockEntity { +public abstract class BlockEntity extends net.minecraftforge.common.capabilities.CapabilityProvider implements net.minecraftforge.common.extensions.IForgeBlockEntity { - private static final Logger f_58854_ = LogManager.getLogger(); + private static final Logger f_58854_ = LogUtils.getLogger(); private final BlockEntityType f_58855_; @Nullable @@ -23,11 +_,14 @@ diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntityType.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntityType.java.patch index 6283a0ce74..5f8a7e84e5 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntityType.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntityType.java.patch @@ -1,34 +1,11 @@ --- a/net/minecraft/world/level/block/entity/BlockEntityType.java +++ b/net/minecraft/world/level/block/entity/BlockEntityType.java @@ -17,7 +_,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; + import net.minecraft.world.level.block.state.BlockState; + import org.slf4j.Logger; -public class BlockEntityType { +public class BlockEntityType extends net.minecraftforge.registries.ForgeRegistryEntry> { - private static final Logger f_58913_ = LogManager.getLogger(); + private static final Logger f_58913_ = LogUtils.getLogger(); public static final BlockEntityType f_58917_ = m_58956_("furnace", BlockEntityType.Builder.m_155273_(FurnaceBlockEntity::new, Blocks.f_50094_)); public static final BlockEntityType f_58918_ = m_58956_("chest", BlockEntityType.Builder.m_155273_(ChestBlockEntity::new, Blocks.f_50087_)); -@@ -56,6 +_,7 @@ - private final BlockEntityType.BlockEntitySupplier f_58914_; - private final Set f_58915_; - private final Type f_58916_; -+ private final net.minecraftforge.common.util.ReverseTagWrapper> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, () -> net.minecraft.tags.SerializationTags.m_13199_().m_144452_(net.minecraftforge.registries.ForgeRegistries.Keys.BLOCK_ENTITY_TYPES)); - - @Nullable - public static ResourceLocation m_58954_(BlockEntityType p_58955_) { -@@ -75,6 +_,14 @@ - this.f_58914_ = p_155259_; - this.f_58915_ = p_155260_; - this.f_58916_ = p_155261_; -+ } -+ -+ public java.util.Set getTags() { -+ return reverseTags.getTagNames(); -+ } -+ -+ public boolean isIn(net.minecraft.tags.Tag> tag) { -+ return tag.m_8110_(this); - } - - @Nullable diff --git a/patches/minecraft/net/minecraft/world/level/block/state/BlockBehaviour.java.patch b/patches/minecraft/net/minecraft/world/level/block/state/BlockBehaviour.java.patch index 8add842fab..cf662902d0 100644 --- a/patches/minecraft/net/minecraft/world/level/block/state/BlockBehaviour.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/state/BlockBehaviour.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -64,7 +_,8 @@ +@@ -66,7 +_,8 @@ import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; @@ -10,7 +10,7 @@ protected static final Direction[] f_60441_ = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP}; protected final Material f_60442_; protected final boolean f_60443_; -@@ -91,6 +_,8 @@ +@@ -93,6 +_,8 @@ this.f_60449_ = p_60452_.f_60893_; this.f_60438_ = p_60452_.f_60903_; this.f_60439_ = p_60452_; @@ -19,7 +19,7 @@ } /** @deprecated */ -@@ -139,7 +_,7 @@ +@@ -141,7 +_,7 @@ /** @deprecated */ @Deprecated public void m_6810_(BlockState p_60515_, Level p_60516_, BlockPos p_60517_, BlockState p_60518_, boolean p_60519_) { @@ -28,7 +28,7 @@ p_60516_.m_46747_(p_60517_); } -@@ -220,7 +_,7 @@ +@@ -222,7 +_,7 @@ /** @deprecated */ @Deprecated public boolean m_6864_(BlockState p_60470_, BlockPlaceContext p_60471_) { @@ -37,7 +37,7 @@ } /** @deprecated */ -@@ -344,8 +_,8 @@ +@@ -346,8 +_,8 @@ if (f == -1.0F) { return 0.0F; } else { @@ -48,7 +48,7 @@ } } -@@ -378,8 +_,7 @@ +@@ -380,8 +_,7 @@ public final ResourceLocation m_60589_() { if (this.f_60440_ == null) { @@ -58,7 +58,7 @@ } return this.f_60440_; -@@ -402,6 +_,14 @@ +@@ -404,6 +_,14 @@ return this.f_60439_.f_60888_; } @@ -73,7 +73,7 @@ public abstract static class BlockStateBase extends StateHolder { private final int f_60594_; private final boolean f_60595_; -@@ -480,18 +_,22 @@ +@@ -482,18 +_,22 @@ return this.f_60595_; } @@ -97,7 +97,7 @@ public BlockState m_60717_(Rotation p_60718_) { return this.m_60734_().m_6843_(this.m_7160_(), p_60718_); } -@@ -863,8 +_,9 @@ +@@ -873,8 +_,9 @@ ResourceLocation f_60894_; boolean f_60895_ = true; boolean f_60896_; @@ -108,7 +108,7 @@ }; BlockBehaviour.StatePredicate f_60898_ = (p_60985_, p_60986_, p_60987_) -> { return p_60985_.m_60767_().m_76337_() && p_60985_.m_60838_(p_60986_, p_60987_); -@@ -991,9 +_,15 @@ +@@ -1001,9 +_,15 @@ return this; } diff --git a/patches/minecraft/net/minecraft/world/level/chunk/ChunkAccess.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/ChunkAccess.java.patch index 0911edf6ea..ff796ab299 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/ChunkAccess.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/ChunkAccess.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -410,4 +_,7 @@ +@@ -411,4 +_,7 @@ public static record TicksToSave(SerializableTickContainer f_187680_, SerializableTickContainer f_187681_) { } diff --git a/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch index 992b1c6cf8..3e1e581dea 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java @@ -49,7 +_,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; + import net.minecraft.world.ticks.TickContainerAccess; + import org.slf4j.Logger; -public class LevelChunk extends ChunkAccess { +public class LevelChunk extends ChunkAccess implements net.minecraftforge.common.capabilities.ICapabilityProviderImpl { - static final Logger f_62771_ = LogManager.getLogger(); + static final Logger f_62771_ = LogUtils.getLogger(); private static final TickingBlockEntity f_156361_ = new TickingBlockEntity() { public void m_142224_() { @@ -97,6 +_,7 @@ @@ -72,7 +72,7 @@ compoundtag1.m_128379_("keepPacked", false); return compoundtag1; + } catch (Exception e) { -+ LogManager.getLogger().error("A BlockEntity type {} has thrown an exception trying to write state. It will not persist, Report this to the mod author", blockentity.getClass().getName(), e); ++ f_62771_.error("A BlockEntity type {} has thrown an exception trying to write state. It will not persist, Report this to the mod author", blockentity.getClass().getName(), e); + return null; + } } else { @@ -162,20 +162,20 @@ profilerfiller.m_6521_(this::m_142280_); BlockState blockstate = LevelChunk.this.m_8055_(blockpos); if (this.f_156428_.m_58903_().m_155262_(blockstate)) { -@@ -638,6 +_,12 @@ +@@ -636,6 +_,12 @@ CrashReport crashreport = CrashReport.m_127521_(throwable, "Ticking block entity"); CrashReportCategory crashreportcategory = crashreport.m_127514_("Block entity being ticked"); this.f_156428_.m_58886_(crashreportcategory); + + if (net.minecraftforge.common.ForgeConfig.SERVER.removeErroringBlockEntities.get()) { -+ LogManager.getLogger().fatal("{}", crashreport.m_127526_()); ++ f_62771_.error("{}", crashreport.m_127526_()); + f_156428_.m_7651_(); + LevelChunk.this.m_8114_(f_156428_.m_58899_()); + } else throw new ReportedException(crashreport); } } -@@ -666,6 +_,34 @@ +@@ -664,6 +_,34 @@ IMMEDIATE, QUEUED, CHECK; diff --git a/patches/minecraft/net/minecraft/world/level/chunk/ProtoChunk.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/ProtoChunk.java.patch index cc5316fd1d..bbe33a02b2 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/ProtoChunk.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/ProtoChunk.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/net/minecraft/world/level/chunk/ProtoChunk.java -@@ -122,13 +_,13 @@ +@@ -123,13 +_,13 @@ if (this.f_187612_[l].m_188008_() && p_63218_.m_60713_(Blocks.f_50016_)) { return p_63218_; } else { diff --git a/patches/minecraft/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch index 4dbbc58d3e..4b530bc665 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -144,6 +_,7 @@ +@@ -146,6 +_,7 @@ return Registry.f_122822_.m_6612_(ResourceLocation.m_135820_(p_188285_)); }, p_188233_); chunkaccess = new LevelChunk(p_188231_.m_6018_(), p_188233_, upgradedata, levelchunkticks, levelchunkticks1, j1, alevelchunksection, m_196890_(p_188231_, p_188234_), blendingdata); @@ -8,7 +8,7 @@ } else { ProtoChunkTicks protochunkticks = ProtoChunkTicks.m_193302_(p_188234_.m_128437_("block_ticks", 10), (p_196906_) -> { return Registry.f_122824_.m_6612_(ResourceLocation.m_135820_(p_196906_)); -@@ -168,7 +_,7 @@ +@@ -170,7 +_,7 @@ boolean flag2 = chunkstatus.m_62427_(ChunkStatus.f_62323_) || belowzeroretrogen != null && belowzeroretrogen.m_188466_().m_62427_(ChunkStatus.f_62323_); if (!flag && flag2) { for(BlockPos blockpos : BlockPos.m_121976_(p_188233_.m_45604_(), p_188231_.m_141937_(), p_188233_.m_45605_(), p_188233_.m_45608_(), p_188231_.m_151558_() - 1, p_188233_.m_45609_())) { @@ -17,16 +17,16 @@ protochunk.m_63277_(blockpos); } } -@@ -191,7 +_,7 @@ +@@ -193,7 +_,7 @@ Heightmap.m_64256_(chunkaccess, enumset); CompoundTag compoundtag3 = p_188234_.m_128469_("structures"); chunkaccess.m_8040_(m_188254_(StructurePieceSerializationContext.m_192770_(p_188231_), compoundtag3, p_188231_.m_7328_())); -- chunkaccess.m_7946_(m_63471_(p_188233_, compoundtag3)); -+ net.minecraftforge.common.ForgeHooks.fixNullStructureReferences(chunkaccess, m_63471_(p_188233_, compoundtag3)); +- chunkaccess.m_7946_(m_208154_(p_188231_.m_5962_(), p_188233_, compoundtag3)); ++ net.minecraftforge.common.ForgeHooks.fixNullStructureReferences(chunkaccess, m_208154_(p_188231_.m_5962_(), p_188233_, compoundtag3)); if (p_188234_.m_128471_("shouldSave")) { chunkaccess.m_8092_(true); } -@@ -207,6 +_,7 @@ +@@ -209,6 +_,7 @@ } if (chunkstatus$chunktype == ChunkStatus.ChunkType.LEVELCHUNK) { @@ -34,7 +34,7 @@ return new ImposterProtoChunk((LevelChunk)chunkaccess, false); } else { ProtoChunk protochunk1 = (ProtoChunk)chunkaccess; -@@ -240,6 +_,7 @@ +@@ -242,6 +_,7 @@ protochunk1.m_188186_(generationstep$carving, new CarvingMask(compoundtag4.m_128467_(s1), chunkaccess.m_141937_())); } @@ -42,7 +42,7 @@ return protochunk1; } } -@@ -347,6 +_,15 @@ +@@ -349,6 +_,15 @@ } compoundtag.m_128365_("CarvingMasks", compoundtag4); @@ -53,7 +53,7 @@ + final CompoundTag capTag = levelChunk.writeCapsToNBT(); + if (capTag != null) compoundtag.m_128365_("ForgeCaps", capTag); + } catch (Exception exception) { -+ LogManager.getLogger().error("A capability provider has thrown an exception trying to write state. It will not persist. Report this to the mod author", exception); ++ f_63449_.error("A capability provider has thrown an exception trying to write state. It will not persist. Report this to the mod author", exception); + } } diff --git a/patches/minecraft/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch index 8487ef8b6e..a771146601 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch @@ -9,7 +9,7 @@ listtag.add(compoundtag1); + } + } catch (Exception e) { -+ LogManager.getLogger().error("An Entity type {} has thrown an exception trying to write state. It will not persist. Report this to the mod author", p_156567_.m_6095_(), e); ++ f_156535_.error("An Entity type {} has thrown an exception trying to write state. It will not persist. Report this to the mod author", p_156567_.m_6095_(), e); } }); diff --git a/patches/minecraft/net/minecraft/world/level/dimension/LevelStem.java.patch b/patches/minecraft/net/minecraft/world/level/dimension/LevelStem.java.patch index 370ce316f0..d906ff03b3 100644 --- a/patches/minecraft/net/minecraft/world/level/dimension/LevelStem.java.patch +++ b/patches/minecraft/net/minecraft/world/level/dimension/LevelStem.java.patch @@ -1,25 +1,25 @@ --- a/net/minecraft/world/level/dimension/LevelStem.java +++ b/net/minecraft/world/level/dimension/LevelStem.java -@@ -24,7 +_,9 @@ +@@ -23,7 +_,9 @@ public final class LevelStem { public static final Codec f_63970_ = RecordCodecBuilder.create((p_63986_) -> { + return net.minecraftforge.common.ForgeHooks.expandLevelStemCodec(p_63986_, () -> { // forge: reroute the codec builder here to add extra json fields - return p_63986_.group(DimensionType.f_63853_.fieldOf("type").flatXmap(ExtraCodecs.m_181037_(), ExtraCodecs.m_181037_()).forGetter(LevelStem::m_63981_), ChunkGenerator.f_62136_.fieldOf("generator").forGetter(LevelStem::m_63990_)).apply(p_63986_, p_63986_.stable(LevelStem::new)); + return p_63986_.group(DimensionType.f_63853_.fieldOf("type").forGetter(LevelStem::m_204521_), ChunkGenerator.f_62136_.fieldOf("generator").forGetter(LevelStem::m_63990_)).apply(p_63986_, p_63986_.stable(LevelStem::new)); + }); // forge: we're wrapping the original codec builder in our expansion up there }); public static final ResourceKey f_63971_ = ResourceKey.m_135785_(Registry.f_122820_, new ResourceLocation("overworld")); public static final ResourceKey f_63972_ = ResourceKey.m_135785_(Registry.f_122820_, new ResourceLocation("the_nether")); -@@ -34,6 +_,12 @@ +@@ -33,6 +_,12 @@ private final ChunkGenerator f_63976_; - public LevelStem(Supplier p_63979_, ChunkGenerator p_63980_) { -+ this(p_63979_, p_63980_, false); // forge: by default, dimension jsons use the fixed seed required by the vanilla format + public LevelStem(Holder p_204519_, ChunkGenerator p_204520_) { ++ this(p_204519_, p_204520_, false); // forge: by default, dimension jsons use the fixed seed required by the vanilla format + } // forge: reroute the vanilla constructor to our expanded constructor with default args + private final boolean useServerSeed; // forge: whether the dimension parser should use the server seed instead of the fixed seed + public boolean useServerSeed() { return this.useServerSeed; } -+ public LevelStem(Supplier p_63979_, ChunkGenerator p_63980_, boolean useServerSeed) { // forge: allow dimension jsons to specify that they should use the server seed instead of the fixed seed field ++ public LevelStem(Holder p_204519_, ChunkGenerator p_204520_, boolean useServerSeed) { // forge: allow dimension jsons to specify that they should use the server seed instead of the fixed seed field + this.useServerSeed = useServerSeed; // forge - this.f_63975_ = p_63979_; - this.f_63976_ = p_63980_; + this.f_63975_ = p_204519_; + this.f_63976_ = p_204520_; } diff --git a/patches/minecraft/net/minecraft/world/level/gameevent/GameEvent.java.patch b/patches/minecraft/net/minecraft/world/level/gameevent/GameEvent.java.patch deleted file mode 100644 index 7d5780881c..0000000000 --- a/patches/minecraft/net/minecraft/world/level/gameevent/GameEvent.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/net/minecraft/world/level/gameevent/GameEvent.java -+++ b/net/minecraft/world/level/gameevent/GameEvent.java -@@ -51,10 +_,15 @@ - public static final int f_157788_ = 16; - private final String f_157789_; - private final int f_157790_; -+ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.GameEventTags::m_144306_); - - public GameEvent(String p_157819_, int p_157820_) { - this.f_157789_ = p_157819_; - this.f_157790_ = p_157820_; -+ } -+ -+ public java.util.Set getTags() { -+ return reverseTags.getTagNames(); - } - - public String m_157821_() { diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/DebugLevelSource.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/DebugLevelSource.java.patch index c43c786192..baef5b7f74 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/DebugLevelSource.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/DebugLevelSource.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/DebugLevelSource.java +++ b/net/minecraft/world/level/levelgen/DebugLevelSource.java -@@ -107,6 +_,12 @@ +@@ -117,6 +_,12 @@ return blockstate; } @@ -12,4 +12,4 @@ + } public Climate.Sampler m_183403_() { - return (p_188507_, p_188508_, p_188509_) -> { + return Climate.m_207841_(); diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java.patch deleted file mode 100644 index 5645968ed1..0000000000 --- a/patches/minecraft/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -+++ b/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -@@ -387,6 +_,9 @@ - if (!p_158434_.m_186605_(p_158436_)) { - return super.m_142184_(p_158433_, p_158434_, p_158435_, p_158436_); - } else { -+ WeightedRandomList spawns = net.minecraftforge.common.world.StructureSpawnManager.getStructureSpawns(p_158434_, p_158435_, p_158436_); -+ if (spawns != null) return spawns; -+ if (false) {//Forge: We handle these hardcoded cases above in StructureSpawnManager#getStructureSpawns, but allow for insideOnly to be changed and allow for creatures to be spawned in ones other than just the witch hut - if (p_158434_.m_186613_(p_158436_, StructureFeature.f_67021_).m_73603_()) { - if (p_158435_ == MobCategory.MONSTER) { - return SwamplandHutFeature.f_67169_; -@@ -410,6 +_,7 @@ - return NetherFortressFeature.f_66381_; - } - } -+ } - - return (p_158435_ == MobCategory.UNDERGROUND_WATER_CREATURE || p_158435_ == MobCategory.AXOLOTLS) && p_158434_.m_186607_(p_158436_, StructureFeature.f_67023_).m_73603_() ? MobSpawnSettings.f_151796_ : super.m_142184_(p_158433_, p_158434_, p_158435_, p_158436_); - } diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/PatrolSpawner.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/PatrolSpawner.java.patch index 83500d2f8a..899600618b 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/PatrolSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/PatrolSpawner.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/PatrolSpawner.java +++ b/net/minecraft/world/level/levelgen/PatrolSpawner.java -@@ -103,6 +_,7 @@ +@@ -104,6 +_,7 @@ } patrollingmonster.m_6034_((double)p_64566_.m_123341_(), (double)p_64566_.m_123342_(), (double)p_64566_.m_123343_()); diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/WorldGenSettings.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/WorldGenSettings.java.patch index 4d67fc7b89..7494a84c9d 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/WorldGenSettings.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/WorldGenSettings.java.patch @@ -1,28 +1,19 @@ --- a/net/minecraft/world/level/levelgen/WorldGenSettings.java +++ b/net/minecraft/world/level/levelgen/WorldGenSettings.java @@ -39,6 +_,7 @@ - return p_64626_.group(Codec.LONG.fieldOf("seed").stable().forGetter(WorldGenSettings::m_64619_), Codec.BOOL.fieldOf("generate_features").orElse(true).stable().forGetter(WorldGenSettings::m_64657_), Codec.BOOL.fieldOf("bonus_chest").orElse(false).stable().forGetter(WorldGenSettings::m_64660_), MappedRegistry.m_122747_(Registry.f_122820_, Lifecycle.stable(), LevelStem.f_63970_).xmap(LevelStem::m_63987_, Function.identity()).fieldOf("dimensions").forGetter(WorldGenSettings::m_64663_), Codec.STRING.optionalFieldOf("legacy_custom_options").stable().forGetter((p_158959_) -> { + return p_64626_.group(Codec.LONG.fieldOf("seed").stable().forGetter(WorldGenSettings::m_64619_), Codec.BOOL.fieldOf("generate_features").orElse(true).stable().forGetter(WorldGenSettings::m_64657_), Codec.BOOL.fieldOf("bonus_chest").orElse(false).stable().forGetter(WorldGenSettings::m_64660_), RegistryCodecs.m_206318_(Registry.f_122820_, Lifecycle.stable(), LevelStem.f_63970_).xmap(LevelStem::m_204525_, Function.identity()).fieldOf("dimensions").forGetter(WorldGenSettings::m_204655_), Codec.STRING.optionalFieldOf("legacy_custom_options").stable().forGetter((p_158959_) -> { return p_158959_.f_64606_; })).apply(p_64626_, p_64626_.stable(WorldGenSettings::new)); + }).xmap(net.minecraftforge.common.ForgeHooks::loadDimensionsWithServerSeed, wgs -> {return wgs; // forge: when loading/registering json dimensions, replace hardcoded seeds of custom dimensions with the server/overworld's seed, where requested; fixes MC-195717 }).comapFlatMap(WorldGenSettings::m_64674_, Function.identity()); - private static final Logger f_64601_ = LogManager.getLogger(); + private static final Logger f_64601_ = LogUtils.getLogger(); private final long f_64602_; -@@ -198,7 +_,7 @@ - String s3 = (String)p_64649_.get("level-type"); - String s4 = Optional.ofNullable(s3).map((p_190047_) -> { - return p_190047_.toLowerCase(Locale.ROOT); -- }).orElse("default"); -+ }).orElseGet(net.minecraftforge.common.ForgeHooks::getDefaultWorldPreset); - p_64649_.put("level-type", s4); - long i = (new Random()).nextLong(); - if (!s1.isEmpty()) { -@@ -215,6 +_,8 @@ - Registry registry1 = p_64648_.m_175515_(Registry.f_122818_); - Registry registry = p_64648_.m_175515_(Registry.f_122885_); - MappedRegistry mappedregistry = DimensionType.m_188317_(p_64648_, i); -+ net.minecraftforge.common.world.ForgeWorldPreset type = net.minecraftforge.registries.ForgeRegistries.WORLD_TYPES.getValue(new net.minecraft.resources.ResourceLocation(s4)); -+ if (type != null) return type.createSettings(p_64648_, i, flag, false, s); - switch(s4) { +@@ -194,6 +_,8 @@ + Registry registry2 = p_209717_.m_175515_(Registry.f_211073_); + Registry registry3 = DimensionType.m_204490_(p_209717_, i); + String s = p_209718_.f_207545_(); ++ net.minecraftforge.common.world.ForgeWorldPreset type = net.minecraftforge.registries.ForgeRegistries.WORLD_TYPES.getValue(new net.minecraft.resources.ResourceLocation(s)); ++ if (type != null) return type.createSettings(p_209717_, i, p_209718_.f_207544_(), false, s); + switch(s) { case "flat": - JsonObject jsonobject = !s.isEmpty() ? GsonHelper.m_13864_(s) : new JsonObject(); + Dynamic dynamic = new Dynamic<>(JsonOps.INSTANCE, p_209718_.f_207543_()); diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/carver/WorldCarver.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/carver/WorldCarver.java.patch index 924da44d51..2901f98bc3 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/carver/WorldCarver.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/carver/WorldCarver.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/carver/WorldCarver.java +++ b/net/minecraft/world/level/levelgen/carver/WorldCarver.java -@@ -24,7 +_,7 @@ +@@ -26,7 +_,7 @@ import net.minecraft.world.level.material.Fluids; import org.apache.commons.lang3.mutable.MutableBoolean; diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/Feature.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/Feature.java.patch index 0db8cfe0de..d08ad7171e 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/Feature.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/feature/Feature.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/feature/Feature.java +++ b/net/minecraft/world/level/levelgen/feature/Feature.java -@@ -50,7 +_,7 @@ +@@ -52,7 +_,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.UnderwaterMagmaConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.VegetationPatchConfiguration; @@ -9,12 +9,12 @@ public static final Feature f_65759_ = m_65807_("no_op", new NoOpFeature(NoneFeatureConfiguration.f_67815_)); public static final Feature f_65760_ = m_65807_("tree", new TreeFeature(TreeConfiguration.f_68184_)); public static final Feature f_65761_ = m_65807_("flower", new RandomPatchFeature(RandomPatchConfiguration.f_67902_)); -@@ -157,7 +_,7 @@ - public abstract boolean m_142674_(FeaturePlaceContext p_159749_); +@@ -154,7 +_,7 @@ + } protected static boolean m_159747_(BlockState p_159748_) { -- return p_159748_.m_60620_(BlockTags.f_13061_); -+ return p_159748_.m_60620_(net.minecraftforge.common.Tags.Blocks.STONE); +- return p_159748_.m_204336_(BlockTags.f_13061_); ++ return p_159748_.m_204336_(net.minecraftforge.common.Tags.Blocks.STONE); } public static boolean m_159759_(BlockState p_159760_) { diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/NetherFortressFeature.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/NetherFortressFeature.java.patch deleted file mode 100644 index 40f64830e1..0000000000 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/NetherFortressFeature.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/feature/NetherFortressFeature.java -+++ b/net/minecraft/world/level/levelgen/feature/NetherFortressFeature.java -@@ -42,4 +_,11 @@ - - p_197129_.m_192792_(p_197130_.f_192708_(), 48, 70); - } -+ -+ @Override -+ public List getDefaultSpawnList(net.minecraft.world.entity.MobCategory category) { -+ if (category == net.minecraft.world.entity.MobCategory.MONSTER) -+ return f_66381_.m_146338_(); -+ return java.util.Collections.emptyList(); -+ } - } diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.java.patch deleted file mode 100644 index a64b7798c2..0000000000 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.java -+++ b/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.java -@@ -74,4 +_,11 @@ - return structurepiecesbuilder.m_192780_(); - } - } -+ -+ @Override -+ public java.util.List getDefaultSpawnList(net.minecraft.world.entity.MobCategory category) { -+ if (category == net.minecraft.world.entity.MobCategory.MONSTER) -+ return f_66469_.m_146338_(); -+ return java.util.Collections.emptyList(); -+ } - } diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/PillagerOutpostFeature.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/PillagerOutpostFeature.java.patch deleted file mode 100644 index 571148aa0e..0000000000 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/PillagerOutpostFeature.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/feature/PillagerOutpostFeature.java -+++ b/net/minecraft/world/level/levelgen/feature/PillagerOutpostFeature.java -@@ -52,4 +_,11 @@ - return false; - } - } -+ -+ @Override -+ public java.util.List getDefaultSpawnList(net.minecraft.world.entity.MobCategory category) { -+ if (category == net.minecraft.world.entity.MobCategory.MONSTER) -+ return f_66559_.m_146338_(); -+ return java.util.Collections.emptyList(); -+ } - } diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/StructureFeature.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/StructureFeature.java.patch index f53a1ae8ff..46c18e7f18 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/StructureFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/feature/StructureFeature.java.patch @@ -1,46 +1,11 @@ --- a/net/minecraft/world/level/levelgen/feature/StructureFeature.java +++ b/net/minecraft/world/level/levelgen/feature/StructureFeature.java -@@ -55,7 +_,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +@@ -46,7 +_,7 @@ + import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager; + import org.slf4j.Logger; -public class StructureFeature { -+public abstract class StructureFeature extends net.minecraftforge.registries.ForgeRegistryEntry> implements net.minecraftforge.common.extensions.IForgeStructureFeature { - public static final BiMap> f_67012_ = HashBiMap.create(); ++public abstract class StructureFeature extends net.minecraftforge.registries.ForgeRegistryEntry> { private static final Map, GenerationStep.Decoration> f_67032_ = Maps.newHashMap(); - private static final Logger f_67033_ = LogManager.getLogger(); -@@ -79,6 +_,7 @@ - public static final StructureFeature f_67030_ = m_67089_("Bastion_Remnant", new BastionFeature(JigsawConfiguration.f_67756_), GenerationStep.Decoration.SURFACE_STRUCTURES); - public static final List> f_67031_ = ImmutableList.of(f_67013_, f_67028_, f_67029_, f_67022_); - public static final int f_160446_ = 8; -+ private final net.minecraftforge.common.util.ReverseTagWrapper> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, () -> net.minecraft.tags.SerializationTags.m_13199_().m_144452_(Registry.f_122840_)); - private final Codec>> f_67036_; - private final PieceGeneratorSupplier f_191106_; - private final PostPlacementProcessor f_191107_; -@@ -103,6 +_,14 @@ - this.f_191107_ = p_197170_; - } - -+ public java.util.Set getTags() { -+ return reverseTags.getTagNames(); -+ } -+ -+ public boolean is(net.minecraft.tags.Tag> tag) { -+ return tag.m_8110_(this); -+ } -+ - public GenerationStep.Decoration m_67095_() { - return f_67032_.get(this); - } -@@ -256,6 +_,11 @@ - - public String m_67098_() { - return f_67012_.inverse().get(this); -+ } -+ -+ @Override -+ public final net.minecraft.util.random.WeightedRandomList getSpawnList(net.minecraft.world.entity.MobCategory classification) { -+ return net.minecraftforge.common.world.StructureSpawnManager.getSpawnList(this, classification); - } - - public BoundingBox m_183606_(BoundingBox p_191127_) { + private static final Logger f_67033_ = LogUtils.getLogger(); + public static final StructureFeature f_67013_ = m_67089_("pillager_outpost", new PillagerOutpostFeature(JigsawConfiguration.f_67756_), GenerationStep.Decoration.SURFACE_STRUCTURES); diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/SwamplandHutFeature.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/SwamplandHutFeature.java.patch deleted file mode 100644 index e19a9daa09..0000000000 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/SwamplandHutFeature.java.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/feature/SwamplandHutFeature.java -+++ b/net/minecraft/world/level/levelgen/feature/SwamplandHutFeature.java -@@ -22,4 +_,13 @@ - private static void m_197181_(StructurePiecesBuilder p_197182_, PieceGenerator.Context p_197183_) { - p_197182_.m_142679_(new SwamplandHutPiece(p_197183_.f_192708_(), p_197183_.f_192705_().m_45604_(), p_197183_.f_192705_().m_45605_())); - } -+ -+ @Override -+ public java.util.List getDefaultSpawnList(net.minecraft.world.entity.MobCategory category) { -+ if (category == net.minecraft.world.entity.MobCategory.MONSTER) -+ return f_67169_.m_146338_(); -+ else if (category == net.minecraft.world.entity.MobCategory.CREATURE) -+ return f_67170_.m_146338_(); -+ return java.util.Collections.emptyList(); -+ } - } diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/structures/SinglePoolElement.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/structures/SinglePoolElement.java.patch deleted file mode 100644 index ec31d575c9..0000000000 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/structures/SinglePoolElement.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/feature/structures/SinglePoolElement.java -+++ b/net/minecraft/world/level/levelgen/feature/structures/SinglePoolElement.java -@@ -112,7 +_,7 @@ - if (!structuretemplate.m_74536_(p_69123_, p_69126_, p_69127_, structureplacesettings, p_69130_, 18)) { - return false; - } else { -- for(StructureTemplate.StructureBlockInfo structuretemplate$structureblockinfo : StructureTemplate.m_74517_(p_69123_, p_69126_, p_69127_, structureplacesettings, this.m_69141_(p_69122_, p_69126_, p_69128_, false))) { -+ for(StructureTemplate.StructureBlockInfo structuretemplate$structureblockinfo : StructureTemplate.processBlockInfos(p_69123_, p_69126_, p_69127_, structureplacesettings, this.m_69141_(p_69122_, p_69126_, p_69128_, false), structuretemplate)) { - this.m_69157_(p_69123_, structuretemplate$structureblockinfo, p_69126_, p_69128_, p_69130_, p_69129_); - } - diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/structures/StructureTemplatePool.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/structures/StructureTemplatePool.java.patch deleted file mode 100644 index c3de9db562..0000000000 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/structures/StructureTemplatePool.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/feature/structures/StructureTemplatePool.java -+++ b/net/minecraft/world/level/levelgen/feature/structures/StructureTemplatePool.java -@@ -106,11 +_,11 @@ - return this.f_69250_.size(); - } - -- public static enum Projection implements StringRepresentable { -+ public static enum Projection implements StringRepresentable, net.minecraftforge.common.IExtensibleEnum { - TERRAIN_MATCHING("terrain_matching", ImmutableList.of(new GravityProcessor(Heightmap.Types.WORLD_SURFACE_WG, -1))), - RIGID("rigid", ImmutableList.of()); - -- public static final Codec f_69281_ = StringRepresentable.m_14350_(StructureTemplatePool.Projection::values, StructureTemplatePool.Projection::m_69295_); -+ public static final Codec f_69281_ = net.minecraftforge.common.IExtensibleEnum.createCodecForExtensibleEnum(StructureTemplatePool.Projection::values, StructureTemplatePool.Projection::m_69295_); - private static final Map f_69282_ = Arrays.stream(values()).collect(Collectors.toMap(StructureTemplatePool.Projection::m_69297_, (p_69294_) -> { - return p_69294_; - })); -@@ -136,6 +_,16 @@ - - public String m_7912_() { - return this.f_69283_; -+ } -+ -+ public static Projection create(String enumName, String p_i50487_3_, ImmutableList p_i50487_4_) { -+ throw new IllegalStateException("Enum not extended"); -+ } -+ -+ @Override -+ @Deprecated -+ public void init() { -+ f_69282_.put(m_69297_(), this); - } - } - } diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/flat/FlatLevelGeneratorSettings.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/flat/FlatLevelGeneratorSettings.java.patch index 153929dd86..ea2a13ea28 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/flat/FlatLevelGeneratorSettings.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/flat/FlatLevelGeneratorSettings.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/levelgen/flat/FlatLevelGeneratorSettings.java +++ b/net/minecraft/world/level/levelgen/flat/FlatLevelGeneratorSettings.java -@@ -152,7 +_,7 @@ +@@ -147,7 +_,7 @@ } } -- return (new Biome.BiomeBuilder()).m_47597_(biome.m_47530_()).m_47595_(biome.m_47567_()).m_47609_(biome.m_47554_()).m_47611_(biome.m_47548_()).m_47603_(biome.m_47557_()).m_47601_(biomegenerationsettings$builder.m_47831_()).m_47605_(biome.m_47518_()).m_47592_(); -+ return (new Biome.BiomeBuilder()).m_47597_(biome.m_47530_()).m_47595_(biome.m_47567_()).m_47609_(biome.m_47554_()).m_47611_(biome.m_47548_()).m_47603_(biome.m_47557_()).m_47601_(biomegenerationsettings$builder.m_47831_()).m_47605_(biome.m_47518_()).m_47592_().setRegistryName(biome.getRegistryName()); +- return Holder.m_205709_(Biome.BiomeBuilder.m_204185_(biome).m_47601_(biomegenerationsettings$builder.m_47831_()).m_47592_()); ++ return Holder.m_205709_(Biome.BiomeBuilder.m_204185_(biome).m_47601_(biomegenerationsettings$builder.m_47831_()).m_47592_().setRegistryName(biome.getRegistryName())); } - public StructureSettings m_70395_() { + public Optional> m_209810_() { diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch index 1a1356ed05..40998037d0 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch @@ -4,9 +4,9 @@ } public final CompoundTag m_192644_(StructurePieceSerializationContext p_192645_) { -+ if (Registry.f_122843_.m_7981_(this.m_73550_()) == null) { // FORGE: Friendlier error then the Null String error below. -+ throw new RuntimeException("StructurePiece \"" + this.getClass().getName() + "\": \"" + this.m_73550_() + "\" missing ID Mapping, Modder see MapGenStructureIO"); ++ if (Registry.f_122843_.m_7981_(this.m_210000_()) == null) { // FORGE: Friendlier error then the Null String error below. ++ throw new RuntimeException("StructurePiece \"" + this.getClass().getName() + "\": \"" + this.m_210000_() + "\" missing ID Mapping, Modder see MapGenStructureIO"); + } CompoundTag compoundtag = new CompoundTag(); - compoundtag.m_128359_("id", Registry.f_122843_.m_7981_(this.m_73550_()).toString()); + compoundtag.m_128359_("id", Registry.f_122843_.m_7981_(this.m_210000_()).toString()); BoundingBox.f_162354_.encodeStart(NbtOps.f_128958_, this.f_73383_).resultOrPartial(f_163536_::error).ifPresent((p_163579_) -> { diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructureStart.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructureStart.java.patch index 0ec2bde494..b7d012c293 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructureStart.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/structure/StructureStart.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/level/levelgen/structure/StructureStart.java +++ b/net/minecraft/world/level/levelgen/structure/StructureStart.java -@@ -62,6 +_,9 @@ +@@ -61,6 +_,9 @@ public CompoundTag m_192660_(StructurePieceSerializationContext p_192661_, ChunkPos p_192662_) { CompoundTag compoundtag = new CompoundTag(); if (this.m_73603_()) { -+ if (Registry.f_122841_.m_7981_(this.m_73610_()) == null) { // FORGE: This is just a more friendly error instead of the 'Null String' below -+ throw new RuntimeException("StructureStart \"" + this.getClass().getName() + "\": \"" + this.m_73610_() + "\" missing ID Mapping, Modder see MapGenStructureIO"); ++ if (p_192661_.f_192763_().m_175515_(Registry.f_122882_).m_7981_(this.m_210081_()) == null) { // FORGE: This is just a more friendly error instead of the 'Null String' below ++ throw new RuntimeException("StructureStart \"" + this.getClass().getName() + "\": \"" + this.m_210081_() + "\" missing ID Mapping, Modder see MapGenStructureIO"); + } - compoundtag.m_128359_("id", Registry.f_122841_.m_7981_(this.m_73610_()).toString()); + compoundtag.m_128359_("id", p_192661_.f_192763_().m_175515_(Registry.f_122882_).m_7981_(this.f_73565_).toString()); compoundtag.m_128405_("ChunkX", p_192662_.f_45578_); compoundtag.m_128405_("ChunkZ", p_192662_.f_45579_); diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch index e8e52f4d68..b7cb6085e6 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch @@ -90,14 +90,14 @@ @@ -390,10 +_,10 @@ compoundtag.m_128365_("Pos", listtag); compoundtag.m_128473_("UUID"); - m_74543_(p_74524_, compoundtag).ifPresent((p_74553_) -> { -- float f = p_74553_.m_6961_(p_74526_); -- f += p_74553_.m_146908_() - p_74553_.m_7890_(p_74527_); -+ float f = p_74553_.m_6961_(placementIn.m_74401_()); -+ f = f + (p_74553_.m_146908_() - p_74553_.m_7890_(placementIn.m_74404_())); - p_74553_.m_7678_(vec31.f_82479_, vec31.f_82480_, vec31.f_82481_, f, p_74553_.m_146909_()); -- if (p_74530_ && p_74553_ instanceof Mob) { -+ if (placementIn.m_74414_() && p_74553_ instanceof Mob) { - ((Mob)p_74553_).m_6518_(p_74524_, p_74524_.m_6436_(new BlockPos(vec31)), MobSpawnType.STRUCTURE, (SpawnGroupData)null, compoundtag); + m_74543_(p_74524_, compoundtag).ifPresent((p_205061_) -> { +- float f = p_205061_.m_7890_(p_74527_); +- f += p_205061_.m_6961_(p_74526_) - p_205061_.m_146908_(); ++ float f = p_205061_.m_6961_(placementIn.m_74401_()); ++ f = f + (p_205061_.m_146908_() - p_205061_.m_7890_(placementIn.m_74404_())); + p_205061_.m_7678_(vec31.f_82479_, vec31.f_82480_, vec31.f_82481_, f, p_205061_.m_146909_()); +- if (p_74530_ && p_205061_ instanceof Mob) { ++ if (placementIn.m_74414_() && p_205061_ instanceof Mob) { + ((Mob)p_205061_).m_6518_(p_74524_, p_74524_.m_6436_(new BlockPos(vec31)), MobSpawnType.STRUCTURE, (SpawnGroupData)null, compoundtag); } diff --git a/patches/minecraft/net/minecraft/world/level/material/Fluid.java.patch b/patches/minecraft/net/minecraft/world/level/material/Fluid.java.patch index 024722b9a0..2475fd8f12 100644 --- a/patches/minecraft/net/minecraft/world/level/material/Fluid.java.patch +++ b/patches/minecraft/net/minecraft/world/level/material/Fluid.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/material/Fluid.java +++ b/net/minecraft/world/level/material/Fluid.java -@@ -18,7 +_,7 @@ +@@ -20,7 +_,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.VoxelShape; @@ -9,19 +9,13 @@ public static final IdMapper f_76104_ = new IdMapper<>(); protected final StateDefinition f_76105_; private FluidState f_76103_; -@@ -96,6 +_,28 @@ +@@ -101,6 +_,22 @@ } public abstract VoxelShape m_7999_(FluidState p_76137_, BlockGetter p_76138_, BlockPos p_76139_); + -+ private final net.minecraftforge.common.util.ReverseTagWrapper reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.FluidTags::m_144299_); -+ @Override -+ public java.util.Set getTags() { -+ return reverseTags.getTagNames(); -+ } -+ + /** -+ * Creates the fluid attributes object, which will contain all the extended values for the fluid that aren't part of the vanilla system. ++ * Creates the fluid attributes object, which wilAl contain all the extended values for the fluid that aren't part of the vanilla system. + * Do not call this from outside. To retrieve the values use {@link Fluid#getAttributes()} + */ + protected net.minecraftforge.fluids.FluidAttributes createAttributes() diff --git a/patches/minecraft/net/minecraft/world/level/material/FluidState.java.patch b/patches/minecraft/net/minecraft/world/level/material/FluidState.java.patch index 9d25ea00dc..0568b8e884 100644 --- a/patches/minecraft/net/minecraft/world/level/material/FluidState.java.patch +++ b/patches/minecraft/net/minecraft/world/level/material/FluidState.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/material/FluidState.java +++ b/net/minecraft/world/level/material/FluidState.java -@@ -18,7 +_,7 @@ +@@ -21,7 +_,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.VoxelShape; @@ -9,7 +9,7 @@ public static final Codec f_76146_ = m_61127_(Registry.f_122822_.m_194605_(), Fluid::m_76145_).stable(); public static final int f_164510_ = 9; public static final int f_164511_ = 8; -@@ -106,6 +_,7 @@ +@@ -113,6 +_,7 @@ return this.m_76152_() == p_192918_; } diff --git a/patches/minecraft/net/minecraft/world/level/material/LavaFluid.java.patch b/patches/minecraft/net/minecraft/world/level/material/LavaFluid.java.patch index 2f51266bb1..4f53fb1b6d 100644 --- a/patches/minecraft/net/minecraft/world/level/material/LavaFluid.java.patch +++ b/patches/minecraft/net/minecraft/world/level/material/LavaFluid.java.patch @@ -48,7 +48,7 @@ return ParticleTypes.f_123800_; @@ -164,7 +_,7 @@ FluidState fluidstate = p_76220_.m_6425_(p_76221_); - if (this.m_76108_(FluidTags.f_13132_) && fluidstate.m_76153_(FluidTags.f_13131_)) { + if (this.m_205067_(FluidTags.f_13132_) && fluidstate.m_205070_(FluidTags.f_13131_)) { if (p_76222_.m_60734_() instanceof LiquidBlock) { - p_76220_.m_7731_(p_76221_, Blocks.f_50069_.m_49966_(), 3); + p_76220_.m_7731_(p_76221_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_76220_, p_76221_, p_76221_, Blocks.f_50069_.m_49966_()), 3); diff --git a/patches/minecraft/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch b/patches/minecraft/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch index 06eee22430..41a0794110 100644 --- a/patches/minecraft/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch +++ b/patches/minecraft/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/pathfinder/BlockPathTypes.java +++ b/net/minecraft/world/level/pathfinder/BlockPathTypes.java -@@ -36,4 +_,13 @@ +@@ -37,4 +_,13 @@ public float m_77124_() { return this.f_77117_; } diff --git a/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch b/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch index 5cc7bc8471..4bd0f8d3e0 100644 --- a/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch +++ b/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +++ b/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -@@ -472,6 +_,8 @@ +@@ -476,6 +_,8 @@ protected static BlockPathTypes m_77643_(BlockGetter p_77644_, BlockPos p_77645_) { BlockState blockstate = p_77644_.m_8055_(p_77645_); diff --git a/patches/minecraft/net/minecraft/world/level/storage/LevelStorageSource.java.patch b/patches/minecraft/net/minecraft/world/level/storage/LevelStorageSource.java.patch index 21f38fc7a0..bd6101f22e 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/LevelStorageSource.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/LevelStorageSource.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/storage/LevelStorageSource.java +++ b/net/minecraft/world/level/storage/LevelStorageSource.java -@@ -299,6 +_,19 @@ - return LevelStorageSource.this.m_78229_(this.f_78271_.toFile(), LevelStorageSource.m_78247_(p_78281_, p_78282_)); +@@ -324,6 +_,19 @@ + return LevelStorageSource.this.m_78229_(this.f_78271_.toFile(), LevelStorageSource.m_211737_(p_211748_, p_211749_, p_211750_)); } + public void readAdditionalLevelSaveData() { @@ -20,7 +20,7 @@ @Nullable public DataPackConfig m_78309_() { this.m_78313_(); -@@ -315,6 +_,8 @@ +@@ -340,6 +_,8 @@ CompoundTag compoundtag1 = new CompoundTag(); compoundtag1.m_128365_("Data", compoundtag); @@ -29,7 +29,7 @@ try { File file2 = File.createTempFile("level", ".dat", file1); NbtIo.m_128944_(compoundtag1, file2); -@@ -329,6 +_,10 @@ +@@ -354,6 +_,10 @@ public Optional m_182514_() { return !this.f_78270_.m_13639_() ? Optional.empty() : Optional.of(this.f_78271_.resolve("icon.png")); diff --git a/src/generated_test/resources/.cache/cache b/src/generated_test/resources/.cache/cache index 420654fb02..d762f8cd43 100644 --- a/src/generated_test/resources/.cache/cache +++ b/src/generated_test/resources/.cache/cache @@ -84,12 +84,6 @@ bab7cd04569c8aa63320772acdc3c91a5ceda14a assets/new_model_loader_test/models/blo d2c8e860521c5e738ed0798337f5728d610825ff assets/piston_event_test/models/block/shiftonmove.json f51f026a75e27a0a53a76771d553c0e3385a2966 assets/piston_event_test/models/item/shiftonmove.json cf16f861eaf5815238c2278eb48bde0688cb73b7 assets/scaffolding_test/blockstates/scaffolding_method_test.json -8b6073e66bdfecc75229939f550c32460f9b3d81 data/custom_tag_types_test/tags/block_entity_types/storage.json -862196702dcd5538c5ceb4ac6202e57eb5c8a97f data/custom_tag_types_test/tags/custom_tag_types_test/custom_types/tests.json -8c1969250406edfbd470cc06aca4dcccfd6ce682 data/custom_tag_types_test/tags/enchantments/fire.json -acd80cfdb22681f810e41f38776a4ff7ef703799 data/custom_tag_types_test/tags/mob_effects/beacon.json -44985f1cb0df54b632187ed97a6a443455f1e51c data/custom_tag_types_test/tags/potions/damage.json -0b9850b6647ef27f5af6b459749b386ae396aac1 data/custom_tag_types_test/tags/structure_features/overworld_temple.json 806659ba3e9c12797df0fe7211a222795834fdfd data/data_gen_test/advancements/conditional.json 0001aa55877ddee50e3180db7337e926797d7e4d data/data_gen_test/advancements/obtain_dirt.json 76e760c8e8a1bbd3fb5538bc2d773c117016c0ce data/data_gen_test/advancements/recipes/conditional2.json diff --git a/src/generated_test/resources/data/custom_tag_types_test/tags/block_entity_types/storage.json b/src/generated_test/resources/data/custom_tag_types_test/tags/block_entity_types/storage.json deleted file mode 100644 index 7915067f6b..0000000000 --- a/src/generated_test/resources/data/custom_tag_types_test/tags/block_entity_types/storage.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "replace": false, - "values": [ - "minecraft:barrel", - "minecraft:chest", - "minecraft:ender_chest", - "minecraft:trapped_chest" - ] -} \ No newline at end of file diff --git a/src/generated_test/resources/data/custom_tag_types_test/tags/custom_tag_types_test/custom_types/tests.json b/src/generated_test/resources/data/custom_tag_types_test/tags/custom_tag_types_test/custom_types/tests.json deleted file mode 100644 index f9040df204..0000000000 --- a/src/generated_test/resources/data/custom_tag_types_test/tags/custom_tag_types_test/custom_types/tests.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "replace": false, - "values": [ - "custom_tag_types_test:custom" - ] -} \ No newline at end of file diff --git a/src/generated_test/resources/data/custom_tag_types_test/tags/enchantments/fire.json b/src/generated_test/resources/data/custom_tag_types_test/tags/enchantments/fire.json deleted file mode 100644 index 14ae0bf5c5..0000000000 --- a/src/generated_test/resources/data/custom_tag_types_test/tags/enchantments/fire.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "replace": false, - "values": [ - "minecraft:fire_aspect", - "minecraft:flame" - ] -} \ No newline at end of file diff --git a/src/generated_test/resources/data/custom_tag_types_test/tags/mob_effects/beacon.json b/src/generated_test/resources/data/custom_tag_types_test/tags/mob_effects/beacon.json deleted file mode 100644 index 298ab5885a..0000000000 --- a/src/generated_test/resources/data/custom_tag_types_test/tags/mob_effects/beacon.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "replace": false, - "values": [ - "minecraft:speed", - "minecraft:jump_boost", - "minecraft:haste", - "minecraft:regeneration", - "minecraft:resistance", - "minecraft:strength" - ] -} \ No newline at end of file diff --git a/src/generated_test/resources/data/custom_tag_types_test/tags/potions/damage.json b/src/generated_test/resources/data/custom_tag_types_test/tags/potions/damage.json deleted file mode 100644 index 8ea8224710..0000000000 --- a/src/generated_test/resources/data/custom_tag_types_test/tags/potions/damage.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "replace": false, - "values": [ - "minecraft:harming", - "minecraft:strong_harming" - ] -} \ No newline at end of file diff --git a/src/generated_test/resources/data/custom_tag_types_test/tags/structure_features/overworld_temple.json b/src/generated_test/resources/data/custom_tag_types_test/tags/structure_features/overworld_temple.json deleted file mode 100644 index f5036289e1..0000000000 --- a/src/generated_test/resources/data/custom_tag_types_test/tags/structure_features/overworld_temple.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "replace": false, - "values": [ - "minecraft:desert_pyramid", - "minecraft:jungle_pyramid" - ] -} \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/ForgeWorldPresetScreens.java b/src/main/java/net/minecraftforge/client/ForgeWorldPresetScreens.java index 9926181b42..bdb52731e9 100644 --- a/src/main/java/net/minecraftforge/client/ForgeWorldPresetScreens.java +++ b/src/main/java/net/minecraftforge/client/ForgeWorldPresetScreens.java @@ -89,7 +89,7 @@ public class ForgeWorldPresetScreens @Nonnull @Override - public WorldGenSettings create(@Nonnull RegistryAccess.RegistryHolder dynamicRegistries, long seed, boolean generateStructures, boolean bonusChest) + public WorldGenSettings create(@Nonnull RegistryAccess dynamicRegistries, long seed, boolean generateStructures, boolean bonusChest) { return worldPreset.createSettings(dynamicRegistries, seed, generateStructures, bonusChest, ""); } diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 50e75ab28d..7bf3338179 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -46,7 +46,9 @@ import javax.annotation.Nullable; import it.unimi.dsi.fastutil.longs.LongSet; import net.minecraft.advancements.Advancement; +import net.minecraft.core.*; import net.minecraft.tags.BlockTags; +import net.minecraft.tags.TagKey; import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; @@ -56,6 +58,7 @@ import net.minecraft.world.item.*; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; import net.minecraft.world.level.storage.WorldData; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootTable; @@ -88,8 +91,6 @@ import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.item.alchemy.PotionUtils; import net.minecraft.stats.Stats; import net.minecraft.world.phys.Vec3; -import net.minecraft.core.Registry; -import net.minecraft.core.MappedRegistry; import net.minecraft.world.*; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkGenerator; @@ -101,7 +102,6 @@ import net.minecraft.world.level.block.entity.FurnaceBlockEntity; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.phys.AABB; -import net.minecraft.core.BlockPos; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; @@ -170,7 +170,6 @@ import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.MarkerManager; import net.minecraft.ChatFormatting; -import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.TextColor; @@ -525,7 +524,7 @@ public class ForgeHooks if (!entityPlayer.mayBuild()) { - if (itemstack.isEmpty() || !itemstack.hasAdventureModeBreakTagForBlock(level.getTagManager(), new BlockInWorld(level, pos, false))) + if (itemstack.isEmpty() || !itemstack.hasAdventureModeBreakTagForBlock(level.registryAccess().registryOrThrow(Registry.BLOCK_REGISTRY), new BlockInWorld(level, pos, false))) preCancelEvent = true; } } @@ -568,7 +567,7 @@ public class ForgeHooks Level level = context.getLevel(); Player player = context.getPlayer(); - if (player != null && !player.getAbilities().mayBuild && !itemstack.hasAdventureModePlaceTagForBlock(level.getTagManager(), new BlockInWorld(level, context.getClickedPos(), false))) + if (player != null && !player.getAbilities().mayBuild && !itemstack.hasAdventureModePlaceTagForBlock(level.registryAccess().registryOrThrow(Registry.BLOCK_REGISTRY), new BlockInWorld(level, context.getClickedPos(), false))) return InteractionResult.PASS; // handle all placement events here @@ -860,7 +859,7 @@ public class ForgeHooks return "default"; } - public static Tag getTagFromVanillaTier(Tiers tier) + public static TagKey getTagFromVanillaTier(Tiers tier) { return switch(tier) { @@ -1089,10 +1088,10 @@ public class ForgeHooks String s = GsonHelper.convertToString(entry, "value"); Tag.Entry dummy; if (!s.startsWith("#")) - dummy = new Tag.ElementEntry(new ResourceLocation(s)); + dummy = new Tag.OptionalElementEntry(new ResourceLocation(s)); else dummy = new Tag.TagEntry(new ResourceLocation(s.substring(1))); - allList.removeIf(e -> e.getEntry().equals(dummy)); + allList.removeIf(e -> e.entry().equals(dummy)); } } } @@ -1217,7 +1216,7 @@ public class ForgeHooks * When a structure mod is removed, this map may contain null keys. This will make the world unable to save if this persists. * If we remove a structure from the save data in this way, we then mark the chunk for saving */ - public static void fixNullStructureReferences(ChunkAccess chunk, Map, LongSet> structureReferences) + public static void fixNullStructureReferences(ChunkAccess chunk, Map, LongSet> structureReferences) { if (structureReferences.remove(null) != null) { @@ -1230,7 +1229,7 @@ public class ForgeHooks private static final String DIMENSIONS_KEY = "dimensions"; private static final String SEED_KEY = "seed"; //No to static init! - private static final Supplier>> CODEC = Suppliers.memoize(() -> MappedRegistry.dataPackCodec(Registry.LEVEL_STEM_REGISTRY, Lifecycle.stable(), LevelStem.CODEC).xmap(LevelStem::sortMap, Function.identity())); + private static final Supplier>> CODEC = Suppliers.memoize(() -> RegistryCodecs.dataPackAwareCodec(Registry.LEVEL_STEM_REGISTRY, Lifecycle.stable(), LevelStem.CODEC).xmap(LevelStem::sortMap, Function.identity())); private static final Map, AttributeSupplier> FORGE_ATTRIBUTES = new HashMap<>(); /** FOR INTERNAL USE ONLY, DO NOT CALL DIRECTLY */ @@ -1281,19 +1280,19 @@ public class ForgeHooks long seed = wgs.seed(); boolean generateFeatures = wgs.generateFeatures(); boolean generateBonusChest = wgs.generateBonusChest(); - MappedRegistry originalRegistry = wgs.dimensions(); + Registry originalRegistry = wgs.dimensions(); Optional legacyCustomOptions = wgs.legacyCustomOptions; // make a copy of the dimension registry; for dimensions that specify that they should use the server seed instead // of the hardcoded json seed, recreate them with the correct seed - MappedRegistry seededRegistry = new MappedRegistry<>(Registry.LEVEL_STEM_REGISTRY, Lifecycle.experimental()); + MappedRegistry seededRegistry = new MappedRegistry<>(Registry.LEVEL_STEM_REGISTRY, Lifecycle.experimental(), (Function>)null); for (Entry, LevelStem> entry : originalRegistry.entrySet()) { ResourceKey key = entry.getKey(); LevelStem dimension = entry.getValue(); if (dimension.useServerSeed()) { - seededRegistry.register(key, new LevelStem(dimension.typeSupplier(), dimension.generator().withSeed(seed), true), originalRegistry.lifecycle(entry.getValue())); + seededRegistry.register(key, new LevelStem(dimension.typeHolder(), dimension.generator().withSeed(seed), true), originalRegistry.lifecycle(entry.getValue())); } else { @@ -1310,7 +1309,7 @@ public class ForgeHooks App, LevelStem> vanillaFields = vanillaFieldsSupplier.get(); return builder.group(vanillaFields).and( Codec.BOOL.optionalFieldOf("forge:use_server_seed", false).stable().forGetter(levelStem -> levelStem.useServerSeed())) - .apply(builder, builder.stable((stem, useServerSeed) -> new LevelStem(stem.typeSupplier(), stem.generator(), useServerSeed))); + .apply(builder, builder.stable((stem, useServerSeed) -> new LevelStem(stem.typeHolder(), stem.generator(), useServerSeed))); } public static void writeAdditionalLevelSaveData(WorldData worldData, CompoundTag levelTag) diff --git a/src/main/java/net/minecraftforge/common/ForgeStatesProvider.java b/src/main/java/net/minecraftforge/common/ForgeStatesProvider.java index 07c6e4f0be..a1332ca828 100644 --- a/src/main/java/net/minecraftforge/common/ForgeStatesProvider.java +++ b/src/main/java/net/minecraftforge/common/ForgeStatesProvider.java @@ -27,13 +27,13 @@ public class ForgeStatesProvider implements IModStateProvider { final ModLoadingState CREATE_REGISTRIES = ModLoadingState.withTransition("CREATE_REGISTRIES", "CONSTRUCT", ModLoadingPhase.GATHER, SerialTransition.of(()-> Stream.of(IModStateTransition.EventGenerator.fromFunction(RegistryEvent.NewRegistry::new)))); final ModLoadingState OBJECT_HOLDERS = ModLoadingState.withInline("OBJECT_HOLDERS", "CREATE_REGISTRIES", ModLoadingPhase.GATHER, ml-> ObjectHolderRegistry.findObjectHolders()); final ModLoadingState INJECT_CAPABILITIES = ModLoadingState.withInline("INJECT_CAPABILITIES", "OBJECT_HOLDERS", ModLoadingPhase.GATHER, ml-> CapabilityManager.INSTANCE.injectCapabilities(ml.getAllScanData())); - final ModLoadingState CUSTOM_TAGS = ModLoadingState.withInline("CUSTOM_TAGS", "INJECT_CAPABILITIES", ModLoadingPhase.GATHER, ml-> GameData.setCustomTagTypesFromRegistries()); - final ModLoadingState LOAD_REGISTRIES = ModLoadingState.withTransition("LOAD_REGISTRIES", "CUSTOM_TAGS", ModLoadingPhase.GATHER, new SerialTransition>(GameData::generateRegistryEvents, GameData::preRegistryEventDispatch, GameData::postRegistryEventDispatch, GameData::checkForRevertToVanilla)); + final ModLoadingState UNFREEZE = ModLoadingState.withInline("UNFREEZE_DATA", "INJECT_CAPABILITIES", ModLoadingPhase.GATHER, ml->GameData.unfreezeData()); + final ModLoadingState LOAD_REGISTRIES = ModLoadingState.withTransition("LOAD_REGISTRIES", "UNFREEZE_DATA", ModLoadingPhase.GATHER, new SerialTransition>(GameData::generateRegistryEvents, GameData::preRegistryEventDispatch, GameData::postRegistryEventDispatch, GameData::checkForRevertToVanilla)); final ModLoadingState FREEZE = ModLoadingState.withInline("FREEZE_DATA", "COMPLETE", ModLoadingPhase.COMPLETE, ml->GameData.freezeData()); final ModLoadingState NETLOCK = ModLoadingState.withInline("NETWORK_LOCK", "FREEZE_DATA", ModLoadingPhase.COMPLETE, ml-> NetworkRegistry.lock()); @Override public List getAllStates() { - return List.of(CREATE_REGISTRIES, OBJECT_HOLDERS, INJECT_CAPABILITIES, CUSTOM_TAGS, LOAD_REGISTRIES, FREEZE, NETLOCK); + return List.of(CREATE_REGISTRIES, OBJECT_HOLDERS, INJECT_CAPABILITIES, UNFREEZE, LOAD_REGISTRIES, FREEZE, NETLOCK); } static record SerialTransition(Supplier>> eventStream, BiFunction, CompletableFuture>> preDispatchHook, BiFunction, CompletableFuture>> postDispatchHook, BiFunction>, CompletableFuture>> finalActivityGenerator) implements IModStateTransition { diff --git a/src/main/java/net/minecraftforge/common/ForgeTagHandler.java b/src/main/java/net/minecraftforge/common/ForgeTagHandler.java index 4452dab152..167d822f8b 100644 --- a/src/main/java/net/minecraftforge/common/ForgeTagHandler.java +++ b/src/main/java/net/minecraftforge/common/ForgeTagHandler.java @@ -17,13 +17,8 @@ import javax.annotation.Nullable; import com.mojang.serialization.Lifecycle; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; -import net.minecraft.tags.StaticTagHelper; -import net.minecraft.tags.StaticTags; -import net.minecraft.tags.Tag.Named; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.TagContainer; import net.minecraft.tags.TagLoader; -import net.minecraftforge.common.Tags.IOptionalNamedTag; import net.minecraftforge.registries.ForgeRegistry; import net.minecraftforge.registries.GameData; import net.minecraftforge.registries.IForgeRegistry; @@ -38,135 +33,136 @@ public class ForgeTagHandler private static Set customTagTypeNames = Collections.emptySet(); private static boolean tagTypesSet = false; - @Nullable - private static > StaticTagHelper getTagHelper(IForgeRegistry registry) - { - return (StaticTagHelper) StaticTags.get(registry.getRegistryName()); - } - - private static void validateRegistrySupportsTags(IForgeRegistry registry) - { - //Note: We also check against getTagHelper in case someone decides to use the helpers for tag creation for types supported by vanilla - if (getTagHelper(registry) == null && (!(registry instanceof ForgeRegistry) || ((ForgeRegistry) registry).getTagFolder() == null)) - { - throw new IllegalArgumentException("Registry " + registry.getRegistryName() + " does not support tag types."); - } - } - - /** - * Helper method that creates a named tag for a forge registry, erroring if the registry doesn't support custom tag types. If the custom tag types - * have not been set yet, this method falls back and creates the tag reference delaying adding it to the tag registry to allow for statically - * initializing and referencing the tag. - * @param registry Registry the tag is for - * @param name Name of the tag - * @param Type of the registry - * @return A named tag - */ - public static > Named makeWrapperTag(IForgeRegistry registry, ResourceLocation name) - { - validateRegistrySupportsTags(registry); - if (tagTypesSet) - { - StaticTagHelper tagRegistry = getTagHelper(registry); - if (tagRegistry == null) throw new IllegalArgumentException("Registry " + registry.getRegistryName() + " does not support tag types."); - return tagRegistry.bind(name.toString()); - } - return StaticTagHelper.createDelayedTag(registry.getRegistryName(), name); - } - - /** - * Helper method that creates an optional tag for a forge registry, erroring if the registry doesn't support custom tag types. If the custom tag types - * have not been set yet, this method falls back and creates the tag reference delaying adding it to the tag registry to allow for statically - * initializing and referencing the tag. - * @param registry Registry the tag is for - * @param name Name of the tag - * @param Type of the registry - * @return An optional tag - */ - public static > IOptionalNamedTag createOptionalTag(IForgeRegistry registry, ResourceLocation name) - { - return createOptionalTag(registry, name, null); - } - - /** - * Helper method that creates an optional tag for a forge registry, erroring if the registry doesn't support custom tag types. If the custom tag types - * have not been set yet, this method falls back and creates the tag reference delaying adding it to the tag registry to allow for statically - * initializing and referencing the tag. - * @param registry Registry the tag is for - * @param name Name of the tag - * @param defaults Default values for the optional tag - * @param Type of the registry - * @return An optional tag - */ - public static > IOptionalNamedTag createOptionalTag(IForgeRegistry registry, ResourceLocation name, @Nullable Set> defaults) - { - validateRegistrySupportsTags(registry); - if (tagTypesSet) - { - StaticTagHelper tagRegistry = getTagHelper(registry); - if (tagRegistry == null) throw new IllegalArgumentException("Registry " + registry.getRegistryName() + " does not support tag types."); - return tagRegistry.createOptional(name, defaults); - } - return StaticTagHelper.createDelayedOptional(registry.getRegistryName(), name, defaults); - } - - /** - * Helper method for creating named tags for custom forge registries. If the custom tag types have not been set yet, this method falls back and creates - * the tag reference delaying adding it to the tag registry to allow for statically initializing and referencing the tag. - * @param registryName Name of the registry the tag is for - * @param name Name of the tag - * @param Type of the registry - * @return A named tag - * @implNote This method only errors instantly if tag types have already been set, otherwise the error is delayed until after registries finish initializing - * and we can validate if the custom registry really does support custom tags. - */ - public static > Named makeWrapperTag(ResourceLocation registryName, ResourceLocation name) - { - if (tagTypesSet) - { - IForgeRegistry registry = RegistryManager.ACTIVE.getRegistry(registryName); - if (registry == null) throw new IllegalArgumentException("Could not find registry named: " + registryName); - return makeWrapperTag(registry, name); - } - return StaticTagHelper.createDelayedTag(registryName, name); - } - - /** - * Helper method for creating optional tags for custom forge registries. If the custom tag types have not been set yet, this method falls back and creates - * the tag reference delaying adding it to the tag registry to allow for statically initializing and referencing the tag. - * @param registryName Name of the registry the tag is for - * @param name Name of the tag - * @param Type of the registry - * @return An optional tag - * @implNote This method only errors instantly if tag types have already been set, otherwise the error is delayed until after registries finish initializing - * and we can validate if the custom registry really does support custom tags. - */ - public static > IOptionalNamedTag createOptionalTag(ResourceLocation registryName, ResourceLocation name) - { - return createOptionalTag(registryName, name, null); - } - - /** - * Helper method for creating optional tags for custom forge registries. If the custom tag types have not been set yet, this method falls back and creates - * the tag reference delaying adding it to the tag registry to allow for statically initializing and referencing the tag. - * @param registryName Name of the registry the tag is for - * @param name Name of the tag - * @param defaults Default values for the optional tag - * @param Type of the registry - * @return An optional tag - * @implNote This method only errors instantly if tag types have already been set, otherwise the error is delayed until after registries finish initializing - * and we can validate if the custom registry really does support custom tags. - */ - public static > IOptionalNamedTag createOptionalTag(ResourceLocation registryName, ResourceLocation name, @Nullable Set> defaults) - { - if (tagTypesSet) - { - IForgeRegistry registry = RegistryManager.ACTIVE.getRegistry(registryName); - if (registry == null) throw new IllegalArgumentException("Could not find registry named: " + registryName); - return createOptionalTag(registry, name, defaults); - } - return StaticTagHelper.createDelayedOptional(registryName, name, defaults); - } + // TODO-PATCHING: remove the custom registry tags stuff (1.18.2 has universal tags) and rework how optional tags could work +// @Nullable +// private static > StaticTagHelper getTagHelper(IForgeRegistry registry) +// { +// return (StaticTagHelper) StaticTags.get(registry.getRegistryName()); +// } +// +// private static void validateRegistrySupportsTags(IForgeRegistry registry) +// { +// //Note: We also check against getTagHelper in case someone decides to use the helpers for tag creation for types supported by vanilla +// if (getTagHelper(registry) == null && (!(registry instanceof ForgeRegistry) || ((ForgeRegistry) registry).getTagFolder() == null)) +// { +// throw new IllegalArgumentException("Registry " + registry.getRegistryName() + " does not support tag types."); +// } +// } +// +// /** +// * Helper method that creates a named tag for a forge registry, erroring if the registry doesn't support custom tag types. If the custom tag types +// * have not been set yet, this method falls back and creates the tag reference delaying adding it to the tag registry to allow for statically +// * initializing and referencing the tag. +// * @param registry Registry the tag is for +// * @param name Name of the tag +// * @param Type of the registry +// * @return A named tag +// */ +// public static > Named makeWrapperTag(IForgeRegistry registry, ResourceLocation name) +// { +// validateRegistrySupportsTags(registry); +// if (tagTypesSet) +// { +// StaticTagHelper tagRegistry = getTagHelper(registry); +// if (tagRegistry == null) throw new IllegalArgumentException("Registry " + registry.getRegistryName() + " does not support tag types."); +// return tagRegistry.bind(name.toString()); +// } +// return StaticTagHelper.createDelayedTag(registry.getRegistryName(), name); +// } +// +// /** +// * Helper method that creates an optional tag for a forge registry, erroring if the registry doesn't support custom tag types. If the custom tag types +// * have not been set yet, this method falls back and creates the tag reference delaying adding it to the tag registry to allow for statically +// * initializing and referencing the tag. +// * @param registry Registry the tag is for +// * @param name Name of the tag +// * @param Type of the registry +// * @return An optional tag +// */ +// public static > IOptionalNamedTag createOptionalTag(IForgeRegistry registry, ResourceLocation name) +// { +// return createOptionalTag(registry, name, null); +// } +// +// /** +// * Helper method that creates an optional tag for a forge registry, erroring if the registry doesn't support custom tag types. If the custom tag types +// * have not been set yet, this method falls back and creates the tag reference delaying adding it to the tag registry to allow for statically +// * initializing and referencing the tag. +// * @param registry Registry the tag is for +// * @param name Name of the tag +// * @param defaults Default values for the optional tag +// * @param Type of the registry +// * @return An optional tag +// */ +// public static > IOptionalNamedTag createOptionalTag(IForgeRegistry registry, ResourceLocation name, @Nullable Set> defaults) +// { +// validateRegistrySupportsTags(registry); +// if (tagTypesSet) +// { +// StaticTagHelper tagRegistry = getTagHelper(registry); +// if (tagRegistry == null) throw new IllegalArgumentException("Registry " + registry.getRegistryName() + " does not support tag types."); +// return tagRegistry.createOptional(name, defaults); +// } +// return StaticTagHelper.createDelayedOptional(registry.getRegistryName(), name, defaults); +// } +// +// /** +// * Helper method for creating named tags for custom forge registries. If the custom tag types have not been set yet, this method falls back and creates +// * the tag reference delaying adding it to the tag registry to allow for statically initializing and referencing the tag. +// * @param registryName Name of the registry the tag is for +// * @param name Name of the tag +// * @param Type of the registry +// * @return A named tag +// * @implNote This method only errors instantly if tag types have already been set, otherwise the error is delayed until after registries finish initializing +// * and we can validate if the custom registry really does support custom tags. +// */ +// public static > Named makeWrapperTag(ResourceLocation registryName, ResourceLocation name) +// { +// if (tagTypesSet) +// { +// IForgeRegistry registry = RegistryManager.ACTIVE.getRegistry(registryName); +// if (registry == null) throw new IllegalArgumentException("Could not find registry named: " + registryName); +// return makeWrapperTag(registry, name); +// } +// return StaticTagHelper.createDelayedTag(registryName, name); +// } +// +// /** +// * Helper method for creating optional tags for custom forge registries. If the custom tag types have not been set yet, this method falls back and creates +// * the tag reference delaying adding it to the tag registry to allow for statically initializing and referencing the tag. +// * @param registryName Name of the registry the tag is for +// * @param name Name of the tag +// * @param Type of the registry +// * @return An optional tag +// * @implNote This method only errors instantly if tag types have already been set, otherwise the error is delayed until after registries finish initializing +// * and we can validate if the custom registry really does support custom tags. +// */ +// public static > IOptionalNamedTag createOptionalTag(ResourceLocation registryName, ResourceLocation name) +// { +// return createOptionalTag(registryName, name, null); +// } +// +// /** +// * Helper method for creating optional tags for custom forge registries. If the custom tag types have not been set yet, this method falls back and creates +// * the tag reference delaying adding it to the tag registry to allow for statically initializing and referencing the tag. +// * @param registryName Name of the registry the tag is for +// * @param name Name of the tag +// * @param defaults Default values for the optional tag +// * @param Type of the registry +// * @return An optional tag +// * @implNote This method only errors instantly if tag types have already been set, otherwise the error is delayed until after registries finish initializing +// * and we can validate if the custom registry really does support custom tags. +// */ +// public static > IOptionalNamedTag createOptionalTag(ResourceLocation registryName, ResourceLocation name, @Nullable Set> defaults) +// { +// if (tagTypesSet) +// { +// IForgeRegistry registry = RegistryManager.ACTIVE.getRegistry(registryName); +// if (registry == null) throw new IllegalArgumentException("Could not find registry named: " + registryName); +// return createOptionalTag(registry, name, defaults); +// } +// return StaticTagHelper.createDelayedOptional(registryName, name, defaults); +// } /** * Gets the all the registry names of registries that support custom tag types. @@ -176,23 +172,23 @@ public class ForgeTagHandler return customTagTypeNames; } - /** - * Sets the set containing the resource locations representing the registry name of each forge registry that supports custom tag types. - * - * @apiNote Internal: Calling this manually WILL cause a crash to occur as it can only be called once, and is done so by - * forge after all registries have been initialized. - */ - public static void setCustomTagTypes(Set customTagTypesNames) - { - if (tagTypesSet) throw new RuntimeException("Custom tag types have already been set, this method should only be called by forge, and after registries are initialized"); - tagTypesSet = true; - customTagTypeNames = ImmutableSet.copyOf(customTagTypesNames); - //Add the static references for custom tag types to the proper tag registries - // Note: If this ends up being a hotspot due to lots of mods having lots of statically registered tags - // that get loaded/registered before the new registry event is fired/processed everywhere then this - // potentially should end up being moved into an async processor. - StaticTagHelper.performDelayedAdd(); - } +// /** +// * Sets the set containing the resource locations representing the registry name of each forge registry that supports custom tag types. +// * +// * @apiNote Internal: Calling this manually WILL cause a crash to occur as it can only be called once, and is done so by +// * forge after all registries have been initialized. +// */ +// public static void setCustomTagTypes(Set customTagTypesNames) +// { +// if (tagTypesSet) throw new RuntimeException("Custom tag types have already been set, this method should only be called by forge, and after registries are initialized"); +// tagTypesSet = true; +// customTagTypeNames = ImmutableSet.copyOf(customTagTypesNames); +// //Add the static references for custom tag types to the proper tag registries +// // Note: If this ends up being a hotspot due to lots of mods having lots of statically registered tags +// // that get loaded/registered before the new registry event is fired/processed everywhere then this +// // potentially should end up being moved into an async processor. +// StaticTagHelper.performDelayedAdd(); +// } /** * Creates a map for custom tag type to tag reader @@ -214,36 +210,36 @@ public class ForgeTagHandler return builder.build(); } - /** - * Wraps the forge registry if it supports tags into the internal registry for use in serialization - * - * @apiNote Internal: For use in TagContainer - */ - @SuppressWarnings({"OptionalUsedAsFieldOrParameterType", "unchecked"}) - public static Optional> getWrapperRegistry(ResourceKey> key, Optional> vanillaReg) - { - if (vanillaReg.isPresent()) - return vanillaReg; - - ForgeRegistry reg = RegistryManager.ACTIVE.getRegistry(key.location()); - if (reg == null || reg.getTagFolder() == null) - return Optional.empty(); - - if (reg.getDefaultKey() == null) - return Optional.of((Registry) GameData.getWrapper(reg.getRegistryKey(), Lifecycle.stable())); - return Optional.of((Registry) GameData.getWrapper(reg.getRegistryKey(), Lifecycle.stable(), "ignored")); - } - - /** - * Helper to reinject missing optional tags. - * - * @apiNote Internal - */ - public static TagContainer reinjectOptionalTags(TagContainer tagCollectionSupplier) - { - TagContainer.Builder builder = new TagContainer.Builder(); - //noinspection unchecked,rawtypes - StaticTags.visitHelpers(h -> builder.add(h.getKey(), h.reinjectOptionalTags(tagCollectionSupplier.getOrEmpty((ResourceKey) h.getKey())))); - return builder.build(); - } +// /** +// * Wraps the forge registry if it supports tags into the internal registry for use in serialization +// * +// * @apiNote Internal: For use in TagContainer +// */ +// @SuppressWarnings({"OptionalUsedAsFieldOrParameterType", "unchecked"}) +// public static Optional> getWrapperRegistry(ResourceKey> key, Optional> vanillaReg) +// { +// if (vanillaReg.isPresent()) +// return vanillaReg; +// +// ForgeRegistry reg = RegistryManager.ACTIVE.getRegistry(key.location()); +// if (reg == null || reg.getTagFolder() == null) +// return Optional.empty(); +// +// if (reg.getDefaultKey() == null) +// return Optional.of((Registry) GameData.getWrapper(reg.getRegistryKey(), Lifecycle.stable())); +// return Optional.of((Registry) GameData.getWrapper(reg.getRegistryKey(), Lifecycle.stable(), "ignored")); +// } +// +// /** +// * Helper to reinject missing optional tags. +// * +// * @apiNote Internal +// */ +// public static TagContainer reinjectOptionalTags(TagContainer tagCollectionSupplier) +// { +// TagContainer.Builder builder = new TagContainer.Builder(); +// //noinspection unchecked,rawtypes +// StaticTags.visitHelpers(h -> builder.add(h.getKey(), h.reinjectOptionalTags(tagCollectionSupplier.getOrEmpty((ResourceKey) h.getKey())))); +// return builder.build(); +// } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/common/ForgeTier.java b/src/main/java/net/minecraftforge/common/ForgeTier.java index f65f798f5e..40d3c3ae64 100644 --- a/src/main/java/net/minecraftforge/common/ForgeTier.java +++ b/src/main/java/net/minecraftforge/common/ForgeTier.java @@ -5,7 +5,7 @@ package net.minecraftforge.common; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.Tier; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.block.Block; @@ -26,12 +26,12 @@ public final class ForgeTier implements Tier private final float attackDamageBonus; private final int enchantmentValue; @Nonnull - private final Tag tag; + private final TagKey tag; @Nonnull private final Supplier repairIngredient; public ForgeTier(int level, int uses, float speed, float attackDamageBonus, int enchantmentValue, - @Nonnull Tag tag, @Nonnull Supplier repairIngredient) + @Nonnull TagKey tag, @Nonnull Supplier repairIngredient) { this.level = level; this.uses = uses; @@ -73,7 +73,7 @@ public final class ForgeTier implements Tier } @Nonnull - public Tag getTag() + public TagKey getTag() { return this.tag; } diff --git a/src/main/java/net/minecraftforge/common/Tags.java b/src/main/java/net/minecraftforge/common/Tags.java index 0d050d9bc3..ed4f1bd2da 100644 --- a/src/main/java/net/minecraftforge/common/Tags.java +++ b/src/main/java/net/minecraftforge/common/Tags.java @@ -9,7 +9,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.tags.FluidTags; import net.minecraft.tags.ItemTags; -import net.minecraft.tags.Tag.Named; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; @@ -32,150 +32,150 @@ public class Tags { private static void init(){} - public static final IOptionalNamedTag BARRELS = tag("barrels"); - public static final IOptionalNamedTag BARRELS_WOODEN = tag("barrels/wooden"); - public static final IOptionalNamedTag CHESTS = tag("chests"); - public static final IOptionalNamedTag CHESTS_ENDER = tag("chests/ender"); - public static final IOptionalNamedTag CHESTS_TRAPPED = tag("chests/trapped"); - public static final IOptionalNamedTag CHESTS_WOODEN = tag("chests/wooden"); - public static final IOptionalNamedTag COBBLESTONE = tag("cobblestone"); - public static final IOptionalNamedTag COBBLESTONE_NORMAL = tag("cobblestone/normal"); - public static final IOptionalNamedTag COBBLESTONE_INFESTED = tag("cobblestone/infested"); - public static final IOptionalNamedTag COBBLESTONE_MOSSY = tag("cobblestone/mossy"); - public static final IOptionalNamedTag COBBLESTONE_DEEPSLATE = tag("cobblestone/deepslate"); - public static final IOptionalNamedTag END_STONES = tag("end_stones"); - public static final IOptionalNamedTag ENDERMAN_PLACE_ON_BLACKLIST = tag("enderman_place_on_blacklist"); - public static final IOptionalNamedTag FENCE_GATES = tag("fence_gates"); - public static final IOptionalNamedTag FENCE_GATES_WOODEN = tag("fence_gates/wooden"); - public static final IOptionalNamedTag FENCES = tag("fences"); - public static final IOptionalNamedTag FENCES_NETHER_BRICK = tag("fences/nether_brick"); - public static final IOptionalNamedTag FENCES_WOODEN = tag("fences/wooden"); + public static final TagKey BARRELS = tag("barrels"); + public static final TagKey BARRELS_WOODEN = tag("barrels/wooden"); + public static final TagKey CHESTS = tag("chests"); + public static final TagKey CHESTS_ENDER = tag("chests/ender"); + public static final TagKey CHESTS_TRAPPED = tag("chests/trapped"); + public static final TagKey CHESTS_WOODEN = tag("chests/wooden"); + public static final TagKey COBBLESTONE = tag("cobblestone"); + public static final TagKey COBBLESTONE_NORMAL = tag("cobblestone/normal"); + public static final TagKey COBBLESTONE_INFESTED = tag("cobblestone/infested"); + public static final TagKey COBBLESTONE_MOSSY = tag("cobblestone/mossy"); + public static final TagKey COBBLESTONE_DEEPSLATE = tag("cobblestone/deepslate"); + public static final TagKey END_STONES = tag("end_stones"); + public static final TagKey ENDERMAN_PLACE_ON_BLACKLIST = tag("enderman_place_on_blacklist"); + public static final TagKey FENCE_GATES = tag("fence_gates"); + public static final TagKey FENCE_GATES_WOODEN = tag("fence_gates/wooden"); + public static final TagKey FENCES = tag("fences"); + public static final TagKey FENCES_NETHER_BRICK = tag("fences/nether_brick"); + public static final TagKey FENCES_WOODEN = tag("fences/wooden"); - public static final IOptionalNamedTag GLASS = tag("glass"); - public static final IOptionalNamedTag GLASS_BLACK = tag("glass/black"); - public static final IOptionalNamedTag GLASS_BLUE = tag("glass/blue"); - public static final IOptionalNamedTag GLASS_BROWN = tag("glass/brown"); - public static final IOptionalNamedTag GLASS_COLORLESS = tag("glass/colorless"); - public static final IOptionalNamedTag GLASS_CYAN = tag("glass/cyan"); - public static final IOptionalNamedTag GLASS_GRAY = tag("glass/gray"); - public static final IOptionalNamedTag GLASS_GREEN = tag("glass/green"); - public static final IOptionalNamedTag GLASS_LIGHT_BLUE = tag("glass/light_blue"); - public static final IOptionalNamedTag GLASS_LIGHT_GRAY = tag("glass/light_gray"); - public static final IOptionalNamedTag GLASS_LIME = tag("glass/lime"); - public static final IOptionalNamedTag GLASS_MAGENTA = tag("glass/magenta"); - public static final IOptionalNamedTag GLASS_ORANGE = tag("glass/orange"); - public static final IOptionalNamedTag GLASS_PINK = tag("glass/pink"); - public static final IOptionalNamedTag GLASS_PURPLE = tag("glass/purple"); - public static final IOptionalNamedTag GLASS_RED = tag("glass/red"); + public static final TagKey GLASS = tag("glass"); + public static final TagKey GLASS_BLACK = tag("glass/black"); + public static final TagKey GLASS_BLUE = tag("glass/blue"); + public static final TagKey GLASS_BROWN = tag("glass/brown"); + public static final TagKey GLASS_COLORLESS = tag("glass/colorless"); + public static final TagKey GLASS_CYAN = tag("glass/cyan"); + public static final TagKey GLASS_GRAY = tag("glass/gray"); + public static final TagKey GLASS_GREEN = tag("glass/green"); + public static final TagKey GLASS_LIGHT_BLUE = tag("glass/light_blue"); + public static final TagKey GLASS_LIGHT_GRAY = tag("glass/light_gray"); + public static final TagKey GLASS_LIME = tag("glass/lime"); + public static final TagKey GLASS_MAGENTA = tag("glass/magenta"); + public static final TagKey GLASS_ORANGE = tag("glass/orange"); + public static final TagKey GLASS_PINK = tag("glass/pink"); + public static final TagKey GLASS_PURPLE = tag("glass/purple"); + public static final TagKey GLASS_RED = tag("glass/red"); /** * Glass which is made from sand and only minor additional ingredients like dyes */ - public static final IOptionalNamedTag GLASS_SILICA = tag("glass/silica"); - public static final IOptionalNamedTag GLASS_TINTED = tag("glass/tinted"); - public static final IOptionalNamedTag GLASS_WHITE = tag("glass/white"); - public static final IOptionalNamedTag GLASS_YELLOW = tag("glass/yellow"); + public static final TagKey GLASS_SILICA = tag("glass/silica"); + public static final TagKey GLASS_TINTED = tag("glass/tinted"); + public static final TagKey GLASS_WHITE = tag("glass/white"); + public static final TagKey GLASS_YELLOW = tag("glass/yellow"); - public static final IOptionalNamedTag GLASS_PANES = tag("glass_panes"); - public static final IOptionalNamedTag GLASS_PANES_BLACK = tag("glass_panes/black"); - public static final IOptionalNamedTag GLASS_PANES_BLUE = tag("glass_panes/blue"); - public static final IOptionalNamedTag GLASS_PANES_BROWN = tag("glass_panes/brown"); - public static final IOptionalNamedTag GLASS_PANES_COLORLESS = tag("glass_panes/colorless"); - public static final IOptionalNamedTag GLASS_PANES_CYAN = tag("glass_panes/cyan"); - public static final IOptionalNamedTag GLASS_PANES_GRAY = tag("glass_panes/gray"); - public static final IOptionalNamedTag GLASS_PANES_GREEN = tag("glass_panes/green"); - public static final IOptionalNamedTag GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue"); - public static final IOptionalNamedTag GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray"); - public static final IOptionalNamedTag GLASS_PANES_LIME = tag("glass_panes/lime"); - public static final IOptionalNamedTag GLASS_PANES_MAGENTA = tag("glass_panes/magenta"); - public static final IOptionalNamedTag GLASS_PANES_ORANGE = tag("glass_panes/orange"); - public static final IOptionalNamedTag GLASS_PANES_PINK = tag("glass_panes/pink"); - public static final IOptionalNamedTag GLASS_PANES_PURPLE = tag("glass_panes/purple"); - public static final IOptionalNamedTag GLASS_PANES_RED = tag("glass_panes/red"); - public static final IOptionalNamedTag GLASS_PANES_WHITE = tag("glass_panes/white"); - public static final IOptionalNamedTag GLASS_PANES_YELLOW = tag("glass_panes/yellow"); + public static final TagKey GLASS_PANES = tag("glass_panes"); + public static final TagKey GLASS_PANES_BLACK = tag("glass_panes/black"); + public static final TagKey GLASS_PANES_BLUE = tag("glass_panes/blue"); + public static final TagKey GLASS_PANES_BROWN = tag("glass_panes/brown"); + public static final TagKey GLASS_PANES_COLORLESS = tag("glass_panes/colorless"); + public static final TagKey GLASS_PANES_CYAN = tag("glass_panes/cyan"); + public static final TagKey GLASS_PANES_GRAY = tag("glass_panes/gray"); + public static final TagKey GLASS_PANES_GREEN = tag("glass_panes/green"); + public static final TagKey GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue"); + public static final TagKey GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray"); + public static final TagKey GLASS_PANES_LIME = tag("glass_panes/lime"); + public static final TagKey GLASS_PANES_MAGENTA = tag("glass_panes/magenta"); + public static final TagKey GLASS_PANES_ORANGE = tag("glass_panes/orange"); + public static final TagKey GLASS_PANES_PINK = tag("glass_panes/pink"); + public static final TagKey GLASS_PANES_PURPLE = tag("glass_panes/purple"); + public static final TagKey GLASS_PANES_RED = tag("glass_panes/red"); + public static final TagKey GLASS_PANES_WHITE = tag("glass_panes/white"); + public static final TagKey GLASS_PANES_YELLOW = tag("glass_panes/yellow"); - public static final IOptionalNamedTag GRAVEL = tag("gravel"); - public static final IOptionalNamedTag NETHERRACK = tag("netherrack"); - public static final IOptionalNamedTag OBSIDIAN = tag("obsidian"); + public static final TagKey GRAVEL = tag("gravel"); + public static final TagKey NETHERRACK = tag("netherrack"); + public static final TagKey OBSIDIAN = tag("obsidian"); /** * Blocks which are often replaced by deepslate ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_DEEPSLATE}, during world generation */ - public static final IOptionalNamedTag ORE_BEARING_GROUND_DEEPSLATE = tag("ore_bearing_ground/deepslate"); + public static final TagKey ORE_BEARING_GROUND_DEEPSLATE = tag("ore_bearing_ground/deepslate"); /** * Blocks which are often replaced by netherrack ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_NETHERRACK}, during world generation */ - public static final IOptionalNamedTag ORE_BEARING_GROUND_NETHERRACK = tag("ore_bearing_ground/netherrack"); + public static final TagKey ORE_BEARING_GROUND_NETHERRACK = tag("ore_bearing_ground/netherrack"); /** * Blocks which are often replaced by stone ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_STONE}, during world generation */ - public static final IOptionalNamedTag ORE_BEARING_GROUND_STONE = tag("ore_bearing_ground/stone"); + public static final TagKey ORE_BEARING_GROUND_STONE = tag("ore_bearing_ground/stone"); /** * Ores which on average result in more than one resource worth of materials */ - public static final IOptionalNamedTag ORE_RATES_DENSE = tag("ore_rates/dense"); + public static final TagKey ORE_RATES_DENSE = tag("ore_rates/dense"); /** * Ores which on average result in one resource worth of materials */ - public static final IOptionalNamedTag ORE_RATES_SINGULAR = tag("ore_rates/singular"); + public static final TagKey ORE_RATES_SINGULAR = tag("ore_rates/singular"); /** * Ores which on average result in less than one resource worth of materials */ - public static final IOptionalNamedTag ORE_RATES_SPARSE = tag("ore_rates/sparse"); - public static final IOptionalNamedTag ORES = tag("ores"); - public static final IOptionalNamedTag ORES_COAL = tag("ores/coal"); - public static final IOptionalNamedTag ORES_COPPER = tag("ores/copper"); - public static final IOptionalNamedTag ORES_DIAMOND = tag("ores/diamond"); - public static final IOptionalNamedTag ORES_EMERALD = tag("ores/emerald"); - public static final IOptionalNamedTag ORES_GOLD = tag("ores/gold"); - public static final IOptionalNamedTag ORES_IRON = tag("ores/iron"); - public static final IOptionalNamedTag ORES_LAPIS = tag("ores/lapis"); - public static final IOptionalNamedTag ORES_NETHERITE_SCRAP = tag("ores/netherite_scrap"); - public static final IOptionalNamedTag ORES_QUARTZ = tag("ores/quartz"); - public static final IOptionalNamedTag ORES_REDSTONE = tag("ores/redstone"); + public static final TagKey ORE_RATES_SPARSE = tag("ore_rates/sparse"); + public static final TagKey ORES = tag("ores"); + public static final TagKey ORES_COAL = tag("ores/coal"); + public static final TagKey ORES_COPPER = tag("ores/copper"); + public static final TagKey ORES_DIAMOND = tag("ores/diamond"); + public static final TagKey ORES_EMERALD = tag("ores/emerald"); + public static final TagKey ORES_GOLD = tag("ores/gold"); + public static final TagKey ORES_IRON = tag("ores/iron"); + public static final TagKey ORES_LAPIS = tag("ores/lapis"); + public static final TagKey ORES_NETHERITE_SCRAP = tag("ores/netherite_scrap"); + public static final TagKey ORES_QUARTZ = tag("ores/quartz"); + public static final TagKey ORES_REDSTONE = tag("ores/redstone"); /** * Ores in deepslate (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_DEEPSLATE}) which could logically use deepslate as recipe input or output */ - public static final IOptionalNamedTag ORES_IN_GROUND_DEEPSLATE = tag("ores_in_ground/deepslate"); + public static final TagKey ORES_IN_GROUND_DEEPSLATE = tag("ores_in_ground/deepslate"); /** * Ores in netherrack (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_NETHERRACK}) which could logically use netherrack as recipe input or output */ - public static final IOptionalNamedTag ORES_IN_GROUND_NETHERRACK = tag("ores_in_ground/netherrack"); + public static final TagKey ORES_IN_GROUND_NETHERRACK = tag("ores_in_ground/netherrack"); /** * Ores in stone (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_STONE}) which could logically use stone as recipe input or output */ - public static final IOptionalNamedTag ORES_IN_GROUND_STONE = tag("ores_in_ground/stone"); + public static final TagKey ORES_IN_GROUND_STONE = tag("ores_in_ground/stone"); - public static final IOptionalNamedTag SAND = tag("sand"); - public static final IOptionalNamedTag SAND_COLORLESS = tag("sand/colorless"); - public static final IOptionalNamedTag SAND_RED = tag("sand/red"); + public static final TagKey SAND = tag("sand"); + public static final TagKey SAND_COLORLESS = tag("sand/colorless"); + public static final TagKey SAND_RED = tag("sand/red"); - public static final IOptionalNamedTag SANDSTONE = tag("sandstone"); - public static final IOptionalNamedTag STAINED_GLASS = tag("stained_glass"); - public static final IOptionalNamedTag STAINED_GLASS_PANES = tag("stained_glass_panes"); - public static final IOptionalNamedTag STONE = tag("stone"); - public static final IOptionalNamedTag STORAGE_BLOCKS = tag("storage_blocks"); - public static final IOptionalNamedTag STORAGE_BLOCKS_AMETHYST = tag("storage_blocks/amethyst"); - public static final IOptionalNamedTag STORAGE_BLOCKS_COAL = tag("storage_blocks/coal"); - public static final IOptionalNamedTag STORAGE_BLOCKS_COPPER = tag("storage_blocks/copper"); - public static final IOptionalNamedTag STORAGE_BLOCKS_DIAMOND = tag("storage_blocks/diamond"); - public static final IOptionalNamedTag STORAGE_BLOCKS_EMERALD = tag("storage_blocks/emerald"); - public static final IOptionalNamedTag STORAGE_BLOCKS_GOLD = tag("storage_blocks/gold"); - public static final IOptionalNamedTag STORAGE_BLOCKS_IRON = tag("storage_blocks/iron"); - public static final IOptionalNamedTag STORAGE_BLOCKS_LAPIS = tag("storage_blocks/lapis"); - public static final IOptionalNamedTag STORAGE_BLOCKS_NETHERITE = tag("storage_blocks/netherite"); - public static final IOptionalNamedTag STORAGE_BLOCKS_QUARTZ = tag("storage_blocks/quartz"); - public static final IOptionalNamedTag STORAGE_BLOCKS_RAW_COPPER = tag("storage_blocks/raw_copper"); - public static final IOptionalNamedTag STORAGE_BLOCKS_RAW_GOLD = tag("storage_blocks/raw_gold"); - public static final IOptionalNamedTag STORAGE_BLOCKS_RAW_IRON = tag("storage_blocks/raw_iron"); - public static final IOptionalNamedTag STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone"); + public static final TagKey SANDSTONE = tag("sandstone"); + public static final TagKey STAINED_GLASS = tag("stained_glass"); + public static final TagKey STAINED_GLASS_PANES = tag("stained_glass_panes"); + public static final TagKey STONE = tag("stone"); + public static final TagKey STORAGE_BLOCKS = tag("storage_blocks"); + public static final TagKey STORAGE_BLOCKS_AMETHYST = tag("storage_blocks/amethyst"); + public static final TagKey STORAGE_BLOCKS_COAL = tag("storage_blocks/coal"); + public static final TagKey STORAGE_BLOCKS_COPPER = tag("storage_blocks/copper"); + public static final TagKey STORAGE_BLOCKS_DIAMOND = tag("storage_blocks/diamond"); + public static final TagKey STORAGE_BLOCKS_EMERALD = tag("storage_blocks/emerald"); + public static final TagKey STORAGE_BLOCKS_GOLD = tag("storage_blocks/gold"); + public static final TagKey STORAGE_BLOCKS_IRON = tag("storage_blocks/iron"); + public static final TagKey STORAGE_BLOCKS_LAPIS = tag("storage_blocks/lapis"); + public static final TagKey STORAGE_BLOCKS_NETHERITE = tag("storage_blocks/netherite"); + public static final TagKey STORAGE_BLOCKS_QUARTZ = tag("storage_blocks/quartz"); + public static final TagKey STORAGE_BLOCKS_RAW_COPPER = tag("storage_blocks/raw_copper"); + public static final TagKey STORAGE_BLOCKS_RAW_GOLD = tag("storage_blocks/raw_gold"); + public static final TagKey STORAGE_BLOCKS_RAW_IRON = tag("storage_blocks/raw_iron"); + public static final TagKey STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone"); - public static final IOptionalNamedTag NEEDS_WOOD_TOOL = tag("needs_wood_tool"); - public static final IOptionalNamedTag NEEDS_GOLD_TOOL = tag("needs_gold_tool"); - public static final IOptionalNamedTag NEEDS_NETHERITE_TOOL = tag("needs_netherite_tool"); + public static final TagKey NEEDS_WOOD_TOOL = tag("needs_wood_tool"); + public static final TagKey NEEDS_GOLD_TOOL = tag("needs_gold_tool"); + public static final TagKey NEEDS_NETHERITE_TOOL = tag("needs_netherite_tool"); - private static IOptionalNamedTag tag(String name) + private static TagKey tag(String name) { - return BlockTags.createOptional(new ResourceLocation("forge", name)); + return BlockTags.create(new ResourceLocation("forge", name)); } } @@ -183,220 +183,220 @@ public class Tags { private static void init(){} - public static final IOptionalNamedTag BARRELS = tag("barrels"); - public static final IOptionalNamedTag BARRELS_WOODEN = tag("barrels/wooden"); - public static final IOptionalNamedTag BONES = tag("bones"); - public static final IOptionalNamedTag BOOKSHELVES = tag("bookshelves"); - public static final IOptionalNamedTag CHESTS = tag("chests"); - public static final IOptionalNamedTag CHESTS_ENDER = tag("chests/ender"); - public static final IOptionalNamedTag CHESTS_TRAPPED = tag("chests/trapped"); - public static final IOptionalNamedTag CHESTS_WOODEN = tag("chests/wooden"); - public static final IOptionalNamedTag COBBLESTONE = tag("cobblestone"); - public static final IOptionalNamedTag COBBLESTONE_NORMAL = tag("cobblestone/normal"); - public static final IOptionalNamedTag COBBLESTONE_INFESTED = tag("cobblestone/infested"); - public static final IOptionalNamedTag COBBLESTONE_MOSSY = tag("cobblestone/mossy"); - public static final IOptionalNamedTag COBBLESTONE_DEEPSLATE = tag("cobblestone/deepslate"); - public static final IOptionalNamedTag CROPS = tag("crops"); - public static final IOptionalNamedTag CROPS_BEETROOT = tag("crops/beetroot"); - public static final IOptionalNamedTag CROPS_CARROT = tag("crops/carrot"); - public static final IOptionalNamedTag CROPS_NETHER_WART = tag("crops/nether_wart"); - public static final IOptionalNamedTag CROPS_POTATO = tag("crops/potato"); - public static final IOptionalNamedTag CROPS_WHEAT = tag("crops/wheat"); - public static final IOptionalNamedTag DUSTS = tag("dusts"); - public static final IOptionalNamedTag DUSTS_PRISMARINE = tag("dusts/prismarine"); - public static final IOptionalNamedTag DUSTS_REDSTONE = tag("dusts/redstone"); - public static final IOptionalNamedTag DUSTS_GLOWSTONE = tag("dusts/glowstone"); + public static final TagKey BARRELS = tag("barrels"); + public static final TagKey BARRELS_WOODEN = tag("barrels/wooden"); + public static final TagKey BONES = tag("bones"); + public static final TagKey BOOKSHELVES = tag("bookshelves"); + public static final TagKey CHESTS = tag("chests"); + public static final TagKey CHESTS_ENDER = tag("chests/ender"); + public static final TagKey CHESTS_TRAPPED = tag("chests/trapped"); + public static final TagKey CHESTS_WOODEN = tag("chests/wooden"); + public static final TagKey COBBLESTONE = tag("cobblestone"); + public static final TagKey COBBLESTONE_NORMAL = tag("cobblestone/normal"); + public static final TagKey COBBLESTONE_INFESTED = tag("cobblestone/infested"); + public static final TagKey COBBLESTONE_MOSSY = tag("cobblestone/mossy"); + public static final TagKey COBBLESTONE_DEEPSLATE = tag("cobblestone/deepslate"); + public static final TagKey CROPS = tag("crops"); + public static final TagKey CROPS_BEETROOT = tag("crops/beetroot"); + public static final TagKey CROPS_CARROT = tag("crops/carrot"); + public static final TagKey CROPS_NETHER_WART = tag("crops/nether_wart"); + public static final TagKey CROPS_POTATO = tag("crops/potato"); + public static final TagKey CROPS_WHEAT = tag("crops/wheat"); + public static final TagKey DUSTS = tag("dusts"); + public static final TagKey DUSTS_PRISMARINE = tag("dusts/prismarine"); + public static final TagKey DUSTS_REDSTONE = tag("dusts/redstone"); + public static final TagKey DUSTS_GLOWSTONE = tag("dusts/glowstone"); - public static final IOptionalNamedTag DYES = tag("dyes"); - public static final IOptionalNamedTag DYES_BLACK = DyeColor.BLACK.getTag(); - public static final IOptionalNamedTag DYES_RED = DyeColor.RED.getTag(); - public static final IOptionalNamedTag DYES_GREEN = DyeColor.GREEN.getTag(); - public static final IOptionalNamedTag DYES_BROWN = DyeColor.BROWN.getTag(); - public static final IOptionalNamedTag DYES_BLUE = DyeColor.BLUE.getTag(); - public static final IOptionalNamedTag DYES_PURPLE = DyeColor.PURPLE.getTag(); - public static final IOptionalNamedTag DYES_CYAN = DyeColor.CYAN.getTag(); - public static final IOptionalNamedTag DYES_LIGHT_GRAY = DyeColor.LIGHT_GRAY.getTag(); - public static final IOptionalNamedTag DYES_GRAY = DyeColor.GRAY.getTag(); - public static final IOptionalNamedTag DYES_PINK = DyeColor.PINK.getTag(); - public static final IOptionalNamedTag DYES_LIME = DyeColor.LIME.getTag(); - public static final IOptionalNamedTag DYES_YELLOW = DyeColor.YELLOW.getTag(); - public static final IOptionalNamedTag DYES_LIGHT_BLUE = DyeColor.LIGHT_BLUE.getTag(); - public static final IOptionalNamedTag DYES_MAGENTA = DyeColor.MAGENTA.getTag(); - public static final IOptionalNamedTag DYES_ORANGE = DyeColor.ORANGE.getTag(); - public static final IOptionalNamedTag DYES_WHITE = DyeColor.WHITE.getTag(); + public static final TagKey DYES = tag("dyes"); + public static final TagKey DYES_BLACK = DyeColor.BLACK.getTag(); + public static final TagKey DYES_RED = DyeColor.RED.getTag(); + public static final TagKey DYES_GREEN = DyeColor.GREEN.getTag(); + public static final TagKey DYES_BROWN = DyeColor.BROWN.getTag(); + public static final TagKey DYES_BLUE = DyeColor.BLUE.getTag(); + public static final TagKey DYES_PURPLE = DyeColor.PURPLE.getTag(); + public static final TagKey DYES_CYAN = DyeColor.CYAN.getTag(); + public static final TagKey DYES_LIGHT_GRAY = DyeColor.LIGHT_GRAY.getTag(); + public static final TagKey DYES_GRAY = DyeColor.GRAY.getTag(); + public static final TagKey DYES_PINK = DyeColor.PINK.getTag(); + public static final TagKey DYES_LIME = DyeColor.LIME.getTag(); + public static final TagKey DYES_YELLOW = DyeColor.YELLOW.getTag(); + public static final TagKey DYES_LIGHT_BLUE = DyeColor.LIGHT_BLUE.getTag(); + public static final TagKey DYES_MAGENTA = DyeColor.MAGENTA.getTag(); + public static final TagKey DYES_ORANGE = DyeColor.ORANGE.getTag(); + public static final TagKey DYES_WHITE = DyeColor.WHITE.getTag(); - public static final IOptionalNamedTag EGGS = tag("eggs"); - public static final IOptionalNamedTag ENCHANTING_FUELS = tag("enchanting_fuels", Set.of(() -> net.minecraft.world.item.Items.LAPIS_LAZULI)); - public static final IOptionalNamedTag END_STONES = tag("end_stones"); - public static final IOptionalNamedTag ENDER_PEARLS = tag("ender_pearls"); - public static final IOptionalNamedTag FEATHERS = tag("feathers"); - public static final IOptionalNamedTag FENCE_GATES = tag("fence_gates"); - public static final IOptionalNamedTag FENCE_GATES_WOODEN = tag("fence_gates/wooden"); - public static final IOptionalNamedTag FENCES = tag("fences"); - public static final IOptionalNamedTag FENCES_NETHER_BRICK = tag("fences/nether_brick"); - public static final IOptionalNamedTag FENCES_WOODEN = tag("fences/wooden"); - public static final IOptionalNamedTag GEMS = tag("gems"); - public static final IOptionalNamedTag GEMS_DIAMOND = tag("gems/diamond"); - public static final IOptionalNamedTag GEMS_EMERALD = tag("gems/emerald"); - public static final IOptionalNamedTag GEMS_AMETHYST = tag("gems/amethyst"); - public static final IOptionalNamedTag GEMS_LAPIS = tag("gems/lapis"); - public static final IOptionalNamedTag GEMS_PRISMARINE = tag("gems/prismarine"); - public static final IOptionalNamedTag GEMS_QUARTZ = tag("gems/quartz"); + public static final TagKey EGGS = tag("eggs"); + public static final TagKey ENCHANTING_FUELS = tag("enchanting_fuels", Set.of(() -> net.minecraft.world.item.Items.LAPIS_LAZULI)); + public static final TagKey END_STONES = tag("end_stones"); + public static final TagKey ENDER_PEARLS = tag("ender_pearls"); + public static final TagKey FEATHERS = tag("feathers"); + public static final TagKey FENCE_GATES = tag("fence_gates"); + public static final TagKey FENCE_GATES_WOODEN = tag("fence_gates/wooden"); + public static final TagKey FENCES = tag("fences"); + public static final TagKey FENCES_NETHER_BRICK = tag("fences/nether_brick"); + public static final TagKey FENCES_WOODEN = tag("fences/wooden"); + public static final TagKey GEMS = tag("gems"); + public static final TagKey GEMS_DIAMOND = tag("gems/diamond"); + public static final TagKey GEMS_EMERALD = tag("gems/emerald"); + public static final TagKey GEMS_AMETHYST = tag("gems/amethyst"); + public static final TagKey GEMS_LAPIS = tag("gems/lapis"); + public static final TagKey GEMS_PRISMARINE = tag("gems/prismarine"); + public static final TagKey GEMS_QUARTZ = tag("gems/quartz"); - public static final IOptionalNamedTag GLASS = tag("glass"); - public static final IOptionalNamedTag GLASS_BLACK = tag("glass/black"); - public static final IOptionalNamedTag GLASS_BLUE = tag("glass/blue"); - public static final IOptionalNamedTag GLASS_BROWN = tag("glass/brown"); - public static final IOptionalNamedTag GLASS_COLORLESS = tag("glass/colorless"); - public static final IOptionalNamedTag GLASS_CYAN = tag("glass/cyan"); - public static final IOptionalNamedTag GLASS_GRAY = tag("glass/gray"); - public static final IOptionalNamedTag GLASS_GREEN = tag("glass/green"); - public static final IOptionalNamedTag GLASS_LIGHT_BLUE = tag("glass/light_blue"); - public static final IOptionalNamedTag GLASS_LIGHT_GRAY = tag("glass/light_gray"); - public static final IOptionalNamedTag GLASS_LIME = tag("glass/lime"); - public static final IOptionalNamedTag GLASS_MAGENTA = tag("glass/magenta"); - public static final IOptionalNamedTag GLASS_ORANGE = tag("glass/orange"); - public static final IOptionalNamedTag GLASS_PINK = tag("glass/pink"); - public static final IOptionalNamedTag GLASS_PURPLE = tag("glass/purple"); - public static final IOptionalNamedTag GLASS_RED = tag("glass/red"); + public static final TagKey GLASS = tag("glass"); + public static final TagKey GLASS_BLACK = tag("glass/black"); + public static final TagKey GLASS_BLUE = tag("glass/blue"); + public static final TagKey GLASS_BROWN = tag("glass/brown"); + public static final TagKey GLASS_COLORLESS = tag("glass/colorless"); + public static final TagKey GLASS_CYAN = tag("glass/cyan"); + public static final TagKey GLASS_GRAY = tag("glass/gray"); + public static final TagKey GLASS_GREEN = tag("glass/green"); + public static final TagKey GLASS_LIGHT_BLUE = tag("glass/light_blue"); + public static final TagKey GLASS_LIGHT_GRAY = tag("glass/light_gray"); + public static final TagKey GLASS_LIME = tag("glass/lime"); + public static final TagKey GLASS_MAGENTA = tag("glass/magenta"); + public static final TagKey GLASS_ORANGE = tag("glass/orange"); + public static final TagKey GLASS_PINK = tag("glass/pink"); + public static final TagKey GLASS_PURPLE = tag("glass/purple"); + public static final TagKey GLASS_RED = tag("glass/red"); /** * Glass which is made from sand and only minor additional ingredients like dyes */ - public static final IOptionalNamedTag GLASS_SILICA = tag("glass/silica"); - public static final IOptionalNamedTag GLASS_TINTED = tag("glass/tinted"); - public static final IOptionalNamedTag GLASS_WHITE = tag("glass/white"); - public static final IOptionalNamedTag GLASS_YELLOW = tag("glass/yellow"); + public static final TagKey GLASS_SILICA = tag("glass/silica"); + public static final TagKey GLASS_TINTED = tag("glass/tinted"); + public static final TagKey GLASS_WHITE = tag("glass/white"); + public static final TagKey GLASS_YELLOW = tag("glass/yellow"); - public static final IOptionalNamedTag GLASS_PANES = tag("glass_panes"); - public static final IOptionalNamedTag GLASS_PANES_BLACK = tag("glass_panes/black"); - public static final IOptionalNamedTag GLASS_PANES_BLUE = tag("glass_panes/blue"); - public static final IOptionalNamedTag GLASS_PANES_BROWN = tag("glass_panes/brown"); - public static final IOptionalNamedTag GLASS_PANES_COLORLESS = tag("glass_panes/colorless"); - public static final IOptionalNamedTag GLASS_PANES_CYAN = tag("glass_panes/cyan"); - public static final IOptionalNamedTag GLASS_PANES_GRAY = tag("glass_panes/gray"); - public static final IOptionalNamedTag GLASS_PANES_GREEN = tag("glass_panes/green"); - public static final IOptionalNamedTag GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue"); - public static final IOptionalNamedTag GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray"); - public static final IOptionalNamedTag GLASS_PANES_LIME = tag("glass_panes/lime"); - public static final IOptionalNamedTag GLASS_PANES_MAGENTA = tag("glass_panes/magenta"); - public static final IOptionalNamedTag GLASS_PANES_ORANGE = tag("glass_panes/orange"); - public static final IOptionalNamedTag GLASS_PANES_PINK = tag("glass_panes/pink"); - public static final IOptionalNamedTag GLASS_PANES_PURPLE = tag("glass_panes/purple"); - public static final IOptionalNamedTag GLASS_PANES_RED = tag("glass_panes/red"); - public static final IOptionalNamedTag GLASS_PANES_WHITE = tag("glass_panes/white"); - public static final IOptionalNamedTag GLASS_PANES_YELLOW = tag("glass_panes/yellow"); + public static final TagKey GLASS_PANES = tag("glass_panes"); + public static final TagKey GLASS_PANES_BLACK = tag("glass_panes/black"); + public static final TagKey GLASS_PANES_BLUE = tag("glass_panes/blue"); + public static final TagKey GLASS_PANES_BROWN = tag("glass_panes/brown"); + public static final TagKey GLASS_PANES_COLORLESS = tag("glass_panes/colorless"); + public static final TagKey GLASS_PANES_CYAN = tag("glass_panes/cyan"); + public static final TagKey GLASS_PANES_GRAY = tag("glass_panes/gray"); + public static final TagKey GLASS_PANES_GREEN = tag("glass_panes/green"); + public static final TagKey GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue"); + public static final TagKey GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray"); + public static final TagKey GLASS_PANES_LIME = tag("glass_panes/lime"); + public static final TagKey GLASS_PANES_MAGENTA = tag("glass_panes/magenta"); + public static final TagKey GLASS_PANES_ORANGE = tag("glass_panes/orange"); + public static final TagKey GLASS_PANES_PINK = tag("glass_panes/pink"); + public static final TagKey GLASS_PANES_PURPLE = tag("glass_panes/purple"); + public static final TagKey GLASS_PANES_RED = tag("glass_panes/red"); + public static final TagKey GLASS_PANES_WHITE = tag("glass_panes/white"); + public static final TagKey GLASS_PANES_YELLOW = tag("glass_panes/yellow"); - public static final IOptionalNamedTag GRAVEL = tag("gravel"); - public static final IOptionalNamedTag GUNPOWDER = tag("gunpowder"); - public static final IOptionalNamedTag HEADS = tag("heads"); - public static final IOptionalNamedTag INGOTS = tag("ingots"); - public static final IOptionalNamedTag INGOTS_BRICK = tag("ingots/brick"); - public static final IOptionalNamedTag INGOTS_COPPER = tag("ingots/copper"); - public static final IOptionalNamedTag INGOTS_GOLD = tag("ingots/gold"); - public static final IOptionalNamedTag INGOTS_IRON = tag("ingots/iron"); - public static final IOptionalNamedTag INGOTS_NETHERITE = tag("ingots/netherite"); - public static final IOptionalNamedTag INGOTS_NETHER_BRICK = tag("ingots/nether_brick"); - public static final IOptionalNamedTag LEATHER = tag("leather"); - public static final IOptionalNamedTag MUSHROOMS = tag("mushrooms"); - public static final IOptionalNamedTag NETHER_STARS = tag("nether_stars"); - public static final IOptionalNamedTag NETHERRACK = tag("netherrack"); - public static final IOptionalNamedTag NUGGETS = tag("nuggets"); - public static final IOptionalNamedTag NUGGETS_GOLD = tag("nuggets/gold"); - public static final IOptionalNamedTag NUGGETS_IRON = tag("nuggets/iron"); - public static final IOptionalNamedTag OBSIDIAN = tag("obsidian"); + public static final TagKey GRAVEL = tag("gravel"); + public static final TagKey GUNPOWDER = tag("gunpowder"); + public static final TagKey HEADS = tag("heads"); + public static final TagKey INGOTS = tag("ingots"); + public static final TagKey INGOTS_BRICK = tag("ingots/brick"); + public static final TagKey INGOTS_COPPER = tag("ingots/copper"); + public static final TagKey INGOTS_GOLD = tag("ingots/gold"); + public static final TagKey INGOTS_IRON = tag("ingots/iron"); + public static final TagKey INGOTS_NETHERITE = tag("ingots/netherite"); + public static final TagKey INGOTS_NETHER_BRICK = tag("ingots/nether_brick"); + public static final TagKey LEATHER = tag("leather"); + public static final TagKey MUSHROOMS = tag("mushrooms"); + public static final TagKey NETHER_STARS = tag("nether_stars"); + public static final TagKey NETHERRACK = tag("netherrack"); + public static final TagKey NUGGETS = tag("nuggets"); + public static final TagKey NUGGETS_GOLD = tag("nuggets/gold"); + public static final TagKey NUGGETS_IRON = tag("nuggets/iron"); + public static final TagKey OBSIDIAN = tag("obsidian"); /** * Blocks which are often replaced by deepslate ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_DEEPSLATE}, during world generation */ - public static final IOptionalNamedTag ORE_BEARING_GROUND_DEEPSLATE = tag("ore_bearing_ground/deepslate"); + public static final TagKey ORE_BEARING_GROUND_DEEPSLATE = tag("ore_bearing_ground/deepslate"); /** * Blocks which are often replaced by netherrack ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_NETHERRACK}, during world generation */ - public static final IOptionalNamedTag ORE_BEARING_GROUND_NETHERRACK = tag("ore_bearing_ground/netherrack"); + public static final TagKey ORE_BEARING_GROUND_NETHERRACK = tag("ore_bearing_ground/netherrack"); /** * Blocks which are often replaced by stone ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_STONE}, during world generation */ - public static final IOptionalNamedTag ORE_BEARING_GROUND_STONE = tag("ore_bearing_ground/stone"); + public static final TagKey ORE_BEARING_GROUND_STONE = tag("ore_bearing_ground/stone"); /** * Ores which on average result in more than one resource worth of materials */ - public static final IOptionalNamedTag ORE_RATES_DENSE = tag("ore_rates/dense"); + public static final TagKey ORE_RATES_DENSE = tag("ore_rates/dense"); /** * Ores which on average result in one resource worth of materials */ - public static final IOptionalNamedTag ORE_RATES_SINGULAR = tag("ore_rates/singular"); + public static final TagKey ORE_RATES_SINGULAR = tag("ore_rates/singular"); /** * Ores which on average result in less than one resource worth of materials */ - public static final IOptionalNamedTag ORE_RATES_SPARSE = tag("ore_rates/sparse"); - public static final IOptionalNamedTag ORES = tag("ores"); - public static final IOptionalNamedTag ORES_COAL = tag("ores/coal"); - public static final IOptionalNamedTag ORES_COPPER = tag("ores/copper"); - public static final IOptionalNamedTag ORES_DIAMOND = tag("ores/diamond"); - public static final IOptionalNamedTag ORES_EMERALD = tag("ores/emerald"); - public static final IOptionalNamedTag ORES_GOLD = tag("ores/gold"); - public static final IOptionalNamedTag ORES_IRON = tag("ores/iron"); - public static final IOptionalNamedTag ORES_LAPIS = tag("ores/lapis"); - public static final IOptionalNamedTag ORES_NETHERITE_SCRAP = tag("ores/netherite_scrap"); - public static final IOptionalNamedTag ORES_QUARTZ = tag("ores/quartz"); - public static final IOptionalNamedTag ORES_REDSTONE = tag("ores/redstone"); + public static final TagKey ORE_RATES_SPARSE = tag("ore_rates/sparse"); + public static final TagKey ORES = tag("ores"); + public static final TagKey ORES_COAL = tag("ores/coal"); + public static final TagKey ORES_COPPER = tag("ores/copper"); + public static final TagKey ORES_DIAMOND = tag("ores/diamond"); + public static final TagKey ORES_EMERALD = tag("ores/emerald"); + public static final TagKey ORES_GOLD = tag("ores/gold"); + public static final TagKey ORES_IRON = tag("ores/iron"); + public static final TagKey ORES_LAPIS = tag("ores/lapis"); + public static final TagKey ORES_NETHERITE_SCRAP = tag("ores/netherite_scrap"); + public static final TagKey ORES_QUARTZ = tag("ores/quartz"); + public static final TagKey ORES_REDSTONE = tag("ores/redstone"); /** * Ores in deepslate (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_DEEPSLATE}) which could logically use deepslate as recipe input or output */ - public static final IOptionalNamedTag ORES_IN_GROUND_DEEPSLATE = tag("ores_in_ground/deepslate"); + public static final TagKey ORES_IN_GROUND_DEEPSLATE = tag("ores_in_ground/deepslate"); /** * Ores in netherrack (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_NETHERRACK}) which could logically use netherrack as recipe input or output */ - public static final IOptionalNamedTag ORES_IN_GROUND_NETHERRACK = tag("ores_in_ground/netherrack"); + public static final TagKey ORES_IN_GROUND_NETHERRACK = tag("ores_in_ground/netherrack"); /** * Ores in stone (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_STONE}) which could logically use stone as recipe input or output */ - public static final IOptionalNamedTag ORES_IN_GROUND_STONE = tag("ores_in_ground/stone"); - public static final IOptionalNamedTag RAW_MATERIALS = tag("raw_materials"); - public static final IOptionalNamedTag RAW_MATERIALS_COPPER = tag("raw_materials/copper"); - public static final IOptionalNamedTag RAW_MATERIALS_GOLD = tag("raw_materials/gold"); - public static final IOptionalNamedTag RAW_MATERIALS_IRON = tag("raw_materials/iron"); - public static final IOptionalNamedTag RODS = tag("rods"); - public static final IOptionalNamedTag RODS_BLAZE = tag("rods/blaze"); - public static final IOptionalNamedTag RODS_WOODEN = tag("rods/wooden"); + public static final TagKey ORES_IN_GROUND_STONE = tag("ores_in_ground/stone"); + public static final TagKey RAW_MATERIALS = tag("raw_materials"); + public static final TagKey RAW_MATERIALS_COPPER = tag("raw_materials/copper"); + public static final TagKey RAW_MATERIALS_GOLD = tag("raw_materials/gold"); + public static final TagKey RAW_MATERIALS_IRON = tag("raw_materials/iron"); + public static final TagKey RODS = tag("rods"); + public static final TagKey RODS_BLAZE = tag("rods/blaze"); + public static final TagKey RODS_WOODEN = tag("rods/wooden"); - public static final IOptionalNamedTag SAND = tag("sand"); - public static final IOptionalNamedTag SAND_COLORLESS = tag("sand/colorless"); - public static final IOptionalNamedTag SAND_RED = tag("sand/red"); + public static final TagKey SAND = tag("sand"); + public static final TagKey SAND_COLORLESS = tag("sand/colorless"); + public static final TagKey SAND_RED = tag("sand/red"); - public static final IOptionalNamedTag SANDSTONE = tag("sandstone"); - public static final IOptionalNamedTag SEEDS = tag("seeds"); - public static final IOptionalNamedTag SEEDS_BEETROOT = tag("seeds/beetroot"); - public static final IOptionalNamedTag SEEDS_MELON = tag("seeds/melon"); - public static final IOptionalNamedTag SEEDS_PUMPKIN = tag("seeds/pumpkin"); - public static final IOptionalNamedTag SEEDS_WHEAT = tag("seeds/wheat"); - public static final IOptionalNamedTag SHEARS = tag("shears"); - public static final IOptionalNamedTag SLIMEBALLS = tag("slimeballs"); - public static final IOptionalNamedTag STAINED_GLASS = tag("stained_glass"); - public static final IOptionalNamedTag STAINED_GLASS_PANES = tag("stained_glass_panes"); - public static final IOptionalNamedTag STONE = tag("stone"); - public static final IOptionalNamedTag STORAGE_BLOCKS = tag("storage_blocks"); - public static final IOptionalNamedTag STORAGE_BLOCKS_AMETHYST = tag("storage_blocks/amethyst"); - public static final IOptionalNamedTag STORAGE_BLOCKS_COAL = tag("storage_blocks/coal"); - public static final IOptionalNamedTag STORAGE_BLOCKS_COPPER = tag("storage_blocks/copper"); - public static final IOptionalNamedTag STORAGE_BLOCKS_DIAMOND = tag("storage_blocks/diamond"); - public static final IOptionalNamedTag STORAGE_BLOCKS_EMERALD = tag("storage_blocks/emerald"); - public static final IOptionalNamedTag STORAGE_BLOCKS_GOLD = tag("storage_blocks/gold"); - public static final IOptionalNamedTag STORAGE_BLOCKS_IRON = tag("storage_blocks/iron"); - public static final IOptionalNamedTag STORAGE_BLOCKS_LAPIS = tag("storage_blocks/lapis"); - public static final IOptionalNamedTag STORAGE_BLOCKS_NETHERITE = tag("storage_blocks/netherite"); - public static final IOptionalNamedTag STORAGE_BLOCKS_QUARTZ = tag("storage_blocks/quartz"); - public static final IOptionalNamedTag STORAGE_BLOCKS_RAW_COPPER = tag("storage_blocks/raw_copper"); - public static final IOptionalNamedTag STORAGE_BLOCKS_RAW_GOLD = tag("storage_blocks/raw_gold"); - public static final IOptionalNamedTag STORAGE_BLOCKS_RAW_IRON = tag("storage_blocks/raw_iron"); - public static final IOptionalNamedTag STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone"); - public static final IOptionalNamedTag STRING = tag("string"); + public static final TagKey SANDSTONE = tag("sandstone"); + public static final TagKey SEEDS = tag("seeds"); + public static final TagKey SEEDS_BEETROOT = tag("seeds/beetroot"); + public static final TagKey SEEDS_MELON = tag("seeds/melon"); + public static final TagKey SEEDS_PUMPKIN = tag("seeds/pumpkin"); + public static final TagKey SEEDS_WHEAT = tag("seeds/wheat"); + public static final TagKey SHEARS = tag("shears"); + public static final TagKey SLIMEBALLS = tag("slimeballs"); + public static final TagKey STAINED_GLASS = tag("stained_glass"); + public static final TagKey STAINED_GLASS_PANES = tag("stained_glass_panes"); + public static final TagKey STONE = tag("stone"); + public static final TagKey STORAGE_BLOCKS = tag("storage_blocks"); + public static final TagKey STORAGE_BLOCKS_AMETHYST = tag("storage_blocks/amethyst"); + public static final TagKey STORAGE_BLOCKS_COAL = tag("storage_blocks/coal"); + public static final TagKey STORAGE_BLOCKS_COPPER = tag("storage_blocks/copper"); + public static final TagKey STORAGE_BLOCKS_DIAMOND = tag("storage_blocks/diamond"); + public static final TagKey STORAGE_BLOCKS_EMERALD = tag("storage_blocks/emerald"); + public static final TagKey STORAGE_BLOCKS_GOLD = tag("storage_blocks/gold"); + public static final TagKey STORAGE_BLOCKS_IRON = tag("storage_blocks/iron"); + public static final TagKey STORAGE_BLOCKS_LAPIS = tag("storage_blocks/lapis"); + public static final TagKey STORAGE_BLOCKS_NETHERITE = tag("storage_blocks/netherite"); + public static final TagKey STORAGE_BLOCKS_QUARTZ = tag("storage_blocks/quartz"); + public static final TagKey STORAGE_BLOCKS_RAW_COPPER = tag("storage_blocks/raw_copper"); + public static final TagKey STORAGE_BLOCKS_RAW_GOLD = tag("storage_blocks/raw_gold"); + public static final TagKey STORAGE_BLOCKS_RAW_IRON = tag("storage_blocks/raw_iron"); + public static final TagKey STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone"); + public static final TagKey STRING = tag("string"); - private static IOptionalNamedTag tag(String name, @Nullable Set> defaults) + private static TagKey tag(String name, @Nullable Set> defaults) { - return ItemTags.createOptional(new ResourceLocation("forge", name), defaults); + return ItemTags.create(new ResourceLocation("forge", name)); } - private static IOptionalNamedTag tag(String name) + private static TagKey tag(String name) { return tag(name, null); } @@ -406,20 +406,11 @@ public class Tags { private static void init() {} - public static final IOptionalNamedTag MILK = tag("milk"); + public static final TagKey MILK = tag("milk"); - private static IOptionalNamedTag tag(String name) + private static TagKey tag(String name) { - return FluidTags.createOptional(new ResourceLocation("forge", name)); + return FluidTags.create(new ResourceLocation("forge", name)); } } - - public interface IOptionalNamedTag extends Named - { - /** - * Returns true if the current state is defaulted. This means we have connected to a server that does not contain this tag. - * The values referenced in this tag may be empty, or some values specified by the original tag creator. - */ - boolean isDefaulted(); - } } diff --git a/src/main/java/net/minecraftforge/common/TierSortingRegistry.java b/src/main/java/net/minecraftforge/common/TierSortingRegistry.java index d5f1d534ea..ff3a329018 100644 --- a/src/main/java/net/minecraftforge/common/TierSortingRegistry.java +++ b/src/main/java/net/minecraftforge/common/TierSortingRegistry.java @@ -20,7 +20,7 @@ import net.minecraft.server.packs.resources.Resource; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.SimplePreparableReloadListener; import net.minecraft.tags.BlockTags; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.util.GsonHelper; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.item.DiggerItem; @@ -127,7 +127,7 @@ public class TierSortingRegistry return isCorrectTierVanilla(tier, state); for (int x = sortedTiers.indexOf(tier) + 1; x < sortedTiers.size(); x++) { - Tag tag = sortedTiers.get(x).getTag(); + TagKey tag = sortedTiers.get(x).getTag(); if (tag != null && state.is(tag)) return false; } diff --git a/src/main/java/net/minecraftforge/common/crafting/conditions/TagEmptyCondition.java b/src/main/java/net/minecraftforge/common/crafting/conditions/TagEmptyCondition.java index 7e7ff52362..c9f7fe2cb9 100644 --- a/src/main/java/net/minecraftforge/common/crafting/conditions/TagEmptyCondition.java +++ b/src/main/java/net/minecraftforge/common/crafting/conditions/TagEmptyCondition.java @@ -7,17 +7,19 @@ package net.minecraftforge.common.crafting.conditions; import com.google.gson.JsonObject; +import net.minecraft.core.HolderSet; import net.minecraft.core.Registry; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; -import net.minecraft.tags.Tag; -import net.minecraft.tags.SerializationTags; import net.minecraft.util.GsonHelper; import net.minecraft.resources.ResourceLocation; +import java.util.Iterator; + public class TagEmptyCondition implements ICondition { private static final ResourceLocation NAME = new ResourceLocation("forge", "tag_empty"); - private final ResourceLocation tag_name; + private final TagKey tag; public TagEmptyCondition(String location) { @@ -31,7 +33,7 @@ public class TagEmptyCondition implements ICondition public TagEmptyCondition(ResourceLocation tag) { - this.tag_name = tag; + this.tag = TagKey.create(Registry.ITEM_REGISTRY, tag); } @Override @@ -43,14 +45,13 @@ public class TagEmptyCondition implements ICondition @Override public boolean test() { - Tag tag = SerializationTags.getInstance().getOrEmpty(Registry.ITEM_REGISTRY).getTag(tag_name); - return tag == null || tag.getValues().isEmpty(); + return !Registry.ITEM.getTag(tag).map(HolderSet.Named::iterator).map(Iterator::hasNext).orElse(false); } @Override public String toString() { - return "tag_empty(\"" + tag_name + "\")"; + return "tag_empty(\"" + tag.location() + "\")"; } public static class Serializer implements IConditionSerializer @@ -60,7 +61,7 @@ public class TagEmptyCondition implements ICondition @Override public void write(JsonObject json, TagEmptyCondition value) { - json.addProperty("tag", value.tag_name.toString()); + json.addProperty("tag", value.tag.location().toString()); } @Override diff --git a/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java b/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java index 2c0adfa111..74f0d30e6a 100644 --- a/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java +++ b/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java @@ -8,7 +8,9 @@ package net.minecraftforge.common.data; import java.io.File; import java.io.IOException; import java.nio.file.Path; +import java.util.ArrayList; import java.util.Collection; +import java.util.List; import java.util.Set; import com.google.common.annotations.VisibleForTesting; @@ -23,22 +25,19 @@ import net.minecraft.data.HashCache; import net.minecraft.server.packs.FilePackResources; import net.minecraft.server.packs.FolderPackResources; import net.minecraft.server.packs.repository.ServerPacksSource; +import net.minecraft.server.packs.resources.MultiPackResourceManager; import net.minecraft.server.packs.resources.Resource; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.PackResources; import net.minecraft.server.packs.PackType; -import net.minecraft.server.packs.resources.SimpleReloadableResourceManager; import net.minecraft.server.packs.VanillaPackResources; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.client.model.generators.ModelBuilder; import net.minecraftforge.fml.ModList; import net.minecraftforge.forge.event.lifecycle.GatherDataEvent; import net.minecraftforge.forgespi.language.IModFileInfo; -import net.minecraftforge.forgespi.locating.IModFile; -import net.minecraftforge.resource.PathResourcePack; import net.minecraftforge.resource.ResourcePackLoader; -import javax.annotation.Nonnull; import javax.annotation.Nullable; /** @@ -79,7 +78,7 @@ public class ExistingFileHelper { public String getPrefix() { return prefix; } } - private final SimpleReloadableResourceManager clientResources, serverData; + private final MultiPackResourceManager clientResources, serverData; private final boolean enable; private final Multimap generated = HashMultimap.create(); @@ -97,29 +96,33 @@ public class ExistingFileHelper { * @param assetsDir the directory in which to find vanilla assets and indexes */ public ExistingFileHelper(Collection existingPacks, final Set existingMods, boolean enable, @Nullable final String assetIndex, @Nullable final File assetsDir) { - this.clientResources = new SimpleReloadableResourceManager(PackType.CLIENT_RESOURCES); - this.serverData = new SimpleReloadableResourceManager(PackType.SERVER_DATA); + List candidateClientResources = new ArrayList<>(); + List candidateServerResources = new ArrayList<>(); - this.clientResources.add(new VanillaPackResources(ClientPackSource.BUILT_IN, "minecraft", "realms")); + candidateClientResources.add(new VanillaPackResources(ClientPackSource.BUILT_IN, "minecraft", "realms")); if (assetIndex != null && assetsDir != null) { - this.clientResources.add(new DefaultClientPackResources(ClientPackSource.BUILT_IN, new AssetIndex(assetsDir, assetIndex))); + candidateClientResources.add(new DefaultClientPackResources(ClientPackSource.BUILT_IN, new AssetIndex(assetsDir, assetIndex))); } - this.serverData.add(new VanillaPackResources(ServerPacksSource.BUILT_IN_METADATA, "minecraft")); + candidateServerResources.add(new VanillaPackResources(ServerPacksSource.BUILT_IN_METADATA, "minecraft")); for (Path existing : existingPacks) { File file = existing.toFile(); PackResources pack = file.isDirectory() ? new FolderPackResources(file) : new FilePackResources(file); - this.clientResources.add(pack); - this.serverData.add(pack); + candidateClientResources.add(pack); + candidateServerResources.add(pack); } for (String existingMod : existingMods) { IModFileInfo modFileInfo = ModList.get().getModFileById(existingMod); if (modFileInfo != null) { PackResources pack = ResourcePackLoader.createPackForMod(modFileInfo); - this.clientResources.add(pack); - this.serverData.add(pack); + candidateClientResources.add(pack); + candidateServerResources.add(pack); } } + + this.clientResources = new MultiPackResourceManager(PackType.CLIENT_RESOURCES, candidateClientResources); + this.serverData = new MultiPackResourceManager(PackType.SERVER_DATA, candidateServerResources); + this.enable = enable; } diff --git a/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java index 98bd053915..51d421a45b 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java @@ -10,6 +10,7 @@ import net.minecraft.data.tags.BlockTagsProvider; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.DyeColor; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; @@ -103,13 +104,13 @@ public final class ForgeBlockTagsProvider extends BlockTagsProvider tag(STORAGE_BLOCKS_NETHERITE).add(Blocks.NETHERITE_BLOCK); } - private void addColored(Consumer consumer, Tag.Named group, String pattern) + private void addColored(Consumer consumer, TagKey group, String pattern) { - String prefix = group.getName().getPath().toUpperCase(Locale.ENGLISH) + '_'; + String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; for (DyeColor color : DyeColor.values()) { ResourceLocation key = new ResourceLocation("minecraft", pattern.replace("{color}", color.getName())); - Tag.Named tag = getForgeTag(prefix + color.getName()); + TagKey tag = getForgeTag(prefix + color.getName()); Block block = ForgeRegistries.BLOCKS.getValue(key); if (block == null || block == Blocks.AIR) throw new IllegalStateException("Unknown vanilla block: " + key.toString()); @@ -119,12 +120,12 @@ public final class ForgeBlockTagsProvider extends BlockTagsProvider } @SuppressWarnings("unchecked") - private Tag.Named getForgeTag(String name) + private TagKey getForgeTag(String name) { try { name = name.toUpperCase(Locale.ENGLISH); - return (Tag.Named)Tags.Blocks.class.getDeclaredField(name).get(null); + return (TagKey) Tags.Blocks.class.getDeclaredField(name).get(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { diff --git a/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java index c0eb782122..4c958f46fb 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java @@ -10,6 +10,7 @@ import net.minecraft.data.tags.BlockTagsProvider; import net.minecraft.data.tags.ItemTagsProvider; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; @@ -155,13 +156,13 @@ public final class ForgeItemTagsProvider extends ItemTagsProvider tag(Tags.Items.STRING).add(Items.STRING); } - private void addColored(Consumer> consumer, Tag.Named group, String pattern) + private void addColored(Consumer> consumer, TagKey group, String pattern) { - String prefix = group.getName().getPath().toUpperCase(Locale.ENGLISH) + '_'; + String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; for (DyeColor color : DyeColor.values()) { ResourceLocation key = new ResourceLocation("minecraft", pattern.replace("{color}", color.getName())); - Tag.Named tag = getForgeItemTag(prefix + color.getName()); + TagKey tag = getForgeItemTag(prefix + color.getName()); Item item = ForgeRegistries.ITEMS.getValue(key); if (item == null || item == Items.AIR) throw new IllegalStateException("Unknown vanilla item: " + key.toString()); @@ -170,26 +171,26 @@ public final class ForgeItemTagsProvider extends ItemTagsProvider } } - private void copyColored(Tag.Named blockGroup, Tag.Named itemGroup) + private void copyColored(TagKey blockGroup, TagKey itemGroup) { - String blockPre = blockGroup.getName().getPath().toUpperCase(Locale.ENGLISH) + '_'; - String itemPre = itemGroup.getName().getPath().toUpperCase(Locale.ENGLISH) + '_'; + String blockPre = blockGroup.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; + String itemPre = itemGroup.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; for (DyeColor color : DyeColor.values()) { - Tag.Named from = getForgeBlockTag(blockPre + color.getName()); - Tag.Named to = getForgeItemTag(itemPre + color.getName()); + TagKey from = getForgeBlockTag(blockPre + color.getName()); + TagKey to = getForgeItemTag(itemPre + color.getName()); copy(from, to); } copy(getForgeBlockTag(blockPre + "colorless"), getForgeItemTag(itemPre + "colorless")); } @SuppressWarnings("unchecked") - private Tag.Named getForgeBlockTag(String name) + private TagKey getForgeBlockTag(String name) { try { name = name.toUpperCase(Locale.ENGLISH); - return (Tag.Named)Tags.Blocks.class.getDeclaredField(name).get(null); + return (TagKey)Tags.Blocks.class.getDeclaredField(name).get(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { @@ -198,12 +199,12 @@ public final class ForgeItemTagsProvider extends ItemTagsProvider } @SuppressWarnings("unchecked") - private Tag.Named getForgeItemTag(String name) + private TagKey getForgeItemTag(String name) { try { name = name.toUpperCase(Locale.ENGLISH); - return (Tag.Named)Tags.Items.class.getDeclaredField(name).get(null); + return (TagKey)Tags.Items.class.getDeclaredField(name).get(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { diff --git a/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java index b94d22bc67..718d42e38e 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeRecipeProvider.java @@ -14,6 +14,7 @@ import net.minecraft.data.recipes.ShapedRecipeBuilder; import net.minecraft.data.recipes.ShapelessRecipeBuilder; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -32,7 +33,7 @@ import java.util.function.Consumer; public final class ForgeRecipeProvider extends RecipeProvider { - private Map> replacements = new HashMap<>(); + private Map> replacements = new HashMap<>(); private Set excludes = new HashSet<>(); public ForgeRecipeProvider(DataGenerator generatorIn) @@ -45,7 +46,7 @@ public final class ForgeRecipeProvider extends RecipeProvider excludes.add(item.asItem().getRegistryName()); } - private void replace(ItemLike item, Tag tag) + private void replace(ItemLike item, TagKey tag) { replacements.put(item.asItem(), tag); } @@ -148,7 +149,7 @@ public final class ForgeRecipeProvider extends RecipeProvider if (entry instanceof ItemValue) { ItemStack stack = entry.getItems().stream().findFirst().orElse(ItemStack.EMPTY); - Tag replacement = replacements.get(stack.getItem()); + TagKey replacement = replacements.get(stack.getItem()); if (replacement != null) { items.add(new TagValue(replacement)); diff --git a/src/main/java/net/minecraftforge/common/data/ForgeRegistryTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeRegistryTagsProvider.java index f8d2f2d1ac..0d870fb4a9 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeRegistryTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeRegistryTagsProvider.java @@ -57,6 +57,7 @@ public abstract class ForgeRegistryTagsProvider @Override protected Path getPath(ResourceLocation id) { + //TODO-PATCHING: Mojang has introduced logic here to determine where the tags go, we need to replicate that logic possibly. return generator.getOutputFolder().resolve("data/" + id.getNamespace() + "/tags/" + folder + "/" + id.getPath() + ".json"); } } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java index 934deb2390..d22634b841 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java @@ -602,7 +602,7 @@ public interface IForgeBlock { if (entity instanceof EnderDragon) { - return !BlockTags.DRAGON_IMMUNE.contains(this.self()); + return !this.self().defaultBlockState().is(BlockTags.DRAGON_IMMUNE); } else if ((entity instanceof WitherBoss) || (entity instanceof WitherSkull)) @@ -621,12 +621,6 @@ public interface IForgeBlock return state.getBlock().dropFromExplosion(explosion); } - /** - * Retrieves a list of tags names this is known to be associated with. - * This should be used in favor of TagCollection.getOwningTags, as this caches the result and automatically updates when the TagCollection changes. - */ - Set getTags(); - /** * Called when the block is destroyed by an explosion. * Useful for allowing the block to take into account tile entities, diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeFluid.java b/src/main/java/net/minecraftforge/common/extensions/IForgeFluid.java index ed90a21ddd..91951c86ba 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeFluid.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeFluid.java @@ -9,11 +9,11 @@ import java.util.Set; import javax.annotation.Nullable; +import net.minecraft.core.HolderSet; import net.minecraft.world.level.material.Material; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; -import net.minecraft.tags.SetTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.phys.AABB; import net.minecraft.core.BlockPos; @@ -35,7 +35,7 @@ public interface IForgeFluid * @param tag Fluid category * @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment. */ - default boolean isEntityInside(FluidState state, LevelReader level, BlockPos pos, Entity entity, double yToTest, SetTag tag, boolean testingHead) + default boolean isEntityInside(FluidState state, LevelReader level, BlockPos pos, Entity entity, double yToTest, HolderSet tag, boolean testingHead) { return state.is(tag) && yToTest < (double)(pos.getY() + state.getHeight(level, pos) + 0.11111111F); } @@ -94,11 +94,12 @@ public interface IForgeFluid return this.getFluid().getRenderLayer() == layer; }*/ - /** - * Retrieves a list of tags names this is known to be associated with. - * This should be used in favor of TagCollection.getOwningTags, as this caches the result and automatically updates when the TagCollection changes. - */ - Set getTags(); +// /** +// * Retrieves a list of tags names this is known to be associated with. +// * This should be used in favor of TagCollection.getOwningTags, as this caches the result and automatically updates when the TagCollection changes. +// */ +// Set getTags(); + // TODO-PATCHING: Tag locations are now TagKeys /** * Retrieves the non-vanilla fluid attributes, including localized name. diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeFluidState.java b/src/main/java/net/minecraftforge/common/extensions/IForgeFluidState.java index e1168a7f62..87eec27e7b 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeFluidState.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeFluidState.java @@ -5,10 +5,10 @@ package net.minecraftforge.common.extensions; +import net.minecraft.core.HolderSet; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; -import net.minecraft.tags.SetTag; import net.minecraft.core.BlockPos; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.BlockGetter; @@ -32,7 +32,7 @@ public interface IForgeFluidState * @param tag to test for. * @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment. */ - default boolean isEntityInside(LevelReader level, BlockPos pos, Entity entity, double yToTest, SetTag tag, boolean testingHead) + default boolean isEntityInside(LevelReader level, BlockPos pos, Entity entity, double yToTest, HolderSet tag, boolean testingHead) { // return ifluidstate.isTagged(p_213290_1_) && d0 < (double)((float)blockpos.getY() + ifluidstate.getActualHeight(this.level, blockpos) + 0.11111111F); return self().getType().isEntityInside(self(), level, pos, entity, yToTest, tag, testingHead); diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java b/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java index 0822d87823..668cd5deb4 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java @@ -639,12 +639,6 @@ public interface IForgeItem { } - /** - * Retrieves a list of tags names this is known to be associated with. - * This should be used in favor of TagCollection.getOwningTags, as this caches the result and automatically updates when the TagCollection changes. - */ - Set getTags(); - /** * Reduce the durability of this item by the amount given. * This can be used to e.g. consume power from NBT before durability. diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java b/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java index 5d9eeffbe0..321787441e 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java @@ -8,9 +8,11 @@ package net.minecraftforge.common.extensions; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import net.minecraft.core.Registry; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.monster.EnderMan; import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.pattern.BlockInWorld; import net.minecraft.world.phys.AABB; import net.minecraft.world.item.enchantment.Enchantment; @@ -80,7 +82,8 @@ public interface IForgeItemStack extends ICapabilitySerializable Player entityplayer = context.getPlayer(); BlockPos blockpos = context.getClickedPos(); BlockInWorld blockworldstate = new BlockInWorld(context.getLevel(), blockpos, false); - if (entityplayer != null && !entityplayer.getAbilities().mayBuild && !self().hasAdventureModePlaceTagForBlock(context.getLevel().getTagManager(), blockworldstate)) { + Registry registry = entityplayer.level.registryAccess().registryOrThrow(Registry.BLOCK_REGISTRY); + if (entityplayer != null && !entityplayer.getAbilities().mayBuild && !self().hasAdventureModePlaceTagForBlock(registry, blockworldstate)) { return InteractionResult.PASS; } else { Item item = self().getItem(); @@ -270,17 +273,6 @@ public interface IForgeItemStack extends ICapabilitySerializable self().getItem().onHorseArmorTick(self(), level, horse); } - /** - * Called when an item entity for this stack is destroyed. - * - * @param itemEntity The item entity that was destroyed. - * @param damageSource Damage source that caused the item entity to "die". - */ - default void onDestroyed(ItemEntity itemEntity, DamageSource damageSource) - { - self().getItem().onDestroyed(itemEntity, damageSource); - } - /** * Determines if the specific ItemStack can be placed in the specified armor * slot, for the entity. @@ -490,4 +482,15 @@ public interface IForgeItemStack extends ICapabilitySerializable { return self().getItem().getSweepHitBox(self(), player, target); } + + /** + * Called when an item entity for this stack is destroyed. Note: The {@link ItemStack} can be retrieved from the item entity. + * + * @param itemEntity The item entity that was destroyed. + * @param damageSource Damage source that caused the item entity to "die". + */ + default void onDestroyed(ItemEntity itemEntity, DamageSource damageSource) + { + self().getItem().onDestroyed(itemEntity, damageSource); + } } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeRawTagBuilder.java b/src/main/java/net/minecraftforge/common/extensions/IForgeRawTagBuilder.java index 0f4e38f2be..47617cf1a5 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeRawTagBuilder.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeRawTagBuilder.java @@ -19,7 +19,7 @@ public interface IForgeRawTagBuilder { return (Tag.Builder)this; } - + /** * internal, called when a raw builder is written to json to add forge additions (e.g. the remove list) */ @@ -28,14 +28,14 @@ public interface IForgeRawTagBuilder Tag.Builder rawBuilder = this.getRawBuilder(); Stream removeEntries = rawBuilder.getRemoveEntries(); JsonArray removeEntriesAsJsonArray = new JsonArray(); - removeEntries.forEach(proxy ->proxy.getEntry().serializeTo(removeEntriesAsJsonArray)); + removeEntries.forEach(proxy ->proxy.entry().serializeTo(removeEntriesAsJsonArray)); if (removeEntriesAsJsonArray.size() > 0) { tagJson.add("remove", removeEntriesAsJsonArray); } - + } - + /** * Adds a tag entry to the remove list. * @param tagEntry The tag entry to add to the remove list @@ -46,7 +46,7 @@ public interface IForgeRawTagBuilder { return this.getRawBuilder().remove(new Tag.BuilderEntry(tagEntry,source)); } - + /** * Adds a single-element entry to the remove list. * @param elementID The ID of the element to add to the remove list @@ -58,7 +58,7 @@ public interface IForgeRawTagBuilder return this.remove(new Tag.ElementEntry(elementID), source); } - + /** * Adds a tag to the remove list. * @param tagID The ID of the tag to add to the remove list diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeStructureFeature.java b/src/main/java/net/minecraftforge/common/extensions/IForgeStructureFeature.java deleted file mode 100644 index 54826174b2..0000000000 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeStructureFeature.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Minecraft Forge - Forge Development LLC - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.common.extensions; - -import java.util.Collections; -import java.util.List; -import net.minecraft.util.random.WeightedRandomList; -import net.minecraft.world.entity.MobCategory; -import net.minecraft.world.level.biome.MobSpawnSettings; -import net.minecraft.world.level.levelgen.feature.StructureFeature; - -public interface IForgeStructureFeature -{ - private StructureFeature self() - { - return (StructureFeature) this; - } - - /** - * Gets the default list of spawns for this structure, of the specified category. - * - * @apiNote Implement this over any of the type specific getSpecial functions in StructureFeature. - */ - @SuppressWarnings("incomplete-switch") - default List getDefaultSpawnList(MobCategory category) - { - return Collections.emptyList(); - } - - /** - * Gets the default for if entity spawns are restricted to being inside of the pieces making up the structure or if being in the bounds of the overall structure - * is good enough. - * @return {@code true} if the location to check spawns for has to be inside of the pieces making up the structure, {@code false} otherwise. - */ - default boolean getDefaultRestrictsSpawnsToInside() - { - //The Pillager Outpost and Ocean Monument check the full structure by default instead of limiting themselves to being within the structure's bounds - return self() != StructureFeature.PILLAGER_OUTPOST && self() != StructureFeature.OCEAN_MONUMENT; - } - - /** - * Helper method to get the list of entity spawns for this structure for the given classification. - * @param classification The classification of entities. - * @apiNote This method is marked as final in {@link StructureFeature} so as to not be overridden by modders and breaking support for - * {@link net.minecraftforge.event.world.StructureSpawnListGatherEvent}. - */ - WeightedRandomList getSpawnList(MobCategory classification); -} diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeTagAppender.java b/src/main/java/net/minecraftforge/common/extensions/IForgeTagAppender.java index 74bc601d4b..dd549ed1c2 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeTagAppender.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeTagAppender.java @@ -9,6 +9,7 @@ import net.minecraft.data.tags.TagsProvider; import net.minecraft.tags.Tag; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; public interface IForgeTagAppender { @@ -17,22 +18,14 @@ public interface IForgeTagAppender } @SuppressWarnings("unchecked") - default TagsProvider.TagAppender addTags(Tag.Named... values) { + default TagsProvider.TagAppender addTags(TagKey... values) { TagsProvider.TagAppender builder = self(); - for (Tag.Named value : values) { + for (TagKey value : values) { builder.addTag(value); } return builder; } - default TagsProvider.TagAppender add(ResourceKey... keys) { - TagsProvider.TagAppender builder = self(); - for (ResourceKey key : keys) { - builder.getInternalBuilder().addElement(key.location(), self().getModID()); - } - return builder; - } - default TagsProvider.TagAppender replace() { return replace(true); } @@ -42,16 +35,6 @@ public interface IForgeTagAppender return self(); } - default TagsProvider.TagAppender addOptional(final ResourceLocation location) - { - return self().add(new Tag.OptionalElementEntry(location)); - } - - default TagsProvider.TagAppender addOptionalTag(final ResourceLocation location) - { - return self().add(new Tag.OptionalTagEntry(location)); - } - /** * Adds a registry entry to the tag json's remove list. Callable during datageneration. * @param entry The entry to remove @@ -61,7 +44,7 @@ public interface IForgeTagAppender { return remove(this.self().registry.getKey(entry)); } - + /** * Adds multiple registry entries to the tag json's remove list. Callable during datageneration. * @param entries The entries to remove @@ -77,7 +60,7 @@ public interface IForgeTagAppender } return self(); } - + /** * Adds a single element's ID to the tag json's remove list. Callable during datageneration. * @param location The ID of the element to remove @@ -89,7 +72,7 @@ public interface IForgeTagAppender builder.getInternalBuilder().removeElement(location, builder.getModID()); return builder; } - + /** * Adds multiple elements' IDs to the tag json's remove list. Callable during datageneration. * @param locations The IDs of the elements to remove @@ -104,29 +87,29 @@ public interface IForgeTagAppender } return self(); } - + /** * Adds a tag to the tag json's remove list. Callable during datageneration. * @param tag The ID of the tag to remove * @return The builder for chaining */ - default TagsProvider.TagAppender remove(Tag.Named tag) + default TagsProvider.TagAppender remove(TagKey tag) { TagsProvider.TagAppender builder = self(); - builder.getInternalBuilder().removeTag(tag.getName(), builder.getModID()); + builder.getInternalBuilder().removeTag(tag.location(), builder.getModID()); return builder; } - + /** * Adds multiple tags to the tag json's remove list. Callable during datageneration. * @param tags The IDs of the tags to remove * @return The builder for chaining */ @SuppressWarnings("unchecked") - default TagsProvider.TagAppender remove(Tag.Named first, Tag.Named...tags) + default TagsProvider.TagAppender remove(TagKey first, TagKey...tags) { this.remove(first); - for (Tag.Named tag : tags) + for (TagKey tag : tags) { this.remove(tag); } diff --git a/src/main/java/net/minecraftforge/common/util/ReverseTagWrapper.java b/src/main/java/net/minecraftforge/common/util/ReverseTagWrapper.java deleted file mode 100644 index 3f22a8cf88..0000000000 --- a/src/main/java/net/minecraftforge/common/util/ReverseTagWrapper.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Minecraft Forge - Forge Development LLC - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.common.util; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.function.Supplier; - -import net.minecraft.tags.Tag; -import net.minecraft.tags.TagCollection; -import net.minecraft.resources.ResourceLocation; - -public class ReverseTagWrapper -{ - private final T target; - private final Supplier> colSupplier; - - //This map is immutable we track its identity change. - private Map> colCache; - private Set cache = null; - - public ReverseTagWrapper(T target, Supplier> colSupplier) - { - this.target = target; - this.colSupplier = colSupplier; - } - - public Set getTagNames() - { - TagCollection collection = colSupplier.get(); - if (cache == null || colCache != collection.getAllTags()) // Identity equals. - { - this.cache = Collections.unmodifiableSet(new HashSet<>(collection.getMatchingTags(target))); - this.colCache = collection.getAllTags(); - } - return this.cache; - } -} diff --git a/src/main/java/net/minecraftforge/common/world/BiomeGenerationSettingsBuilder.java b/src/main/java/net/minecraftforge/common/world/BiomeGenerationSettingsBuilder.java index 3ec5e8a236..c44845d9b3 100644 --- a/src/main/java/net/minecraftforge/common/world/BiomeGenerationSettingsBuilder.java +++ b/src/main/java/net/minecraftforge/common/world/BiomeGenerationSettingsBuilder.java @@ -5,6 +5,8 @@ package net.minecraftforge.common.world; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderSet; import net.minecraft.world.level.biome.BiomeGenerationSettings; import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver; @@ -18,16 +20,23 @@ public class BiomeGenerationSettingsBuilder extends BiomeGenerationSettings.Buil { public BiomeGenerationSettingsBuilder(BiomeGenerationSettings orig) { - orig.getCarvingStages().forEach(k -> carvers.put(k, new ArrayList<>(orig.getCarvers(k)))); - orig.features().forEach(l -> features.add(new ArrayList<>(l))); + orig.getCarvingStages().forEach(k -> { + carvers.put(k, new ArrayList<>()); + orig.getCarvers(k).forEach(v -> carvers.get(k).add(v)); + }); + orig.features().forEach(l -> { + final ArrayList> featureList = new ArrayList<>(); + l.forEach(featureList::add); + features.add(featureList); + }); } - public List> getFeatures(GenerationStep.Decoration stage) { + public List> getFeatures(GenerationStep.Decoration stage) { addFeatureStepsUpTo(stage.ordinal()); return features.get(stage.ordinal()); } - public List>> getCarvers(GenerationStep.Carving stage) { + public List>> getCarvers(GenerationStep.Carving stage) { return carvers.computeIfAbsent(stage, key -> new ArrayList<>()); } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/common/world/StructureSpawnManager.java b/src/main/java/net/minecraftforge/common/world/StructureSpawnManager.java index df47753dfa..e0675320d9 100644 --- a/src/main/java/net/minecraftforge/common/world/StructureSpawnManager.java +++ b/src/main/java/net/minecraftforge/common/world/StructureSpawnManager.java @@ -5,25 +5,10 @@ package net.minecraftforge.common.world; -import com.google.common.collect.ImmutableMap; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; -import javax.annotation.Nullable; -import net.minecraft.util.random.WeightedRandomList; -import net.minecraft.world.entity.MobCategory; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.biome.MobSpawnSettings; -import net.minecraft.world.level.levelgen.feature.StructureFeature; -import net.minecraft.world.level.StructureFeatureManager; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.world.StructureSpawnListGatherEvent; -import net.minecraftforge.registries.ForgeRegistries; - +//TODO-PATCHING: Reengineer this with configured features in mind as those are what handle spawning right now.s /** * Class to help manage entity spawns inside of structures - */ + * / public class StructureSpawnManager { private static Map, StructureSpawnInfo> structuresWithSpawns = Collections.emptyMap(); @@ -31,7 +16,7 @@ public class StructureSpawnManager /** * Gathers potential entity spawns for all the different registered structures. * @apiNote Internal - */ + * / public static void gatherEntitySpawns() { //We use a linked hash map to ensure that we check the structures in an order that if there are multiple structures a position satisfies @@ -75,7 +60,7 @@ public class StructureSpawnManager * @param structureManager Structure Manager, used to check if a position is within a structure. * @param classification Entity classification * @param pos Position to get entity spawns of - */ + * / @Nullable public static WeightedRandomList getStructureSpawns(StructureFeatureManager structureManager, MobCategory classification, BlockPos pos) { @@ -100,7 +85,7 @@ public class StructureSpawnManager * Gets the entity spawn lists for entities of a given classification for a given structure. * @param structure The Structure * @param classification The classification to lookup - */ + * / public static WeightedRandomList getSpawnList(StructureFeature structure, MobCategory classification) { StructureSpawnInfo info = structuresWithSpawns.get(structure); @@ -111,7 +96,7 @@ public class StructureSpawnManager /** * Helper class to keep track of spawns and if the spawns should be restricted to inside the structure pieces. - */ + * / private static class StructureSpawnInfo { private final Map> spawns; @@ -124,3 +109,4 @@ public class StructureSpawnManager } } } +*/ \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/event/AddReloadListenerEvent.java b/src/main/java/net/minecraftforge/event/AddReloadListenerEvent.java index 6b53412005..b089a48195 100644 --- a/src/main/java/net/minecraftforge/event/AddReloadListenerEvent.java +++ b/src/main/java/net/minecraftforge/event/AddReloadListenerEvent.java @@ -6,8 +6,8 @@ package net.minecraftforge.event; import com.google.common.collect.ImmutableList; +import net.minecraft.server.MinecraftServer; import net.minecraft.util.profiling.ProfilerFiller; -import net.minecraft.server.ServerResources; import net.minecraft.server.packs.resources.PreparableReloadListener; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraftforge.common.MinecraftForge; @@ -22,7 +22,7 @@ import java.util.concurrent.Executor; import net.minecraft.server.packs.resources.PreparableReloadListener.PreparationBarrier; /** - * The main ResourceManager is recreated on each reload, through {@link ServerResources}'s creation. + * The main ResourceManager is recreated on each reload, through {@link MinecraftServer.ReloadableResources}'s creation. * * The event is fired on each reload and lets modders add their own ReloadListeners, for server-side resources. * The event is fired on the {@link MinecraftForge#EVENT_BUS} @@ -30,30 +30,34 @@ import net.minecraft.server.packs.resources.PreparableReloadListener.Preparation public class AddReloadListenerEvent extends Event { private final List listeners = new ArrayList<>(); - private final ServerResources dataPackRegistries; - - public AddReloadListenerEvent(ServerResources dataPackRegistries) + /* + private final MinecraftServer.ReloadableResources dataPackRegistries; + + public AddReloadListenerEvent(MinecraftServer.ReloadableResources dataPackRegistries) { this.dataPackRegistries = dataPackRegistries; } - + */ + /** * @param listener the listener to add to the ResourceManager on reload */ - public void addListener(PreparableReloadListener listener) - { - listeners.add(new WrappedStateAwareListener(listener)); - } + public void addListener(PreparableReloadListener listener) + { + listeners.add(new WrappedStateAwareListener(listener)); + } - public List getListeners() - { - return ImmutableList.copyOf(listeners); - } - - public ServerResources getDataPackRegistries() + public List getListeners() + { + return ImmutableList.copyOf(listeners); + } + + /* + public MinecraftServer.ReloadableResources getDataPackRegistries() { return dataPackRegistries; } + */ private static class WrappedStateAwareListener implements PreparableReloadListener { private final PreparableReloadListener wrapped; diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index 4f354df1fb..9369656c0c 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -16,6 +16,7 @@ import com.mojang.authlib.GameProfile; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.brigadier.CommandDispatcher; +import net.minecraft.server.MinecraftServer; import net.minecraft.server.players.PlayerList; import net.minecraft.world.Container; import net.minecraft.world.entity.projectile.FireworkRocketEntity; @@ -48,7 +49,6 @@ import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.LootTables; import net.minecraft.server.packs.resources.PreparableReloadListener; -import net.minecraft.server.ServerResources; import net.minecraft.world.level.BaseSpawner; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.InteractionResult; @@ -709,9 +709,9 @@ public class ForgeEventFactory return event.getNewTime(); } - public static List onResourceReload(ServerResources dataPackRegistries) + public static List onResourceReload(/*MinecraftServer.ReloadableResources dataPackRegistries*/) { - AddReloadListenerEvent event = new AddReloadListenerEvent(dataPackRegistries); + AddReloadListenerEvent event = new AddReloadListenerEvent(/*dataPackRegistries*/); MinecraftForge.EVENT_BUS.post(event); return event.getListeners(); } diff --git a/src/main/java/net/minecraftforge/event/RegisterCommandsEvent.java b/src/main/java/net/minecraftforge/event/RegisterCommandsEvent.java index 82b6cbe6ee..4e2847f752 100644 --- a/src/main/java/net/minecraftforge/event/RegisterCommandsEvent.java +++ b/src/main/java/net/minecraftforge/event/RegisterCommandsEvent.java @@ -6,7 +6,7 @@ package net.minecraftforge.event; import com.mojang.brigadier.CommandDispatcher; -import net.minecraft.server.ServerResources; +import net.minecraft.server.ReloadableServerResources; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Event; @@ -15,7 +15,7 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; /** - * Commands are rebuilt whenever {@link ServerResources} is recreated. + * Commands are rebuilt whenever {@link ReloadableServerResources} is recreated. * You can use this event to register your commands whenever the {@link Commands} class in constructed. * * The event is fired on the {@link MinecraftForge#EVENT_BUS} diff --git a/src/main/java/net/minecraftforge/event/TagsUpdatedEvent.java b/src/main/java/net/minecraftforge/event/TagsUpdatedEvent.java index 21bd7e06ce..77e68e3143 100644 --- a/src/main/java/net/minecraftforge/event/TagsUpdatedEvent.java +++ b/src/main/java/net/minecraftforge/event/TagsUpdatedEvent.java @@ -5,33 +5,23 @@ package net.minecraftforge.event; -import net.minecraft.tags.TagContainer; -import net.minecraftforge.common.MinecraftForge; +import net.minecraft.core.RegistryAccess; import net.minecraftforge.eventbus.api.Event; -/** - * Fired on the client when : - * {@link TagContainer} has all of its tags synced from the server to the client (just after a client has connected). - * The integrated server is about to be created see {@code net.minecraft.client.Minecraft#doLoadLevel} - * Fired on the server when {@link TagContainer} has read all tags from disk, during initial load and after the reload command is used - * This event is fired on the {@link MinecraftForge#EVENT_BUS} - * On the client, this event fires on the Client Thread. - * On the server, this event may be fired on the Server Thread, or an async reloader thread. - */ public class TagsUpdatedEvent extends Event { - private final TagContainer manager; + private final RegistryAccess registries; - public TagsUpdatedEvent(TagContainer manager) - { - this.manager = manager; - } + public TagsUpdatedEvent(RegistryAccess registries) + { + this.registries = registries; + } - /** - * @return The impl tag manager that has been updated with newly received tags. - */ - public TagContainer getTagManager() - { - return manager; - } + /** + * @return The dynamic registries that have had their tags rebound. + */ + public RegistryAccess getTagManager() + { + return registries; + } } diff --git a/src/main/java/net/minecraftforge/event/world/StructureSpawnListGatherEvent.java b/src/main/java/net/minecraftforge/event/world/StructureSpawnListGatherEvent.java index 01b0d13504..74b8ef8f73 100644 --- a/src/main/java/net/minecraftforge/event/world/StructureSpawnListGatherEvent.java +++ b/src/main/java/net/minecraftforge/event/world/StructureSpawnListGatherEvent.java @@ -43,13 +43,15 @@ public class StructureSpawnListGatherEvent extends Event public StructureSpawnListGatherEvent(StructureFeature structure) { this.structure = structure; - this.insideOnly = this.structure.getDefaultRestrictsSpawnsToInside(); + this.insideOnly = false; + /*this.insideOnly = this.structure.getDefaultRestrictsSpawnsToInside(); for (MobCategory cat : MobCategory.values()) { List lst = this.structure.getDefaultSpawnList(cat); if (!lst.isEmpty()) addEntitySpawns(cat, lst); - } + }*/ + // TODO-PATCHING: follow how StructureSpawnManager is reengineered } /** diff --git a/src/main/java/net/minecraftforge/network/filters/VanillaConnectionNetworkFilter.java b/src/main/java/net/minecraftforge/network/filters/VanillaConnectionNetworkFilter.java index 2e6053d129..906c243ec3 100644 --- a/src/main/java/net/minecraftforge/network/filters/VanillaConnectionNetworkFilter.java +++ b/src/main/java/net/minecraftforge/network/filters/VanillaConnectionNetworkFilter.java @@ -24,7 +24,7 @@ import net.minecraft.network.protocol.game.ClientboundUpdateAttributesPacket; import net.minecraft.network.protocol.game.ClientboundUpdateTagsPacket; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.TagCollection; +import net.minecraft.tags.TagNetworkSerialization; import net.minecraftforge.common.ForgeTagHandler; import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.registries.ForgeRegistries; @@ -99,7 +99,7 @@ public class VanillaConnectionNetworkFilter extends VanillaPacketFilter * It prevents a rare error from logging and reduces the packet size */ private static ClientboundUpdateTagsPacket filterCustomTagTypes(ClientboundUpdateTagsPacket packet) { - Map>, TagCollection.NetworkPayload> tags = packet.getTags() + Map>, TagNetworkSerialization.NetworkPayload> tags = packet.getTags() .entrySet().stream().filter(e -> !ForgeTagHandler.getCustomTagTypeNames().contains(e.getKey().location())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); return new ClientboundUpdateTagsPacket(tags); diff --git a/src/main/java/net/minecraftforge/registries/ForgeRegistry.java b/src/main/java/net/minecraftforge/registries/ForgeRegistry.java index 12806e9387..53ca032ed5 100644 --- a/src/main/java/net/minecraftforge/registries/ForgeRegistry.java +++ b/src/main/java/net/minecraftforge/registries/ForgeRegistry.java @@ -392,6 +392,12 @@ public class ForgeRegistry> implements IForgeRe } } + if (this.builder.getVanillaHolder() != null) + { + var ref = this.builder.getVanillaHolder().apply(value); + ref.bind(rkey, value); + } + if (this.add != null) this.add.onAdd(this, this.stage, idToUse, value, oldEntry); @@ -1140,5 +1146,10 @@ public class ForgeRegistry> implements IForgeRe LOGGER.debug(REGISTRIES,"There were {} missing mappings that have been ignored", ignored); } + RegistryBuilder getBuilder() + { + return this.builder; + } + private record OverrideOwner(String owner, ResourceKey key){}; } diff --git a/src/main/java/net/minecraftforge/registries/GameData.java b/src/main/java/net/minecraftforge/registries/GameData.java index b55dd3254d..487fb75adc 100644 --- a/src/main/java/net/minecraftforge/registries/GameData.java +++ b/src/main/java/net/minecraftforge/registries/GameData.java @@ -35,7 +35,6 @@ import net.minecraft.world.effect.MobEffect; import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.stats.StatType; -import net.minecraft.tags.StaticTags; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.core.DefaultedRegistry; import net.minecraft.core.Registry; @@ -50,7 +49,6 @@ import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.StructureFeature; import net.minecraft.world.level.levelgen.feature.foliageplacers.FoliagePlacerType; import net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecoratorType; -import net.minecraftforge.common.ForgeTagHandler; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.loot.GlobalLootModifierSerializer; import net.minecraftforge.common.util.LogMessageAdapter; @@ -120,15 +118,15 @@ public class GameData hasInit = true; // Game objects - makeRegistry(BLOCKS, Block.class, "air").addCallback(BlockCallbacks.INSTANCE).legacyName("blocks").create(); - makeRegistry(FLUIDS, Fluid.class, "empty").create(); - makeRegistry(ITEMS, Item.class, "air").addCallback(ItemCallbacks.INSTANCE).legacyName("items").create(); + makeRegistry(BLOCKS, Block.class, "air").addCallback(BlockCallbacks.INSTANCE).legacyName("blocks").vanillaHolder(Block::builtInRegistryHolder).create(); + makeRegistry(FLUIDS, Fluid.class, "empty").vanillaHolder(Fluid::builtInRegistryHolder).create(); + makeRegistry(ITEMS, Item.class, "air").addCallback(ItemCallbacks.INSTANCE).legacyName("items").vanillaHolder(Item::builtInRegistryHolder).create(); makeRegistry(MOB_EFFECTS, MobEffect.class).legacyName("potions").tagFolder("mob_effects").create(); //makeRegistry(BIOMES, Biome.class).legacyName("biomes").create(); makeRegistry(SOUND_EVENTS, SoundEvent.class).legacyName("soundevents").create(); makeRegistry(POTIONS, Potion.class, "empty").legacyName("potiontypes").tagFolder("potions").create(); makeRegistry(ENCHANTMENTS, Enchantment.class).legacyName("enchantments").tagFolder("enchantments").create(); - makeRegistry(ENTITY_TYPES, c(EntityType.class), "pig").legacyName("entities").create(); + makeRegistry(ENTITY_TYPES, c(EntityType.class), "pig").legacyName("entities").vanillaHolder(EntityType::builtInRegistryHolder).create(); makeRegistry(BLOCK_ENTITY_TYPES, c(BlockEntityType.class)).disableSaving().legacyName("blockentities").tagFolder("block_entity_types").create(); makeRegistry(PARTICLE_TYPES, c(ParticleType.class)).disableSaving().create(); makeRegistry(CONTAINER_TYPES, c(MenuType.class)).disableSaving().create(); @@ -257,10 +255,18 @@ public class GameData LOGGER.debug(REGISTRIES, "Vanilla freeze snapshot created"); } + public static void unfreezeData() + { + LOGGER.debug(REGISTRIES, "Unfreezing vanilla registries"); + Registry.REGISTRY.stream().filter(r -> r instanceof MappedRegistry).forEach(r -> ((MappedRegistry)r).unfreeze()); + } + @SuppressWarnings({ "rawtypes", "unchecked" }) public static void freezeData() { LOGGER.debug(REGISTRIES, "Freezing registries"); + Registry.REGISTRY.stream().filter(r -> r instanceof MappedRegistry).forEach(r -> ((MappedRegistry)r).freeze()); + for (Map.Entry>> r : RegistryManager.ACTIVE.registries.entrySet()) { final Class clazz = RegistryManager.ACTIVE.getSuperType(r.getKey()); @@ -372,22 +378,6 @@ public class GameData }, executor); } - public static void setCustomTagTypesFromRegistries() - { - Set customTagTypes = new HashSet<>(); - for (Map.Entry>> entry : RegistryManager.ACTIVE.registries.entrySet()) - { - ResourceLocation registryName = entry.getKey(); - if (entry.getValue().getTagFolder() != null && StaticTags.get(registryName) == null) - { - LOGGER.debug(REGISTRIES, "Registering custom tag type for: {}", registryName); - customTagTypes.add(registryName); - StaticTags.create(ResourceKey.createRegistryKey(registryName), "tags/" + entry.getValue().getTagFolder()); - } - } - ForgeTagHandler.setCustomTagTypes(customTagTypes); - } - //Lets us clear the map so we can rebuild it. private static class ClearableObjectIntIdentityMap extends IdMapper { diff --git a/src/main/java/net/minecraftforge/registries/NamespacedDefaultedWrapper.java b/src/main/java/net/minecraftforge/registries/NamespacedDefaultedWrapper.java index 016fe882c5..5b56dc0ac2 100644 --- a/src/main/java/net/minecraftforge/registries/NamespacedDefaultedWrapper.java +++ b/src/main/java/net/minecraftforge/registries/NamespacedDefaultedWrapper.java @@ -5,16 +5,16 @@ package net.minecraftforge.registries; -import java.util.Collection; import java.util.Iterator; import java.util.Map; import java.util.Optional; import java.util.OptionalInt; -import java.util.Random; import java.util.Set; +import java.util.function.Function; import javax.annotation.Nullable; +import net.minecraft.core.Holder; import org.apache.commons.lang3.Validate; import net.minecraft.resources.ResourceKey; @@ -31,14 +31,14 @@ class NamespacedDefaultedWrapper> extends Defau private boolean locked = false; private ForgeRegistry delegate; - private NamespacedDefaultedWrapper(ForgeRegistry owner) + private NamespacedDefaultedWrapper(ForgeRegistry owner, Function> holderLookup) { - super("empty", owner.getRegistryKey(), Lifecycle.experimental()); + super("empty", owner.getRegistryKey(), Lifecycle.experimental(), holderLookup); this.delegate = owner; } @Override - public V registerMapping(int id, ResourceKey key, V value, Lifecycle lifecycle) + public Holder registerMapping(final int id, final ResourceKey key, final T value, final Lifecycle lifecycle) { if (locked) throw new IllegalStateException("Can not register to a locked registry. Modder should use Forge Register methods."); @@ -51,21 +51,22 @@ class NamespacedDefaultedWrapper> extends Defau if (realId != id && id != -1) LOGGER.warn("Registered object did not get ID it asked for. Name: {} Type: {} Expected: {} Got: {}", key, value.getRegistryType().getName(), id, realId); - return value; + return super.registerMapping(realId, key, value, lifecycle); } @Override - public V register(ResourceKey key, V value, Lifecycle lifecycle) + public Holder register(final ResourceKey p_205891_, final T p_205892_, final Lifecycle p_205893_) { - return registerMapping(-1, key, value, lifecycle); + return registerMapping(-1, p_205891_, p_205892_, p_205893_); } @Override - public V registerOrOverride(OptionalInt id, ResourceKey key, V value, Lifecycle lifecycle) { + public Holder registerOrOverride(final OptionalInt id, final ResourceKey p_205885_, final T p_205886_, final Lifecycle p_205887_) + { int wanted = -1; if (id.isPresent() && byId(id.getAsInt()) != null) wanted = id.getAsInt(); - return registerMapping(wanted, key, value, lifecycle); + return registerMapping(wanted, p_205885_, p_205886_, p_205887_); } // Reading Functions @@ -144,13 +145,7 @@ class NamespacedDefaultedWrapper> extends Defau return this.delegate.getEntries(); } - @Override - @Nullable - public T getRandom(Random random) - { - Collection values = this.delegate.getValues(); - return values.stream().skip(random.nextInt(values.size())).findFirst().orElse(this.delegate.getDefault()); - } + //TODO-PATCHING: Figure out if getRandom needs to be overriden. @Override public ResourceLocation getDefaultKey() @@ -162,13 +157,16 @@ class NamespacedDefaultedWrapper> extends Defau @Override public void lock(){ this.locked = true; } + //@Override public void unfreeze() {} + public static class Factory> implements IForgeRegistry.CreateCallback { public static final ResourceLocation ID = new ResourceLocation("forge", "registry_defaulted_wrapper"); @Override public void onCreate(IForgeRegistryInternal owner, RegistryManager stage) { - owner.setSlaveMap(ID, new NamespacedDefaultedWrapper((ForgeRegistry)owner)); + ForgeRegistry fowner = (ForgeRegistry)owner; + owner.setSlaveMap(ID, new NamespacedDefaultedWrapper(fowner, fowner.getBuilder().getVanillaHolder())); } } } diff --git a/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java b/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java index b0a02c9759..566a25dcb6 100644 --- a/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java +++ b/src/main/java/net/minecraftforge/registries/NamespacedWrapper.java @@ -5,15 +5,15 @@ package net.minecraftforge.registries; -import java.util.Collection; import java.util.Iterator; import java.util.Map; import java.util.Optional; import java.util.OptionalInt; -import java.util.Random; import java.util.Set; +import java.util.function.Function; import javax.annotation.Nullable; +import net.minecraft.core.Holder; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.core.MappedRegistry; @@ -29,14 +29,14 @@ class NamespacedWrapper> extends MappedRegistry private boolean locked = false; private ForgeRegistry delegate; - public NamespacedWrapper(ForgeRegistry owner) + public NamespacedWrapper(ForgeRegistry owner, Function> holderLookup) { - super(owner.getRegistryKey(), Lifecycle.experimental()); + super(owner.getRegistryKey(), Lifecycle.experimental(), holderLookup); this.delegate = owner; } @Override - public V registerMapping(int id, ResourceKey key, V value, Lifecycle lifecycle) + public Holder registerMapping(int id, ResourceKey key, T value, Lifecycle lifecycle) { if (locked) throw new IllegalStateException("Can not register to a locked registry. Modder should use Forge Register methods."); @@ -49,17 +49,17 @@ class NamespacedWrapper> extends MappedRegistry int realId = this.delegate.add(id, value); if (realId != id && id != -1) LOGGER.warn("Registered object did not get ID it asked for. Name: {} Type: {} Expected: {} Got: {}", key, value.getRegistryType().getName(), id, realId); - return value; + return super.registerMapping(realId, key, value, lifecycle); } @Override - public R register(ResourceKey key, R value, Lifecycle lifecycle) + public Holder register(ResourceKey key, T value, Lifecycle lifecycle) { return registerMapping(-1, key, value, lifecycle); } @Override - public V registerOrOverride(OptionalInt id, ResourceKey key, V value, Lifecycle lifecycle) { + public Holder registerOrOverride(OptionalInt id, ResourceKey key, T value, Lifecycle lifecycle) { int wanted = -1; if (id.isPresent() && byId(id.getAsInt()) != null) wanted = id.getAsInt(); @@ -142,13 +142,7 @@ class NamespacedWrapper> extends MappedRegistry return this.delegate.getEntries(); } - @Override - @Nullable - public T getRandom(Random random) - { - Collection values = this.delegate.getValues(); - return values.stream().skip(random.nextInt(values.size())).findFirst().orElse(null); - } + // TODO-PATCHING: Figure out if getRandom needs to be overriden. /* @Override @@ -162,13 +156,16 @@ class NamespacedWrapper> extends MappedRegistry @Override public void lock(){ this.locked = true; } + //@Override public void unfreeze() {} + public static class Factory> implements IForgeRegistry.CreateCallback { public static final ResourceLocation ID = new ResourceLocation("forge", "registry_defaulted_wrapper"); @Override public void onCreate(IForgeRegistryInternal owner, RegistryManager stage) { - owner.setSlaveMap(ID, new NamespacedWrapper((ForgeRegistry)owner)); + ForgeRegistry fowner = (ForgeRegistry)owner; + owner.setSlaveMap(ID, new NamespacedWrapper(fowner, fowner.getBuilder().getVanillaHolder())); } } } diff --git a/src/main/java/net/minecraftforge/registries/RegistryBuilder.java b/src/main/java/net/minecraftforge/registries/RegistryBuilder.java index 46f72c6990..08cce7aaab 100644 --- a/src/main/java/net/minecraftforge/registries/RegistryBuilder.java +++ b/src/main/java/net/minecraftforge/registries/RegistryBuilder.java @@ -8,9 +8,11 @@ package net.minecraftforge.registries; import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.function.Function; import com.google.common.collect.Lists; +import net.minecraft.core.Holder; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.registries.IForgeRegistry.*; @@ -30,6 +32,7 @@ public class RegistryBuilder> private List> createCallback = Lists.newArrayList(); private List> validateCallback = Lists.newArrayList(); private List> bakeCallback = Lists.newArrayList(); + private Function> vanillaHolder; private boolean saveToDisc = true; private boolean sync = true; private boolean allowOverrides = true; @@ -218,6 +221,12 @@ public class RegistryBuilder> return this; } + RegistryBuilder vanillaHolder(Function> func) + { + this.vanillaHolder = func; + return this; + } + public IForgeRegistry create() { if (hasWrapper) @@ -368,4 +377,9 @@ public class RegistryBuilder> { return legacyNames; } + + Function> getVanillaHolder() + { + return this.vanillaHolder; + } } diff --git a/src/main/java/net/minecraftforge/server/LanguageHook.java b/src/main/java/net/minecraftforge/server/LanguageHook.java index aaa1c8ae05..68405fb1fc 100644 --- a/src/main/java/net/minecraftforge/server/LanguageHook.java +++ b/src/main/java/net/minecraftforge/server/LanguageHook.java @@ -67,7 +67,7 @@ public class LanguageHook private static void loadLanguage(String langName, MinecraftServer server) { String langFile = String.format(Locale.ROOT, "lang/%s.json", langName); - ResourceManager resourceManager = server.getServerResources().getResourceManager(); + ResourceManager resourceManager = server.getServerResources().resourceManager(); resourceManager.getNamespaces().forEach(namespace -> { try { ResourceLocation langResource = new ResourceLocation(namespace, langFile); diff --git a/src/main/java/net/minecraftforge/server/permission/PermissionAPI.java b/src/main/java/net/minecraftforge/server/permission/PermissionAPI.java index 4c0a8cc81a..f88f21a7d0 100644 --- a/src/main/java/net/minecraftforge/server/permission/PermissionAPI.java +++ b/src/main/java/net/minecraftforge/server/permission/PermissionAPI.java @@ -95,7 +95,7 @@ public final class PermissionAPI */ public static void initializePermissionAPI() { - Class callerClass = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass(); + Class callerClass = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass(); if (callerClass != ServerLifecycleHooks.class) { LOGGER.warn("{} tried to initialize the PermissionAPI, this call will be ignored.", callerClass.getName()); diff --git a/src/main/java/net/minecraftforge/server/permission/exceptions/UnregisteredPermissionException.java b/src/main/java/net/minecraftforge/server/permission/exceptions/UnregisteredPermissionException.java index 7acc4a7fa9..7140da8b7c 100644 --- a/src/main/java/net/minecraftforge/server/permission/exceptions/UnregisteredPermissionException.java +++ b/src/main/java/net/minecraftforge/server/permission/exceptions/UnregisteredPermissionException.java @@ -11,15 +11,15 @@ import java.util.Locale; public class UnregisteredPermissionException extends RuntimeException { - private PermissionNode node; + private PermissionNode node; - public UnregisteredPermissionException(PermissionNode node) + public UnregisteredPermissionException(PermissionNode node) { super(String.format(Locale.ENGLISH, "Tried to query PermissionNode '%s' although it has not been Registered", node.getNodeName())); this.node = node; } - public PermissionNode getNode() + public PermissionNode getNode() { return node; } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 8c08cf5f46..126a1a8f0a 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -75,7 +75,7 @@ public net.minecraft.client.multiplayer.ClientPacketListener f_104899_ # command public net.minecraft.client.particle.ParticleEngine m_107378_(Lnet/minecraft/core/particles/ParticleType;Lnet/minecraft/client/particle/ParticleEngine$SpriteParticleRegistration;)V # register public net.minecraft.client.particle.ParticleEngine m_107381_(Lnet/minecraft/core/particles/ParticleType;Lnet/minecraft/client/particle/ParticleProvider;)V # register public net.minecraft.client.particle.ParticleEngine$SpriteParticleRegistration -public net.minecraft.client.player.LocalPlayer m_8088_()I #getPermissionLevel +public net.minecraft.client.player.LocalPlayer m_8088_()I # getPermissionLevel public net.minecraft.client.renderer.GameRenderer m_109128_(Lnet/minecraft/resources/ResourceLocation;)V # loadEffect protected-f net.minecraft.client.renderer.RenderStateShard f_110131_ # setupState public net.minecraft.client.renderer.RenderStateShard$BooleanStateShard @@ -137,6 +137,7 @@ public net.minecraft.client.sounds.SoundEngine f_120217_ # soundManager public net.minecraft.commands.arguments.selector.EntitySelectorParser m_121229_()V # finalizePredicates public net.minecraft.commands.arguments.selector.EntitySelectorParser m_121317_()V # parseOptions public net.minecraft.commands.arguments.selector.options.EntitySelectorOptions m_121453_(Ljava/lang/String;Lnet/minecraft/commands/arguments/selector/options/EntitySelectorOptions$Modifier;Ljava/util/function/Predicate;Lnet/minecraft/network/chat/Component;)V # register +public net.minecraft.core.Holder$Reference m_205775_(Lnet/minecraft/resources/ResourceKey;Ljava/lang/Object;)V # bind protected net.minecraft.core.IdMapper f_122653_ # nextId protected net.minecraft.core.IdMapper f_122654_ # tToId - internal map protected net.minecraft.core.IdMapper f_122655_ # idToT - internal index list @@ -185,7 +186,6 @@ protected net.minecraft.data.loot.EntityLoot f_124366_ # ENTITY_ON_FIRE protected net.minecraft.data.loot.EntityLoot m_124371_(Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/level/storage/loot/LootTable$Builder;)V # add protected net.minecraft.data.loot.EntityLoot m_124380_(Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/world/level/storage/loot/LootTable$Builder;)V # add protected net.minecraft.data.recipes.RecipeProvider f_125970_ # generator -protected net.minecraft.data.recipes.RecipeProvider m_125975_(Lnet/minecraft/tags/Tag;)Lnet/minecraft/advancements/critereon/InventoryChangeTrigger$TriggerInstance; # has protected net.minecraft.data.recipes.RecipeProvider m_125977_(Lnet/minecraft/world/level/ItemLike;)Lnet/minecraft/advancements/critereon/InventoryChangeTrigger$TriggerInstance; # has protected net.minecraft.data.recipes.RecipeProvider m_125979_(Lnet/minecraft/world/level/block/Block;)Lnet/minecraft/advancements/critereon/EnterBlockTrigger$TriggerInstance; # insideOf protected net.minecraft.data.recipes.RecipeProvider m_126011_([Lnet/minecraft/advancements/critereon/ItemPredicate;)Lnet/minecraft/advancements/critereon/InventoryChangeTrigger$TriggerInstance; # inventoryTrigger @@ -193,10 +193,12 @@ protected net.minecraft.data.recipes.RecipeProvider m_126013_(Lnet/minecraft/dat protected net.minecraft.data.recipes.RecipeProvider m_176531_(Ljava/util/function/Consumer;)V # buildCraftingRecipes public net.minecraft.data.recipes.ShapedRecipeBuilder$Result protected net.minecraft.data.tags.TagsProvider f_126543_ # builders +protected net.minecraft.data.tags.TagsProvider m_6648_(Lnet/minecraft/resources/ResourceLocation;)Ljava/nio/file/Path; # getPath public net.minecraft.data.tags.TagsProvider$TagAppender f_126569_ # registry +public net.minecraft.gametest.framework.GameTestServer (Ljava/lang/Thread;Lnet/minecraft/world/level/storage/LevelStorageSource$LevelStorageAccess;Lnet/minecraft/server/packs/repository/PackRepository;Lnet/minecraft/server/WorldStem;Ljava/util/Collection;Lnet/minecraft/core/BlockPos;)V # constructor public net.minecraft.network.protocol.status.ClientboundStatusResponsePacket f_134885_ # GSON -public net.minecraft.resources.RegistryReadOps f_179860_ # registryAccess protected net.minecraft.server.MinecraftServer f_129726_ # nextTickTime +public net.minecraft.server.MinecraftServer$ReloadableResources public net.minecraft.server.dedicated.DedicatedServer f_139600_ # consoleInput public net.minecraft.server.level.ServerChunkCache f_8329_ # level public net.minecraft.server.level.ServerLevel m_142646_()Lnet/minecraft/world/level/entity/LevelEntityGetter; # getEntities @@ -205,15 +207,11 @@ public net.minecraft.server.level.ServerPlayer m_143399_(Lnet/minecraft/world/in public net.minecraft.server.level.ServerPlayer m_9217_()V # nextContainerCounter public net.minecraft.server.packs.AbstractPackResources f_10203_ # file public net.minecraft.server.packs.resources.FallbackResourceManager f_10599_ # fallbacks -public net.minecraft.tags.BlockTags m_13116_(Ljava/lang/String;)Lnet/minecraft/tags/Tag$Named; # bind -public net.minecraft.tags.EntityTypeTags m_13127_(Ljava/lang/String;)Lnet/minecraft/tags/Tag$Named; # bind -public net.minecraft.tags.FluidTags m_13134_(Ljava/lang/String;)Lnet/minecraft/tags/Tag$Named; # bind -public net.minecraft.tags.GameEventTags m_144307_(Ljava/lang/String;)Lnet/minecraft/tags/Tag$Named; # bind -public net.minecraft.tags.ItemTags m_13194_(Ljava/lang/String;)Lnet/minecraft/tags/Tag$Named; # bind -protected net.minecraft.tags.StaticTagHelper$Wrapper f_13251_ # tag public net.minecraft.tags.Tag$BuilderEntry (Lnet/minecraft/tags/Tag$Entry;Ljava/lang/String;)V # constructor -public net.minecraft.tags.TagContainer (Ljava/util/Map;)V # constructor -public net.minecraft.tags.TagContainer f_144433_ # collections +public net.minecraft.tags.Tag$ElementEntry +public net.minecraft.tags.Tag$OptionalElementEntry +public net.minecraft.tags.Tag$OptionalTagEntry +public net.minecraft.tags.Tag$TagEntry public net.minecraft.util.thread.BlockableEventLoop m_18689_(Ljava/lang/Runnable;)Ljava/util/concurrent/CompletableFuture; # submitAsync #group public net.minecraft.world.damagesource.DamageSource *() #All methods public, most are already public net.minecraft.world.damagesource.DamageSource (Ljava/lang/String;)V # constructor @@ -249,7 +247,7 @@ public net.minecraft.world.inventory.MenuType$MenuSupplier public-f net.minecraft.world.item.CreativeModeTab f_40748_ # TABS - group array #group public net.minecraft.world.item.Item public net.minecraft.world.item.AxeItem (Lnet/minecraft/world/item/Tier;FFLnet/minecraft/world/item/Item$Properties;)V # constructor -public net.minecraft.world.item.DiggerItem (FFLnet/minecraft/world/item/Tier;Lnet/minecraft/tags/Tag;Lnet/minecraft/world/item/Item$Properties;)V # constructor +public net.minecraft.world.item.DiggerItem (FFLnet/minecraft/world/item/Tier;Lnet/minecraft/tags/TagKey;Lnet/minecraft/world/item/Item$Properties;)V # constructor public net.minecraft.world.item.HoeItem (Lnet/minecraft/world/item/Tier;IFLnet/minecraft/world/item/Item$Properties;)V # constructor public net.minecraft.world.item.PickaxeItem (Lnet/minecraft/world/item/Tier;IFLnet/minecraft/world/item/Item$Properties;)V # constructor public net.minecraft.world.item.RecordItem (ILnet/minecraft/sounds/SoundEvent;Lnet/minecraft/world/item/Item$Properties;)V # constructor @@ -266,7 +264,7 @@ public net.minecraft.world.item.crafting.Ingredient m_43938_(Ljava/util/stream/S public net.minecraft.world.item.crafting.Ingredient$ItemValue public net.minecraft.world.item.crafting.Ingredient$ItemValue (Lnet/minecraft/world/item/ItemStack;)V # constructor public net.minecraft.world.item.crafting.Ingredient$TagValue -public net.minecraft.world.item.crafting.Ingredient$TagValue (Lnet/minecraft/tags/Tag;)V # constructor +public net.minecraft.world.item.crafting.Ingredient$TagValue (Lnet/minecraft/tags/TagKey;)V # constructor public net.minecraft.world.item.crafting.Ingredient$Value public net.minecraft.world.level.GameRules m_46189_(Ljava/lang/String;Lnet/minecraft/world/level/GameRules$Category;Lnet/minecraft/world/level/GameRules$Type;)Lnet/minecraft/world/level/GameRules$Key; # register public net.minecraft.world.level.Level f_46437_ # oRainLevel @@ -421,7 +419,6 @@ protected net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator f_158382_ protected net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator f_64333_ # seed protected net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator m_158413_(II[Lnet/minecraft/world/level/block/state/BlockState;Ljava/util/function/Predicate;II)Ljava/util/OptionalInt; # iterateNoiseColumn #group public net.minecraft.world.level.levelgen.NoiseGeneratorSettings *() -public net.minecraft.world.level.levelgen.NoiseGeneratorSettings (Lnet/minecraft/world/level/levelgen/StructureSettings;Lnet/minecraft/world/level/levelgen/NoiseSettings;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/levelgen/SurfaceRules$RuleSource;IZZZZZZ)V # constructor public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_198262_(Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings;)V # register public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_198265_(ZZ)Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # overworld public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_198268_()Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # end @@ -429,14 +426,9 @@ public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_198269_()Lnet public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_198270_()Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # caves public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_198271_()Lnet/minecraft/world/level/levelgen/NoiseGeneratorSettings; # floatingIslands public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_64474_(Lcom/mojang/serialization/codecs/RecordCodecBuilder$Instance;)Lcom/mojang/datafixers/kinds/App; # lambda$static$0 -public net.minecraft.world.level.levelgen.NoiseGeneratorSettings m_64487_()Z # disableMobGeneration #endgroup -protected net.minecraft.world.level.levelgen.NoiseSampler f_158643_ # noiseSettings -public net.minecraft.world.level.levelgen.NoiseSampler f_158644_ # blendedNoise -public net.minecraft.world.level.levelgen.NoiseSampler f_158645_ # islandNoise -protected net.minecraft.world.level.levelgen.NoiseSampler m_158667_(DI)D # applySlide +public net.minecraft.world.level.levelgen.WorldGenSettings (JZZLnet/minecraft/core/Registry;Ljava/util/Optional;)V # constructor public net.minecraft.world.level.levelgen.WorldGenSettings f_64606_ # legacyCustomOptions -public net.minecraft.world.level.levelgen.WorldGenSettings (JZZLnet/minecraft/core/MappedRegistry;Ljava/util/Optional;)V # constructor public net.minecraft.world.level.levelgen.feature.foliageplacers.FoliagePlacerType (Lcom/mojang/serialization/Codec;)V # constructor public net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProviderType (Lcom/mojang/serialization/Codec;)V # constructor public net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecoratorType (Lcom/mojang/serialization/Codec;)V # constructor diff --git a/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java b/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java index a263cbc5e6..da1eb5bef8 100644 --- a/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java +++ b/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java @@ -456,7 +456,7 @@ public class DataGeneratorTest @Override protected void addTags() { - tag(BlockTags.bind(new ResourceLocation(MODID, "test").toString())) + tag(BlockTags.create(new ResourceLocation(MODID, "test"))) .add(Blocks.DIAMOND_BLOCK) .addTag(BlockTags.STONE_BRICKS) .addTag(net.minecraftforge.common.Tags.Blocks.COBBLESTONE) @@ -464,14 +464,14 @@ public class DataGeneratorTest .addOptionalTag(new ResourceLocation("forge", "storage_blocks/ruby")); // Hopefully sorting issues - tag(BlockTags.bind(new ResourceLocation(MODID, "thing/one").toString())) + tag(BlockTags.create(new ResourceLocation(MODID, "thing/one"))) .add(Blocks.COBBLESTONE); - tag(BlockTags.bind(new ResourceLocation(MODID, "thing/two").toString())) + tag(BlockTags.create(new ResourceLocation(MODID, "thing/two"))) .add(Blocks.DIORITE); - tag(BlockTags.bind(new ResourceLocation(MODID, "thing/three").toString())) + tag(BlockTags.create(new ResourceLocation(MODID, "thing/three"))) .add(Blocks.ANDESITE); - tag(BlockTags.bind(new ResourceLocation(MODID, "things").toString())) + tag(BlockTags.create(new ResourceLocation(MODID, "things"))) .add(Blocks.COBBLESTONE) .add(Blocks.DIORITE) .add(Blocks.ANDESITE); diff --git a/src/test/java/net/minecraftforge/debug/DuplicateOptionalTagTest.java b/src/test/java/net/minecraftforge/debug/DuplicateOptionalTagTest.java index 6881f14779..0167ae0547 100644 --- a/src/test/java/net/minecraftforge/debug/DuplicateOptionalTagTest.java +++ b/src/test/java/net/minecraftforge/debug/DuplicateOptionalTagTest.java @@ -41,45 +41,46 @@ public class DuplicateOptionalTagTest private static final Set> TAG_A_DEFAULTS = Set.of(Blocks.BEDROCK.delegate); private static final Set> TAG_B_DEFAULTS = Set.of(Blocks.WHITE_WOOL.delegate); - private static final Tags.IOptionalNamedTag TAG_A = ForgeTagHandler.createOptionalTag(ForgeRegistries.BLOCKS, TAG_NAME, - TAG_A_DEFAULTS); - private static final Tags.IOptionalNamedTag TAG_B = ForgeTagHandler.createOptionalTag(ForgeRegistries.BLOCKS, TAG_NAME, - TAG_B_DEFAULTS); + // TODO-PATCHING: fix or remove this accordingly with optional tags feature (specifically, default values for opt. tags) +// private static final Tags.IOptionalNamedTag TAG_A = ForgeTagHandler.createOptionalTag(ForgeRegistries.BLOCKS, TAG_NAME, +// TAG_A_DEFAULTS); +// private static final Tags.IOptionalNamedTag TAG_B = ForgeTagHandler.createOptionalTag(ForgeRegistries.BLOCKS, TAG_NAME, +// TAG_B_DEFAULTS); public DuplicateOptionalTagTest() { - MinecraftForge.EVENT_BUS.addListener(this::onServerStarted); +// MinecraftForge.EVENT_BUS.addListener(this::onServerStarted); } - private void onServerStarted(ServerStartedEvent event) - { - if (!TAG_A.isDefaulted()) - { - LOGGER.warn("First instance of optional tag is not defaulted!"); - } - - if (!TAG_B.isDefaulted()) - { - LOGGER.warn("Second instance of optional tag is not defaulted!"); - } - - if (!TAG_A.getValues().equals(TAG_B.getValues())) - { - LOGGER.error("Values of both optional tag instances are not the same: first instance: {}, second instance: {}", - TAG_A.getValues(), TAG_B.getValues()); - return; - } - - final List expected = Sets.union(TAG_A_DEFAULTS, TAG_B_DEFAULTS).stream() - .map(Supplier::get) - .toList(); - if (!TAG_A.getValues().equals(expected)) - { - LOGGER.error("Values of the optional tag do not match the expected union of their defaults: expected {}, got {}", - expected, TAG_A.getValues()); - return; - } - - LOGGER.info("Optional tag instances match each other and the expected union of their defaults"); - } +// private void onServerStarted(ServerStartedEvent event) +// { +// if (!TAG_A.isDefaulted()) +// { +// LOGGER.warn("First instance of optional tag is not defaulted!"); +// } +// +// if (!TAG_B.isDefaulted()) +// { +// LOGGER.warn("Second instance of optional tag is not defaulted!"); +// } +// +// if (!TAG_A.getValues().equals(TAG_B.getValues())) +// { +// LOGGER.error("Values of both optional tag instances are not the same: first instance: {}, second instance: {}", +// TAG_A.getValues(), TAG_B.getValues()); +// return; +// } +// +// final List expected = Sets.union(TAG_A_DEFAULTS, TAG_B_DEFAULTS).stream() +// .map(Supplier::get) +// .toList(); +// if (!TAG_A.getValues().equals(expected)) +// { +// LOGGER.error("Values of the optional tag do not match the expected union of their defaults: expected {}, got {}", +// expected, TAG_A.getValues()); +// return; +// } +// +// LOGGER.info("Optional tag instances match each other and the expected union of their defaults"); +// } } diff --git a/src/test/java/net/minecraftforge/debug/RemoveTagDatagenTest.java b/src/test/java/net/minecraftforge/debug/RemoveTagDatagenTest.java index a3cb6422d6..8dd9238694 100644 --- a/src/test/java/net/minecraftforge/debug/RemoveTagDatagenTest.java +++ b/src/test/java/net/minecraftforge/debug/RemoveTagDatagenTest.java @@ -7,8 +7,10 @@ package net.minecraftforge.debug; import net.minecraft.data.DataGenerator; import net.minecraft.data.tags.BlockTagsProvider; +import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraftforge.common.data.ExistingFileHelper; @@ -21,7 +23,7 @@ import net.minecraftforge.forge.event.lifecycle.GatherDataEvent; public class RemoveTagDatagenTest { public static final String MODID = "remove_tag_datagen_test"; - public static final Tag.Named TEST_TAG = BlockTags.bind("test_tag"); + public static final TagKey TEST_TAG = BlockTags.create(new ResourceLocation("test_tag")); public RemoveTagDatagenTest() { diff --git a/src/test/java/net/minecraftforge/debug/block/BlockEntityOnLoadTest.java b/src/test/java/net/minecraftforge/debug/block/BlockEntityOnLoadTest.java index 7028e323aa..c91252d21a 100644 --- a/src/test/java/net/minecraftforge/debug/block/BlockEntityOnLoadTest.java +++ b/src/test/java/net/minecraftforge/debug/block/BlockEntityOnLoadTest.java @@ -5,6 +5,7 @@ package net.minecraftforge.debug.block; +import com.mojang.logging.LogUtils; import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -24,8 +25,7 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; import javax.annotation.Nullable; import java.util.Locale; @@ -34,6 +34,7 @@ import java.util.Locale; public class BlockEntityOnLoadTest { private static final boolean ENABLED = true; + private static final Logger LOGGER = LogUtils.getLogger(); private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, "be_onload_test"); private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, "be_onload_test"); @@ -82,7 +83,6 @@ public class BlockEntityOnLoadTest private static class TestBlockEntity extends BlockEntity { - private static final Logger LOGGER = LogManager.getLogger(); private boolean loaded = false; public TestBlockEntity(BlockPos pos, BlockState state) diff --git a/src/test/java/net/minecraftforge/debug/block/ScaffoldingTest.java b/src/test/java/net/minecraftforge/debug/block/ScaffoldingTest.java index 17f96ec93f..6c01bdc192 100644 --- a/src/test/java/net/minecraftforge/debug/block/ScaffoldingTest.java +++ b/src/test/java/net/minecraftforge/debug/block/ScaffoldingTest.java @@ -5,6 +5,7 @@ package net.minecraftforge.debug.block; +import net.minecraft.tags.TagKey; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.ScaffoldingBlock; @@ -20,7 +21,6 @@ import net.minecraft.world.level.LevelReader; import net.minecraftforge.client.model.generators.BlockStateProvider; import net.minecraftforge.client.model.generators.ConfiguredModel; import net.minecraftforge.client.model.generators.ModelFile; -import net.minecraftforge.common.Tags.IOptionalNamedTag; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.RegistryObject; @@ -41,7 +41,7 @@ public class ScaffoldingTest { static final String MODID = "scaffolding_test"; static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); - static final IOptionalNamedTag SCAFFOLDING = BlockTags.createOptional(new ResourceLocation("forge", "scaffolding")); + static final TagKey SCAFFOLDING = BlockTags.create(new ResourceLocation("forge", "scaffolding")); static final RegistryObject SCAFFOLDING_METHOD_TEST = BLOCKS.register("scaffolding_method_test", () -> new ScaffoldingMethodTestBlock(Properties.of(Material.DECORATION, MaterialColor.SAND).noCollission().sound(SoundType.SCAFFOLDING).dynamicShape())); diff --git a/src/test/java/net/minecraftforge/debug/chat/ClientCommandTest.java b/src/test/java/net/minecraftforge/debug/chat/ClientCommandTest.java index 3f195c44f9..d0a4303ee9 100644 --- a/src/test/java/net/minecraftforge/debug/chat/ClientCommandTest.java +++ b/src/test/java/net/minecraftforge/debug/chat/ClientCommandTest.java @@ -43,7 +43,7 @@ public class ClientCommandTest // Used for checking suggestion providers that are registered .then(Commands.literal("registeredsuggest").then( Commands.argument("block", ResourceLocationArgument.id()) - .suggests(SuggestionProviders.AVAILABLE_BIOMES) + .suggests(SuggestionProviders.ALL_RECIPES) .executes(this::testCommand))) // Used for checking if attempting to get the server on the client side errors .then(Commands.literal("server") diff --git a/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java b/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java index 09b2fe1b4e..aa792f2bfa 100644 --- a/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java +++ b/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java @@ -13,6 +13,7 @@ import java.util.stream.Stream; import java.util.stream.StreamSupport; import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.level.biome.Biome; import net.minecraftforge.common.ForgeMod; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -93,7 +94,7 @@ public class GravityAttributeTest for(LivingEntity liv : list) { AttributeInstance grav = liv.getAttribute(ForgeMod.ENTITY_GRAVITY.get()); - boolean inPlains = liv.level.getBiome(liv.blockPosition()).getBiomeCategory() == BiomeCategory.PLAINS; + boolean inPlains = Biome.getBiomeCategory(liv.level.getBiome(liv.blockPosition())) == BiomeCategory.PLAINS; if (inPlains && !grav.hasModifier(REDUCED_GRAVITY)) { logger.info("Granted low gravity to Entity: {}", liv); diff --git a/src/test/java/net/minecraftforge/debug/item/TagBasedToolTypesTest.java b/src/test/java/net/minecraftforge/debug/item/TagBasedToolTypesTest.java index 74a99ffb4e..35031565b3 100644 --- a/src/test/java/net/minecraftforge/debug/item/TagBasedToolTypesTest.java +++ b/src/test/java/net/minecraftforge/debug/item/TagBasedToolTypesTest.java @@ -8,6 +8,7 @@ package net.minecraftforge.debug.item; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.*; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.block.Block; @@ -26,8 +27,8 @@ import java.util.List; @Mod.EventBusSubscriber(bus= Mod.EventBusSubscriber.Bus.MOD) public class TagBasedToolTypesTest { - public static final Tag.Named MY_TOOL_TAG = BlockTags.createOptional(new ResourceLocation("tag_based_tool_types:minable/my_tool")); - public static final Tag.Named MY_TIER_TAG = BlockTags.createOptional(new ResourceLocation("tag_based_tool_types:needs_my_tier_tool")); + public static final TagKey MY_TOOL_TAG = BlockTags.create(new ResourceLocation("tag_based_tool_types:minable/my_tool")); + public static final TagKey MY_TIER_TAG = BlockTags.create(new ResourceLocation("tag_based_tool_types:needs_my_tier_tool")); public static final Tier MY_TIER = TierSortingRegistry.registerTier( new ForgeTier(5, 5000, 10, 100, 0, MY_TIER_TAG, () -> Ingredient.of(Items.BEDROCK)), new ResourceLocation("tag_based_tool_types:my_tier"), diff --git a/src/test/java/net/minecraftforge/debug/misc/CustomTagTypesTest.java b/src/test/java/net/minecraftforge/debug/misc/CustomTagTypesTest.java deleted file mode 100644 index f470cc0b96..0000000000 --- a/src/test/java/net/minecraftforge/debug/misc/CustomTagTypesTest.java +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Minecraft Forge - Forge Development LLC - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.debug.misc; - -import java.util.Set; -import java.util.function.Supplier; -import javax.annotation.Nullable; - -import net.minecraft.core.BlockPos; -import net.minecraft.core.Registry; -import net.minecraft.data.DataGenerator; -import net.minecraft.resources.ResourceKey; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.effect.MobEffect; -import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.item.enchantment.Enchantment; -import net.minecraft.world.item.enchantment.EnchantmentHelper; -import net.minecraft.world.item.enchantment.Enchantments; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.PotionItem; -import net.minecraft.world.item.alchemy.Potion; -import net.minecraft.world.item.alchemy.PotionUtils; -import net.minecraft.world.item.alchemy.Potions; -import net.minecraft.tags.Tag; -import net.minecraft.tags.ItemTags; -import net.minecraft.tags.SerializationTags; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.entity.BlockEntityType; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.levelgen.feature.StructureFeature; -import net.minecraftforge.common.ForgeTagHandler; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.data.ExistingFileHelper; -import net.minecraftforge.common.data.ForgeRegistryTagsProvider; -import net.minecraftforge.common.util.ReverseTagWrapper; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.registries.RegistryObject; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.forge.event.lifecycle.GatherDataEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.ForgeRegistryEntry; -import net.minecraftforge.registries.IForgeRegistry; -import net.minecraftforge.registries.RegistryBuilder; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -@Mod(CustomTagTypesTest.MODID) -public class CustomTagTypesTest -{ - public static final String MODID = "custom_tag_types_test"; - private static final Logger LOGGER = LogManager.getLogger(MODID); - private static final ResourceLocation customRegistryName = new ResourceLocation(MODID, "custom_type_registry"); - private static final DeferredRegister CUSTOMS = DeferredRegister.create(Custom.class, MODID); - private static final RegistryObject CUSTOM = CUSTOMS.register("custom", Custom::new); - private static final ResourceKey> CUSTOM_KEY = ResourceKey.createRegistryKey(customRegistryName); - private static final Supplier> CUSTOM_REG = CUSTOMS.makeRegistry(customRegistryName.getPath(), - () -> new RegistryBuilder().tagFolder(MODID + "/custom_types")); - private static final Tag.Named TESTS = ForgeTagHandler.createOptionalTag(customRegistryName, new ResourceLocation(MODID, "tests"), Set.of(CUSTOM)); - private static final Tag.Named OPTIONAL_TEST = ItemTags.createOptional(new ResourceLocation(MODID, "optional_test"), Set.of(() -> Items.BONE)); - private static final Tag.Named FIRE = ForgeTagHandler.createOptionalTag(ForgeRegistries.ENCHANTMENTS, new ResourceLocation(MODID, "fire")); - private static final Tag.Named DAMAGE = ForgeTagHandler.createOptionalTag(ForgeRegistries.POTIONS, new ResourceLocation(MODID, "damage")); - private static final Tag.Named> STORAGE = ForgeTagHandler.createOptionalTag(ForgeRegistries.BLOCK_ENTITIES, new ResourceLocation(MODID, "storage")); - private static final Tag.Named BEACON = ForgeTagHandler.createOptionalTag(ForgeRegistries.MOB_EFFECTS, new ResourceLocation(MODID, "beacon")); - private static final Tag.Named> OVERWORLD_TEMPLE = ForgeTagHandler.createOptionalTag(ForgeRegistries.STRUCTURE_FEATURES, new ResourceLocation(MODID, "overworld_temple")); - - public CustomTagTypesTest() - { - IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus(); - CUSTOMS.register(modBus); - modBus.addListener(this::gatherData); - MinecraftForge.EVENT_BUS.addListener(this::leftClick); - } - - private void gatherData(GatherDataEvent event) - { - if (event.includeServer()) - { - DataGenerator gen = event.getGenerator(); - ExistingFileHelper existingFileHelper = event.getExistingFileHelper(); - gen.addProvider(new CustomRegistryTags(gen, existingFileHelper)); - gen.addProvider(new EnchantmentTags(gen, existingFileHelper)); - gen.addProvider(new PotionTags(gen, existingFileHelper)); - gen.addProvider(new BlockEntityTypeTags(gen, existingFileHelper)); - gen.addProvider(new MobEffectTypeTags(gen, existingFileHelper)); - gen.addProvider(new StructureFeatureTags(gen, existingFileHelper)); - } - } - - private void leftClick(PlayerInteractEvent.LeftClickBlock event) - { - ItemStack itemStack = event.getItemStack(); - if (!itemStack.isEmpty()) - { - LOGGER.info("{} {} {}", Items.BONE.getTags(), OPTIONAL_TEST.getValues().size(), SerializationTags.getInstance().getOrEmpty(Registry.ITEM_REGISTRY).getTag(new ResourceLocation(MODID, "optional_test"))); - LOGGER.info("{} {}", CUSTOM.get().getTags(), TESTS.getValues().size()); - EnchantmentHelper.getEnchantments(itemStack).forEach((enchantment, level) -> logTagsIfPresent(enchantment.getTags())); - if (itemStack.getItem() instanceof PotionItem) logTagsIfPresent(PotionUtils.getPotion(itemStack).getTags()); - BlockEntity blockEntity = event.getWorld().getBlockEntity(event.getPos()); - if (blockEntity != null) logTagsIfPresent(blockEntity.getType().getTags()); - event.getEntityLiving().getActiveEffects().forEach((mobEffectInstance) -> logTagsIfPresent(mobEffectInstance.getEffect().getTags())); - } - - if (event.getPlayer().getLevel() instanceof ServerLevel serverLevel) - { - OVERWORLD_TEMPLE.getValues().forEach(temple -> { - final BlockPos found = serverLevel.findNearestMapFeature(temple, event.getPos(), 100, false); - if (found != null) - { - LOGGER.info("Found {} at {}", temple.getRegistryName(), found); - } - else - { - LOGGER.info("Could not find {}", temple.getRegistryName()); - } - }); - } - } - - private void logTagsIfPresent(Set tags) - { - if (!tags.isEmpty()) - { - LOGGER.info("Tags: {}", tags); - } - } - - public static class Custom extends ForgeRegistryEntry - { - private final ReverseTagWrapper reverseTags = new ReverseTagWrapper<>(this, () -> SerializationTags.getInstance().getOrEmpty(CUSTOM_KEY)); - - public Set getTags() - { - return reverseTags.getTagNames(); - } - } - - public static class CustomRegistryTags extends ForgeRegistryTagsProvider - { - public CustomRegistryTags(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper) - { - super(gen, CUSTOM_REG.get(), MODID, existingFileHelper); - } - - @Override - protected void addTags() - { - tag(TESTS).add(CUSTOM.get()); - } - - @Override - public String getName() - { - return "Custom Registry Tags"; - } - } - - public static class EnchantmentTags extends ForgeRegistryTagsProvider - { - public EnchantmentTags(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper) - { - super(gen, ForgeRegistries.ENCHANTMENTS, MODID, existingFileHelper); - } - - @Override - protected void addTags() - { - tag(FIRE).add(Enchantments.FIRE_ASPECT, Enchantments.FLAMING_ARROWS); - } - - @Override - public String getName() - { - return "Enchantment Tags"; - } - } - - public static class PotionTags extends ForgeRegistryTagsProvider - { - public PotionTags(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper) - { - super(gen, ForgeRegistries.POTIONS, MODID, existingFileHelper); - } - - @Override - protected void addTags() - { - tag(DAMAGE).add(Potions.HARMING, Potions.STRONG_HARMING); - } - - @Override - public String getName() - { - return "Potion Tags"; - } - } - - public static class BlockEntityTypeTags extends ForgeRegistryTagsProvider> - { - public BlockEntityTypeTags(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper) - { - super(gen, ForgeRegistries.BLOCK_ENTITIES, MODID, existingFileHelper); - } - - @Override - protected void addTags() - { - tag(STORAGE).add(BlockEntityType.BARREL, BlockEntityType.CHEST, BlockEntityType.ENDER_CHEST, BlockEntityType.TRAPPED_CHEST); - } - - @Override - public String getName() - { - return "Block Entity Type Tags"; - } - } - - public static class MobEffectTypeTags extends ForgeRegistryTagsProvider - { - public MobEffectTypeTags(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper) - { - super(gen, ForgeRegistries.MOB_EFFECTS, MODID, existingFileHelper); - } - - @Override - protected void addTags() - { - tag(BEACON).add(MobEffects.MOVEMENT_SPEED, MobEffects.JUMP, MobEffects.DIG_SPEED, MobEffects.REGENERATION, MobEffects.DAMAGE_RESISTANCE, MobEffects.DAMAGE_BOOST); - } - - @Override - public String getName() - { - return "Mob Effect Tags"; - } - } - - public static class StructureFeatureTags extends ForgeRegistryTagsProvider> - { - - public StructureFeatureTags(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper) - { - super(gen, ForgeRegistries.STRUCTURE_FEATURES, MODID, existingFileHelper); - } - - @Override - public String getName() - { - return "Structure Feature Tags"; - } - - @Override - protected void addTags() - { - tag(OVERWORLD_TEMPLE).add(StructureFeature.DESERT_PYRAMID, StructureFeature.JUNGLE_TEMPLE); - } - } -} diff --git a/src/test/java/net/minecraftforge/debug/world/DimensionSettingsTest.java b/src/test/java/net/minecraftforge/debug/world/DimensionSettingsTest.java index bba51b37b7..5b6701ae2d 100644 --- a/src/test/java/net/minecraftforge/debug/world/DimensionSettingsTest.java +++ b/src/test/java/net/minecraftforge/debug/world/DimensionSettingsTest.java @@ -9,9 +9,7 @@ import com.sun.jna.Structure; import net.minecraft.data.BuiltinRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.levelgen.NoiseGeneratorSettings; -import net.minecraft.world.level.levelgen.StructureSettings; import net.minecraft.world.level.levelgen.feature.StructureFeature; -import net.minecraft.world.level.levelgen.feature.configurations.StructureFeatureConfiguration; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; @@ -35,12 +33,14 @@ import java.util.Optional; @Mod(DimensionSettingsTest.MODID) public class DimensionSettingsTest { public static final String MODID = "dimension_settings_test"; +/* public static final ResourceLocation TEST_OVERWORLD = new ResourceLocation(MODID, "test_overworld"); private static final Logger LOGGER = LogManager.getLogger(); public DimensionSettingsTest() { + // TODO-PATCHING: Fix these dimensional stuffs FMLJavaModLoadingContext.get().getModEventBus().addListener(this::registerSettings); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::addStructure); } @@ -49,7 +49,7 @@ public class DimensionSettingsTest { * Demonstrates how a mod can register custom DimensionSettings which can be referenced from * within a datapack dimension config whilst being discoverable for other mods to add to and * remove structures etc from. - */ + * / private void registerSettings(FMLCommonSetupEvent event) { event.enqueueWork(() -> @@ -62,7 +62,7 @@ public class DimensionSettingsTest { /** * Demonstrates how a mod could handle adding their structure settings to a specific dimension. - */ + * / private void addStructure(FMLLoadCompleteEvent event) { event.enqueueWork(() -> @@ -84,7 +84,7 @@ public class DimensionSettingsTest { /** * Create a NoiseGeneratorSettings instance copying all but the structure settings from overworld. - */ + * / private static NoiseGeneratorSettings createNoiseGenerationSettings() { NoiseGeneratorSettings overworld = BuiltinRegistries.NOISE_GENERATOR_SETTINGS.getOrThrow(NoiseGeneratorSettings.OVERWORLD); @@ -96,8 +96,8 @@ public class DimensionSettingsTest { return new NoiseGeneratorSettings( structures, overworld.noiseSettings(), - overworld.getDefaultBlock(), - overworld.getDefaultFluid(), + overworld.defaultBlock(), + overworld.defaultFluid(), overworld.surfaceRule(), overworld.seaLevel(), overworld.disableMobGeneration(), @@ -108,4 +108,29 @@ public class DimensionSettingsTest { overworld.useLegacyRandomSource() ); } +*/ } + +/* +TODO: Make this a data gen: +data/dimension_settings_test/dimension/test_overworld.json +{ + "#comment": [ + "This is an example Dimension showing how it can be configured to use a custom", + "DimensionSettings that possess similar generation settings to overworld but", + "has independently configurable structure settings.", + "", + "See the 'settings' field below" + ], + "type": "minecraft:overworld", + "generator": { + "type": "minecraft:noise", + "seed": 12345, + "settings": "dimension_settings_test:test_overworld", + "biome_source": { + "preset": "minecraft:overworld", + "type": "minecraft:multi_noise" + } + } +} +*/ diff --git a/src/test/resources/META-INF/mods.toml b/src/test/resources/META-INF/mods.toml index 4a26d46301..9f0a7e2e3d 100644 --- a/src/test/resources/META-INF/mods.toml +++ b/src/test/resources/META-INF/mods.toml @@ -88,8 +88,6 @@ license="LGPL v2.1" modId="finite_water_test" [[mods]] modId="scaffolding_test" -[[mods]] - modId="custom_tag_types_test" [[mods]] modId="biome_loading_event_test" [[mods]] diff --git a/src/test/resources/data/dimension_settings_test/dimension/test_overworld.json b/src/test/resources/data/dimension_settings_test/dimension/test_overworld.json deleted file mode 100644 index 86b8947ec6..0000000000 --- a/src/test/resources/data/dimension_settings_test/dimension/test_overworld.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "#comment": [ - "This is an example Dimension showing how it can be configured to use a custom", - "DimensionSettings that possess similar generation settings to overworld but", - "has independently configurable structure settings.", - "", - "See the 'settings' field below" - ], - "type": "minecraft:overworld", - "generator": { - "type": "minecraft:noise", - "seed": 12345, - "settings": "dimension_settings_test:test_overworld", - "biome_source": { - "preset": "minecraft:overworld", - "type": "minecraft:multi_noise" - } - } -} \ No newline at end of file