diff --git a/build.gradle b/build.gradle index 6c8c9f33ec3..561d14eb594 100644 --- a/build.gradle +++ b/build.gradle @@ -9,28 +9,36 @@ plugins { apply plugin: 'net.neoforged.gradleutils' -gradleutils.version { - minecraftVersion project.minecraft_version - versionPrefix = null // Reset version prefix, which is set by prev. line - tags { - label = 'beta' - cleanMarkerLabel = 'stable' +ext.isPreReleaseVersion = project.minecraft_version.contains("w") || project.minecraft_version.contains("-") + +if (isPreReleaseVersion) { + project.version = "${project.neoforge_snapshot_next_stable}.0-alpha.${project.minecraft_version}.${(new Date()).format('yyyyMMdd.HHmmss', TimeZone.getTimeZone('UTC'))}" +} else { + gradleutils.version { + minecraftVersion project.minecraft_version + versionPrefix = null // Reset version prefix, which is set by prev. line + tags { + label = 'beta' + cleanMarkerLabel = 'stable' + } + branches { + suffixBranch = true + } } - branches { - suffixBranch = true + + changelog { + from '20.5' + disableAutomaticPublicationRegistration() } -} -changelog { - from '20.4' - disableAutomaticPublicationRegistration() + project.version = gradleutils.version.toString() } // Print version, generally useful to know - also appears on CI -System.out.println("NeoForge version ${gradleutils.version.toString()}") +System.out.println("NeoForge version ${project.version}") allprojects { - version gradleutils.version.toString() + version rootProject.version group 'net.neoforged' repositories { mavenLocal() diff --git a/gradle.properties b/gradle.properties index d908c24c54f..1e7c299d19a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,17 +7,19 @@ org.gradle.caching=true org.gradle.configuration-cache=false org.gradle.debug=false -java_version=17 +java_version=21 -minecraft_version=1.20.4 -neoform_version=20231207.154220 +minecraft_version=1.20.5 +neoform_version=20240423.152201 +# on snapshot versions, used to prefix the version +neoforge_snapshot_next_stable=20.6 mergetool_version=2.0.0 accesstransformers_version=10.0.1 coremods_version=6.0.4 eventbus_version=7.2.0 -modlauncher_version=10.0.9 -securejarhandler_version=2.1.24 +modlauncher_version=10.1.10 +securejarhandler_version=2.1.31 bootstraplauncher_version=1.1.2 asm_version=9.5 installer_version=2.1.+ @@ -29,9 +31,9 @@ jetbrains_annotations_version=24.0.1 slf4j_api_version=2.0.7 apache_maven_artifact_version=3.8.5 jarjar_version=0.4.0 -fancy_mod_loader_version=2.0.17 +fancy_mod_loader_version=3.0.18 mojang_logging_version=1.1.1 -log4j_version=2.19.0 +log4j_version=2.22.1 guava_version=31.1.2-jre gson_version=2.10.1 apache_commons_lang3_version=3.13.0 diff --git a/patches/com/mojang/blaze3d/pipeline/RenderTarget.java.patch b/patches/com/mojang/blaze3d/pipeline/RenderTarget.java.patch index 003e87a4ce5..60dcaed7f31 100644 --- a/patches/com/mojang/blaze3d/pipeline/RenderTarget.java.patch +++ b/patches/com/mojang/blaze3d/pipeline/RenderTarget.java.patch @@ -10,7 +10,7 @@ + GlStateManager._texImage2D(3553, 0, org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8, this.width, this.height, 0, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL, org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV, null); } - this.setFilterMode(9728); + this.setFilterMode(9728, true); @@ -117,7 +_,14 @@ GlStateManager._glBindFramebuffer(36160, this.frameBufferId); GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, this.colorTextureId, 0); @@ -26,7 +26,7 @@ } this.checkStatus(); -@@ -275,4 +_,27 @@ +@@ -281,4 +_,27 @@ public int getDepthTextureId() { return this.depthBufferId; } diff --git a/patches/com/mojang/blaze3d/systems/RenderSystem.java.patch b/patches/com/mojang/blaze3d/systems/RenderSystem.java.patch index bdeaa81d232..cf132da04b1 100644 --- a/patches/com/mojang/blaze3d/systems/RenderSystem.java.patch +++ b/patches/com/mojang/blaze3d/systems/RenderSystem.java.patch @@ -1,6 +1,6 @@ --- a/com/mojang/blaze3d/systems/RenderSystem.java +++ b/com/mojang/blaze3d/systems/RenderSystem.java -@@ -1030,4 +_,14 @@ +@@ -1014,4 +_,14 @@ void accept(it.unimi.dsi.fastutil.ints.IntConsumer p_157488_, int p_157489_); } } diff --git a/patches/com/mojang/blaze3d/vertex/PoseStack.java.patch b/patches/com/mojang/blaze3d/vertex/PoseStack.java.patch index 26e0edbb9a9..a21f52da74b 100644 --- a/patches/com/mojang/blaze3d/vertex/PoseStack.java.patch +++ b/patches/com/mojang/blaze3d/vertex/PoseStack.java.patch @@ -1,7 +1,7 @@ --- a/com/mojang/blaze3d/vertex/PoseStack.java +++ b/com/mojang/blaze3d/vertex/PoseStack.java -@@ -12,7 +_,7 @@ - import org.joml.Quaternionf; +@@ -13,7 +_,7 @@ + import org.joml.Vector3f; @OnlyIn(Dist.CLIENT) -public class PoseStack { diff --git a/patches/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java.patch b/patches/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java.patch deleted file mode 100644 index 17184211f05..00000000000 --- a/patches/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java -+++ b/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java -@@ -47,7 +_,7 @@ - @Override - public void endVertex() { - Vector3f vector3f = this.normalInversePose.transform(new Vector3f(this.nx, this.ny, this.nz)); -- Direction direction = Direction.getNearest(vector3f.x(), vector3f.y(), vector3f.z()); -+ Direction direction = Direction.getNearestStable(vector3f.x(), vector3f.y(), vector3f.z()); - Vector4f vector4f = this.cameraInversePose.transform(new Vector4f(this.x, this.y, this.z, 1.0F)); - vector4f.rotateY((float) Math.PI); - vector4f.rotateX((float) (-Math.PI / 2)); diff --git a/patches/com/mojang/blaze3d/vertex/VertexConsumer.java.patch b/patches/com/mojang/blaze3d/vertex/VertexConsumer.java.patch index b51e2af5987..f31d8261358 100644 --- a/patches/com/mojang/blaze3d/vertex/VertexConsumer.java.patch +++ b/patches/com/mojang/blaze3d/vertex/VertexConsumer.java.patch @@ -1,6 +1,6 @@ --- a/com/mojang/blaze3d/vertex/VertexConsumer.java +++ b/com/mojang/blaze3d/vertex/VertexConsumer.java -@@ -14,7 +_,7 @@ +@@ -13,7 +_,7 @@ import org.lwjgl.system.MemoryStack; @OnlyIn(Dist.CLIENT) @@ -9,30 +9,20 @@ VertexConsumer vertex(double p_85945_, double p_85946_, double p_85947_); VertexConsumer color(int p_85973_, int p_85974_, int p_85975_, int p_85976_); -@@ -101,6 +_,10 @@ - int p_86003_, - boolean p_86004_ - ) { -+ putBulkData(p_85996_, p_85997_, p_85998_, p_85999_, p_86000_, p_86001_, 1, p_86002_, p_86003_, p_86004_); -+ } -+ -+ default void putBulkData(PoseStack.Pose p_85996_, BakedQuad p_85997_, float[] p_85998_, float p_85999_, float p_86000_, float p_86001_, float alpha, int[] p_86002_, int p_86003_, boolean p_86004_) { - float[] afloat = new float[]{p_85998_[0], p_85998_[1], p_85998_[2], p_85998_[3]}; - int[] aint = new int[]{p_86002_[0], p_86002_[1], p_86002_[2], p_86002_[3]}; - int[] aint1 = p_85997_.getVertices(); -@@ -136,11 +_,13 @@ - f5 = afloat[k] * p_86001_; +@@ -139,11 +_,14 @@ + f5 = afloat[k] * p_85992_; } - int l = aint[k]; -+ int l = applyBakedLighting(p_86002_[k], bytebuffer); ++ int l = applyBakedLighting(p_331378_[k], bytebuffer); float f9 = bytebuffer.getFloat(16); float f10 = bytebuffer.getFloat(20); Vector4f vector4f = matrix4f.transform(new Vector4f(f, f1, f2, 1.0F)); -- this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, 1.0F, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z()); -+ applyBakedNormals(vector3f, bytebuffer, p_85996_.normal()); -+ float vertexAlpha = p_86004_ ? alpha * (float) (bytebuffer.get(15) & 255) / 255.0F : alpha; -+ this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, vertexAlpha, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z()); +- this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, p_331416_, f9, f10, p_85993_, l, vector3f.x(), vector3f.y(), vector3f.z()); ++ applyBakedNormals(vector3f, bytebuffer, p_85988_.normal()); ++ // Neo: also apply alpha that's coming from the baked quad ++ float vertexAlpha = p_331268_ ? p_331416_ * (float) (bytebuffer.get(15) & 255) / 255.0F : p_331416_; ++ this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, vertexAlpha, f9, f10, p_85993_, l, vector3f.x(), vector3f.y(), vector3f.z()); } } } diff --git a/patches/com/mojang/blaze3d/vertex/VertexFormatElement.java.patch b/patches/com/mojang/blaze3d/vertex/VertexFormatElement.java.patch index ab30583627b..0aeabbbe5e7 100644 --- a/patches/com/mojang/blaze3d/vertex/VertexFormatElement.java.patch +++ b/patches/com/mojang/blaze3d/vertex/VertexFormatElement.java.patch @@ -1,6 +1,6 @@ --- a/com/mojang/blaze3d/vertex/VertexFormatElement.java +++ b/com/mojang/blaze3d/vertex/VertexFormatElement.java -@@ -93,6 +_,10 @@ +@@ -91,6 +_,10 @@ this.usage.clearBufferState(this.index, p_166964_); } @@ -11,7 +11,7 @@ @OnlyIn(Dist.CLIENT) public static enum Type { FLOAT(4, "Float", 5126), -@@ -127,7 +_,7 @@ +@@ -125,7 +_,7 @@ } @OnlyIn(Dist.CLIENT) @@ -20,7 +20,7 @@ POSITION("Position", (p_167043_, p_167044_, p_167045_, p_167046_, p_167047_, p_167048_) -> { GlStateManager._enableVertexAttribArray(p_167048_); GlStateManager._vertexAttribPointer(p_167048_, p_167043_, p_167044_, false, p_167045_, p_167046_); -@@ -188,6 +_,10 @@ +@@ -186,6 +_,10 @@ @OnlyIn(Dist.CLIENT) public interface SetupState { void setupBufferState(int p_167053_, int p_167054_, int p_167055_, long p_167056_, int p_167057_, int p_167058_); diff --git a/patches/com/mojang/realmsclient/RealmsAvailability.java.patch b/patches/com/mojang/realmsclient/RealmsAvailability.java.patch deleted file mode 100644 index 0167248963c..00000000000 --- a/patches/com/mojang/realmsclient/RealmsAvailability.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/com/mojang/realmsclient/RealmsAvailability.java -+++ b/com/mojang/realmsclient/RealmsAvailability.java -@@ -38,6 +_,12 @@ - private static CompletableFuture check() { - return CompletableFuture.supplyAsync( - () -> { -+ if (!net.neoforged.fml.loading.FMLLoader.isProduction() && net.minecraft.client.Minecraft.getInstance().getUser().getAccessToken().equals("0")) { -+ // Neo: we use '0' in dev, so short-circuit to avoid exception -+ LOGGER.trace("User access token is '0'. Skipping realms availability check."); -+ return new RealmsAvailability.Result(Type.AUTHENTICATION_ERROR); -+ } -+ - RealmsClient realmsclient = RealmsClient.create(); - - try { diff --git a/patches/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch b/patches/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch index dfd8fde7acc..36f6a45b7d9 100644 --- a/patches/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch +++ b/patches/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch @@ -1,6 +1,6 @@ --- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java -@@ -66,6 +_,15 @@ +@@ -69,6 +_,15 @@ } @Override diff --git a/patches/net/minecraft/CrashReport.java.patch b/patches/net/minecraft/CrashReport.java.patch index 0d5c42822fb..c04957c468b 100644 --- a/patches/net/minecraft/CrashReport.java.patch +++ b/patches/net/minecraft/CrashReport.java.patch @@ -6,7 +6,7 @@ p_127520_.append("Thread: ").append(Thread.currentThread().getName()).append("\n"); - p_127520_.append("Stacktrace:\n"); - -- for(StackTraceElement stacktraceelement : this.uncategorizedStackTrace) { +- for (StackTraceElement stacktraceelement : this.uncategorizedStackTrace) { - p_127520_.append("\t").append("at ").append(stacktraceelement); - p_127520_.append("\n"); - } @@ -16,7 +16,7 @@ + p_127520_.append(net.neoforged.neoforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.uncategorizedStackTrace)); } - for(CrashReportCategory crashreportcategory : this.details) { + for (CrashReportCategory crashreportcategory : this.details) { @@ -74,6 +_,7 @@ p_127520_.append("\n\n"); } diff --git a/patches/net/minecraft/CrashReportCategory.java.patch b/patches/net/minecraft/CrashReportCategory.java.patch index b72249ebb32..50c9e7294b4 100644 --- a/patches/net/minecraft/CrashReportCategory.java.patch +++ b/patches/net/minecraft/CrashReportCategory.java.patch @@ -18,7 +18,7 @@ if (this.stackTrace != null && this.stackTrace.length > 0) { p_128169_.append("\nStacktrace:"); - -- for(StackTraceElement stacktraceelement : this.stackTrace) { +- for (StackTraceElement stacktraceelement : this.stackTrace) { - p_128169_.append("\n\tat "); - p_128169_.append(stacktraceelement); - } diff --git a/patches/net/minecraft/SharedConstants.java.patch b/patches/net/minecraft/SharedConstants.java.patch index 46185759ea1..7626d97bb94 100644 --- a/patches/net/minecraft/SharedConstants.java.patch +++ b/patches/net/minecraft/SharedConstants.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/SharedConstants.java +++ b/net/minecraft/SharedConstants.java -@@ -122,7 +_,8 @@ - public static final long MAXIMUM_TICK_TIME_NANOS = Duration.ofMillis(300L).toNanos(); +@@ -123,7 +_,8 @@ public static final boolean USE_WORKFLOWS_HOOKS = false; + public static final boolean USE_DEVONLY = false; public static boolean CHECK_DATA_FIXER_SCHEMA = true; - public static boolean IS_RUNNING_IN_IDE; + public static boolean IS_RUNNING_IN_IDE = !net.neoforged.fml.loading.FMLLoader.isProduction(); @@ -10,7 +10,7 @@ public static Set DATA_FIX_TYPES_TO_OPTIMIZE = Set.of(); public static final int WORLD_RESOLUTION = 16; public static final int MAX_CHAT_LENGTH = 256; -@@ -204,6 +_,7 @@ +@@ -181,6 +_,7 @@ } static { diff --git a/patches/net/minecraft/Util.java.patch b/patches/net/minecraft/Util.java.patch index bb35ceb7721..632e23e46dd 100644 --- a/patches/net/minecraft/Util.java.patch +++ b/patches/net/minecraft/Util.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/Util.java +++ b/net/minecraft/Util.java -@@ -261,8 +_,8 @@ +@@ -267,8 +_,8 @@ .getSchema(DataFixUtils.makeKey(SharedConstants.getCurrentVersion().getDataVersion().getVersion())) .getChoiceType(p_137552_, p_137553_); } catch (IllegalArgumentException illegalargumentexception) { @@ -11,7 +11,7 @@ throw illegalargumentexception; } } -@@ -438,20 +_,20 @@ +@@ -488,20 +_,20 @@ public static void logAndPauseIfInIde(String p_143786_) { LOGGER.error(p_143786_); diff --git a/patches/net/minecraft/advancements/Advancement.java.patch b/patches/net/minecraft/advancements/Advancement.java.patch index e13d970dfd9..8a488857dc6 100644 --- a/patches/net/minecraft/advancements/Advancement.java.patch +++ b/patches/net/minecraft/advancements/Advancement.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/advancements/Advancement.java +++ b/net/minecraft/advancements/Advancement.java -@@ -54,6 +_,7 @@ - ), - Advancement::validate - ); +@@ -52,6 +_,7 @@ + ) + .validate(Advancement::validate); + public static final StreamCodec STREAM_CODEC = StreamCodec.ofMember(Advancement::write, Advancement::read); + public static final Codec>> CONDITIONAL_CODEC = net.neoforged.neoforge.common.conditions.ConditionalOps.createConditionalCodecWithConditions(CODEC); public Advancement( Optional p_300893_, -@@ -113,7 +_,7 @@ +@@ -111,7 +_,7 @@ }); } diff --git a/patches/net/minecraft/advancements/AdvancementRewards.java.patch b/patches/net/minecraft/advancements/AdvancementRewards.java.patch index 03e638e1224..2b4fd0ad197 100644 --- a/patches/net/minecraft/advancements/AdvancementRewards.java.patch +++ b/patches/net/minecraft/advancements/AdvancementRewards.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/advancements/AdvancementRewards.java +++ b/net/minecraft/advancements/AdvancementRewards.java -@@ -37,6 +_,7 @@ +@@ -40,6 +_,7 @@ LootParams lootparams = new LootParams.Builder(p_9990_.serverLevel()) .withParameter(LootContextParams.THIS_ENTITY, p_9990_) .withParameter(LootContextParams.ORIGIN, p_9990_.position()) diff --git a/patches/net/minecraft/advancements/critereon/EntityPredicate.java.patch b/patches/net/minecraft/advancements/critereon/EntityPredicate.java.patch deleted file mode 100644 index 2dc030d0bfd..00000000000 --- a/patches/net/minecraft/advancements/critereon/EntityPredicate.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- a/net/minecraft/advancements/critereon/EntityPredicate.java -+++ b/net/minecraft/advancements/critereon/EntityPredicate.java -@@ -36,9 +_,10 @@ - Optional vehicle, - Optional passenger, - Optional targetedEntity, -- Optional team -+ Optional team, -+ Optional customLogic - ) { -- public static final Codec CODEC = ExtraCodecs.recursive( -+ public static final Codec VANILLA_CODEC = ExtraCodecs.recursive( - "EntityPredicate", - p_297888_ -> RecordCodecBuilder.create( - p_297890_ -> p_297890_.group( -@@ -59,8 +_,26 @@ - .apply(p_297890_, EntityPredicate::new) - ) - ); -+ public static final Codec CODEC = ExtraCodecs.either( -+ net.neoforged.neoforge.registries.NeoForgeRegistries.ENTITY_PREDICATE_SERIALIZERS.byNameCodec() -+ .dispatch( -+ net.neoforged.neoforge.common.advancements.critereon.ICustomEntityPredicate::codec, -+ java.util.function.Function.identity()), -+ VANILLA_CODEC -+ ).xmap(either -> either.map(EntityPredicate::new, p -> p), -+ // Serialize using dispatch codec if custom logic is present, otherwise use vanilla codec -+ predicate -> predicate.customLogic.>map( -+ com.mojang.datafixers.util.Either::left).orElseGet(() -> com.mojang.datafixers.util.Either.right(predicate))); - public static final Codec ADVANCEMENT_CODEC = ExtraCodecs.withAlternative(ContextAwarePredicate.CODEC, CODEC, EntityPredicate::wrap); - -+ public EntityPredicate(Optional entityType, Optional distanceToPlayer, Optional location, Optional steppingOnLocation, Optional effects, Optional nbt, Optional flags, Optional equipment, Optional subPredicate, Optional vehicle, Optional passenger, Optional targetedEntity, Optional team) { -+ this(entityType, distanceToPlayer, location, steppingOnLocation, effects, nbt, flags, equipment, subPredicate, vehicle, passenger, targetedEntity, team, Optional.empty()); -+ } -+ -+ public EntityPredicate(net.neoforged.neoforge.common.advancements.critereon.ICustomEntityPredicate customLogic) { -+ this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.of(customLogic)); -+ } -+ - public static ContextAwarePredicate wrap(EntityPredicate.Builder p_298222_) { - return wrap(p_298222_.build()); - } -@@ -83,6 +_,9 @@ - } - - public boolean matches(ServerLevel p_36608_, @Nullable Vec3 p_36609_, @Nullable Entity p_36610_) { -+ if (p_36610_ != null && this.customLogic.isPresent()) { -+ return this.customLogic.get().test(p_36608_, p_36609_, p_36610_); -+ } - if (p_36610_ == null) { - return false; - } else if (this.entityType.isPresent() && !this.entityType.get().matches(p_36610_.getType())) { diff --git a/patches/net/minecraft/advancements/critereon/ItemEnchantmentsPredicate.java.patch b/patches/net/minecraft/advancements/critereon/ItemEnchantmentsPredicate.java.patch new file mode 100644 index 00000000000..0ac4af6c6ad --- /dev/null +++ b/patches/net/minecraft/advancements/critereon/ItemEnchantmentsPredicate.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/advancements/critereon/ItemEnchantmentsPredicate.java ++++ b/net/minecraft/advancements/critereon/ItemEnchantmentsPredicate.java +@@ -23,6 +_,11 @@ + return this.enchantments; + } + ++ @Override // NEO: use getAllEnchantments for enchantments ++ public boolean matches(ItemStack p_333958_) { ++ return matches(p_333958_, p_333958_.getAllEnchantments()); ++ } ++ + public boolean matches(ItemStack p_333811_, ItemEnchantments p_334059_) { + for (EnchantmentPredicate enchantmentpredicate : this.enchantments) { + if (!enchantmentpredicate.containedIn(p_334059_)) { diff --git a/patches/net/minecraft/advancements/critereon/ItemPredicate.java.patch b/patches/net/minecraft/advancements/critereon/ItemPredicate.java.patch deleted file mode 100644 index b83d3c039f7..00000000000 --- a/patches/net/minecraft/advancements/critereon/ItemPredicate.java.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- a/net/minecraft/advancements/critereon/ItemPredicate.java -+++ b/net/minecraft/advancements/critereon/ItemPredicate.java -@@ -31,13 +_,14 @@ - List enchantments, - List storedEnchantments, - Optional> potion, -- Optional nbt -+ Optional nbt, -+ Optional customLogic - ) { - private static final Codec> ITEMS_CODEC = BuiltInRegistries.ITEM - .holderByNameCodec() - .listOf() - .xmap(HolderSet::direct, p_297903_ -> p_297903_.stream().toList()); -- public static final Codec CODEC = RecordCodecBuilder.create( -+ public static final Codec VANILLA_CODEC = RecordCodecBuilder.create( - p_297904_ -> p_297904_.group( - ExtraCodecs.strictOptionalField(TagKey.codec(Registries.ITEM), "tag").forGetter(ItemPredicate::tag), - ExtraCodecs.strictOptionalField(ITEMS_CODEC, "items").forGetter(ItemPredicate::items), -@@ -51,8 +_,34 @@ - ) - .apply(p_297904_, ItemPredicate::new) - ); -+ //TODO - 1.20.5: Make this final -+ public static Codec CODEC = ExtraCodecs.either( -+ net.neoforged.neoforge.registries.NeoForgeRegistries.ITEM_PREDICATE_SERIALIZERS.byNameCodec() -+ .dispatch( -+ net.neoforged.neoforge.common.advancements.critereon.ICustomItemPredicate::codec, -+ java.util.function.Function.identity()), -+ VANILLA_CODEC -+ ).xmap(either -> either.map(ItemPredicate::new, p -> p), predicate -> { -+ // Serialize using dispatch codec if custom logic is present, otherwise use vanilla codec -+ if (predicate.customLogic.isPresent()) { -+ return com.mojang.datafixers.util.Either.left(predicate.customLogic.get()); -+ } else { -+ return com.mojang.datafixers.util.Either.right(predicate); -+ } -+ }); -+ -+ public ItemPredicate(Optional> tag, Optional> items, MinMaxBounds.Ints count, MinMaxBounds.Ints durability, List enchantments, List storedEnchantments, Optional> potion, Optional nbt) { -+ this(tag, items, count, durability, enchantments, storedEnchantments, potion, nbt, Optional.empty()); -+ } -+ -+ public ItemPredicate(net.neoforged.neoforge.common.advancements.critereon.ICustomItemPredicate customLogic) { -+ this(Optional.empty(), Optional.empty(), MinMaxBounds.Ints.ANY, MinMaxBounds.Ints.ANY, List.of(), List.of(), Optional.empty(), Optional.empty(), Optional.of(customLogic)); -+ } - - public boolean matches(ItemStack p_45050_) { -+ if (this.customLogic.isPresent()) { -+ return this.customLogic.get().test(p_45050_); -+ } - if (this.tag.isPresent() && !p_45050_.is(this.tag.get())) { - return false; - } else if (this.items.isPresent() && !p_45050_.is(this.items.get())) { -@@ -67,7 +_,7 @@ - return false; - } else { - if (!this.enchantments.isEmpty()) { -- Map map = EnchantmentHelper.deserializeEnchantments(p_45050_.getEnchantmentTags()); -+ Map map = p_45050_.getAllEnchantments(); - - for(EnchantmentPredicate enchantmentpredicate : this.enchantments) { - if (!enchantmentpredicate.containedIn(map)) { diff --git a/patches/net/minecraft/client/Camera.java.patch b/patches/net/minecraft/client/Camera.java.patch index 886220ed292..638694e2cbd 100644 --- a/patches/net/minecraft/client/Camera.java.patch +++ b/patches/net/minecraft/client/Camera.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/Camera.java +++ b/net/minecraft/client/Camera.java -@@ -56,7 +_,7 @@ - this.setRotation(this.yRot + 180.0F, -this.xRot); +@@ -58,7 +_,7 @@ } -- this.move(-this.getMaxZoom(4.0), 0.0, 0.0); -+ this.move(-this.getMaxZoom(net.neoforged.neoforge.client.ClientHooks.getDetachedCameraDistance(this, p_90579_, 4.0)), 0.0, 0.0); + float f = p_90577_ instanceof LivingEntity livingentity ? livingentity.getScale() : 1.0F; +- this.move(-this.getMaxZoom((double)(4.0F * f)), 0.0, 0.0); ++ this.move(-this.getMaxZoom((double)(net.neoforged.neoforge.client.ClientHooks.getDetachedCameraDistance(this, p_90579_, f, 4.0) * f)), 0.0, 0.0); } else if (p_90577_ instanceof LivingEntity && ((LivingEntity)p_90577_).isSleeping()) { Direction direction = ((LivingEntity)p_90577_).getBedOrientation(); this.setRotation(direction != null ? direction.toYRot() - 180.0F : 0.0F, 0.0F); -@@ -223,6 +_,18 @@ +@@ -225,6 +_,18 @@ public float getPartialTickTime() { return this.partialTickTime; diff --git a/patches/net/minecraft/client/ClientRecipeBook.java.patch b/patches/net/minecraft/client/ClientRecipeBook.java.patch index 6f1be0534e1..774d2198dae 100644 --- a/patches/net/minecraft/client/ClientRecipeBook.java.patch +++ b/patches/net/minecraft/client/ClientRecipeBook.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/ClientRecipeBook.java +++ b/net/minecraft/client/ClientRecipeBook.java -@@ -62,7 +_,7 @@ +@@ -65,7 +_,7 @@ Recipe recipe = recipeholder.value(); if (!recipe.isSpecial() && !recipe.isIncomplete()) { RecipeBookCategories recipebookcategories = getCategory(recipeholder); @@ -9,7 +9,7 @@ if (s.isEmpty()) { map.computeIfAbsent(recipebookcategories, p_90645_ -> Lists.newArrayList()).add(ImmutableList.of(recipeholder)); } else { -@@ -122,6 +_,8 @@ +@@ -125,6 +_,8 @@ } else if (recipetype == RecipeType.SMITHING) { return RecipeBookCategories.SMITHING; } else { diff --git a/patches/net/minecraft/client/KeyMapping.java.patch b/patches/net/minecraft/client/KeyMapping.java.patch index 6f41d540745..f0a66100e69 100644 --- a/patches/net/minecraft/client/KeyMapping.java.patch +++ b/patches/net/minecraft/client/KeyMapping.java.patch @@ -19,7 +19,7 @@ - KeyMapping keymapping = MAP.get(p_90836_); + for (KeyMapping keymapping : MAP.getAll(p_90836_)) if (keymapping != null) { - ++keymapping.clickCount; + keymapping.clickCount++; } } @@ -82,7 +82,7 @@ return this.key.equals(p_90851_.key); } -@@ -165,11 +_,13 @@ +@@ -163,11 +_,13 @@ } public Component getTranslatedKeyMessage() { @@ -97,7 +97,7 @@ } public String saveString() { -@@ -179,4 +_,84 @@ +@@ -177,4 +_,84 @@ public void setDown(boolean p_90846_) { this.isDown = p_90846_; } diff --git a/patches/net/minecraft/client/KeyboardHandler.java.patch b/patches/net/minecraft/client/KeyboardHandler.java.patch index bff669ac52b..a5352659ea1 100644 --- a/patches/net/minecraft/client/KeyboardHandler.java.patch +++ b/patches/net/minecraft/client/KeyboardHandler.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/KeyboardHandler.java +++ b/net/minecraft/client/KeyboardHandler.java -@@ -364,7 +_,9 @@ +@@ -367,7 +_,9 @@ } } @@ -11,7 +11,7 @@ if (this.minecraft.options.keyFullscreen.matches(p_90895_, p_90896_)) { this.minecraft.getWindow().toggleFullScreen(); this.minecraft.options.fullscreen().set(this.minecraft.getWindow().isFullscreen()); -@@ -382,6 +_,8 @@ +@@ -385,6 +_,8 @@ ); return; } @@ -19,8 +19,8 @@ + ((KeyBindsScreen)this.minecraft.screen).selectedKey = null; //Forge: Unset pure modifiers. } - if (this.minecraft.getNarrator().isActive() && this.minecraft.options.narratorHotkey().get()) { -@@ -418,9 +_,13 @@ + if (p_90897_ != 0) { +@@ -412,9 +_,13 @@ Screen.wrapScreenError(() -> { if (p_90897_ == 1 || p_90897_ == 2) { screen.afterKeyboardAction(); @@ -36,7 +36,7 @@ } }, "keyPressed event handler", screen.getClass().getCanonicalName()); if (aboolean[0]) { -@@ -490,22 +_,27 @@ +@@ -483,22 +_,27 @@ } } } @@ -59,7 +59,7 @@ + net.neoforged.neoforge.client.ClientHooks.onScreenCharTypedPost(guieventlistener, (char)p_90891_, p_90892_); + }, "charTyped event handler", guieventlistener.getClass().getCanonicalName()); } else { - for(char c0 : Character.toChars(p_90891_)) { + for (char c0 : Character.toChars(p_90891_)) { - Screen.wrapScreenError( - () -> guieventlistener.charTyped(c0, p_90892_), "charTyped event handler", guieventlistener.getClass().getCanonicalName() - ); diff --git a/patches/net/minecraft/client/Minecraft.java.patch b/patches/net/minecraft/client/Minecraft.java.patch index a0d749f9a64..7a8dcecbfe6 100644 --- a/patches/net/minecraft/client/Minecraft.java.patch +++ b/patches/net/minecraft/client/Minecraft.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/Minecraft.java +++ b/net/minecraft/client/Minecraft.java -@@ -258,7 +_,7 @@ +@@ -259,7 +_,7 @@ import org.slf4j.Logger; @OnlyIn(Dist.CLIENT) @@ -17,7 +17,7 @@ this.demo = p_91084_.game.demo; this.allowsMultiplayer = !p_91084_.game.disableMultiplayer; this.allowsChat = !p_91084_.game.disableChat; -@@ -484,15 +_,15 @@ +@@ -483,15 +_,15 @@ } this.window.setFramerateLimit(this.options.framerateLimit().get()); @@ -35,27 +35,28 @@ this.resourcePackRepository.reload(); this.options.loadSelectedResourcePacks(this.resourcePackRepository); this.languageManager = new LanguageManager(this.options.languageCode); -@@ -560,10 +_,13 @@ +@@ -556,6 +_,7 @@ + ); + this.resourceManager.registerReloadListener(this.entityRenderDispatcher); + this.particleEngine = new ParticleEngine(this.level, this.textureManager); ++ net.neoforged.neoforge.client.ClientHooks.onRegisterParticleProviders(this.particleEngine); + this.resourceManager.registerReloadListener(this.particleEngine); + this.paintingTextures = new PaintingTextureManager(this.textureManager); + this.resourceManager.registerReloadListener(this.paintingTextures); +@@ -568,13 +_,18 @@ this.gameRenderer = new GameRenderer(this, this.entityRenderDispatcher.getItemInHandRenderer(), this.resourceManager, this.renderBuffers); this.resourceManager.registerReloadListener(this.gameRenderer.createReloadListener()); this.levelRenderer = new LevelRenderer(this, this.entityRenderDispatcher, this.blockEntityRenderDispatcher, this.renderBuffers); -+ net.neoforged.fml.ModLoader.get().postEvent(new net.neoforged.neoforge.client.event.RenderLevelStageEvent.RegisterStageEvent()); ++ net.neoforged.fml.ModLoader.postEvent(new net.neoforged.neoforge.client.event.RenderLevelStageEvent.RegisterStageEvent()); this.resourceManager.registerReloadListener(this.levelRenderer); - this.createSearchTrees(); + // Forge: We delay this to allow registration of modded creative mode tabs + // this.createSearchTrees(); this.resourceManager.registerReloadListener(this.searchRegistry); - this.particleEngine = new ParticleEngine(this.level, this.textureManager); -+ net.neoforged.neoforge.client.ClientHooks.onRegisterParticleProviders(this.particleEngine); - this.resourceManager.registerReloadListener(this.particleEngine); - this.paintingTextures = new PaintingTextureManager(this.textureManager); - this.resourceManager.registerReloadListener(this.paintingTextures); -@@ -574,7 +_,10 @@ this.gpuWarnlistManager = new GpuWarnlistManager(); this.resourceManager.registerReloadListener(this.gpuWarnlistManager); this.resourceManager.registerReloadListener(this.regionalCompliancies); -- this.gui = new Gui(this, this.itemRenderer); -+ this.gui = new net.neoforged.neoforge.client.gui.overlay.ExtendedGui(this); + this.gui = new Gui(this); + // FORGE: Moved keyboard and mouse handler setup below ingame gui creation to prevent NPEs in them. + this.mouseHandler.setup(this.window.getWindow()); + this.keyboardHandler.setup(this.window.getWindow()); @@ -70,7 +71,7 @@ this.window.updateVsync(this.options.enableVsync().get()); this.window.updateRawMouseInput(this.options.rawMouseInput().get()); this.window.setDefaultErrorCallback(); -@@ -619,16 +_,18 @@ +@@ -618,16 +_,18 @@ GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS); Minecraft.GameLoadCookie minecraft$gameloadcookie = new Minecraft.GameLoadCookie(realmsclient, p_91084_.quickPlay); this.setOverlay( @@ -82,7 +83,7 @@ + if (SharedConstants.IS_RUNNING_IN_IDE && false) { this.selfTest(); } - + this.reloadStateTracker.finishReload(); this.onResourceLoadFinished(minecraft$gameloadcookie); + @@ -93,7 +94,7 @@ ); this.quickPlayLog = QuickPlayLog.of(p_91084_.quickPlay.path()); } -@@ -668,6 +_,11 @@ +@@ -667,6 +_,11 @@ runnable = () -> this.setScreen(screen); } @@ -105,7 +106,7 @@ return runnable; } -@@ -716,7 +_,7 @@ +@@ -715,7 +_,7 @@ private String createTitle() { StringBuilder stringbuilder = new StringBuilder("Minecraft"); if (checkModStatus().shouldReportAsModified()) { @@ -114,16 +115,7 @@ } stringbuilder.append(" "); -@@ -740,6 +_,8 @@ - } - - private UserApiService createUserApiService(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) { -+ if ("0".equals(p_193587_.user.user.getAccessToken())) // Forge: We use "0" in dev. Short circuit to stop exception spam. -+ return UserApiService.OFFLINE; - return p_193586_.createUserApiService(p_193587_.user.user.getAccessToken()); - } - -@@ -748,7 +_,7 @@ +@@ -747,7 +_,7 @@ } private void rollbackResourcePacks(Throwable p_91240_, @Nullable Minecraft.GameLoadCookie p_299846_) { @@ -132,7 +124,7 @@ this.clearResourcePacksOnError(p_91240_, null, p_299846_); } else { Util.throwAsRuntime(p_91240_); -@@ -830,9 +_,12 @@ +@@ -829,9 +_,12 @@ } public void createSearchTrees() { @@ -144,9 +136,9 @@ - SearchRegistry.CREATIVE_NAMES, + nameSearchKey, p_231451_ -> new FullTextSearchTree<>( - p_210797_ -> p_210797_.getTooltipLines(null, TooltipFlag.Default.NORMAL.asCreative()) + p_339262_ -> p_339262_.getTooltipLines(Item.TooltipContext.EMPTY, null, TooltipFlag.Default.NORMAL.asCreative()) .stream() -@@ -864,9 +_,14 @@ +@@ -866,9 +_,14 @@ p_302141_ ) ); @@ -164,7 +156,7 @@ }); } -@@ -930,13 +_,13 @@ +@@ -919,13 +_,13 @@ if (p_91333_.getSaveFile() != null) { Bootstrap.realStdoutPrintln("#@!@# Game crashed! Crash report saved to: #@!@# " + p_91333_.getSaveFile()); @@ -181,18 +173,18 @@ } } -@@ -1065,10 +_,6 @@ +@@ -1054,9 +_,7 @@ LOGGER.error("setScreen called from non-game thread"); } - if (this.screen != null) { - this.screen.removed(); -- } -- - if (p_91153_ == null && this.clientLevelTeardownInProgress) { - throw new IllegalStateException("Trying to return to in-game GUI during disconnection"); - } else { -@@ -1082,6 +_,19 @@ +- } else { ++ if (this.screen == null) { + this.setLastInputType(InputType.NONE); + } + +@@ -1073,6 +_,19 @@ } } @@ -212,20 +204,20 @@ this.screen = p_91153_; if (this.screen != null) { this.screen.added(); -@@ -1225,9 +_,12 @@ - RenderSystem.enableCull(); +@@ -1219,9 +_,12 @@ + this.mouseHandler.handleAccumulatedMovement(); this.profiler.pop(); if (!this.noRender) { + this.realPartialTick = this.pause ? this.pausePartialTick : this.timer.partialTick; // Cache this since pause is volatile -+ net.neoforged.neoforge.event.EventHooks.onRenderTickStart(this.realPartialTick); ++ net.neoforged.neoforge.client.ClientHooks.fireRenderFramePre(this.realPartialTick); this.profiler.popPush("gameRenderer"); this.gameRenderer.render(this.pause ? this.pausePartialTick : this.timer.partialTick, i, p_91384_); this.profiler.pop(); -+ net.neoforged.neoforge.event.EventHooks.onRenderTickEnd(this.realPartialTick); ++ net.neoforged.neoforge.client.ClientHooks.fireRenderFramePost(this.realPartialTick); } if (this.fpsPieResults != null) { -@@ -1269,6 +_,7 @@ +@@ -1263,6 +_,7 @@ } this.pause = flag1; @@ -233,7 +225,7 @@ } long l = Util.getNanos(); -@@ -1361,10 +_,12 @@ +@@ -1355,10 +_,12 @@ this.window.setGuiScale((double)i); if (this.screen != null) { this.screen.resize(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight()); @@ -246,7 +238,7 @@ this.gameRenderer.resize(this.window.getWidth(), this.window.getHeight()); this.mouseHandler.setIgnoreFirstMove(); } -@@ -1641,6 +_,7 @@ +@@ -1634,6 +_,7 @@ } public void stop() { @@ -254,7 +246,7 @@ this.running = false; } -@@ -1670,9 +_,17 @@ +@@ -1663,9 +_,17 @@ BlockHitResult blockhitresult = (BlockHitResult)this.hitResult; BlockPos blockpos = blockhitresult.getBlockPos(); if (!this.level.getBlockState(blockpos).isAir()) { @@ -274,16 +266,16 @@ this.player.swing(InteractionHand.MAIN_HAND); } } -@@ -1700,6 +_,8 @@ +@@ -1693,6 +_,8 @@ return false; } else { boolean flag = false; + var inputEvent = net.neoforged.neoforge.client.ClientHooks.onClickInput(0, this.options.keyAttack, InteractionHand.MAIN_HAND); + if (!inputEvent.isCanceled()) - switch(this.hitResult.getType()) { + switch (this.hitResult.getType()) { case ENTITY: this.gameMode.attack(this.player, ((EntityHitResult)this.hitResult).getEntity()); -@@ -1720,8 +_,10 @@ +@@ -1713,8 +_,10 @@ } this.player.resetAttackStrengthTicker(); @@ -294,10 +286,10 @@ this.player.swing(InteractionHand.MAIN_HAND); return flag; } -@@ -1737,6 +_,11 @@ +@@ -1730,6 +_,11 @@ } - for(InteractionHand interactionhand : InteractionHand.values()) { + for (InteractionHand interactionhand : InteractionHand.values()) { + var inputEvent = net.neoforged.neoforge.client.ClientHooks.onClickInput(1, this.options.keyUse, interactionhand); + if (inputEvent.isCanceled()) { + if (inputEvent.shouldSwingHand()) this.player.swing(interactionhand); @@ -306,7 +298,7 @@ ItemStack itemstack = this.player.getItemInHand(interactionhand); if (!itemstack.isItemEnabled(this.level.enabledFeatures())) { return; -@@ -1757,7 +_,7 @@ +@@ -1750,7 +_,7 @@ } if (interactionresult.consumesAction()) { @@ -315,7 +307,7 @@ this.player.swing(interactionhand); } -@@ -1769,7 +_,7 @@ +@@ -1762,7 +_,7 @@ int i = itemstack.getCount(); InteractionResult interactionresult1 = this.gameMode.useItemOn(this.player, interactionhand, blockhitresult); if (interactionresult1.consumesAction()) { @@ -324,7 +316,7 @@ this.player.swing(interactionhand); if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.gameMode.hasInfiniteItems())) { this.gameRenderer.itemInHandRenderer.itemUsed(interactionhand); -@@ -1785,6 +_,9 @@ +@@ -1778,6 +_,9 @@ } } @@ -334,49 +326,49 @@ if (!itemstack.isEmpty()) { InteractionResult interactionresult2 = this.gameMode.useItem(this.player, interactionhand); if (interactionresult2.consumesAction()) { -@@ -1815,6 +_,8 @@ - --this.rightClickDelay; - } +@@ -1800,6 +_,8 @@ -+ net.neoforged.neoforge.event.EventHooks.onPreClientTick(); + public void tick() { + this.clientTickCount++; ++ net.neoforged.neoforge.client.ClientHooks.fireClientTickPre(); + - this.profiler.push("gui"); - this.chatListener.tick(); - this.gui.tick(this.pause); -@@ -1900,6 +_,7 @@ + if (this.level != null && !this.pause) { + this.level.tickRateManager().tick(); + } +@@ -1892,6 +_,7 @@ this.tutorial.tick(); -+ net.neoforged.neoforge.event.EventHooks.onPreLevelTick(this.level, () -> true); ++ net.neoforged.neoforge.event.EventHooks.fireLevelTickPre(this.level, () -> true); try { this.level.tick(() -> true); } catch (Throwable throwable) { -@@ -1913,6 +_,7 @@ +@@ -1905,6 +_,7 @@ throw new ReportedException(crashreport); } -+ net.neoforged.neoforge.event.EventHooks.onPostLevelTick(this.level, () -> true); ++ net.neoforged.neoforge.event.EventHooks.fireLevelTickPost(this.level, () -> true); } this.profiler.popPush("animateTick"); -@@ -1932,6 +_,8 @@ +@@ -1924,6 +_,8 @@ this.profiler.popPush("keyboard"); this.keyboardHandler.tick(); this.profiler.pop(); + -+ net.neoforged.neoforge.event.EventHooks.onPostClientTick(); ++ net.neoforged.neoforge.client.ClientHooks.fireClientTickPost(); } private boolean isMultiplayerServer() { -@@ -2124,6 +_,7 @@ +@@ -2118,6 +_,7 @@ } - public void setLevel(ClientLevel p_91157_) { + public void setLevel(ClientLevel p_91157_, ReceivingLevelScreen.Reason p_341652_) { + if (this.level != null) net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.LevelEvent.Unload(this.level)); - ProgressScreen progressscreen = new ProgressScreen(true); - progressscreen.progressStartNoAbort(Component.translatable("connect.joining")); - this.updateScreenAndTick(progressscreen); -@@ -2157,6 +_,7 @@ + this.updateScreenAndTick(new ReceivingLevelScreen(() -> false, p_341652_)); + this.level = p_91157_; + this.updateLevelInEngines(p_91157_); +@@ -2155,6 +_,7 @@ IntegratedServer integratedserver = this.singleplayerServer; this.singleplayerServer = null; this.gameRenderer.resetData(); @@ -384,15 +376,15 @@ this.gameMode = null; this.narrator.clear(); this.clientLevelTeardownInProgress = true; -@@ -2164,6 +_,7 @@ +@@ -2162,6 +_,7 @@ try { - this.updateScreenAndTick(p_91321_); + this.updateScreenAndTick(p_320248_); if (this.level != null) { + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.LevelEvent.Unload(this.level)); if (integratedserver != null) { this.profiler.push("waitForServer"); -@@ -2324,6 +_,7 @@ +@@ -2320,6 +_,7 @@ private void pickBlock() { if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) { @@ -400,7 +392,7 @@ boolean flag = this.player.getAbilities().instabuild; BlockEntity blockentity = null; HitResult.Type hitresult$type = this.hitResult.getType(); -@@ -2336,7 +_,7 @@ +@@ -2332,7 +_,7 @@ } Block block = blockstate.getBlock(); @@ -409,7 +401,7 @@ if (itemstack.isEmpty()) { return; } -@@ -2350,7 +_,7 @@ +@@ -2346,7 +_,7 @@ } Entity entity = ((EntityHitResult)this.hitResult).getEntity(); @@ -418,7 +410,7 @@ if (itemstack == null) { return; } -@@ -2900,6 +_,19 @@ +@@ -2870,6 +_,19 @@ public void updateMaxMipLevel(int p_91313_) { this.modelManager.updateMaxMipLevel(p_91313_); diff --git a/patches/net/minecraft/client/MouseHandler.java.patch b/patches/net/minecraft/client/MouseHandler.java.patch index e34d4430874..e51da3e3084 100644 --- a/patches/net/minecraft/client/MouseHandler.java.patch +++ b/patches/net/minecraft/client/MouseHandler.java.patch @@ -65,38 +65,38 @@ if (this.minecraft.player.isSpectator()) { if (this.minecraft.gui.getSpectatorGui().isMenuActive()) { this.minecraft.gui.getSpectatorGui().onMouseScrolled(-k); -@@ -209,9 +_,11 @@ - double d3 = (p_91564_ - this.ypos) +@@ -224,9 +_,11 @@ + double d5 = this.accumulatedDY * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight(); - Screen.wrapScreenError( -- () -> screen.mouseDragged(d0, d1, this.activeButton, d2, d3), "mouseDragged event handler", screen.getClass().getCanonicalName() +- () -> screen.mouseDragged(d2, d3, this.activeButton, d4, d5), "mouseDragged event handler", screen.getClass().getCanonicalName() - ); + Screen.wrapScreenError(() -> { -+ if (net.neoforged.neoforge.client.ClientHooks.onScreenMouseDragPre(screen, d0, d1, this.activeButton, d2, d3)) return; -+ if (screen.mouseDragged(d0, d1, this.activeButton, d2, d3)) return; -+ net.neoforged.neoforge.client.ClientHooks.onScreenMouseDragPost(screen, d0, d1, this.activeButton, d2, d3); ++ if (net.neoforged.neoforge.client.ClientHooks.onScreenMouseDragPre(screen, d2, d3, this.activeButton, d4, d5)) return; ++ if (screen.mouseDragged(d2, d3, this.activeButton, d4, d5)) return; ++ net.neoforged.neoforge.client.ClientHooks.onScreenMouseDragPost(screen, d2, d3, this.activeButton, d4, d5); + }, "mouseDragged event handler", screen.getClass().getCanonicalName()); } screen.afterMouseMove(); -@@ -235,12 +_,13 @@ - double d1 = d0 - this.lastMouseEventTime; - this.lastMouseEventTime = d0; - if (this.isMouseGrabbed() && this.minecraft.isWindowActive()) { -- double d4 = this.minecraft.options.sensitivity().get() * 0.6F + 0.2F; -+ var event = net.neoforged.neoforge.client.ClientHooks.getTurnPlayerValues(this.minecraft.options.sensitivity().get(), this.minecraft.options.smoothCamera); -+ double d4 = event.getMouseSensitivity() * 0.6F + 0.2F; - double d5 = d4 * d4 * d4; - double d6 = d5 * 8.0; - double d2; - double d3; -- if (this.minecraft.options.smoothCamera) { -+ if (event.getCinematicCameraEnabled()) { - double d7 = this.smoothTurnX.getNewDeltaValue(this.accumulatedDX * d6, d1 * d6); - double d8 = this.smoothTurnY.getNewDeltaValue(this.accumulatedDY * d6, d1 * d6); - d2 = d7; -@@ -292,6 +_,14 @@ +@@ -242,12 +_,13 @@ + } + + private void turnPlayer(double p_316356_) { +- double d2 = this.minecraft.options.sensitivity().get() * 0.6F + 0.2F; ++ var event = net.neoforged.neoforge.client.ClientHooks.getTurnPlayerValues(this.minecraft.options.sensitivity().get(), this.minecraft.options.smoothCamera); ++ double d2 = event.getMouseSensitivity() * 0.6F + 0.2F; + double d3 = d2 * d2 * d2; + double d4 = d3 * 8.0; + double d0; + double d1; +- if (this.minecraft.options.smoothCamera) { ++ if (event.getCinematicCameraEnabled()) { + double d5 = this.smoothTurnX.getNewDeltaValue(this.accumulatedDX * d4, p_316356_ * d4); + double d6 = this.smoothTurnY.getNewDeltaValue(this.accumulatedDY * d4, p_316356_ * d4); + d0 = d5; +@@ -293,6 +_,14 @@ public double ypos() { return this.ypos; diff --git a/patches/net/minecraft/client/Options.java.patch b/patches/net/minecraft/client/Options.java.patch index 63c153e9881..4df5a1639b6 100644 --- a/patches/net/minecraft/client/Options.java.patch +++ b/patches/net/minecraft/client/Options.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/Options.java +++ b/net/minecraft/client/Options.java -@@ -715,9 +_,10 @@ +@@ -724,9 +_,10 @@ } }, new OptionInstance.LazyEnum<>( @@ -12,26 +12,26 @@ && !Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().contains(p_232011_) ? Optional.empty() : Optional.of(p_232011_), -@@ -787,7 +_,7 @@ +@@ -796,7 +_,7 @@ this.incompatibleResourcePacks.clear(); - for(Pack pack : p_275268_.getSelectedPacks()) { + for (Pack pack : p_275268_.getSelectedPacks()) { - if (!pack.isFixedPosition()) { + if (!pack.isFixedPosition() && !pack.isHidden()) { this.resourcePacks.add(pack.getId()); if (!pack.getCompatibility().isCompatible()) { this.incompatibleResourcePacks.add(pack.getId()); -@@ -1058,6 +_,7 @@ +@@ -1091,6 +_,7 @@ } public Options(Minecraft p_92138_, File p_92139_) { + setForgeKeybindProperties(); this.minecraft = p_92138_; this.optionsFile = new File(p_92139_, "options.txt"); - boolean flag = p_92138_.is64Bit(); -@@ -1191,11 +_,21 @@ - p_168428_.process("telemetryOptInExtra", this.telemetryOptInExtra); + boolean flag = Runtime.getRuntime().maxMemory() >= 1000000000L; +@@ -1228,11 +_,21 @@ this.onboardAccessibility = p_168428_.process("onboardAccessibility", this.onboardAccessibility); + p_168428_.process("menuBackgroundBlurriness", this.menuBackgroundBlurriness); + net.neoforged.neoforge.forge.snapshots.ForgeSnapshotsMod.processOptions(p_168428_); + processOptionsForge(p_168428_); @@ -39,7 +39,7 @@ + // FORGE: split off to allow reloading options after mod loading is done + private void processOptionsForge(Options.FieldAccess p_168428_) + { - for(KeyMapping keymapping : this.keyMappings) { + for (KeyMapping keymapping : this.keyMappings) { - String s = keymapping.saveString(); + String s = keymapping.saveString() + (keymapping.getKeyModifier() != net.neoforged.neoforge.client.settings.KeyModifier.NONE ? ":" + keymapping.getKeyModifier() : ""); String s1 = p_168428_.process("key_" + keymapping.getName(), s); @@ -53,7 +53,7 @@ } } -@@ -1213,6 +_,9 @@ +@@ -1250,6 +_,9 @@ } public void load() { @@ -63,7 +63,7 @@ try { if (!this.optionsFile.exists()) { return; -@@ -1240,7 +_,8 @@ +@@ -1277,7 +_,8 @@ } } @@ -73,15 +73,15 @@ new Options.FieldAccess() { @Nullable private String getValueOrNull(String p_168459_) { -@@ -1412,6 +_,7 @@ +@@ -1452,6 +_,7 @@ } public ClientInformation buildPlayerInformation() { + if (net.neoforged.neoforge.client.loading.ClientModLoader.isLoading()) return ClientInformation.createDefault(); //Don't save settings before mods add keybindigns and the like to prevent them from being deleted. int i = 0; - for(PlayerModelPart playermodelpart : this.modelParts) { -@@ -1487,6 +_,23 @@ + for (PlayerModelPart playermodelpart : this.modelParts) { +@@ -1527,6 +_,23 @@ } p_92146_.setSelected(set); diff --git a/patches/net/minecraft/client/color/block/BlockColors.java.patch b/patches/net/minecraft/client/color/block/BlockColors.java.patch index 25d4cb17d9f..32c2a2e76bb 100644 --- a/patches/net/minecraft/client/color/block/BlockColors.java.patch +++ b/patches/net/minecraft/client/color/block/BlockColors.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/color/block/BlockColors.java +++ b/net/minecraft/client/color/block/BlockColors.java -@@ -28,7 +_,8 @@ +@@ -29,7 +_,8 @@ @OnlyIn(Dist.CLIENT) public class BlockColors { private static final int DEFAULT = -1; @@ -10,10 +10,10 @@ private final Map>> coloringStates = Maps.newHashMap(); public static BlockColors createDefault() { -@@ -96,11 +_,12 @@ +@@ -94,11 +_,12 @@ }, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); blockcolors.addColoringState(StemBlock.AGE, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); - blockcolors.register((p_92596_, p_92597_, p_92598_, p_92599_) -> p_92597_ != null && p_92598_ != null ? 2129968 : 7455580, Blocks.LILY_PAD); + blockcolors.register((p_92596_, p_92597_, p_92598_, p_92599_) -> p_92597_ != null && p_92598_ != null ? -14647248 : -9321636, Blocks.LILY_PAD); + net.neoforged.neoforge.client.ClientHooks.onBlockColorsInit(blockcolors); return blockcolors; } @@ -24,7 +24,7 @@ if (blockcolor != null) { return blockcolor.getColor(p_92583_, null, null, 0); } else { -@@ -110,13 +_,15 @@ +@@ -108,13 +_,15 @@ } public int getColor(BlockState p_92578_, @Nullable BlockAndTintGetter p_92579_, @Nullable BlockPos p_92580_, int p_92581_) { @@ -36,7 +36,7 @@ + /** @deprecated Register via {@link net.neoforged.neoforge.client.event.RegisterColorHandlersEvent.Block} */ + @Deprecated public void register(BlockColor p_92590_, Block... p_92591_) { - for(Block block : p_92591_) { + for (Block block : p_92591_) { - this.blockColors.addMapping(p_92590_, BuiltInRegistries.BLOCK.getId(block)); + this.blockColors.put(block, p_92590_); } diff --git a/patches/net/minecraft/client/color/item/ItemColors.java.patch b/patches/net/minecraft/client/color/item/ItemColors.java.patch index 40c84b636cc..491886484de 100644 --- a/patches/net/minecraft/client/color/item/ItemColors.java.patch +++ b/patches/net/minecraft/client/color/item/ItemColors.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/color/item/ItemColors.java +++ b/net/minecraft/client/color/item/ItemColors.java -@@ -23,7 +_,8 @@ +@@ -26,7 +_,8 @@ @OnlyIn(Dist.CLIENT) public class ItemColors { private static final int DEFAULT = -1; @@ -10,10 +10,10 @@ public static ItemColors createDefault(BlockColors p_92684_) { ItemColors itemcolors = new ItemColors(); -@@ -94,17 +_,20 @@ - itemcolors.register((p_92696_, p_92697_) -> FoliageColor.getMangroveColor(), Blocks.MANGROVE_LEAVES); - itemcolors.register((p_92693_, p_92694_) -> p_92694_ == 0 ? PotionUtils.getColor(p_92693_) : -1, Items.TIPPED_ARROW); - itemcolors.register((p_232352_, p_232353_) -> p_232353_ == 0 ? -1 : MapItem.getColor(p_232352_), Items.FILLED_MAP); +@@ -105,17 +_,20 @@ + : FastColor.ARGB32.opaque(p_329710_.getOrDefault(DataComponents.MAP_COLOR, MapItemColor.DEFAULT).rgb()), + Items.FILLED_MAP + ); + net.neoforged.neoforge.client.ClientHooks.onItemColorsInit(itemcolors, p_92684_); return itemcolors; } @@ -27,7 +27,7 @@ + /** @deprecated Register via {@link net.neoforged.neoforge.client.event.RegisterColorHandlersEvent.Item} */ + @Deprecated public void register(ItemColor p_92690_, ItemLike... p_92691_) { - for(ItemLike itemlike : p_92691_) { + for (ItemLike itemlike : p_92691_) { - this.itemColors.addMapping(p_92690_, Item.getId(itemlike.asItem())); + this.itemColors.put(itemlike.asItem(), p_92690_); } diff --git a/patches/net/minecraft/client/gui/Gui.java.patch b/patches/net/minecraft/client/gui/Gui.java.patch index 28bbd9914e2..494b70bc482 100644 --- a/patches/net/minecraft/client/gui/Gui.java.patch +++ b/patches/net/minecraft/client/gui/Gui.java.patch @@ -1,26 +1,204 @@ --- a/net/minecraft/client/gui/Gui.java +++ b/net/minecraft/client/gui/Gui.java -@@ -456,6 +_,8 @@ +@@ -68,6 +_,9 @@ + import net.neoforged.api.distmarker.OnlyIn; + import org.joml.Matrix4fStack; - for(MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) { - MobEffect mobeffect = mobeffectinstance.getEffect(); ++// Neo: Exceptionally add a static wildcard import to make the patch bearable, and comments to avoid the detection by spotless rules. ++/* space for import change */ import static net.neoforged.neoforge.client.gui.VanillaGuiLayers.* /* space for wildcard import */; ++ + @OnlyIn(Dist.CLIENT) + public class Gui { + protected static final ResourceLocation CROSSHAIR_SPRITE = new ResourceLocation("hud/crosshair"); +@@ -150,9 +_,21 @@ + protected long healthBlinkTime; + protected float autosaveIndicatorValue; + protected float lastAutosaveIndicatorValue; ++ /** Neo: This is empty and unused, rendering goes through {@link #layerManager} instead. */ ++ @Deprecated + private final LayeredDraw layers = new LayeredDraw(); ++ private final net.neoforged.neoforge.client.gui.GuiLayerManager layerManager = new net.neoforged.neoforge.client.gui.GuiLayerManager(); + protected float scopeScale; + ++ /** ++ * Neo: This variable controls the height of overlays on the left of the hotbar (e.g. health, armor). ++ */ ++ public int leftHeight; ++ /** ++ * Neo: This variable controls the height of overlays on the right of the hotbar (e.g. food, vehicle health, air). ++ */ ++ public int rightHeight; ++ + public Gui(Minecraft p_232355_) { + this.minecraft = p_232355_; + this.debugOverlay = new DebugScreenOverlay(p_232355_); +@@ -162,27 +_,40 @@ + this.bossOverlay = new BossHealthOverlay(p_232355_); + this.subtitleOverlay = new SubtitleOverlay(p_232355_); + this.resetTitleTimes(); +- LayeredDraw layereddraw = new LayeredDraw() +- .add(this::renderCameraOverlays) +- .add(this::renderCrosshair) +- .add(this::renderHotbarAndDecorations) +- .add(this::renderExperienceLevel) +- .add(this::renderEffects) +- .add((p_315814_, p_315815_) -> this.bossOverlay.render(p_315814_)); +- LayeredDraw layereddraw1 = new LayeredDraw() +- .add(this::renderDemoOverlay) +- .add((p_315812_, p_315813_) -> { ++ var playerHealthComponents = new net.neoforged.neoforge.client.gui.GuiLayerManager() ++ .add(PLAYER_HEALTH, (guiGraphics, partialTick) -> renderHealthLevel(guiGraphics)) ++ .add(ARMOR_LEVEL, (guiGraphics, partialTick) -> renderArmorLevel(guiGraphics)) ++ .add(FOOD_LEVEL, (guiGraphics, partialTick) -> renderFoodLevel(guiGraphics)); ++ var layereddraw = new net.neoforged.neoforge.client.gui.GuiLayerManager() ++ .add(CAMERA_OVERLAYS, this::renderCameraOverlays) ++ .add(CROSSHAIR, this::renderCrosshair) ++ .add(HOTBAR, this::renderHotbar) ++ .add(JUMP_METER, this::maybeRenderJumpMeter) ++ .add(EXPERIENCE_BAR, this::maybeRenderExperienceBar) ++ .add(playerHealthComponents, () -> this.minecraft.gameMode.canHurtPlayer()) ++ .add(VEHICLE_HEALTH, this::maybeRenderVehicleHealth) ++ // Air goes above vehicle health, it must render after it for `rightHeight` to work! ++ .add(AIR_LEVEL, (guiGraphics, partialTick) -> { if (this.minecraft.gameMode.canHurtPlayer()) renderAirLevel(guiGraphics); }) ++ .add(SELECTED_ITEM_NAME, this::maybeRenderSelectedItemName) ++ .add(SPECTATOR_TOOLTIP, this::maybeRenderSpectatorTooltip) ++ .add(EXPERIENCE_LEVEL, this::renderExperienceLevel) ++ .add(EFFECTS, this::renderEffects) ++ .add(BOSS_OVERLAY, (p_315814_, p_315815_) -> this.bossOverlay.render(p_315814_)); ++ var layereddraw1 = new net.neoforged.neoforge.client.gui.GuiLayerManager() ++ .add(DEMO_OVERLAY, this::renderDemoOverlay) ++ .add(DEBUG_OVERLAY, (p_315812_, p_315813_) -> { + if (this.debugOverlay.showDebugScreen()) { + this.debugOverlay.render(p_315812_); + } + }) +- .add(this::renderScoreboardSidebar) +- .add(this::renderOverlayMessage) +- .add(this::renderTitle) +- .add(this::renderChat) +- .add(this::renderTabList) +- .add((p_315816_, p_315817_) -> this.subtitleOverlay.render(p_315816_)); +- this.layers.add(layereddraw, () -> !p_232355_.options.hideGui).add(this::renderSleepOverlay).add(layereddraw1, () -> !p_232355_.options.hideGui); ++ .add(SCOREBOARD_SIDEBAR, this::renderScoreboardSidebar) ++ .add(OVERLAY_MESSAGE, this::renderOverlayMessage) ++ .add(TITLE, this::renderTitle) ++ .add(CHAT, this::renderChat) ++ .add(TAB_LIST, this::renderTabList) ++ .add(SUBTITLE_OVERLAY, (p_315816_, p_315817_) -> this.subtitleOverlay.render(p_315816_)) ++ .add(SAVING_INDICATOR, this::renderSavingIndicator); ++ this.layerManager.add(layereddraw, () -> !p_232355_.options.hideGui).add(SLEEP_OVERLAY, this::renderSleepOverlay).add(layereddraw1, () -> !p_232355_.options.hideGui); + } + + public void resetTitleTimes() { +@@ -193,7 +_,9 @@ + + public void render(GuiGraphics p_282884_, float p_282611_) { + RenderSystem.enableDepthTest(); +- this.layers.render(p_282884_, p_282611_); ++ leftHeight = 39; ++ rightHeight = 39; ++ this.layerManager.render(p_282884_, p_282611_); + RenderSystem.disableDepthTest(); + } + +@@ -252,8 +_,12 @@ + } + + if (i > 8) { ++ //Include a shift based on the bar height plus the difference between the height that renderSelectedItemName ++ // renders at (59) and the height that the overlay/status bar renders at (68) by default ++ int yShift = Math.max(leftHeight, rightHeight) + (68 - 59); + p_316291_.pose().pushPose(); +- p_316291_.pose().translate((float)(p_316291_.guiWidth() / 2), (float)(p_316291_.guiHeight() - 68), 0.0F); ++ //If y shift is smaller less than the default y level, just render it at the base y level ++ p_316291_.pose().translate((float)(p_316291_.guiWidth() / 2), (float)(p_316291_.guiHeight() - Math.max(yShift, 68)), 0.0F); + int j = 16777215; + if (this.animateOverlayMessageColor) { + j = Mth.hsvToRgb(f / 50.0F, 0.7F, 0.6F) & 16777215; +@@ -441,6 +_,8 @@ + List list = Lists.newArrayListWithExpectedSize(collection.size()); + + for (MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) { + var renderer = net.neoforged.neoforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance); + if (!renderer.isVisibleInGui(mobeffectinstance)) continue; + Holder holder = mobeffectinstance.getEffect(); if (mobeffectinstance.showIcon()) { - int i = this.screenWidth; - int j = 1; -@@ -485,6 +_,7 @@ + int i = p_282812_.guiWidth(); +@@ -471,6 +_,7 @@ } } + if (renderer.renderGuiIcon(mobeffectinstance, this, p_282812_, i, j, 0, f)) continue; - TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(mobeffect); + TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(holder); + int l1 = i; int i1 = j; - float f1 = f; -@@ -604,18 +_,23 @@ +@@ -488,29 +_,59 @@ + } } - public void renderSelectedItemName(GuiGraphics p_283501_) { ++ @Deprecated // Neo: Split up into different layers + private void renderHotbarAndDecorations(GuiGraphics p_316628_, float p_316765_) { ++ renderHotbar(p_316628_, p_316765_); ++ maybeRenderJumpMeter(p_316628_, p_316765_); ++ maybeRenderExperienceBar(p_316628_, p_316765_); ++ maybeRenderPlayerHealth(p_316628_, p_316765_); ++ maybeRenderVehicleHealth(p_316628_, p_316765_); ++ maybeRenderSelectedItemName(p_316628_, p_316765_); ++ maybeRenderSpectatorTooltip(p_316628_, p_316765_); ++ } ++ ++ private void renderHotbar(GuiGraphics p_316628_, float p_316765_) { + if (this.minecraft.gameMode.getPlayerMode() == GameType.SPECTATOR) { + this.spectatorGui.renderHotbar(p_316628_); + } else { + this.renderItemHotbar(p_316628_, p_316765_); + } ++ } + ++ private void maybeRenderJumpMeter(GuiGraphics p_316628_, float p_316765_) { + int i = p_316628_.guiWidth() / 2 - 91; + PlayerRideableJumping playerrideablejumping = this.minecraft.player.jumpableVehicle(); + if (playerrideablejumping != null) { + this.renderJumpMeter(playerrideablejumping, p_316628_, i); +- } else if (this.isExperienceBarVisible()) { ++ } ++ ++ } ++ ++ private void maybeRenderExperienceBar(GuiGraphics p_316628_, float p_316765_) { ++ int i = p_316628_.guiWidth() / 2 - 91; ++ if (this.minecraft.player.jumpableVehicle() == null && this.isExperienceBarVisible()) { + this.renderExperienceBar(p_316628_, i); + } ++ } + ++ private void maybeRenderPlayerHealth(GuiGraphics p_316628_, float p_316765_) { + if (this.minecraft.gameMode.canHurtPlayer()) { + this.renderPlayerHealth(p_316628_); + } ++ } + ++ private void maybeRenderVehicleHealth(GuiGraphics p_316628_, float p_316765_) { + this.renderVehicleHealth(p_316628_); ++ } ++ ++ private void maybeRenderSelectedItemName(GuiGraphics p_316628_, float p_316765_) { + if (this.minecraft.gameMode.getPlayerMode() != GameType.SPECTATOR) { +- this.renderSelectedItemName(p_316628_); +- } else if (this.minecraft.player.isSpectator()) { ++ this.renderSelectedItemName(p_316628_, Math.max(this.leftHeight, this.rightHeight)); ++ } ++ } ++ ++ private void maybeRenderSpectatorTooltip(GuiGraphics p_316628_, float p_316765_) { ++ if (this.minecraft.gameMode.getPlayerMode() == GameType.SPECTATOR && this.minecraft.player.isSpectator()) { + this.spectatorGui.renderTooltip(p_316628_); + } + } +@@ -633,18 +_,23 @@ + } + + private void renderSelectedItemName(GuiGraphics p_283501_) { + renderSelectedItemName(p_283501_, 0); + } + @@ -29,22 +207,22 @@ if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) { MutableComponent mutablecomponent = Component.empty() .append(this.lastToolHighlight.getHoverName()) -- .withStyle(this.lastToolHighlight.getRarity().color); +- .withStyle(this.lastToolHighlight.getRarity().color()); + .withStyle(this.lastToolHighlight.getRarity().getStyleModifier()); - if (this.lastToolHighlight.hasCustomHoverName()) { + if (this.lastToolHighlight.has(DataComponents.CUSTOM_NAME)) { mutablecomponent.withStyle(ChatFormatting.ITALIC); } - int i = this.getFont().width(mutablecomponent); + Component highlightTip = this.lastToolHighlight.getHighlightTip(mutablecomponent); + int i = this.getFont().width(highlightTip); - int j = (this.screenWidth - i) / 2; -- int k = this.screenHeight - 59; -+ int k = this.screenHeight - Math.max(yShift, 59); + int j = (p_283501_.guiWidth() - i) / 2; +- int k = p_283501_.guiHeight() - 59; ++ int k = p_283501_.guiHeight() - Math.max(yShift, 59); if (!this.minecraft.gameMode.canHurtPlayer()) { k += 14; } -@@ -627,7 +_,13 @@ +@@ -656,7 +_,13 @@ if (l > 0) { p_283501_.fill(j - 2, k - 2, j + i + 2, k + 9 + 2, this.minecraft.options.getBackgroundColor(0)); @@ -53,18 +231,154 @@ + if (font == null) { + p_283501_.drawString(this.getFont(), highlightTip, j, k, 16777215 + (l << 24)); + } else { -+ j = (this.screenWidth - font.width(highlightTip)) / 2; ++ j = (p_283501_.guiWidth() - font.width(highlightTip)) / 2; + p_283501_.drawString(font, highlightTip, j, k, 16777215 + (l << 24)); + } } } -@@ -1102,7 +_,7 @@ +@@ -664,7 +_,7 @@ + } + + private void renderDemoOverlay(GuiGraphics p_281825_, float p_316211_) { +- if (this.minecraft.isDemo()) { ++ if (this.minecraft.isDemo() && !this.getDebugOverlay().showDebugScreen()) { // NEO: Hide demo timer when F3 debug overlay is open; fixes MC-271166 + this.minecraft.getProfiler().push("demo"); + Component component; + if (this.minecraft.level.getGameTime() >= 120500L) { +@@ -777,7 +_,15 @@ + return (int)Math.ceil((double)p_93013_ / 10.0); + } + ++ @Deprecated // Neo: Split up into different layers + private void renderPlayerHealth(GuiGraphics p_283143_) { ++ renderHealthLevel(p_283143_); ++ renderArmorLevel(p_283143_); ++ renderFoodLevel(p_283143_); ++ renderAirLevel(p_283143_); ++ } ++ ++ private void renderHealthLevel(GuiGraphics p_283143_) { + Player player = this.getCameraPlayer(); + if (player != null) { + int i = Mth.ceil(player.getHealth()); +@@ -802,35 +_,62 @@ + this.random.setSeed((long)(this.tickCount * 312871)); + int l = p_283143_.guiWidth() / 2 - 91; + int i1 = p_283143_.guiWidth() / 2 + 91; +- int j1 = p_283143_.guiHeight() - 39; ++ int j1 = p_283143_.guiHeight() - leftHeight; + float f = Math.max((float)player.getAttributeValue(Attributes.MAX_HEALTH), (float)Math.max(k, i)); + int k1 = Mth.ceil(player.getAbsorptionAmount()); + int l1 = Mth.ceil((f + (float)k1) / 2.0F / 10.0F); + int i2 = Math.max(10 - (l1 - 2), 3); + int j2 = j1 - 10; ++ leftHeight += (l1 - 1) * i2 + 10; + int k2 = -1; + if (player.hasEffect(MobEffects.REGENERATION)) { + k2 = this.tickCount % Mth.ceil(f + 5.0F); + } +- +- this.minecraft.getProfiler().push("armor"); +- renderArmor(p_283143_, player, j1, l1, i2, l); +- this.minecraft.getProfiler().popPush("health"); ++ this.minecraft.getProfiler().push("health"); + this.renderHearts(p_283143_, player, l, j1, i2, k2, f, i, k, k1, flag); ++ this.minecraft.getProfiler().pop(); ++ } ++ } ++ ++ private void renderArmorLevel(GuiGraphics p_283143_) { ++ Player player = this.getCameraPlayer(); ++ if (player != null) { ++ int l = p_283143_.guiWidth() / 2 - 91; ++ this.minecraft.getProfiler().push("armor"); ++ renderArmor(p_283143_, player, p_283143_.guiHeight() - leftHeight + 10, 1, 0, l); ++ this.minecraft.getProfiler().pop(); ++ if (player.getArmorValue() > 0) { ++ leftHeight += 10; ++ } ++ } ++ } ++ ++ private void renderFoodLevel(GuiGraphics p_283143_) { ++ Player player = this.getCameraPlayer(); ++ if (player != null) { + LivingEntity livingentity = this.getPlayerVehicleWithHealth(); + int l2 = this.getVehicleMaxHearts(livingentity); + if (l2 == 0) { +- this.minecraft.getProfiler().popPush("food"); ++ this.minecraft.getProfiler().push("food"); ++ int i1 = p_283143_.guiWidth() / 2 + 91; ++ int j1 = p_283143_.guiHeight() - rightHeight; + this.renderFood(p_283143_, player, j1, i1); +- j2 -= 10; ++ rightHeight += 10; ++ this.minecraft.getProfiler().pop(); + } +- +- this.minecraft.getProfiler().popPush("air"); ++ } ++ } ++ ++ private void renderAirLevel(GuiGraphics p_283143_) { ++ Player player = this.getCameraPlayer(); ++ if (player != null) { ++ int i1 = p_283143_.guiWidth() / 2 + 91; ++ ++ this.minecraft.getProfiler().push("air"); + int i3 = player.getMaxAirSupply(); + int j3 = Math.min(player.getAirSupply(), i3); + if (player.isEyeInFluid(FluidTags.WATER) || j3 < i3) { +- int k3 = this.getVisibleVehicleHeartRows(l2) - 1; +- j2 -= k3 * 10; ++ int j2 = p_283143_.guiHeight() - rightHeight; + int l3 = Mth.ceil((double)(j3 - 2) * 10.0 / (double)i3); + int i4 = Mth.ceil((double)j3 * 10.0 / (double)i3) - l3; + RenderSystem.enableBlend(); +@@ -844,6 +_,7 @@ + } + + RenderSystem.disableBlend(); ++ rightHeight += 10; + } + + this.minecraft.getProfiler().pop(); +@@ -983,7 +_,7 @@ + if (i != 0) { + int j = (int)Math.ceil((double)livingentity.getHealth()); + this.minecraft.getProfiler().popPush("mountHealth"); +- int k = p_283368_.guiHeight() - 39; ++ int k = p_283368_.guiHeight() - rightHeight; + int l = p_283368_.guiWidth() / 2 + 91; + int i1 = k; + int j1 = 0; +@@ -1006,6 +_,7 @@ + } + + i1 -= 10; ++ rightHeight += 10; + j1 += 20; + } + +@@ -1162,7 +_,7 @@ this.toolHighlightTimer = 0; } else if (this.lastToolHighlight.isEmpty() || !itemstack.is(this.lastToolHighlight.getItem()) - || !itemstack.getHoverName().equals(this.lastToolHighlight.getHoverName())) { -+ || (!itemstack.getHoverName().equals(this.lastToolHighlight.getHoverName()) || !itemstack.getHighlightTip(itemstack.getHoverName()).equals(lastToolHighlight.getHighlightTip(lastToolHighlight.getHoverName())))) { ++ || (!itemstack.getHoverName().equals(this.lastToolHighlight.getHoverName()) || !itemstack.getHighlightTip(itemstack.getHoverName()).equals(this.lastToolHighlight.getHighlightTip(this.lastToolHighlight.getHoverName())))) { this.toolHighlightTimer = (int)(40.0 * this.minecraft.options.notificationDisplayTime().get()); } else if (this.toolHighlightTimer > 0) { - --this.toolHighlightTimer; + this.toolHighlightTimer--; +@@ -1287,6 +_,11 @@ + p_282761_.drawString(font, SAVING_TEXT, p_282761_.guiWidth() - j - 10, p_282761_.guiHeight() - 15, k); + } + } ++ } ++ ++ @org.jetbrains.annotations.ApiStatus.Internal ++ public void initModdedOverlays() { ++ this.layerManager.initModdedLayers(); + } + + @OnlyIn(Dist.CLIENT) diff --git a/patches/net/minecraft/client/gui/GuiGraphics.java.patch b/patches/net/minecraft/client/gui/GuiGraphics.java.patch index 3bffce7aec7..e71afe0d19b 100644 --- a/patches/net/minecraft/client/gui/GuiGraphics.java.patch +++ b/patches/net/minecraft/client/gui/GuiGraphics.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/GuiGraphics.java +++ b/net/minecraft/client/gui/GuiGraphics.java -@@ -55,7 +_,7 @@ +@@ -56,7 +_,7 @@ import org.joml.Vector2ic; @OnlyIn(Dist.CLIENT) @@ -9,7 +9,7 @@ public static final float MAX_GUI_Z = 10000.0F; public static final float MIN_GUI_Z = -10000.0F; private static final int EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE = 2; -@@ -265,6 +_,11 @@ +@@ -280,6 +_,11 @@ } public int drawString(Font p_283343_, @Nullable String p_281896_, int p_283569_, int p_283418_, int p_281560_, boolean p_282130_) { @@ -21,7 +21,7 @@ if (p_281896_ == null) { return 0; } else { -@@ -291,6 +_,11 @@ +@@ -306,6 +_,11 @@ } public int drawString(Font p_282636_, FormattedCharSequence p_281596_, int p_281586_, int p_282816_, int p_281743_, boolean p_282394_) { @@ -33,16 +33,7 @@ int i = p_282636_.drawInBatch( p_281596_, (float)p_281586_, -@@ -824,7 +_,7 @@ - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.forThrowable(throwable, "Rendering item"); - CrashReportCategory crashreportcategory = crashreport.addCategory("Item being rendered"); -- crashreportcategory.setDetail("Item Type", () -> String.valueOf(p_281675_.getItem())); -+ crashreportcategory.setDetail("Item Type / Registry Name", () -> String.valueOf(p_281675_.getItem())); - crashreportcategory.setDetail("Item Damage", () -> String.valueOf(p_281675_.getDamageValue())); - crashreportcategory.setDetail("Item NBT", () -> String.valueOf(p_281675_.getTag())); - crashreportcategory.setDetail("Item Foil", () -> String.valueOf(p_281675_.hasFoil())); -@@ -866,19 +_,26 @@ +@@ -879,19 +_,26 @@ } this.pose.popPose(); @@ -68,13 +59,13 @@ - List list = p_282716_.stream() - .map(Component::getVisualOrderText) - .map(ClientTooltipComponent::create) -- .collect(Collectors.toList()); -- p_281682_.ifPresent(p_282969_ -> list.add(1, ClientTooltipComponent.create(p_282969_))); +- .collect(Util.toMutableList()); +- p_281682_.ifPresent(p_337410_ -> list.add(list.isEmpty() ? 0 : 1, ClientTooltipComponent.create(p_337410_))); + List list = net.neoforged.neoforge.client.ClientHooks.gatherTooltipComponents(this.tooltipStack, p_282716_, p_281682_, p_283678_, guiWidth(), guiHeight(), p_283128_); this.renderTooltipInternal(p_283128_, list, p_283678_, p_281696_, DefaultTooltipPositioner.INSTANCE); } -@@ -887,7 +_,15 @@ +@@ -900,7 +_,15 @@ } public void renderComponentTooltip(Font p_282739_, List p_281832_, int p_282191_, int p_282446_) { @@ -91,7 +82,7 @@ } public void renderTooltip(Font p_282192_, List p_282297_, int p_281680_, int p_283325_) { -@@ -908,11 +_,13 @@ +@@ -921,11 +_,13 @@ private void renderTooltipInternal(Font p_282675_, List p_282615_, int p_283230_, int p_283417_, ClientTooltipPositioner p_282442_) { if (!p_282615_.isEmpty()) { @@ -100,13 +91,13 @@ int i = 0; int j = p_282615_.size() == 1 ? -2 : 0; - for(ClientTooltipComponent clienttooltipcomponent : p_282615_) { + for (ClientTooltipComponent clienttooltipcomponent : p_282615_) { - int k = clienttooltipcomponent.getWidth(p_282675_); + int k = clienttooltipcomponent.getWidth(preEvent.getFont()); if (k > i) { i = k; } -@@ -922,18 +_,19 @@ +@@ -935,18 +_,19 @@ int i2 = i; int j2 = j; @@ -122,16 +113,16 @@ this.pose.translate(0.0F, 0.0F, 400.0F); int k1 = i1; - for(int l1 = 0; l1 < p_282615_.size(); ++l1) { + for (int l1 = 0; l1 < p_282615_.size(); l1++) { ClientTooltipComponent clienttooltipcomponent1 = p_282615_.get(l1); - clienttooltipcomponent1.renderText(p_282675_, l, k1, this.pose.last().pose(), this.bufferSource); + clienttooltipcomponent1.renderText(preEvent.getFont(), l, k1, this.pose.last().pose(), this.bufferSource); k1 += clienttooltipcomponent1.getHeight() + (l1 == 0 ? 2 : 0); } -@@ -941,7 +_,7 @@ +@@ -954,7 +_,7 @@ - for(int k2 = 0; k2 < p_282615_.size(); ++k2) { + for (int k2 = 0; k2 < p_282615_.size(); k2++) { ClientTooltipComponent clienttooltipcomponent2 = p_282615_.get(k2); - clienttooltipcomponent2.renderImage(p_282675_, l, k1, this); + clienttooltipcomponent2.renderImage(preEvent.getFont(), l, k1, this); diff --git a/patches/net/minecraft/client/gui/MapRenderer.java.patch b/patches/net/minecraft/client/gui/MapRenderer.java.patch deleted file mode 100644 index c99d811d980..00000000000 --- a/patches/net/minecraft/client/gui/MapRenderer.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/client/gui/MapRenderer.java -+++ b/net/minecraft/client/gui/MapRenderer.java -@@ -119,6 +_,7 @@ - - for(MapDecoration mapdecoration : this.data.getDecorations()) { - if (!p_93294_ || mapdecoration.renderOnFrame()) { -+ if (mapdecoration.render(k)) { k++; continue; } - p_93292_.pushPose(); - p_93292_.translate(0.0F + (float)mapdecoration.x() / 2.0F + 64.0F, 0.0F + (float)mapdecoration.y() / 2.0F + 64.0F, -0.02F); - p_93292_.mulPose(Axis.ZP.rotationDegrees((float)(mapdecoration.rot() * 360) / 16.0F)); diff --git a/patches/net/minecraft/client/gui/components/AbstractWidget.java.patch b/patches/net/minecraft/client/gui/components/AbstractWidget.java.patch index d101d26ce44..0f5ac718d80 100644 --- a/patches/net/minecraft/client/gui/components/AbstractWidget.java.patch +++ b/patches/net/minecraft/client/gui/components/AbstractWidget.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/components/AbstractWidget.java +++ b/net/minecraft/client/gui/components/AbstractWidget.java -@@ -24,7 +_,7 @@ +@@ -25,7 +_,7 @@ import net.neoforged.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) diff --git a/patches/net/minecraft/client/gui/components/BossHealthOverlay.java.patch b/patches/net/minecraft/client/gui/components/BossHealthOverlay.java.patch index bb6aee71cce..4bc398fffe6 100644 --- a/patches/net/minecraft/client/gui/components/BossHealthOverlay.java.patch +++ b/patches/net/minecraft/client/gui/components/BossHealthOverlay.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/gui/components/BossHealthOverlay.java +++ b/net/minecraft/client/gui/components/BossHealthOverlay.java -@@ -62,13 +_,16 @@ +@@ -63,13 +_,16 @@ - for(LerpingBossEvent lerpingbossevent : this.events.values()) { + for (LerpingBossEvent lerpingbossevent : this.events.values()) { int k = i / 2 - 91; + var event = net.neoforged.neoforge.client.ClientHooks.onCustomizeBossEventProgress(p_283175_, this.minecraft.getWindow(), lerpingbossevent, k, j, 10 + this.minecraft.font.lineHeight); + if (!event.isCanceled()) { diff --git a/patches/net/minecraft/client/gui/components/Button.java.patch b/patches/net/minecraft/client/gui/components/Button.java.patch index 77030cca418..c15f1bbcb63 100644 --- a/patches/net/minecraft/client/gui/components/Button.java.patch +++ b/patches/net/minecraft/client/gui/components/Button.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/components/Button.java +++ b/net/minecraft/client/gui/components/Button.java -@@ -30,6 +_,11 @@ +@@ -31,6 +_,11 @@ this.createNarration = p_259552_; } @@ -12,7 +12,7 @@ @Override public void onPress() { this.onPress.onPress(this); -@@ -94,9 +_,11 @@ +@@ -95,9 +_,11 @@ } public Button build() { diff --git a/patches/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch b/patches/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch index ccb756ec408..7369f754b3a 100644 --- a/patches/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch +++ b/patches/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/components/DebugScreenOverlay.java +++ b/net/minecraft/client/gui/components/DebugScreenOverlay.java -@@ -134,8 +_,13 @@ +@@ -135,8 +_,13 @@ this.block = entity.pick(20.0, 0.0F, false); this.liquid = entity.pick(20.0, 0.0F, true); p_281427_.drawManaged(() -> { @@ -16,7 +16,7 @@ if (this.renderFpsCharts) { int i = p_281427_.guiWidth(); int j = i / 2; -@@ -160,7 +_,7 @@ +@@ -161,7 +_,7 @@ this.minecraft.getProfiler().pop(); } @@ -25,7 +25,7 @@ List list = this.getGameInformation(); list.add(""); boolean flag = this.minecraft.getSingleplayerServer() != null; -@@ -175,11 +_,13 @@ +@@ -176,11 +_,13 @@ + (this.renderNetworkCharts ? " visible" : " hidden") ); list.add("For help: press F3 + Q"); @@ -40,7 +40,7 @@ this.renderLines(p_281261_, list, false); } -@@ -508,6 +_,13 @@ +@@ -509,6 +_,13 @@ GlUtil.getRenderer(), GlUtil.getOpenGLVersion() ); @@ -54,7 +54,7 @@ if (this.minecraft.showOnlyReducedInfo()) { return list; } else { -@@ -544,6 +_,7 @@ +@@ -545,6 +_,7 @@ list.add(""); list.add(ChatFormatting.UNDERLINE + "Targeted Entity"); list.add(String.valueOf(BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()))); diff --git a/patches/net/minecraft/client/gui/screens/ChatScreen.java.patch b/patches/net/minecraft/client/gui/screens/ChatScreen.java.patch index c9c9357bea5..d6be9f9fb5a 100644 --- a/patches/net/minecraft/client/gui/screens/ChatScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/ChatScreen.java.patch @@ -1,11 +1,14 @@ --- a/net/minecraft/client/gui/screens/ChatScreen.java +++ b/net/minecraft/client/gui/screens/ChatScreen.java -@@ -232,7 +_,7 @@ - this.minecraft.player.connection.sendChat(p_242400_); - } - -- return true; -+ return minecraft.screen == this; // FORGE: Prevent closing the screen if another screen has been opened. - } - } - +@@ -89,7 +_,10 @@ + return true; + } else if (p_95591_ == 257 || p_95591_ == 335) { + this.handleChatInput(this.input.getValue(), true); +- this.minecraft.setScreen(null); ++ // FORGE: Prevent closing the screen if another screen has been opened. ++ if (minecraft.screen == this) { ++ this.minecraft.setScreen(null); ++ } + return true; + } else if (p_95591_ == 265) { + this.moveInHistory(-1); diff --git a/patches/net/minecraft/client/gui/screens/ConnectScreen.java.patch b/patches/net/minecraft/client/gui/screens/ConnectScreen.java.patch index 4192f448b99..4427113c7fd 100644 --- a/patches/net/minecraft/client/gui/screens/ConnectScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/ConnectScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/ConnectScreen.java +++ b/net/minecraft/client/gui/screens/ConnectScreen.java -@@ -85,6 +_,8 @@ +@@ -102,6 +_,8 @@ } if (optional.isEmpty()) { diff --git a/patches/net/minecraft/client/gui/screens/MenuScreens.java.patch b/patches/net/minecraft/client/gui/screens/MenuScreens.java.patch index 1fb4c35f413..abcbfe3c8be 100644 --- a/patches/net/minecraft/client/gui/screens/MenuScreens.java.patch +++ b/patches/net/minecraft/client/gui/screens/MenuScreens.java.patch @@ -1,29 +1,25 @@ --- a/net/minecraft/client/gui/screens/MenuScreens.java +++ b/net/minecraft/client/gui/screens/MenuScreens.java -@@ -41,6 +_,10 @@ +@@ -41,12 +_,17 @@ private static final Map, MenuScreens.ScreenConstructor> SCREENS = Maps.newHashMap(); - public static void create(@Nullable MenuType p_96202_, Minecraft p_96203_, int p_96204_, Component p_96205_) { -+ getScreenFactory(p_96202_, p_96203_, p_96204_, p_96205_).ifPresent(f -> f.fromPacket(p_96205_, p_96202_, p_96203_, p_96204_)); + public static void create(MenuType p_96202_, Minecraft p_96203_, int p_96204_, Component p_96205_) { ++ getScreenFactory(p_96202_).ifPresent(f -> f.fromPacket(p_96205_, p_96202_, p_96203_, p_96204_)); + } + -+ public static java.util.Optional> getScreenFactory(@Nullable MenuType p_96202_, Minecraft p_96203_, int p_96204_, Component p_96205_) { - if (p_96202_ == null) { - LOGGER.warn("Trying to open invalid screen with name: {}", p_96205_.getString()); ++ public static java.util.Optional> getScreenFactory(MenuType p_96202_) { + MenuScreens.ScreenConstructor screenconstructor = getConstructor(p_96202_); + if (screenconstructor == null) { + LOGGER.warn("Failed to create screen for menu type: {}", BuiltInRegistries.MENU.getKey(p_96202_)); } else { -@@ -48,9 +_,10 @@ - if (screenconstructor == null) { - LOGGER.warn("Failed to create screen for menu type: {}", BuiltInRegistries.MENU.getKey(p_96202_)); - } else { -- screenconstructor.fromPacket(p_96205_, p_96202_, p_96203_, p_96204_); -+ return java.util.Optional.of(screenconstructor); - } +- screenconstructor.fromPacket(p_96205_, p_96202_, p_96203_, p_96204_); ++ return java.util.Optional.of(screenconstructor); } + return java.util.Optional.empty(); } @Nullable -@@ -58,6 +_,11 @@ +@@ -54,6 +_,11 @@ return (MenuScreens.ScreenConstructor)SCREENS.get(p_96200_); } @@ -35,7 +31,7 @@ public static > void register( MenuType p_96207_, MenuScreens.ScreenConstructor p_96208_ ) { -@@ -65,6 +_,12 @@ +@@ -61,6 +_,12 @@ if (screenconstructor != null) { throw new IllegalStateException("Duplicate registration for " + BuiltInRegistries.MENU.getKey(p_96207_)); } @@ -44,7 +40,7 @@ + @org.jetbrains.annotations.ApiStatus.Internal + public static void init() { + var event = new net.neoforged.neoforge.client.event.RegisterMenuScreensEvent(SCREENS); -+ net.neoforged.fml.ModLoader.get().postEvent(event); ++ net.neoforged.fml.ModLoader.postEvent(event); } public static boolean selfTest() { diff --git a/patches/net/minecraft/client/gui/screens/OptionsScreen.java.patch b/patches/net/minecraft/client/gui/screens/OptionsScreen.java.patch index cdc8c1ad5eb..c14b66a7a98 100644 --- a/patches/net/minecraft/client/gui/screens/OptionsScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/OptionsScreen.java.patch @@ -1,17 +1,14 @@ --- a/net/minecraft/client/gui/screens/OptionsScreen.java +++ b/net/minecraft/client/gui/screens/OptionsScreen.java -@@ -164,6 +_,14 @@ - p_283520_.drawCenteredString(this.font, this.title, this.width / 2, 15, 16777215); - } +@@ -104,7 +_,10 @@ -+ @Override -+ public void onClose() { -+ // We need to consider 2 potential parent screens here: -+ // 1. From the main menu, in which case display the main menu -+ // 2. From the pause menu, in which case exit back to game -+ this.minecraft.setScreen(this.lastScreen instanceof PauseScreen ? null : this.lastScreen); -+ } -+ - private Button openScreenButton(Component p_261565_, Supplier p_262119_) { - return Button.builder(p_261565_, p_280808_ -> this.minecraft.setScreen(p_262119_.get())).build(); + @Override + public void onClose() { +- this.minecraft.setScreen(this.lastScreen); ++ // We need to consider 2 potential parent screens here: ++ // 1. From the main menu, in which case display the main menu ++ // 2. From the pause menu, in which case exit back to game ++ this.minecraft.setScreen(this.lastScreen instanceof PauseScreen ? null : this.lastScreen); } + + private void applyPacks(PackRepository p_275714_) { diff --git a/patches/net/minecraft/client/gui/screens/PauseScreen.java.patch b/patches/net/minecraft/client/gui/screens/PauseScreen.java.patch index bbab6f045c0..e95ad0d6f28 100644 --- a/patches/net/minecraft/client/gui/screens/PauseScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/PauseScreen.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/gui/screens/PauseScreen.java +++ b/net/minecraft/client/gui/screens/PauseScreen.java -@@ -87,6 +_,7 @@ +@@ -89,6 +_,7 @@ } else { - gridlayout$rowhelper.addChild(this.openScreenButton(PLAYER_REPORTING, SocialInteractionsScreen::new)); + gridlayout$rowhelper.addChild(this.openScreenButton(PLAYER_REPORTING, () -> new SocialInteractionsScreen(this))); } + gridlayout$rowhelper.addChild(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.setScreen(new net.neoforged.neoforge.client.gui.ModListScreen(this))).width(BUTTON_WIDTH_FULL).build(), 2); diff --git a/patches/net/minecraft/client/gui/screens/Screen.java.patch b/patches/net/minecraft/client/gui/screens/Screen.java.patch index 63f69e0d52c..9209c777843 100644 --- a/patches/net/minecraft/client/gui/screens/Screen.java.patch +++ b/patches/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 -@@ -110,6 +_,7 @@ +@@ -119,6 +_,7 @@ } } @@ -8,7 +8,7 @@ @Override public void render(GuiGraphics p_281549_, int p_281550_, int p_282878_, float p_282465_) { this.renderBackground(p_281549_, p_281550_, p_282878_, p_282465_); -@@ -185,7 +_,7 @@ +@@ -204,7 +_,7 @@ } public void onClose() { @@ -17,45 +17,39 @@ } protected T addRenderableWidget(T p_169406_) { -@@ -297,7 +_,10 @@ +@@ -320,8 +_,11 @@ this.width = p_96608_; this.height = p_96609_; if (!this.initialized) { + if (!net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.client.event.ScreenEvent.Init.Pre(this, this.children, this::addEventWidget, this::removeWidget)).isCanceled()) { this.init(); + this.setInitialFocus(); + } + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.client.event.ScreenEvent.Init.Post(this, this.children, this::addEventWidget, this::removeWidget)); } else { this.repositionElements(); } -@@ -310,7 +_,10 @@ +@@ -334,8 +_,11 @@ protected void rebuildWidgets() { this.clearWidgets(); this.clearFocus(); + if (!net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.client.event.ScreenEvent.Init.Pre(this, this.children, this::addEventWidget, this::removeWidget)).isCanceled()) { this.init(); + this.setInitialFocus(); + } + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.client.event.ScreenEvent.Init.Post(this, this.children, this::addEventWidget, this::removeWidget)); } @Override -@@ -333,6 +_,7 @@ - public void renderBackground(GuiGraphics p_283688_, int p_296369_, int p_296477_, float p_294317_) { - if (this.minecraft.level != null) { - this.renderTransparentBackground(p_283688_); -+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.client.event.ScreenEvent.BackgroundRendered(this, p_283688_)); - } else { - this.renderDirtBackground(p_283688_); - } -@@ -347,6 +_,7 @@ - int i = 32; - p_282281_.blit(BACKGROUND_LOCATION, 0, 0, 0, 0.0F, 0.0F, this.width, this.height, 32, 32); - p_282281_.setColor(1.0F, 1.0F, 1.0F, 1.0F); -+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.client.event.ScreenEvent.BackgroundRendered(this, p_282281_)); +@@ -362,6 +_,7 @@ + + this.renderBlurredBackground(p_294317_); + this.renderMenuBackground(p_283688_); ++ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.client.event.ScreenEvent.BackgroundRendered(this, p_283688_)); } - public boolean isPauseScreen() { -@@ -443,6 +_,10 @@ + protected void renderBlurredBackground(float p_330683_) { +@@ -496,6 +_,10 @@ public void onFilesDrop(List p_96591_) { } @@ -66,7 +60,7 @@ private void scheduleNarration(long p_169381_, boolean p_169382_) { this.nextNarrationTime = Util.getMillis() + p_169381_; if (p_169382_) { -@@ -612,5 +_,13 @@ +@@ -666,5 +_,13 @@ this.index = p_169425_; this.priority = p_169426_; } diff --git a/patches/net/minecraft/client/gui/screens/TitleScreen.java.patch b/patches/net/minecraft/client/gui/screens/TitleScreen.java.patch index 208213373d0..dc7090d094a 100644 --- a/patches/net/minecraft/client/gui/screens/TitleScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/TitleScreen.java.patch @@ -1,14 +1,6 @@ --- a/net/minecraft/client/gui/screens/TitleScreen.java +++ b/net/minecraft/client/gui/screens/TitleScreen.java -@@ -63,6 +_,7 @@ - @Nullable - private TitleScreen.WarningLabel warningLabel; - private final LogoRenderer logoRenderer; -+ private net.neoforged.neoforge.client.gui.TitleScreenModUpdateIndicator modUpdateNotification; - - public TitleScreen() { - this(false); -@@ -120,11 +_,15 @@ +@@ -116,10 +_,13 @@ int j = this.width - i - 2; int k = 24; int l = this.height / 4 + 48; @@ -17,23 +9,21 @@ this.createDemoMenuOptions(l, 24); } else { this.createNormalMenuOptions(l, 24); -+ modButton = this.addRenderableWidget(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.setScreen(new net.neoforged.neoforge.client.gui.ModListScreen(this))) -+ .pos(this.width / 2 - 100, l + 24 * 2).size(98, 20).build()); ++ modButton = this.addRenderableWidget(new net.neoforged.neoforge.client.gui.widget.ModsButton(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.setScreen(new net.neoforged.neoforge.client.gui.ModListScreen(this))) ++ .pos(this.width / 2 - 100, l + 24 * 2).size(98, 20))); } -+ modUpdateNotification = net.neoforged.neoforge.client.gui.TitleScreenModUpdateIndicator.init(this, modButton); SpriteIconButton spriteiconbutton = this.addRenderableWidget( - CommonButtons.language( -@@ -179,7 +_,7 @@ +@@ -169,7 +_,7 @@ }).bounds(this.width / 2 - 100, p_96764_ + p_96765_ * 1, 200, 20).tooltip(tooltip).build()).active = flag; this.addRenderableWidget( - Button.builder(Component.translatable("menu.online"), p_210872_ -> this.realmsButtonClicked()) + Button.builder(Component.translatable("menu.online"), p_315821_ -> this.minecraft.setScreen(new RealmsMainScreen(this))) - .bounds(this.width / 2 - 100, p_96764_ + p_96765_ * 2, 200, 20) + .bounds(this.width / 2 + 2, p_96764_ + p_96765_ * 2, 98, 20) .tooltip(tooltip) .build() ) -@@ -294,6 +_,7 @@ +@@ -290,6 +_,7 @@ this.warningLabel.render(p_282860_, i); } @@ -41,27 +31,18 @@ if (this.splash != null && !this.minecraft.options.hideSplashTexts().get()) { this.splash.render(p_282860_, this.width, this.font, i); } -@@ -309,7 +_,13 @@ +@@ -305,7 +_,13 @@ s = s + I18n.get("menu.modded"); } - p_282860_.drawString(this.font, s, 2, this.height - 10, 16777215 | i); + net.neoforged.neoforge.internal.BrandingControl.forEachLine(true, true, (brdline, brd) -> -+ p_282860_.drawString(this.font, brd, 2, this.height - ( 10 + brdline * (this.font.lineHeight + 1)), 16777215 | i) ++ p_282860_.drawString(this.font, brd, 2, this.height - (10 + brdline * (this.font.lineHeight + 1)), 16777215 | i) + ); + + net.neoforged.neoforge.internal.BrandingControl.forEachAboveCopyrightLine((brdline, brd) -> -+ p_282860_.drawString(this.font, brd, this.width - font.width(brd), this.height - (10 + (brdline + 1) * ( this.font.lineHeight + 1)), 16777215 | i) ++ p_282860_.drawString(this.font, brd, this.width - font.width(brd), this.height - (10 + (brdline + 1) * (this.font.lineHeight + 1)), 16777215 | i) + ); - - for(GuiEventListener guieventlistener : this.children()) { - if (guieventlistener instanceof AbstractWidget) { -@@ -322,6 +_,8 @@ + if (this.realmsNotificationsEnabled() && f >= 1.0F) { RenderSystem.enableDepthTest(); this.realmsNotificationsScreen.render(p_282860_, p_281753_, p_283539_, p_282628_); - } -+ if (f1 >= 1.0f) modUpdateNotification.render(p_282860_, p_281753_, p_283539_, p_282628_); -+ - } - } - diff --git a/patches/net/minecraft/client/gui/screens/advancements/AdvancementTab.java.patch b/patches/net/minecraft/client/gui/screens/advancements/AdvancementTab.java.patch index 3574087cf38..01da559bba8 100644 --- a/patches/net/minecraft/client/gui/screens/advancements/AdvancementTab.java.patch +++ b/patches/net/minecraft/client/gui/screens/advancements/AdvancementTab.java.patch @@ -27,7 +27,7 @@ @@ -146,8 +_,8 @@ return null; } else { - for(AdvancementTabType advancementtabtype : AdvancementTabType.values()) { + for (AdvancementTabType advancementtabtype : AdvancementTabType.values()) { - if (p_97173_ < advancementtabtype.getMax()) { - return new AdvancementTab(p_97171_, p_97172_, advancementtabtype, p_97173_, p_301072_, optional.get()); + if ((p_97173_ % AdvancementTabType.MAX_TABS) < advancementtabtype.getMax()) { diff --git a/patches/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch b/patches/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch index 7c74f0d03dd..3e9f5ae7949 100644 --- a/patches/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch @@ -1,46 +1,43 @@ --- a/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java +++ b/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java -@@ -42,6 +_,7 @@ +@@ -49,6 +_,7 @@ @Nullable private AdvancementTab selectedTab; private boolean isScrolling; + private static int tabPage, maxPages; public AdvancementsScreen(ClientAdvancements p_97340_) { - super(GameNarrator.NO_TITLE); -@@ -59,6 +_,15 @@ - } else { + this(p_97340_, null); +@@ -73,6 +_,16 @@ this.advancements.setSelectedTab(this.selectedTab == null ? null : this.selectedTab.getRootNode().holder(), true); } -+ if (this.tabs.size() > AdvancementTabType.MAX_TABS) { -+ int guiLeft = (this.width - 252) / 2; -+ int guiTop = (this.height - 140) / 2; -+ addRenderableWidget(net.minecraft.client.gui.components.Button.builder(Component.literal("<"), b -> tabPage = Math.max(tabPage - 1, 0 )) -+ .pos(guiLeft, guiTop - 50).size(20, 20).build()); -+ addRenderableWidget(net.minecraft.client.gui.components.Button.builder(Component.literal(">"), b -> tabPage = Math.min(tabPage + 1, maxPages)) -+ .pos(guiLeft + WINDOW_WIDTH - 20, guiTop - 50).size(20, 20).build()); -+ maxPages = this.tabs.size() / AdvancementTabType.MAX_TABS; -+ } - } - @Override -@@ -77,7 +_,7 @@ ++ if (this.tabs.size() > AdvancementTabType.MAX_TABS) { ++ int guiLeft = (this.width - 252) / 2; ++ int guiTop = (this.height - 140) / 2; ++ addRenderableWidget(net.minecraft.client.gui.components.Button.builder(Component.literal("<"), b -> tabPage = Math.max(tabPage - 1, 0 )) ++ .pos(guiLeft, guiTop - 50).size(20, 20).build()); ++ addRenderableWidget(net.minecraft.client.gui.components.Button.builder(Component.literal(">"), b -> tabPage = Math.min(tabPage + 1, maxPages)) ++ .pos(guiLeft + WINDOW_WIDTH - 20, guiTop - 50).size(20, 20).build()); ++ maxPages = this.tabs.size() / AdvancementTabType.MAX_TABS; ++ } ++ + this.layout.addToFooter(Button.builder(CommonComponents.GUI_DONE, p_331557_ -> this.onClose()).width(200).build()); + this.layout.visitWidgets(p_332019_ -> { + AbstractWidget abstractwidget = this.addRenderableWidget(p_332019_); +@@ -106,7 +_,7 @@ int j = (this.height - 140) / 2; - for(AdvancementTab advancementtab : this.tabs.values()) { + for (AdvancementTab advancementtab : this.tabs.values()) { - if (advancementtab.isMouseOver(i, j, p_97343_, p_97344_)) { + if (advancementtab.getPage() == tabPage && advancementtab.isMouseOver(i, j, p_97343_, p_97344_)) { this.advancements.setSelectedTab(advancementtab.getRootNode().holder(), true); break; } -@@ -100,9 +_,14 @@ - - @Override - public void render(GuiGraphics p_282589_, int p_282255_, int p_283354_, float p_283123_) { -+ super.render(p_282589_, p_282255_, p_283354_, p_283123_); +@@ -132,6 +_,11 @@ + super.render(p_282589_, p_282255_, p_283354_, p_283123_); int i = (this.width - 252) / 2; int j = (this.height - 140) / 2; -- this.renderBackground(p_282589_, p_282255_, p_283354_, p_283123_); + if (maxPages != 0) { + net.minecraft.network.chat.Component page = Component.literal(String.format("%d / %d", tabPage + 1, maxPages + 1)); + int width = this.font.width(page); @@ -49,23 +46,23 @@ this.renderInside(p_282589_, p_282255_, p_283354_, i, j); this.renderWindow(p_282589_, i, j); this.renderTooltips(p_282589_, p_282255_, p_283354_, i, j); -@@ -151,10 +_,12 @@ +@@ -180,10 +_,12 @@ p_283395_.blit(WINDOW_LOCATION, p_281890_, p_282532_, 0, 0, 252, 140); if (this.tabs.size() > 1) { - for(AdvancementTab advancementtab : this.tabs.values()) { + for (AdvancementTab advancementtab : this.tabs.values()) { + if (advancementtab.getPage() == tabPage) advancementtab.drawTab(p_283395_, p_281890_, p_282532_, advancementtab == this.selectedTab); } - for(AdvancementTab advancementtab1 : this.tabs.values()) { + for (AdvancementTab advancementtab1 : this.tabs.values()) { + if (advancementtab1.getPage() == tabPage) advancementtab1.drawIcon(p_283395_, p_281890_, p_282532_); } } -@@ -174,7 +_,7 @@ +@@ -203,7 +_,7 @@ if (this.tabs.size() > 1) { - for(AdvancementTab advancementtab : this.tabs.values()) { + for (AdvancementTab advancementtab : this.tabs.values()) { - if (advancementtab.isMouseOver(p_281519_, p_283371_, (double)p_283556_, (double)p_282458_)) { + if (advancementtab.getPage() == tabPage && advancementtab.isMouseOver(p_281519_, p_283371_, (double)p_283556_, (double)p_282458_)) { p_282784_.renderTooltip(this.font, advancementtab.getTitle(), p_283556_, p_282458_); diff --git a/patches/net/minecraft/client/gui/screens/controls/KeyBindsList.java.patch b/patches/net/minecraft/client/gui/screens/controls/KeyBindsList.java.patch index c532d3adfd9..b09f7225b79 100644 --- a/patches/net/minecraft/client/gui/screens/controls/KeyBindsList.java.patch +++ b/patches/net/minecraft/client/gui/screens/controls/KeyBindsList.java.patch @@ -1,29 +1,26 @@ --- a/net/minecraft/client/gui/screens/controls/KeyBindsList.java +++ b/net/minecraft/client/gui/screens/controls/KeyBindsList.java -@@ -165,6 +_,7 @@ +@@ -158,6 +_,7 @@ ) .build(); - this.resetButton = Button.builder(Component.translatable("controls.reset"), p_269616_ -> { + this.resetButton = Button.builder(RESET_BUTTON_TITLE, p_329729_ -> { + this.key.setToDefault(); KeyBindsList.this.minecraft.options.setKey(p_193916_, p_193916_.getDefaultKey()); KeyBindsList.this.resetMappingAndUpdateButtons(); }).bounds(0, 0, 50, 20).createNarration(p_253313_ -> Component.translatable("narrator.controls.reset", p_193917_)).build(); -@@ -184,8 +_,9 @@ - boolean p_282605_, - float p_281432_ - ) { -- int k = p_281373_ + 90 - KeyBindsList.this.maxNameWidth; -- p_281805_.drawString(KeyBindsList.this.minecraft.font, this.name, k, p_282357_ + p_281932_ / 2 - 9 / 2, 16777215, false); -+ int textMaxWidth = p_281805_.guiWidth() / 2; -+ int k = p_281373_ + 90 - Math.min(KeyBindsList.this.maxNameWidth, textMaxWidth - 40); -+ net.minecraft.client.gui.components.AbstractWidget.renderScrollingString(p_281805_, KeyBindsList.this.minecraft.font, this.name, k, k, p_282357_ + p_281932_ / 2 - 9 / 2, textMaxWidth, p_282357_ + p_281932_ / 2 - 9 / 2 + 16, 16777215); // Neo: Makes descriptions start scrolling if too long - this.resetButton.setX(p_281373_ + 190); - this.resetButton.setY(p_282357_); - this.resetButton.render(p_281805_, p_282224_, p_282053_, p_281432_); -@@ -218,7 +_,7 @@ +@@ -184,7 +_,7 @@ + int k = i - 5 - this.changeButton.getWidth(); + this.changeButton.setPosition(k, j); + this.changeButton.render(p_281805_, p_282224_, p_282053_, p_281432_); +- p_281805_.drawString(KeyBindsList.this.minecraft.font, this.name, p_281373_, p_282357_ + p_281932_ / 2 - 9 / 2, -1); ++ p_281805_.drawScrollingString(KeyBindsList.this.minecraft.font, this.name, p_281373_, k - 9, p_282357_ + p_281932_ / 2 - 9 / 2, -1); // Neo: Makes descriptions start scrolling if too long + if (this.hasCollision) { + int l = 3; + int i1 = this.changeButton.getX() - 6; +@@ -210,7 +_,7 @@ MutableComponent mutablecomponent = Component.empty(); if (!this.key.isUnbound()) { - for(KeyMapping keymapping : KeyBindsList.this.minecraft.options.keyMappings) { + for (KeyMapping keymapping : KeyBindsList.this.minecraft.options.keyMappings) { - if (keymapping != this.key && this.key.same(keymapping)) { + if ((keymapping != this.key && this.key.same(keymapping)) || keymapping.hasKeyModifierConflict(this.key)) { // Neo: gracefully handle conflicts like SHIFT vs SHIFT+G if (this.hasCollision) { diff --git a/patches/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java.patch b/patches/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java.patch index d0c438d6f08..a3fc5368fae 100644 --- a/patches/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java +++ b/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java -@@ -31,7 +_,7 @@ +@@ -33,7 +_,7 @@ this.keyBindsList = this.addRenderableWidget(new KeyBindsList(this, this.minecraft)); - this.resetButton = this.addRenderableWidget(Button.builder(Component.translatable("controls.resetAll"), p_269619_ -> { - for(KeyMapping keymapping : this.options.keyMappings) { + this.resetButton = Button.builder(Component.translatable("controls.resetAll"), p_269619_ -> { + for (KeyMapping keymapping : this.options.keyMappings) { - keymapping.setKey(keymapping.getDefaultKey()); + keymapping.setToDefault(); } this.keyBindsList.resetMappingAndUpdateButtons(); -@@ -59,11 +_,14 @@ +@@ -70,11 +_,14 @@ public boolean keyPressed(int p_193987_, int p_193988_, int p_193989_) { if (this.selectedKey != null) { if (p_193987_ == 256) { diff --git a/patches/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch b/patches/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch index 42d1f18d9c7..d00c918adba 100644 --- a/patches/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch @@ -14,13 +14,16 @@ RenderSystem.disableDepthTest(); p_283479_.pose().pushPose(); p_283479_.pose().translate((float)i, (float)j, 0.0F); -@@ -108,12 +_,13 @@ - int l = slot.x; - int i1 = slot.y; - if (this.hoveredSlot.isHighlightable()) { +@@ -105,15 +_,12 @@ + + if (this.isHovering(slot, (double)p_283661_, (double)p_281248_) && slot.isActive()) { + this.hoveredSlot = slot; +- int l = slot.x; +- int i1 = slot.y; +- if (this.hoveredSlot.isHighlightable()) { - renderSlotHighlight(p_283479_, l, i1, 0); -+ renderSlotHighlight(p_283479_, l, i1, 0, getSlotColor(k)); - } +- } ++ this.renderSlotHighlight(p_283479_, slot, p_283661_, p_281248_, p_281886_); } } @@ -29,7 +32,7 @@ ItemStack itemstack = this.draggingItem.isEmpty() ? this.menu.getCarried() : this.draggingItem; if (!itemstack.isEmpty()) { int l1 = 8; -@@ -156,13 +_,16 @@ +@@ -156,13 +_,25 @@ } public static void renderSlotHighlight(GuiGraphics p_283692_, int p_281453_, int p_281915_, int p_283504_) { @@ -38,6 +41,15 @@ + } + public static void renderSlotHighlight(GuiGraphics p_283692_, int p_281453_, int p_281915_, int p_283504_, int color) { + p_283692_.fillGradient(RenderType.guiOverlay(), p_281453_, p_281915_, p_281453_ + 16, p_281915_ + 16, color, color, p_283504_); ++ } ++ ++ /** ++ * Renders a highlight for the given slot to indicate the mouse is currently hovering over it. ++ */ ++ protected void renderSlotHighlight(GuiGraphics guiGraphics, Slot slot, int mouseX, int mouseY, float partialTick) { ++ if (slot.isHighlightable()) { ++ renderSlotHighlight(guiGraphics, slot.x, slot.y, 0, getSlotColor(slot.index)); ++ } } protected void renderTooltip(GuiGraphics p_283594_, int p_282171_, int p_281909_) { @@ -62,14 +74,14 @@ p_281607_.fill(i, j, i + 16, j + 16, -2130706433); } -+ renderSlotContents(p_281607_, itemstack, p_282613_, i, j, s); ++ renderSlotContents(p_281607_, itemstack, p_282613_, s); + } + + p_281607_.pose().popPose(); + } + -+ protected void renderSlotContents(GuiGraphics guiGraphics, ItemStack itemstack, Slot slot, int i, int j, @Nullable String countString) { -+ GuiGraphics p_281607_ = guiGraphics; Slot p_282613_ = slot; String s = countString; ++ protected void renderSlotContents(GuiGraphics guiGraphics, ItemStack itemstack, Slot slot, @Nullable String countString) { ++ GuiGraphics p_281607_ = guiGraphics; Slot p_282613_ = slot; String s = countString; int i = slot.x; int j = slot.y; int j1 = p_282613_.x + p_282613_.y * this.imageWidth; if (p_282613_.isFake()) { p_281607_.renderFakeItem(itemstack, i, j, j1); @@ -192,7 +204,7 @@ return true; } - for(int i = 0; i < 9; ++i) { + for (int i = 0; i < 9; i++) { - if (this.minecraft.options.keyHotbarSlots[i].matches(p_97806_, p_97807_)) { + if (this.minecraft.options.keyHotbarSlots[i].isActiveAndMatches(InputConstants.getKey(p_97806_, p_97807_))) { this.slotClicked(this.hoveredSlot, this.hoveredSlot.index, i, ClickType.SWAP); diff --git a/patches/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch b/patches/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch index 5acc5342286..f5b9b063350 100644 --- a/patches/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java +++ b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java -@@ -110,6 +_,8 @@ +@@ -112,6 +_,8 @@ private boolean hasClickedOutside; private final Set> visibleTags = new HashSet<>(); private final boolean displayOperatorCreativeTab; @@ -9,7 +9,7 @@ public CreativeModeInventoryScreen(Player p_259788_, FeatureFlagSet p_260074_, boolean p_259569_) { super(new CreativeModeInventoryScreen.ItemPickerMenu(p_259788_), p_259788_.getInventory(), CommonComponents.EMPTY); -@@ -142,7 +_,7 @@ +@@ -144,7 +_,7 @@ private void refreshCurrentTabContents(Collection p_261591_) { int i = this.menu.getRowIndexForScroll(this.scrollOffs); this.menu.items.clear(); @@ -18,7 +18,7 @@ this.refreshSearchResults(); } else { this.menu.items.addAll(p_261591_); -@@ -309,6 +_,34 @@ +@@ -311,6 +_,34 @@ protected void init() { if (this.minecraft.gameMode.hasInfiniteItems()) { super.init(); @@ -53,7 +53,7 @@ this.searchBox = new EditBox(this.font, this.leftPos + 82, this.topPos + 6, 80, 9, Component.translatable("itemGroup.search")); this.searchBox.setMaxLength(50); this.searchBox.setBordered(false); -@@ -355,7 +_,7 @@ +@@ -357,7 +_,7 @@ public boolean charTyped(char p_98521_, int p_98522_) { if (this.ignoreTextInput) { return false; @@ -62,7 +62,7 @@ return false; } else { String s = this.searchBox.getValue(); -@@ -374,7 +_,7 @@ +@@ -376,7 +_,7 @@ @Override public boolean keyPressed(int p_98547_, int p_98548_, int p_98549_) { this.ignoreTextInput = false; @@ -71,7 +71,7 @@ if (this.minecraft.options.keyChat.matches(p_98547_, p_98548_)) { this.ignoreTextInput = true; this.selectTab(CreativeModeTabs.searchTab()); -@@ -410,6 +_,7 @@ +@@ -412,6 +_,7 @@ } private void refreshSearchResults() { @@ -79,7 +79,7 @@ this.menu.items.clear(); this.visibleTags.clear(); String s = this.searchBox.getValue(); -@@ -419,10 +_,10 @@ +@@ -421,10 +_,10 @@ SearchTree searchtree; if (s.startsWith("#")) { s = s.substring(1); @@ -92,7 +92,7 @@ } this.menu.items.addAll(searchtree.search(s.toLowerCase(Locale.ROOT))); -@@ -449,7 +_,8 @@ +@@ -451,7 +_,8 @@ @Override protected void renderLabels(GuiGraphics p_283168_, int p_281774_, int p_281466_) { if (selectedTab.showTitle()) { @@ -102,25 +102,25 @@ } } -@@ -459,7 +_,7 @@ +@@ -461,7 +_,7 @@ double d0 = p_98531_ - (double)this.leftPos; double d1 = p_98532_ - (double)this.topPos; -- for(CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { +- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { + for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) { if (this.checkTabClicked(creativemodetab, d0, d1)) { return true; } -@@ -481,7 +_,7 @@ +@@ -483,7 +_,7 @@ double d1 = p_98623_ - (double)this.topPos; this.scrolling = false; -- for(CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { +- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { + for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) { if (this.checkTabClicked(creativemodetab, d0, d1)) { this.selectTab(creativemodetab); return true; -@@ -499,6 +_,7 @@ +@@ -501,6 +_,7 @@ private void selectTab(CreativeModeTab p_98561_) { CreativeModeTab creativemodetab = selectedTab; selectedTab = p_98561_; @@ -128,7 +128,7 @@ this.quickCraftSlots.clear(); this.menu.items.clear(); this.clearDraggingState(); -@@ -575,13 +_,15 @@ +@@ -577,13 +_,15 @@ this.originalSlots = null; } @@ -145,16 +145,16 @@ this.refreshSearchResults(); } else { -@@ -644,7 +_,7 @@ +@@ -646,7 +_,7 @@ public void render(GuiGraphics p_283000_, int p_281317_, int p_282770_, float p_281295_) { super.render(p_283000_, p_281317_, p_282770_, p_281295_); -- for(CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { +- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { + for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) { if (this.checkTabHovering(p_283000_, creativemodetab, p_281317_, p_282770_)) { break; } -@@ -656,6 +_,15 @@ +@@ -658,6 +_,15 @@ p_283000_.renderTooltip(this.font, TRASH_SLOT_TOOLTIP, p_281317_, p_282770_); } @@ -170,7 +170,7 @@ this.renderTooltip(p_283000_, p_281317_, p_282770_); } -@@ -663,7 +_,7 @@ +@@ -665,7 +_,7 @@ public List getTooltipFromContainerItem(ItemStack p_281769_) { boolean flag = this.hoveredSlot != null && this.hoveredSlot instanceof CreativeModeInventoryScreen.CustomCreativeSlot; boolean flag1 = selectedTab.getType() == CreativeModeTab.Type.CATEGORY; @@ -178,21 +178,21 @@ + boolean flag2 = selectedTab.hasSearchBar(); TooltipFlag.Default tooltipflag$default = this.minecraft.options.advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL; TooltipFlag tooltipflag = flag ? tooltipflag$default.asCreative() : tooltipflag$default; - List list = p_281769_.getTooltipLines(this.minecraft.player, tooltipflag); -@@ -682,7 +_,7 @@ + List list = p_281769_.getTooltipLines(Item.TooltipContext.of(this.minecraft.level), this.minecraft.player, tooltipflag); +@@ -684,7 +_,7 @@ int i = 1; - for(CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { + for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { - if (creativemodetab.getType() != CreativeModeTab.Type.SEARCH && creativemodetab.contains(p_281769_)) { + if (!creativemodetab.hasSearchBar() && creativemodetab.contains(p_281769_)) { list1.add(i++, creativemodetab.getDisplayName().copy().withStyle(ChatFormatting.BLUE)); } } -@@ -693,14 +_,14 @@ +@@ -695,14 +_,14 @@ @Override protected void renderBg(GuiGraphics p_282663_, float p_282504_, int p_282089_, int p_282249_) { -- for(CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { +- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) { + for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) { if (creativemodetab != selectedTab) { this.renderTabButton(p_282663_, creativemodetab); @@ -205,7 +205,7 @@ this.leftPos, this.topPos, 0, -@@ -713,10 +_,11 @@ +@@ -715,10 +_,11 @@ int k = this.topPos + 18; int i = k + 112; if (selectedTab.canScroll()) { @@ -218,7 +218,7 @@ this.renderTabButton(p_282663_, selectedTab); if (selectedTab.getType() == CreativeModeTab.Type.INVENTORY) { InventoryScreen.renderEntityInInventoryFollowsMouse( -@@ -735,7 +_,7 @@ +@@ -737,7 +_,7 @@ } private int getTabX(CreativeModeTab p_260136_) { @@ -227,7 +227,7 @@ int j = 27; int k = 27 * i; if (p_260136_.isAlignedRight()) { -@@ -747,7 +_,7 @@ +@@ -749,7 +_,7 @@ private int getTabY(CreativeModeTab p_260181_) { int i = 0; @@ -236,7 +236,7 @@ i -= 32; } else { i += this.imageHeight; -@@ -775,8 +_,8 @@ +@@ -777,8 +_,8 @@ protected void renderTabButton(GuiGraphics p_283590_, CreativeModeTab p_283489_) { boolean flag = p_283489_ == selectedTab; @@ -247,7 +247,7 @@ int j = this.leftPos + this.getTabX(p_283489_); int k = this.topPos - (flag1 ? 28 : -(this.imageHeight - 4)); ResourceLocation[] aresourcelocation; -@@ -786,6 +_,7 @@ +@@ -788,6 +_,7 @@ aresourcelocation = flag ? SELECTED_BOTTOM_TABS : UNSELECTED_BOTTOM_TABS; } @@ -255,7 +255,7 @@ p_283590_.blitSprite(aresourcelocation[Mth.clamp(i, 0, aresourcelocation.length)], j, k, 26, 32); p_283590_.pose().pushPose(); p_283590_.pose().translate(0.0F, 0.0F, 100.0F); -@@ -828,6 +_,14 @@ +@@ -829,6 +_,14 @@ } } @@ -270,7 +270,7 @@ @OnlyIn(Dist.CLIENT) static class CustomCreativeSlot extends Slot { public CustomCreativeSlot(Container p_98633_, int p_98634_, int p_98635_, int p_98636_) { -@@ -1014,6 +_,22 @@ +@@ -1013,6 +_,22 @@ @Override public boolean mayPickup(Player p_98665_) { return this.target.mayPickup(p_98665_); diff --git a/patches/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java.patch b/patches/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java.patch index 4ec18822d97..1a68a571779 100644 --- a/patches/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java +++ b/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java -@@ -46,12 +_,17 @@ +@@ -47,12 +_,17 @@ Collection collection = this.minecraft.player.getActiveEffects(); if (!collection.isEmpty() && j >= 32) { boolean flag = j >= 120; @@ -19,22 +19,22 @@ this.renderBackgrounds(p_281945_, i, k, iterable, flag); this.renderIcons(p_281945_, i, k, iterable, flag); if (flag) { -@@ -98,6 +_,11 @@ +@@ -99,6 +_,11 @@ int i = this.topPos; - for(MobEffectInstance mobeffectinstance : p_282642_) { + for (MobEffectInstance mobeffectinstance : p_282642_) { + var renderer = net.neoforged.neoforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance); + if (renderer.renderInventoryIcon(mobeffectinstance, this, p_282745_, p_282521_ + (p_281536_ ? 6 : 7), i, 0)) { + i += p_282291_; + continue; + } - MobEffect mobeffect = mobeffectinstance.getEffect(); - TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(mobeffect); + Holder holder = mobeffectinstance.getEffect(); + TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(holder); p_282745_.blit(p_282521_ + (p_281536_ ? 6 : 7), i + 7, 0, 18, 18, textureatlassprite); -@@ -109,6 +_,11 @@ +@@ -110,6 +_,11 @@ int i = this.topPos; - for(MobEffectInstance mobeffectinstance : p_281986_) { + for (MobEffectInstance mobeffectinstance : p_281986_) { + var renderer = net.neoforged.neoforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance); + if (renderer.renderInventoryText(mobeffectinstance, this, p_281462_, p_283484_, i, 0)) { + i += p_282057_; diff --git a/patches/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java.patch b/patches/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java.patch index e774497c6d4..3053f57dfd1 100644 --- a/patches/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java +++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java -@@ -105,7 +_,7 @@ +@@ -108,7 +_,7 @@ int l1 = 86 - this.font.width(s); FormattedText formattedtext = EnchantmentNames.getInstance().getRandomName(this.font, l1); int i2 = 6839882; - if ((k < l + 1 || this.minecraft.player.experienceLevel < k1) && !this.minecraft.player.getAbilities().instabuild) { + if (((k < l + 1 || this.minecraft.player.experienceLevel < k1) && !this.minecraft.player.getAbilities().instabuild) || this.menu.enchantClue[l] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels + RenderSystem.enableBlend(); p_282430_.blitSprite(ENCHANTMENT_SLOT_DISABLED_SPRITE, i1, j + 14 + 19 * l, 108, 19); p_282430_.blitSprite(DISABLED_LEVEL_SPRITES[l], i1 + 1, j + 15 + 19 * l, 16, 16); - p_282430_.drawWordWrap(this.font, formattedtext, j1, j + 16 + 19 * l, l1, (i2 & 16711422) >> 1); -@@ -166,10 +_,13 @@ +@@ -173,10 +_,13 @@ Enchantment enchantment = Enchantment.byId(this.menu.enchantClue[j]); int l = this.menu.levelClue[j]; int i1 = j + 1; diff --git a/patches/net/minecraft/client/gui/screens/inventory/InventoryScreen.java.patch b/patches/net/minecraft/client/gui/screens/inventory/InventoryScreen.java.patch index aba01cbabc4..f6a01bfedae 100644 --- a/patches/net/minecraft/client/gui/screens/inventory/InventoryScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/inventory/InventoryScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/inventory/InventoryScreen.java +++ b/net/minecraft/client/gui/screens/inventory/InventoryScreen.java -@@ -120,9 +_,29 @@ +@@ -118,9 +_,29 @@ ) { float f = (float)(p_275688_ + p_275535_) / 2.0F; float f1 = (float)(p_275245_ + p_294406_) / 2.0F; diff --git a/patches/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java.patch b/patches/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java.patch index 46ee5f420d8..dadea02e457 100644 --- a/patches/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java.patch +++ b/patches/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java +++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java @@ -20,6 +_,8 @@ - if (p_169951_ instanceof BundleTooltip) { - return new ClientBundleTooltip((BundleTooltip)p_169951_); + if (p_169951_ instanceof BundleTooltip bundletooltip) { + return new ClientBundleTooltip(bundletooltip.contents()); } else { + ClientTooltipComponent result = net.neoforged.neoforge.client.gui.ClientTooltipComponentManager.createClientTooltipComponent(p_169951_); + if (result != null) return result; diff --git a/patches/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java.patch b/patches/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java.patch deleted file mode 100644 index c469fb8c94a..00000000000 --- a/patches/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java -+++ b/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java -@@ -280,6 +_,11 @@ - } - } - -+ @Override -+ public void onClose() { -+ this.minecraft.setScreen(this.lastScreen); -+ } -+ - public ServerStatusPinger getPinger() { - return this.pinger; - } diff --git a/patches/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java.patch b/patches/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java.patch index befbcccd3aa..5cf9b50a9d5 100644 --- a/patches/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java.patch +++ b/patches/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java.patch @@ -4,7 +4,7 @@ this.initFilterButtonTextures(); this.tabButtons.clear(); -- for(RecipeBookCategories recipebookcategories : RecipeBookCategories.getCategories(this.menu.getRecipeBookType())) { +- for (RecipeBookCategories recipebookcategories : RecipeBookCategories.getCategories(this.menu.getRecipeBookType())) { + for(RecipeBookCategories recipebookcategories : this.menu.getRecipeBookCategories()) { this.tabButtons.add(new RecipeBookTabButton(recipebookcategories)); } diff --git a/patches/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch b/patches/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch index 657f3b25905..4a83630a834 100644 --- a/patches/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch +++ b/patches/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java +++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java -@@ -122,6 +_,7 @@ +@@ -119,6 +_,7 @@ public static void openFresh(Minecraft p_232897_, @Nullable Screen p_232898_) { queueLoadScreen(p_232897_, PREPARING_WORLD_DATA); PackRepository packrepository = new PackRepository(new ServerPacksSource(p_232897_.directoryValidator())); @@ -8,7 +8,7 @@ WorldLoader.InitConfig worldloader$initconfig = createDefaultLoadConfig(packrepository, WorldDataConfiguration.DEFAULT); CompletableFuture completablefuture = WorldLoader.load( worldloader$initconfig, -@@ -248,6 +_,10 @@ +@@ -244,6 +_,10 @@ WorldCreationContext worldcreationcontext = this.uiState.getSettings(); LevelSettings levelsettings = this.createLevelSettings(flag); WorldData worlddata = new PrimaryLevelData(levelsettings, worldcreationcontext.options(), p_250577_, p_249994_); @@ -19,7 +19,7 @@ this.minecraft .createWorldOpenFlows() .createLevelFromExistingSettings(optional.get(), worldcreationcontext.dataPackResources(), p_249152_, worlddata); -@@ -427,7 +_,7 @@ +@@ -432,7 +_,7 @@ if (p_269627_) { p_270552_.accept(this.uiState.getSettings().dataConfiguration()); } else { @@ -28,7 +28,7 @@ } }, Component.translatable("dataPack.validation.failed"), -@@ -545,6 +_,7 @@ +@@ -551,6 +_,7 @@ if (path != null) { if (this.tempDataPackRepository == null) { this.tempDataPackRepository = ServerPacksSource.createPackRepository(path, this.packValidator); diff --git a/patches/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java.patch b/patches/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java.patch index 5e72d6ac601..b1747f20d9a 100644 --- a/patches/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java.patch +++ b/patches/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java -@@ -227,7 +_,7 @@ +@@ -225,7 +_,7 @@ @Nullable public PresetEditor getPresetEditor() { Holder holder = this.getWorldType().preset(); diff --git a/patches/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch b/patches/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch index 41ee20a0ccd..9dc24fd5725 100644 --- a/patches/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch +++ b/patches/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java -@@ -64,7 +_,7 @@ +@@ -65,7 +_,7 @@ import org.slf4j.Logger; @OnlyIn(Dist.CLIENT) @@ -9,48 +9,37 @@ private static final Logger LOGGER = LogUtils.getLogger(); private static final UUID WORLD_PACK_ID = UUID.fromString("640a6a92-b6cb-48a0-b391-831586500359"); private final Minecraft minecraft; -@@ -338,12 +_,21 @@ - } - - private void loadLevel(LevelStorageSource.LevelStorageAccess p_307362_, Dynamic p_307494_, boolean p_307298_, boolean p_307581_, Runnable p_307336_) { -+ // NEOFORGE: Patch in overload to reduce further patching -+ loadLevel(p_307362_, p_307494_, p_307298_, p_307581_, p_307336_, false); -+ } -+ private void loadLevel(LevelStorageSource.LevelStorageAccess p_307362_, Dynamic p_307494_, boolean p_307298_, boolean p_307581_, Runnable p_307336_, boolean confirmExperimentalWarning) { - this.minecraft.forceSetScreen(new GenericDirtMessageScreen(Component.translatable("selectWorld.resource_load"))); - PackRepository packrepository = ServerPacksSource.createPackRepository(p_307362_); +@@ -210,7 +_,10 @@ + component1 = Component.translatable("selectWorld.backupWarning.customized"); + } else { + component = Component.translatable("selectWorld.backupQuestion.experimental"); +- component1 = Component.translatable("selectWorld.backupWarning.experimental"); ++ // Neo: Add a line saying that the message won't show again. ++ component1 = Component.translatable("selectWorld.backupWarning.experimental") ++ .append("\n\n") ++ .append(Component.translatable("neoforge.selectWorld.backupWarning.experimental.additional")); + } - WorldStem worldstem; - try { -+ p_307362_.readAdditionalLevelSaveData(false); // Read extra (e.g. modded) data from the world before creating it - worldstem = this.loadWorldStem(p_307494_, p_307298_, packrepository); -+ // Forge: Skip confirmation if it has been done already for this world -+ if (confirmExperimentalWarning && worldstem.worldData() instanceof PrimaryLevelData pld) { -+ pld.withConfirmedWarning(true); -+ } - } catch (Exception exception) { - LOGGER.warn("Failed to load level data or datapacks, can't proceed with server load", (Throwable)exception); - if (!p_307298_) { -@@ -371,7 +_,8 @@ - WorldData worlddata = worldstem.worldData(); + this.minecraft.setScreen(new BackupConfirmScreen(p_307323_, (p_307085_, p_307086_) -> { +@@ -377,10 +_,19 @@ + WorldData worlddata = p_330774_.worldData(); boolean flag = worlddata.worldGenOptions().isOldCustomizedWorld(); boolean flag1 = worlddata.worldGenSettingsLifecycle() != Lifecycle.stable(); -- if (!p_307581_ || !flag && !flag1) { +- if (!flag && !flag1) { + boolean skipConfirmation = worlddata instanceof PrimaryLevelData pld && pld.hasConfirmedExperimentalWarning(); -+ if (skipConfirmation || !p_307581_ || !flag && !flag1) { - DownloadedPackSource downloadedpacksource = this.minecraft.getDownloadedPackSource(); - this.loadBundledResourcePack(downloadedpacksource, p_307362_).thenApply(p_233177_ -> true).exceptionallyComposeAsync(p_233183_ -> { - LOGGER.warn("Failed to load pack: ", p_233183_); -@@ -390,10 +_,12 @@ - return null; - }); ++ if (skipConfirmation || (!flag && !flag1)) { + this.openWorldLoadBundledResourcePack(p_331469_, p_330774_, p_330989_, p_332128_); } else { -+ if (flag) // Forge: For legacy world options, let vanilla handle it. - this.askForBackup(p_307362_, flag, () -> this.loadLevel(p_307362_, p_307494_, p_307298_, false, p_307336_), () -> { - p_307362_.safeClose(); - p_307336_.run(); - }); -+ else net.neoforged.neoforge.client.ClientHooks.createWorldConfirmationScreen(() -> this.loadLevel(p_307362_, p_307494_, p_307298_, false, p_307336_, true)); - worldstem.close(); - } - } +- this.askForBackup(p_331469_, flag, () -> this.openWorldLoadBundledResourcePack(p_331469_, p_330774_, p_330989_, p_332128_), () -> { ++ this.askForBackup(p_331469_, flag, () -> { ++ if (!flag) { ++ // Neo: Prevent the message from showing again ++ if (p_330774_.worldData() instanceof PrimaryLevelData pld) { ++ pld.withConfirmedWarning(true); ++ } ++ } ++ this.openWorldLoadBundledResourcePack(p_331469_, p_330774_, p_330989_, p_332128_); ++ }, () -> { + p_330774_.close(); + p_331469_.safeClose(); + p_332128_.run(); diff --git a/patches/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch b/patches/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch index 196df42e27f..898923d63f6 100644 --- a/patches/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch +++ b/patches/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java -@@ -76,6 +_,7 @@ +@@ -74,6 +_,7 @@ + static final ResourceLocation WARNING_SPRITE = new ResourceLocation("world_list/warning"); + static final ResourceLocation JOIN_HIGHLIGHTED_SPRITE = new ResourceLocation("world_list/join_highlighted"); static final ResourceLocation JOIN_SPRITE = new ResourceLocation("world_list/join"); - static final Logger LOGGER = LogUtils.getLogger(); - private static final ResourceLocation ICON_MISSING = new ResourceLocation("textures/misc/unknown_server.png"); + private static final ResourceLocation FORGE_EXPERIMENTAL_WARNING_ICON = new ResourceLocation("neoforge","textures/gui/experimental_warning.png"); + static final Logger LOGGER = LogUtils.getLogger(); static final Component FROM_NEWER_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.fromNewerVersion1").withStyle(ChatFormatting.RED); static final Component FROM_NEWER_TOOLTIP_2 = Component.translatable("selectWorld.tooltip.fromNewerVersion2").withStyle(ChatFormatting.RED); - static final Component SNAPSHOT_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.snapshot1").withStyle(ChatFormatting.GOLD); -@@ -411,6 +_,7 @@ +@@ -405,6 +_,7 @@ RenderSystem.enableBlend(); p_281612_.blit(this.icon.textureLocation(), p_282820_, p_283181_, 0.0F, 0.0F, 32, 32, 32, 32); RenderSystem.disableBlend(); @@ -16,17 +16,15 @@ if (this.minecraft.options.touchscreen().get() || p_283396_) { p_281612_.fill(p_282820_, p_283181_, p_282820_ + 32, p_283181_ + 32, -1601138544); int j = p_283204_ - p_282820_; -@@ -516,7 +_,8 @@ - this.minecraft.setScreen(new ProgressScreen(true)); +@@ -511,6 +_,7 @@ this.doDeleteWorld(); } -- -+ + + if (this.minecraft.screen instanceof ProgressScreen || this.minecraft.screen instanceof ConfirmScreen) // Neo - fix MC-251068 this.minecraft.setScreen(this.screen); }, Component.translatable("selectWorld.deleteQuestion"), -@@ -652,6 +_,19 @@ +@@ -646,6 +_,19 @@ public String getLevelName() { return this.summary.getLevelName(); @@ -34,7 +32,7 @@ + + // FORGE: Patch in experimental warning icon for worlds in the world selection screen + private void renderExperimentalWarning(GuiGraphics guiGraphics, int mouseX, int mouseY, int top, int left) { -+ if (this.summary.isLifecycleExperimental()) { ++ if (this.summary.getSettings() != null && this.summary.getSettings().getLifecycle().equals(com.mojang.serialization.Lifecycle.experimental())) { + int leftStart = left + WorldSelectionList.this.getRowWidth(); + guiGraphics.blit(WorldSelectionList.FORGE_EXPERIMENTAL_WARNING_ICON, leftStart - 36, top, 0.0F, 0.0F, 32, 32, 32, 32); + if (WorldSelectionList.this.getEntryAtPosition(mouseX, mouseY) == this && mouseX > leftStart - 36 && mouseX < leftStart) { diff --git a/patches/net/minecraft/client/model/HumanoidModel.java.patch b/patches/net/minecraft/client/model/HumanoidModel.java.patch index de7544cde7e..c83c8fe091a 100644 --- a/patches/net/minecraft/client/model/HumanoidModel.java.patch +++ b/patches/net/minecraft/client/model/HumanoidModel.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/client/model/HumanoidModel.java +++ b/net/minecraft/client/model/HumanoidModel.java @@ -306,6 +_,8 @@ - case TOOT_HORN: - this.rightArm.xRot = Mth.clamp(this.head.xRot, -1.2F, 1.2F) - 1.4835298F; - this.rightArm.yRot = this.head.yRot - (float) (Math.PI / 6); + case BRUSH: + this.rightArm.xRot = this.rightArm.xRot * 0.5F - (float) (Math.PI / 5); + this.rightArm.yRot = 0.0F; + default: + this.rightArmPose.applyTransform(this, p_102876_, net.minecraft.world.entity.HumanoidArm.RIGHT); } } @@ -348,6 +_,8 @@ - case TOOT_HORN: - this.leftArm.xRot = Mth.clamp(this.head.xRot, -1.2F, 1.2F) - 1.4835298F; - this.leftArm.yRot = this.head.yRot + (float) (Math.PI / 6); + case BRUSH: + this.leftArm.xRot = this.leftArm.xRot * 0.5F - (float) (Math.PI / 5); + this.leftArm.yRot = 0.0F; + default: + this.leftArmPose.applyTransform(this, p_102879_, net.minecraft.world.entity.HumanoidArm.LEFT); } diff --git a/patches/net/minecraft/client/model/geom/LayerDefinitions.java.patch b/patches/net/minecraft/client/model/geom/LayerDefinitions.java.patch index 48389ea4231..e83fcc18dfd 100644 --- a/patches/net/minecraft/client/model/geom/LayerDefinitions.java.patch +++ b/patches/net/minecraft/client/model/geom/LayerDefinitions.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/model/geom/LayerDefinitions.java +++ b/net/minecraft/client/model/geom/LayerDefinitions.java -@@ -322,6 +_,7 @@ +@@ -328,6 +_,7 @@ WoodType.values().forEach(p_171114_ -> builder.put(ModelLayers.createSignModelName(p_171114_), layerdefinition23)); LayerDefinition layerdefinition24 = HangingSignRenderer.createHangingSignLayer(); WoodType.values().forEach(p_247864_ -> builder.put(ModelLayers.createHangingSignModelName(p_247864_), layerdefinition24)); diff --git a/patches/net/minecraft/client/model/geom/ModelLayers.java.patch b/patches/net/minecraft/client/model/geom/ModelLayers.java.patch index a8c0c319b11..f1105baa75a 100644 --- a/patches/net/minecraft/client/model/geom/ModelLayers.java.patch +++ b/patches/net/minecraft/client/model/geom/ModelLayers.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/model/geom/ModelLayers.java +++ b/net/minecraft/client/model/geom/ModelLayers.java -@@ -224,11 +_,13 @@ +@@ -228,11 +_,13 @@ } public static ModelLayerLocation createSignModelName(WoodType p_171292_) { diff --git a/patches/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java.patch b/patches/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java.patch index 20783d2c788..a7b061bb954 100644 --- a/patches/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java.patch +++ b/patches/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java +++ b/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java -@@ -80,6 +_,8 @@ +@@ -76,6 +_,8 @@ this.writeProfileKeyPair(profilekeypair); - return Optional.of(profilekeypair); + return Optional.ofNullable(profilekeypair); } catch (CryptException | MinecraftClientException | IOException ioexception) { + // Forge: The offline user api service always returns a null profile key pair, so let's hide this useless exception if in dev + if (net.neoforged.fml.loading.FMLLoader.isProduction() || this.userApiService != UserApiService.OFFLINE) diff --git a/patches/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java.patch b/patches/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java.patch index 60f2d8cb060..cc04a55d629 100644 --- a/patches/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java.patch +++ b/patches/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java.patch @@ -1,48 +1,71 @@ --- a/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java +++ b/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java -@@ -96,17 +_,17 @@ - public void handleCustomPayload(ClientboundCustomPayloadPacket p_295727_) { - CustomPacketPayload custompacketpayload = p_295727_.payload(); - if (!(custompacketpayload instanceof DiscardedPayload)) { -- PacketUtils.ensureRunningOnSameThread(p_295727_, this, this.minecraft); - if (custompacketpayload instanceof BrandPayload brandpayload) { -+ PacketUtils.ensureRunningOnSameThread(p_295727_, this, this.minecraft); //Neo: We move this here to ensure that only vanilla packets are handled on the main thread. - this.serverBrand = brandpayload.brand(); - this.telemetryManager.onServerBrandReceived(brandpayload.brand()); - } else { -- this.handleCustomPayload(custompacketpayload); -+ this.handleCustomPayload(p_295727_, custompacketpayload); - } - } - } - -- protected abstract void handleCustomPayload(CustomPacketPayload p_295776_); -+ protected abstract void handleCustomPayload(ClientboundCustomPayloadPacket p_295727_, CustomPacketPayload p_295776_); +@@ -76,6 +_,10 @@ + protected final boolean strictErrorHandling; + private final List deferredPackets = new ArrayList<>(); + protected final Map serverCookies; ++ /** ++ * Holds the current connection type, based on the types of payloads that have been received so far. ++ */ ++ protected net.neoforged.neoforge.network.connection.ConnectionType connectionType = net.neoforged.neoforge.network.connection.ConnectionType.VANILLA; - protected abstract RegistryAccess.Frozen registryAccess(); - -@@ -189,6 +_,10 @@ + protected ClientCommonPacketListenerImpl(Minecraft p_295454_, Connection p_294773_, CommonListenerCookie p_294647_) { + this.minecraft = p_295454_; +@@ -86,6 +_,8 @@ + this.postDisconnectScreen = p_294647_.postDisconnectScreen(); + this.serverCookies = p_294647_.serverCookies(); + this.strictErrorHandling = p_294647_.strictErrorHandling(); ++ // Neo: Set the connection type based on the cookie from the previous phase. ++ this.connectionType = p_294647_.connectionType(); } - public void send(Packet p_295097_) { -+ if (!net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().canSendPacket(p_295097_, this)) { + @Override +@@ -116,6 +_,25 @@ + + @Override + public void handleCustomPayload(ClientboundCustomPayloadPacket p_295727_) { ++ // Neo: Unconditionally handle register/unregister payloads and update the connection type accordingly. ++ if (p_295727_.payload() instanceof net.neoforged.neoforge.network.payload.MinecraftRegisterPayload minecraftRegisterPayload) { ++ this.connectionType = this.connectionType.withMinecraftRegisterPayload(); ++ net.neoforged.neoforge.network.registration.NetworkRegistry.onMinecraftRegister(this.getConnection(), minecraftRegisterPayload.newChannels()); + return; + } + ++ if (p_295727_.payload() instanceof net.neoforged.neoforge.network.payload.MinecraftUnregisterPayload minecraftUnregisterPayload) { ++ this.connectionType = this.connectionType.withMinecraftRegisterPayload(); ++ net.neoforged.neoforge.network.registration.NetworkRegistry.onMinecraftUnregister(this.getConnection(), minecraftUnregisterPayload.forgottenChannels()); ++ return; ++ } ++ ++ // Neo: Handle modded payloads on modded connections. Vanilla payloads do not get sent to the modded handling pass. ++ if (this.connectionType.isNotVanilla() && !"minecraft".equals(p_295727_.payload().type().id().getNamespace())) { ++ net.neoforged.neoforge.network.registration.NetworkRegistry.handleModdedPayload(this, p_295727_); ++ return; ++ } ++ + CustomPacketPayload custompacketpayload = p_295727_.payload(); + if (!(custompacketpayload instanceof DiscardedPayload)) { + PacketUtils.ensureRunningOnSameThread(p_295727_, this, this.minecraft); +@@ -228,6 +_,8 @@ + } + + public void send(Packet p_295097_) { ++ // Neo: Validate modded payloads before sending. ++ net.neoforged.neoforge.network.registration.NetworkRegistry.checkPacket(p_295097_, this); this.connection.send(p_295097_); } -@@ -196,6 +_,9 @@ +@@ -235,6 +_,9 @@ public void onDisconnect(Component p_295485_) { this.telemetryManager.onDisconnect(); - this.minecraft.disconnect(this.createDisconnectScreen(p_295485_)); + this.minecraft.disconnect(this.createDisconnectScreen(p_295485_), this.isTransferring); + if (!this.connection.isMemoryConnection()) { + net.neoforged.neoforge.registries.RegistryManager.revertToFrozen(); + } LOGGER.warn("Client disconnected with reason: {}", p_295485_.getString()); } -@@ -315,5 +_,15 @@ +@@ -354,5 +_,15 @@ @OnlyIn(Dist.CLIENT) static record PendingRequest(UUID id, URL url, String hash) { } diff --git a/patches/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java.patch b/patches/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java.patch index 2c228847648..543e3f31af8 100644 --- a/patches/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java.patch +++ b/patches/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java.patch @@ -1,104 +1,86 @@ --- a/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java +++ b/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java -@@ -26,6 +_,9 @@ - private final GameProfile localGameProfile; - private RegistryAccess.Frozen receivedRegistries; - private FeatureFlagSet enabledFeatures; +@@ -44,6 +_,9 @@ + private KnownPacksManager knownPacks; + @Nullable + protected ChatComponent.State chatState; + private net.neoforged.neoforge.network.connection.ConnectionType connectionType = net.neoforged.neoforge.network.connection.ConnectionType.VANILLA; + private boolean initializedConnection = false; + private java.util.Map failureReasons = new java.util.HashMap<>(); public ClientConfigurationPacketListenerImpl(Minecraft p_295262_, Connection p_296339_, CommonListenerCookie p_294706_) { super(p_295262_, p_296339_, p_294706_); -@@ -45,7 +_,41 @@ - } - - @Override -- protected void handleCustomPayload(CustomPacketPayload p_295411_) { -+ protected void handleCustomPayload(net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket p_295727_, CustomPacketPayload p_295411_) { -+ if (p_295411_ instanceof net.neoforged.neoforge.network.payload.MinecraftRegisterPayload minecraftRegisterPayload) { -+ this.connectionType = this.connectionType.withMinecraftRegisterPayload(); -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onMinecraftRegister(this, minecraftRegisterPayload.newChannels()); -+ return; -+ } -+ if (p_295411_ instanceof net.neoforged.neoforge.network.payload.MinecraftUnregisterPayload minecraftUnregisterPayload) { -+ this.connectionType = this.connectionType.withMinecraftRegisterPayload(); -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onMinecraftUnregister(this, minecraftUnregisterPayload.forgottenChannels()); -+ return; -+ } -+ if (p_295411_ instanceof net.neoforged.neoforge.network.payload.ModdedNetworkQueryPayload) { -+ this.connectionType = this.connectionType.withNeoForgeQueryPayload(); -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onNetworkQuery(this); -+ return; -+ } -+ if (p_295411_ instanceof net.neoforged.neoforge.network.payload.ModdedNetworkPayload moddedNetworkPayload) { -+ this.initializedConnection = true; -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onModdedNetworkConnectionEstablished(this, moddedNetworkPayload.configuration(), moddedNetworkPayload.play()); -+ return; -+ } -+ if (p_295411_ instanceof net.neoforged.neoforge.network.payload.ModdedNetworkSetupFailedPayload setupFailedPayload) { -+ failureReasons = setupFailedPayload.failureReasons(); -+ } -+ if (!this.connectionType.isNeoForge() && p_295411_ instanceof net.minecraft.network.protocol.common.custom.BrandPayload) { -+ this.initializedConnection = true; -+ if (!net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onVanillaNetworkConnectionEstablished(this)) { -+ return; -+ } -+ } -+ if (this.connectionType.isNotVanilla()) { -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onModdedPacketAtClient(this, p_295727_); -+ return; -+ } -+ - this.handleUnknownCustomPayload(p_295411_); - } - -@@ -69,12 +_,23 @@ +@@ -82,6 +_,11 @@ @Override public void handleEnabledFeatures(ClientboundUpdateEnabledFeaturesPacket p_294410_) { this.enabledFeatures = FeatureFlags.REGISTRY.fromNames(p_294410_.features()); + //Fallback detection layer for vanilla servers + if (!this.connectionType.isNeoForge()) { + this.initializedConnection = true; -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onVanillaNetworkConnectionEstablished(this); ++ net.neoforged.neoforge.network.registration.NetworkRegistry.initializeNonModdedConnection(this); + } } @Override - public void handleConfigurationFinished(ClientboundFinishConfigurationPacket p_294585_) { - this.connection.suspendInboundAfterProtocolChange(); - PacketUtils.ensureRunningOnSameThread(p_294585_, this, this.minecraft); -+ -+ if (!this.initializedConnection && !this.connectionType.isNeoForge()) { -+ //Fallback detection for servers with a delayed brand payload (BungeeCord) -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onVanillaNetworkConnectionEstablished(this); -+ } -+ - this.connection - .setListener( - new ClientPacketListener( -@@ -87,11 +_,13 @@ - this.enabledFeatures, - this.serverBrand, - this.serverData, -- this.postDisconnectScreen -+ this.postDisconnectScreen, +@@ -135,10 +_,17 @@ + this.postDisconnectScreen, + this.serverCookies, + this.chatState, +- this.strictErrorHandling ++ this.strictErrorHandling, + this.connectionType ) ) ); - this.connection.resumeInboundAfterProtocolChange(); -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onConfigurationFinished(this); - this.connection.send(new ServerboundFinishConfigurationPacket()); ++ // Packets can only be sent after the outbound protocol is set up again ++ if (!this.initializedConnection && !this.connectionType.isNeoForge()) { ++ //Fallback detection for servers with a delayed brand payload (BungeeCord) ++ net.neoforged.neoforge.network.registration.NetworkRegistry.initializeNonModdedConnection(this); ++ } ++ net.neoforged.neoforge.network.registration.NetworkRegistry.onConfigurationFinished(this); + this.connection.send(ServerboundFinishConfigurationPacket.INSTANCE); + this.connection.setupOutboundProtocol(GameProtocols.SERVERBOUND.bind(RegistryFriendlyByteBuf.decorator(registryaccess$frozen))); } - -@@ -104,5 +_,18 @@ +@@ -152,5 +_,51 @@ public void onDisconnect(Component p_314649_) { super.onDisconnect(p_314649_); this.minecraft.clearDownloadedResourcePacks(); + } + + @Override ++ public void handleCustomPayload(net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket packet) { ++ // Handle the query payload by responding with the client's network channels. Update the connection type accordingly. ++ if (packet.payload() instanceof net.neoforged.neoforge.network.payload.ModdedNetworkQueryPayload) { ++ this.connectionType = this.connectionType.withNeoForgeQueryPayload(); ++ net.neoforged.neoforge.network.registration.NetworkRegistry.onNetworkQuery(this); ++ return; ++ } ++ ++ // Receiving a modded network payload implies a successful negotiation by the server. ++ if (packet.payload() instanceof net.neoforged.neoforge.network.payload.ModdedNetworkPayload moddedNetworkPayload) { ++ this.initializedConnection = true; ++ net.neoforged.neoforge.network.registration.NetworkRegistry.onModdedNetworkConnectionEstablished(this, moddedNetworkPayload.setup()); ++ return; ++ } ++ ++ // Receiving a setup failed payload will be followed by a disconnect from the server, so we don't need to disconnect manually here. ++ if (packet.payload() instanceof net.neoforged.neoforge.network.payload.ModdedNetworkSetupFailedPayload setupFailedPayload) { ++ failureReasons = setupFailedPayload.failureReasons(); ++ return; ++ } ++ ++ // Receiving a brand payload without having transitioned to a Neo connection implies a non-modded connection has begun. ++ if (!this.connectionType.isNeoForge() && packet.payload() instanceof net.minecraft.network.protocol.common.custom.BrandPayload) { ++ this.initializedConnection = true; ++ net.neoforged.neoforge.network.registration.NetworkRegistry.initializeNonModdedConnection(this); ++ // Continue processing the brand payload ++ } ++ ++ // Fallback to super for un/register, modded, and vanilla payloads. ++ super.handleCustomPayload(packet); ++ } ++ ++ @Override + protected net.minecraft.client.gui.screens.Screen createDisconnectScreen(net.minecraft.network.chat.Component p_296470_) { + final net.minecraft.client.gui.screens.Screen superScreen = super.createDisconnectScreen(p_296470_); + if (failureReasons.isEmpty()) diff --git a/patches/net/minecraft/client/multiplayer/ClientLevel.java.patch b/patches/net/minecraft/client/multiplayer/ClientLevel.java.patch index 4bdfe362503..50fe9d1fef0 100644 --- a/patches/net/minecraft/client/multiplayer/ClientLevel.java.patch +++ b/patches/net/minecraft/client/multiplayer/ClientLevel.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/multiplayer/ClientLevel.java +++ b/net/minecraft/client/multiplayer/ClientLevel.java -@@ -120,6 +_,7 @@ +@@ -121,6 +_,7 @@ p_194170_.put( BiomeColors.WATER_COLOR_RESOLVER, new BlockTintCache(p_194168_ -> this.calculateBlockTint(p_194168_, BiomeColors.WATER_COLOR_RESOLVER)) ); @@ -8,16 +8,16 @@ } ); private final ClientChunkCache chunkSource; -@@ -127,6 +_,8 @@ +@@ -128,6 +_,8 @@ private int serverSimulationDistance; private final BlockStatePredictionHandler blockStatePredictionHandler = new BlockStatePredictionHandler(); private static final Set MARKER_PARTICLE_ITEMS = Set.of(Items.BARRIER, Items.LIGHT); + private final it.unimi.dsi.fastutil.ints.Int2ObjectMap> partEntities = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>(); -+ private final net.neoforged.neoforge.client.model.data.ModelDataManager.Active modelDataManager = new net.neoforged.neoforge.client.model.data.ModelDataManager.Active(this); ++ private final net.neoforged.neoforge.client.model.data.ModelDataManager modelDataManager = new net.neoforged.neoforge.client.model.data.ModelDataManager(this); public void handleBlockChangedAck(int p_233652_) { this.blockStatePredictionHandler.endPredictionsUpTo(p_233652_, this); -@@ -191,6 +_,7 @@ +@@ -192,6 +_,7 @@ this.serverSimulationDistance = p_205510_; this.updateSkyBrightness(); this.prepareWeather(); @@ -25,15 +25,19 @@ } public void queueLightUpdate(Runnable p_194172_) { -@@ -281,6 +_,7 @@ +@@ -282,7 +_,10 @@ p_104640_.setOldPosAndRot(); - ++p_104640_.tickCount; + p_104640_.tickCount++; this.getProfiler().push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(p_104640_.getType()).toString()); -+ if (p_104640_.canUpdate()) - p_104640_.tick(); +- p_104640_.tick(); ++ // Neo: Permit cancellation of Entity#tick via EntityTickEvent.Pre ++ if (!net.neoforged.neoforge.event.EventHooks.fireEntityTickPre(p_104640_).isCanceled()) { ++ p_104640_.tick(); ++ } this.getProfiler().pop(); -@@ -329,8 +_,10 @@ + for (Entity entity : p_104640_.getPassengers()) { +@@ -330,8 +_,10 @@ } public void addEntity(Entity p_104741_) { @@ -44,7 +48,7 @@ } public void removeEntity(int p_171643_, Entity.RemovalReason p_171644_) { -@@ -501,6 +_,13 @@ +@@ -502,6 +_,13 @@ float p_263349_, long p_263408_ ) { @@ -58,7 +62,7 @@ if (p_263381_ == this.minecraft.player) { this.playSound(p_263372_, p_263404_, p_263365_, p_263335_.value(), p_263417_, p_263416_, p_263349_, false, p_263408_); } -@@ -510,6 +_,12 @@ +@@ -511,6 +_,12 @@ public void playSeededSound( @Nullable Player p_263514_, Entity p_263536_, Holder p_263518_, SoundSource p_263487_, float p_263538_, float p_263524_, long p_263509_ ) { @@ -71,7 +75,7 @@ if (p_263514_ == this.minecraft.player) { this.minecraft.getSoundManager().play(new EntityBoundSoundInstance(p_263518_.value(), p_263487_, p_263538_, p_263524_, p_263536_, p_263509_)); } -@@ -1054,6 +_,7 @@ +@@ -1033,6 +_,7 @@ } public void setDifficulty(Difficulty p_104852_) { @@ -79,7 +83,7 @@ this.difficulty = p_104852_; } -@@ -1090,14 +_,46 @@ +@@ -1069,14 +_,51 @@ if (p_171712_ instanceof AbstractClientPlayer) { ClientLevel.this.players.add((AbstractClientPlayer)p_171712_); } @@ -114,11 +118,16 @@ + } + + @Override -+ public net.neoforged.neoforge.client.model.data.ModelDataManager.Active getModelDataManager() { ++ public net.neoforged.neoforge.client.model.data.ModelDataManager getModelDataManager() { + return modelDataManager; + } + + @Override ++ public net.neoforged.neoforge.client.model.data.ModelData getModelData(BlockPos pos) { ++ return modelDataManager.getAt(pos); ++ } ++ ++ @Override + public float getShade(float normalX, float normalY, float normalZ, boolean shade) { + boolean constantAmbientLight = this.effects().constantAmbientLight(); + if (!shade) diff --git a/patches/net/minecraft/client/multiplayer/ClientPacketListener.java.patch b/patches/net/minecraft/client/multiplayer/ClientPacketListener.java.patch index 11b533d40ab..adaf18af06e 100644 --- a/patches/net/minecraft/client/multiplayer/ClientPacketListener.java.patch +++ b/patches/net/minecraft/client/multiplayer/ClientPacketListener.java.patch @@ -1,22 +1,22 @@ --- a/net/minecraft/client/multiplayer/ClientPacketListener.java +++ b/net/minecraft/client/multiplayer/ClientPacketListener.java -@@ -340,6 +_,7 @@ - private MessageSignatureCache messageSignatureCache = MessageSignatureCache.createDefault(); +@@ -343,6 +_,7 @@ private final ChunkBatchSizeCalculator chunkBatchSizeCalculator = new ChunkBatchSizeCalculator(); private final PingDebugMonitor pingDebugMonitor; + private final DebugSampleSubscriber debugSampleSubscriber; + private net.neoforged.neoforge.network.connection.ConnectionType connectionType; @Nullable private LevelLoadStatusManager levelLoadStatusManager; - private boolean seenInsecureChatWarning = false; -@@ -353,6 +_,7 @@ - this.advancements = new ClientAdvancements(p_253924_, this.telemetryManager); - this.suggestionsProvider = new ClientSuggestionProvider(this, p_253924_); - this.pingDebugMonitor = new PingDebugMonitor(this, p_253924_.getDebugOverlay().getPingLogger()); + private boolean serverEnforcesSecureChat; +@@ -364,6 +_,7 @@ + p_253924_.gui.getChat().restoreState(p_295121_.chatState()); + } + + this.connectionType = p_295121_.connectionType(); + this.potionBrewing = PotionBrewing.bootstrap(this.enabledFeatures); } - public ClientSuggestionProvider getSuggestionsProvider() { -@@ -416,6 +_,7 @@ +@@ -425,6 +_,7 @@ this.minecraft.debugRenderer.clear(); this.minecraft.player.resetPos(); @@ -24,17 +24,17 @@ this.minecraft.player.setId(p_105030_.playerId()); this.level.addEntity(this.minecraft.player); this.minecraft.player.input = new KeyboardInput(this.minecraft.options); -@@ -801,7 +_,8 @@ - this.enabledFeatures, - this.serverBrand, - this.serverData, -- this.postDisconnectScreen -+ this.postDisconnectScreen, +@@ -824,7 +_,8 @@ + this.postDisconnectScreen, + this.serverCookies, + chatcomponent$state, +- this.strictErrorHandling ++ this.strictErrorHandling, + this.connectionType ) ) ); -@@ -1143,6 +_,7 @@ +@@ -1159,6 +_,7 @@ } localplayer1.resetPos(); @@ -42,19 +42,19 @@ this.level.addEntity(localplayer1); localplayer1.setYRot(-180.0F); localplayer1.input = new KeyboardInput(this.minecraft.options); -@@ -1274,10 +_,7 @@ +@@ -1300,10 +_,7 @@ PacketUtils.ensureRunningOnSameThread(p_104976_, this, this.minecraft); BlockPos blockpos = p_104976_.getPos(); - this.minecraft.level.getBlockEntity(blockpos, p_104976_.getType()).ifPresent(p_205557_ -> { + this.minecraft.level.getBlockEntity(blockpos, p_104976_.getType()).ifPresent(p_337415_ -> { - CompoundTag compoundtag = p_104976_.getTag(); -- if (compoundtag != null) { -- p_205557_.load(compoundtag); +- if (!compoundtag.isEmpty()) { +- p_337415_.loadWithComponents(compoundtag, this.registryAccess); - } -+ p_205557_.onDataPacket(connection, p_104976_); ++ p_337415_.onDataPacket(connection, p_104976_, this.registryAccess); - if (p_205557_ instanceof CommandBlockEntity && this.minecraft.screen instanceof CommandBlockEditScreen) { + if (p_337415_ instanceof CommandBlockEntity && this.minecraft.screen instanceof CommandBlockEditScreen) { ((CommandBlockEditScreen)this.minecraft.screen).updateGui(); -@@ -1446,7 +_,9 @@ +@@ -1470,7 +_,9 @@ @Override public void handleCommands(ClientboundCommandsPacket p_104990_) { PacketUtils.ensureRunningOnSameThread(p_104990_, this, this.minecraft); @@ -65,57 +65,15 @@ } @Override -@@ -1468,6 +_,7 @@ +@@ -1492,6 +_,7 @@ ClientRecipeBook clientrecipebook = this.minecraft.player.getRecipeBook(); - clientrecipebook.setupCollections(this.recipeManager.getRecipes(), this.minecraft.level.registryAccess()); + clientrecipebook.setupCollections(this.recipeManager.getOrderedRecipes(), this.minecraft.level.registryAccess()); this.minecraft.populateSearchTree(SearchRegistry.RECIPE_COLLECTIONS, clientrecipebook.getCollections()); + net.neoforged.neoforge.client.ClientHooks.onRecipesUpdated(this.recipeManager); } @Override -@@ -1574,7 +_,8 @@ - Blocks.rebuildCache(); - } - -- CreativeModeTabs.searchTab().rebuildSearchTree(); -+ CreativeModeTabs.allTabs().stream().filter(net.minecraft.world.item.CreativeModeTab::hasSearchBar).forEach(net.minecraft.world.item.CreativeModeTab::rebuildSearchTree); -+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.TagsUpdatedEvent(this.registryAccess, true, connection.isMemoryConnection())); - } - - @Override -@@ -1916,7 +_,21 @@ - } - - @Override -- public void handleCustomPayload(CustomPacketPayload p_295851_) { -+ public void handleCustomPayload(net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket p_295727_, CustomPacketPayload p_295851_) { -+ if (p_295851_ instanceof net.neoforged.neoforge.network.payload.MinecraftRegisterPayload minecraftRegisterPayload) { -+ this.connectionType = this.connectionType.withMinecraftRegisterPayload(); -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onMinecraftRegister(this, minecraftRegisterPayload.newChannels()); -+ return; -+ } -+ if (p_295851_ instanceof net.neoforged.neoforge.network.payload.MinecraftUnregisterPayload minecraftUnregisterPayload) { -+ this.connectionType = this.connectionType.withMinecraftRegisterPayload(); -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onMinecraftUnregister(this, minecraftUnregisterPayload.forgottenChannels()); -+ return; -+ } -+ if (this.connectionType.isNotVanilla() && net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onModdedPacketAtClient(this, p_295727_)) { -+ return; -+ } -+ PacketUtils.ensureRunningOnSameThread(p_295727_, this, this.minecraft); //Neo: We move this here to ensure that only vanilla packets are handled on the main thread. - if (p_295851_ instanceof PathfindingDebugPayload pathfindingdebugpayload) { - this.minecraft - .debugRenderer -@@ -2267,7 +_,7 @@ - public void handleBundlePacket(ClientboundBundlePacket p_265195_) { - PacketUtils.ensureRunningOnSameThread(p_265195_, this, this.minecraft); - -- for(Packet packet : p_265195_.subPackets()) { -+ for(Packet packet : p_265195_.subPackets()) { - packet.handle(this); - } - } -@@ -2389,6 +_,8 @@ +@@ -2406,6 +_,8 @@ } public void sendChat(String p_249888_) { @@ -124,21 +82,22 @@ Instant instant = Instant.now(); long i = Crypt.SaltSupplier.getLong(); LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.lastSeenMessages.generateAndApplyUpdate(); -@@ -2398,6 +_,7 @@ +@@ -2415,6 +_,7 @@ } public void sendCommand(String p_250092_) { + if (net.neoforged.neoforge.client.ClientCommandHandler.runCommand(p_250092_)) return; - Instant instant = Instant.now(); - long i = Crypt.SaltSupplier.getLong(); - LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.lastSeenMessages.generateAndApplyUpdate(); -@@ -2463,5 +_,9 @@ + SignableCommand signablecommand = SignableCommand.of(this.parseCommand(p_250092_)); + if (signablecommand.arguments().isEmpty()) { + this.send(new ServerboundChatCommandPacket(p_250092_)); +@@ -2489,6 +_,10 @@ - public boolean isFeatureEnabled(FeatureFlagSet p_250605_) { - return p_250605_.isSubsetOf(this.enabledFeatures()); + public Scoreboard scoreboard() { + return this.scoreboard; + } + + public net.neoforged.neoforge.network.connection.ConnectionType getConnectionType() { -+ return connectionType; ++ return this.connectionType; } - } + + public PotionBrewing potionBrewing() { diff --git a/patches/net/minecraft/client/multiplayer/CommonListenerCookie.java.patch b/patches/net/minecraft/client/multiplayer/CommonListenerCookie.java.patch index f8d1c041917..707640fd44c 100644 --- a/patches/net/minecraft/client/multiplayer/CommonListenerCookie.java.patch +++ b/patches/net/minecraft/client/multiplayer/CommonListenerCookie.java.patch @@ -1,19 +1,30 @@ --- a/net/minecraft/client/multiplayer/CommonListenerCookie.java +++ b/net/minecraft/client/multiplayer/CommonListenerCookie.java -@@ -17,6 +_,15 @@ - FeatureFlagSet enabledFeatures, - @Nullable String serverBrand, - @Nullable ServerData serverData, -- @Nullable Screen postDisconnectScreen -+ @Nullable Screen postDisconnectScreen, +@@ -23,6 +_,26 @@ + @Nullable Screen postDisconnectScreen, + Map serverCookies, + @Nullable ChatComponent.State chatState, +- @Deprecated(forRemoval = true) boolean strictErrorHandling ++ @Deprecated(forRemoval = true) boolean strictErrorHandling, + net.neoforged.neoforge.network.connection.ConnectionType connectionType ) { -+ + /** -+ * @deprecated Use {@link #CommonListenerCookie(GameProfile, WorldSessionTelemetryManager, RegistryAccess.Frozen, FeatureFlagSet, String, ServerData, Screen, net.neoforged.neoforge.network.connection.ConnectionType)} instead, to indicate whether the connection is modded. ++ * @deprecated Use {@link #CommonListenerCookie(GameProfile, WorldSessionTelemetryManager, RegistryAccess.Frozen, FeatureFlagSet, String, ServerData, Screen, Map, ChatComponent.State, boolean, net.neoforged.neoforge.network.connection.ConnectionType)} ++ * instead,to indicate whether the connection is modded. + */ + @Deprecated -+ public CommonListenerCookie(GameProfile localGameProfile, WorldSessionTelemetryManager telemetryManager, RegistryAccess.Frozen receivedRegistries, FeatureFlagSet enabledFeatures, @Nullable String serverBrand, @Nullable ServerData serverData, @Nullable Screen postDisconnectScreen) { -+ this(localGameProfile, telemetryManager, receivedRegistries, enabledFeatures, serverBrand, serverData, postDisconnectScreen, net.neoforged.neoforge.network.connection.ConnectionType.VANILLA); ++ public CommonListenerCookie( ++ GameProfile localGameProfile, ++ WorldSessionTelemetryManager telemetryManager, ++ RegistryAccess.Frozen receivedRegistries, ++ FeatureFlagSet enabledFeatures, ++ @Nullable String serverBrand, ++ @Nullable ServerData serverData, ++ @Nullable Screen postDisconnectScreen, ++ Map serverCookies, ++ @Nullable ChatComponent.State chatState, ++ @Deprecated(forRemoval = true) boolean strictErrorHandling ++ ) { ++ this(localGameProfile, telemetryManager, receivedRegistries, enabledFeatures, serverBrand, serverData, postDisconnectScreen, serverCookies, chatState, strictErrorHandling, net.neoforged.neoforge.network.connection.ConnectionType.VANILLA); + } } diff --git a/patches/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch b/patches/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch index fe92a047928..217d3dd2516 100644 --- a/patches/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch +++ b/patches/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/multiplayer/MultiPlayerGameMode.java +++ b/net/minecraft/client/multiplayer/MultiPlayerGameMode.java -@@ -105,6 +_,7 @@ +@@ -106,6 +_,7 @@ } public boolean destroyBlock(BlockPos p_105268_) { @@ -8,7 +8,7 @@ if (this.minecraft.player.blockActionRestricted(this.minecraft.level, p_105268_, this.localPlayerMode)) { return false; } else { -@@ -119,9 +_,8 @@ +@@ -120,9 +_,8 @@ } else if (blockstate.isAir()) { return false; } else { @@ -19,7 +19,7 @@ if (flag) { block.destroy(level, p_105268_, blockstate); } -@@ -142,6 +_,7 @@ +@@ -143,6 +_,7 @@ BlockState blockstate = this.minecraft.level.getBlockState(p_105270_); this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105270_, blockstate, 1.0F); this.startPrediction(this.minecraft.level, p_233757_ -> { @@ -27,7 +27,7 @@ this.destroyBlock(p_105270_); return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233757_); }); -@@ -151,15 +_,19 @@ +@@ -152,15 +_,19 @@ this.connection .send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, p_105271_)); } @@ -47,7 +47,7 @@ if (flag && blockstate1.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105270_) >= 1.0F) { this.destroyBlock(p_105270_); } else { -@@ -171,7 +_,7 @@ +@@ -172,7 +_,7 @@ this.minecraft.level.destroyBlockProgress(this.minecraft.player.getId(), this.destroyBlockPos, this.getDestroyStage()); } @@ -56,7 +56,7 @@ }); } -@@ -202,6 +_,7 @@ +@@ -203,6 +_,7 @@ BlockState blockstate1 = this.minecraft.level.getBlockState(p_105284_); this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate1, 1.0F); this.startPrediction(this.minecraft.level, p_233753_ -> { @@ -64,42 +64,33 @@ this.destroyBlock(p_105284_); return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105284_, p_105285_, p_233753_); }); -@@ -214,7 +_,7 @@ +@@ -215,7 +_,7 @@ } else { - this.destroyProgress += blockstate.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105284_); + this.destroyProgress = this.destroyProgress + blockstate.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105284_); if (this.destroyTicks % 4.0F == 0.0F) { - SoundType soundtype = blockstate.getSoundType(); + SoundType soundtype = blockstate.getSoundType(this.minecraft.level, p_105284_, this.minecraft.player); this.minecraft .getSoundManager() .play( -@@ -231,6 +_,7 @@ +@@ -232,6 +_,7 @@ - ++this.destroyTicks; + this.destroyTicks++; this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate, Mth.clamp(this.destroyProgress, 0.0F, 1.0F)); + if (net.neoforged.neoforge.common.CommonHooks.onClientMineHold(this.minecraft.player, p_105284_, p_105285_).getUseItem() == net.neoforged.bus.api.Event.Result.DENY) return true; if (this.destroyProgress >= 1.0F) { this.isDestroying = false; this.startPrediction(this.minecraft.level, p_233739_ -> { -@@ -259,7 +_,7 @@ - } - - public float getPickRange() { -- return Player.getPickRange(this.localPlayerMode.isCreative()); -+ return (float) this.minecraft.player.getBlockReach(); - } - - public void tick() { -@@ -273,7 +_,7 @@ +@@ -270,7 +_,7 @@ private boolean sameDestroyTarget(BlockPos p_105282_) { ItemStack itemstack = this.minecraft.player.getMainHandItem(); -- return p_105282_.equals(this.destroyBlockPos) && ItemStack.isSameItemSameTags(itemstack, this.destroyingItem); +- return p_105282_.equals(this.destroyBlockPos) && ItemStack.isSameItemSameComponents(itemstack, this.destroyingItem); + return p_105282_.equals(this.destroyBlockPos) && !destroyingItem.shouldCauseBlockBreakReset(itemstack); } private void ensureHasSentCarriedItem() { -@@ -301,25 +_,38 @@ +@@ -298,12 +_,23 @@ private InteractionResult performUseItemOn(LocalPlayer p_233747_, InteractionHand p_233748_, BlockHitResult p_233749_) { BlockPos blockpos = p_233749_.getBlockPos(); ItemStack itemstack = p_233747_.getItemInHand(p_233748_); @@ -121,15 +112,11 @@ + boolean flag = !p_233747_.getMainHandItem().doesSneakBypassUse(p_233747_.level(), blockpos, p_233747_) || !p_233747_.getOffhandItem().doesSneakBypassUse(p_233747_.level(), blockpos, p_233747_); boolean flag1 = p_233747_.isSecondaryUseActive() && flag; - if (!flag1) { ++ if (event.getUseBlock() == net.neoforged.bus.api.Event.Result.ALLOW || (event.getUseBlock() != net.neoforged.bus.api.Event.Result.DENY && !flag1)) { BlockState blockstate = this.minecraft.level.getBlockState(blockpos); if (!this.connection.isFeatureEnabled(blockstate.getBlock().requiredFeatures())) { return InteractionResult.FAIL; - } - -+ if (event.getUseBlock() == net.neoforged.bus.api.Event.Result.ALLOW || (event.getUseBlock() != net.neoforged.bus.api.Event.Result.DENY && !flag1)) { - InteractionResult interactionresult = blockstate.use(this.minecraft.level, p_233747_, p_233748_, p_233749_); - if (interactionresult.consumesAction()) { - return interactionresult; +@@ -324,8 +_,10 @@ } } @@ -142,7 +129,7 @@ InteractionResult interactionresult1; if (this.localPlayerMode.isCreative()) { int i = itemstack.getCount(); -@@ -355,10 +_,17 @@ +@@ -361,10 +_,17 @@ mutableobject.setValue(InteractionResult.PASS); return serverbounduseitempacket; } else { @@ -160,7 +147,7 @@ } mutableobject.setValue(interactionresultholder.getResult()); -@@ -396,6 +_,9 @@ +@@ -402,6 +_,9 @@ this.ensureHasSentCarriedItem(); Vec3 vec3 = p_105233_.getLocation().subtract(p_105232_.getX(), p_105232_.getY(), p_105232_.getZ()); this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105232_, p_105231_.isShiftKeyDown(), p_105234_, vec3)); diff --git a/patches/net/minecraft/client/multiplayer/ServerData.java.patch b/patches/net/minecraft/client/multiplayer/ServerData.java.patch index bbe6f6d67d2..88f40c09d13 100644 --- a/patches/net/minecraft/client/multiplayer/ServerData.java.patch +++ b/patches/net/minecraft/client/multiplayer/ServerData.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/client/multiplayer/ServerData.java +++ b/net/minecraft/client/multiplayer/ServerData.java -@@ -35,6 +_,7 @@ +@@ -34,6 +_,7 @@ private byte[] iconBytes; private ServerData.Type type; - private boolean enforcesSecureChat; + private ServerData.State state = ServerData.State.INITIAL; + public net.neoforged.neoforge.client.ExtendedServerListData neoForgeData = null; public ServerData(String p_105375_, String p_105376_, ServerData.Type p_295587_) { diff --git a/patches/net/minecraft/client/multiplayer/TagCollector.java.patch b/patches/net/minecraft/client/multiplayer/TagCollector.java.patch new file mode 100644 index 00000000000..5bfd056538f --- /dev/null +++ b/patches/net/minecraft/client/multiplayer/TagCollector.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/client/multiplayer/TagCollector.java ++++ b/net/minecraft/client/multiplayer/TagCollector.java +@@ -23,7 +_,7 @@ + } + + private static void refreshCommonTagDependentData() { +- CreativeModeTabs.searchTab().rebuildSearchTree(); ++ CreativeModeTabs.allTabs().stream().filter(net.minecraft.world.item.CreativeModeTab::hasSearchBar).forEach(net.minecraft.world.item.CreativeModeTab::rebuildSearchTree); + } + + private static void refreshBuiltInTagDependentData() { +@@ -51,5 +_,6 @@ + } + + refreshCommonTagDependentData(); ++ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.TagsUpdatedEvent(p_326147_, true, p_326486_)); + } + } diff --git a/patches/net/minecraft/client/particle/EnchantmentTableParticle.java.patch b/patches/net/minecraft/client/particle/EnchantmentTableParticle.java.patch deleted file mode 100644 index 1c3bc858528..00000000000 --- a/patches/net/minecraft/client/particle/EnchantmentTableParticle.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/client/particle/EnchantmentTableParticle.java -+++ b/net/minecraft/client/particle/EnchantmentTableParticle.java -@@ -77,6 +_,7 @@ - this.x = this.xStart + this.xd * (double)f; - this.y = this.yStart + this.yd * (double)f - (double)(f1 * 1.2F); - this.z = this.zStart + this.zd * (double)f; -+ this.setPos(this.x, this.y, this.z); // FORGE: update the particle's bounding box - } - } - diff --git a/patches/net/minecraft/client/particle/FireworkParticles.java.patch b/patches/net/minecraft/client/particle/FireworkParticles.java.patch index 88a00aa5e27..709c4d392da 100644 --- a/patches/net/minecraft/client/particle/FireworkParticles.java.patch +++ b/patches/net/minecraft/client/particle/FireworkParticles.java.patch @@ -1,31 +1,13 @@ --- a/net/minecraft/client/particle/FireworkParticles.java +++ b/net/minecraft/client/particle/FireworkParticles.java -@@ -219,7 +_,7 @@ - } else { - for(int i = 0; i < this.explosions.size(); ++i) { - CompoundTag compoundtag = this.explosions.getCompound(i); -- if (FireworkRocketItem.Shape.byId(compoundtag.getByte("Type")) == FireworkRocketItem.Shape.LARGE_BALL) { -+ if (FireworkRocketItem.Shape.getShape(compoundtag) == FireworkRocketItem.Shape.LARGE_BALL) { - flag1 = true; - break; - } -@@ -239,7 +_,7 @@ - if (this.life % 2 == 0 && this.explosions != null && this.life / 2 < this.explosions.size()) { - int k = this.life / 2; - CompoundTag compoundtag1 = this.explosions.getCompound(k); -- FireworkRocketItem.Shape fireworkrocketitem$shape = FireworkRocketItem.Shape.byId(compoundtag1.getByte("Type")); -+ FireworkRocketItem.Shape fireworkrocketitem$shape = FireworkRocketItem.Shape.getShape(compoundtag1); - boolean flag4 = compoundtag1.getBoolean("Trail"); - boolean flag2 = compoundtag1.getBoolean("Flicker"); - int[] aint = compoundtag1.getIntArray("Colors"); -@@ -248,6 +_,10 @@ - aint = new int[]{DyeColor.BLACK.getFireworkColor()}; +@@ -253,6 +_,10 @@ + intlist = IntList.of(DyeColor.BLACK.getFireworkColor()); } -+ var factory = net.neoforged.neoforge.client.FireworkShapeFactoryRegistry.get(fireworkrocketitem$shape); ++ var factory = net.neoforged.neoforge.client.FireworkShapeFactoryRegistry.get(fireworkexplosion1.shape()); + if (factory != null) -+ factory.build(this, flag4, flag2, aint, aint1); ++ factory.build(this, flag3, flag4, intlist.toIntArray(), intlist1.toIntArray()); + else - switch(fireworkrocketitem$shape) { + switch (fireworkexplosion1.shape()) { case SMALL_BALL: - default: + this.createParticleBall(0.25, 2, intlist, intlist1, flag3, flag4); diff --git a/patches/net/minecraft/client/particle/Particle.java.patch b/patches/net/minecraft/client/particle/Particle.java.patch index d7d7e57e61e..b3280b7ed00 100644 --- a/patches/net/minecraft/client/particle/Particle.java.patch +++ b/patches/net/minecraft/client/particle/Particle.java.patch @@ -1,19 +1,21 @@ --- a/net/minecraft/client/particle/Particle.java +++ b/net/minecraft/client/particle/Particle.java -@@ -244,4 +_,16 @@ - public Optional getParticleGroup() { +@@ -245,6 +_,18 @@ return Optional.empty(); } + ++ /** ++ * Forge added method that controls if a particle should be culled to it's bounding box. ++ * Default behaviour is culling enabled ++ */ ++ public boolean shouldCull() { ++ return true; ++ } + -+ /** -+ * Forge added method that controls if a particle should be culled to it's bounding box. -+ * Default behaviour is culling enabled -+ */ -+ public boolean shouldCull() { -+ return true; -+ } ++ public Vec3 getPos() { ++ return new Vec3(this.x, this.y, this.z); ++ } + -+ public net.minecraft.world.phys.Vec3 getPos() { -+ return new net.minecraft.world.phys.Vec3(this.x, this.y, this.z); -+ } - } + @OnlyIn(Dist.CLIENT) + public static record LifetimeAlpha(float startAlpha, float endAlpha, float startAtNormalizedAge, float endAtNormalizedAge) { + public static final Particle.LifetimeAlpha ALWAYS_OPAQUE = new Particle.LifetimeAlpha(1.0F, 1.0F, 0.0F, 1.0F); diff --git a/patches/net/minecraft/client/particle/ParticleEngine.java.patch b/patches/net/minecraft/client/particle/ParticleEngine.java.patch index aacfeb0a5b1..8eee5707c48 100644 --- a/patches/net/minecraft/client/particle/ParticleEngine.java.patch +++ b/patches/net/minecraft/client/particle/ParticleEngine.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/particle/ParticleEngine.java +++ b/net/minecraft/client/particle/ParticleEngine.java -@@ -81,11 +_,11 @@ +@@ -79,11 +_,11 @@ ParticleRenderType.CUSTOM ); protected ClientLevel level; @@ -14,8 +14,8 @@ private final Queue particlesToAdd = Queues.newArrayDeque(); private final Map spriteSets = Maps.newHashMap(); private final TextureAtlas textureAtlas; -@@ -208,10 +_,14 @@ - this.register(ParticleTypes.TRIAL_SPAWNER_DETECTION, TrialSpawnerDetectionParticle.Provider::new); +@@ -214,10 +_,14 @@ + this.register(ParticleTypes.OMINOUS_SPAWNING, FlyStraightTowardsParticle.OminousSpawnProvider::new); } + /** @deprecated Register via {@link net.neoforged.neoforge.client.event.RegisterParticleProvidersEvent} */ @@ -30,7 +30,7 @@ public void register(ParticleType p_273423_, ParticleProvider.Sprite p_273134_) { this.register( p_273423_, -@@ -228,10 +_,12 @@ +@@ -234,10 +_,12 @@ ); } @@ -44,46 +44,43 @@ } @Override -@@ -357,7 +_,7 @@ +@@ -363,7 +_,7 @@ private Particle makeParticle( T p_107396_, double p_107397_, double p_107398_, double p_107399_, double p_107400_, double p_107401_, double p_107402_ ) { -- ParticleProvider particleprovider = (ParticleProvider)this.providers.get(BuiltInRegistries.PARTICLE_TYPE.getId(p_107396_.getType())); +- ParticleProvider particleprovider = (ParticleProvider)this.providers.get(BuiltInRegistries.PARTICLE_TYPE.getId(p_107396_.getType())); + ParticleProvider particleprovider = (ParticleProvider) this.providers.get(BuiltInRegistries.PARTICLE_TYPE.getKey(p_107396_.getType())); return particleprovider == null ? null : particleprovider.createParticle(p_107396_, this.level, p_107397_, p_107398_, p_107399_, p_107400_, p_107401_, p_107402_); -@@ -433,15 +_,24 @@ +@@ -439,11 +_,21 @@ } } -+ /**@deprecated Forge: use {@link #render(PoseStack, MultiBufferSource.BufferSource, LightTexture, Camera, float, net.minecraft.client.renderer.culling.Frustum)} with Frustum as additional parameter*/ ++ /** @deprecated Neo: use {@link #render(LightTexture, Camera, float, net.minecraft.client.renderer.culling.Frustum)} with Frustum as additional parameter */ + @Deprecated - public void render(PoseStack p_107337_, MultiBufferSource.BufferSource p_107338_, LightTexture p_107339_, Camera p_107340_, float p_107341_) { -+ render(p_107337_, p_107338_, p_107339_, p_107340_, p_107341_, null); + public void render(LightTexture p_107339_, Camera p_107340_, float p_107341_) { ++ render(p_107339_, p_107340_, p_107341_, null); + } + -+ public void render(PoseStack p_107337_, MultiBufferSource.BufferSource p_107338_, LightTexture p_107339_, Camera p_107340_, float p_107341_, @Nullable net.minecraft.client.renderer.culling.Frustum clippingHelper) { ++ public void render(LightTexture p_107339_, Camera p_107340_, float p_107341_, @Nullable net.minecraft.client.renderer.culling.Frustum frustum) { p_107339_.turnOnLightLayer(); RenderSystem.enableDepthTest(); ++ //TODO porting: is this even needed with the particle render order fix??? + RenderSystem.activeTexture(org.lwjgl.opengl.GL13.GL_TEXTURE2); + RenderSystem.activeTexture(org.lwjgl.opengl.GL13.GL_TEXTURE0); - PoseStack posestack = RenderSystem.getModelViewStack(); - posestack.pushPose(); - posestack.mulPoseMatrix(p_107337_.last().pose()); - RenderSystem.applyModelViewMatrix(); -- for(ParticleRenderType particlerendertype : RENDER_ORDER) { +- for (ParticleRenderType particlerendertype : RENDER_ORDER) { + for(ParticleRenderType particlerendertype : this.particles.keySet()) { // Forge: allow custom IParticleRenderType's + if (particlerendertype == ParticleRenderType.NO_RENDER) continue; Iterable iterable = this.particles.get(particlerendertype); if (iterable != null) { RenderSystem.setShader(GameRenderer::getParticleShader); -@@ -450,6 +_,7 @@ +@@ -452,6 +_,7 @@ particlerendertype.begin(bufferbuilder, this.textureManager); - for(Particle particle : iterable) { -+ if (clippingHelper != null && particle.shouldCull() && !clippingHelper.isVisible(particle.getBoundingBox().inflate(1.0))) continue; + for (Particle particle : iterable) { ++ if (frustum != null && particle.shouldCull() && !frustum.isVisible(particle.getBoundingBox().inflate(1.0))) continue; try { particle.render(bufferbuilder, p_107340_, p_107341_); } catch (Throwable throwable) { diff --git a/patches/net/minecraft/client/particle/ReversePortalParticle.java.patch b/patches/net/minecraft/client/particle/ReversePortalParticle.java.patch index 7e008c73412..cfae8e80626 100644 --- a/patches/net/minecraft/client/particle/ReversePortalParticle.java.patch +++ b/patches/net/minecraft/client/particle/ReversePortalParticle.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/particle/ReversePortalParticle.java +++ b/net/minecraft/client/particle/ReversePortalParticle.java @@ -31,6 +_,7 @@ - this.x += this.xd * (double)f; - this.y += this.yd * (double)f; - this.z += this.zd * (double)f; -+ this.setPos(this.x, this.y, this.z); // FORGE: update the particle's bounding box + this.x = this.x + this.xd * (double)f; + this.y = this.y + this.yd * (double)f; + this.z = this.z + this.zd * (double)f; ++ this.setPos(this.x, this.y, this.z); // Neo: update the particle's bounding box } } diff --git a/patches/net/minecraft/client/particle/TerrainParticle.java.patch b/patches/net/minecraft/client/particle/TerrainParticle.java.patch index f3489d50d61..ae51665cbd3 100644 --- a/patches/net/minecraft/client/particle/TerrainParticle.java.patch +++ b/patches/net/minecraft/client/particle/TerrainParticle.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/particle/TerrainParticle.java +++ b/net/minecraft/client/particle/TerrainParticle.java -@@ -40,7 +_,7 @@ +@@ -41,7 +_,7 @@ this.rCol = 0.6F; this.gCol = 0.6F; this.bCol = 0.6F; @@ -10,18 +10,18 @@ this.rCol *= (float)(i >> 16 & 0xFF) / 255.0F; this.gCol *= (float)(i >> 8 & 0xFF) / 255.0F; @@ -97,8 +_,14 @@ - ) { - BlockState blockstate = p_108304_.getState(); - return !blockstate.isAir() && !blockstate.is(Blocks.MOVING_PISTON) && blockstate.shouldSpawnTerrainParticles() -- ? new TerrainParticle(p_108305_, p_108306_, p_108307_, p_108308_, p_108309_, p_108310_, p_108311_, blockstate) -+ ? new TerrainParticle(p_108305_, p_108306_, p_108307_, p_108308_, p_108309_, p_108310_, p_108311_, blockstate).updateSprite(blockstate, p_108304_.getPos()) - : null; - } + ) { + BlockState blockstate = p_338588_.getState(); + return !blockstate.isAir() && !blockstate.is(Blocks.MOVING_PISTON) && blockstate.shouldSpawnTerrainParticles() +- ? new TerrainParticle(p_338858_, p_338212_, p_338420_, p_338623_, p_338262_, p_338289_, p_338400_, blockstate) ++ ? new TerrainParticle(p_338858_, p_338212_, p_338420_, p_338623_, p_338262_, p_338289_, p_338400_, blockstate).updateSprite(blockstate, p_338588_.getPos()) + : null; + } + -+ public Particle updateSprite(BlockState state, BlockPos pos) { //FORGE: we cannot assume that the x y z of the particles match the block pos of the block. ++ public TerrainParticle updateSprite(BlockState state, BlockPos pos) { //FORGE: we cannot assume that the x y z of the particles match the block pos of the block. + if (pos != null) // There are cases where we are not able to obtain the correct source pos, and need to fallback to the non-model data version + this.setSprite(Minecraft.getInstance().getBlockRenderer().getBlockModelShaper().getTexture(state, level, pos)); + return this; } - } + + @OnlyIn(Dist.CLIENT) diff --git a/patches/net/minecraft/client/player/LocalPlayer.java.patch b/patches/net/minecraft/client/player/LocalPlayer.java.patch index 99101b0dea8..2ce14eeb1e3 100644 --- a/patches/net/minecraft/client/player/LocalPlayer.java.patch +++ b/patches/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 -@@ -158,6 +_,7 @@ +@@ -160,6 +_,7 @@ @Override public boolean hurt(DamageSource p_108662_, float p_108663_) { @@ -8,7 +8,7 @@ return false; } -@@ -294,6 +_,7 @@ +@@ -296,6 +_,7 @@ ServerboundPlayerActionPacket.Action serverboundplayeractionpacket$action = p_108701_ ? ServerboundPlayerActionPacket.Action.DROP_ALL_ITEMS : ServerboundPlayerActionPacket.Action.DROP_ITEM; @@ -16,7 +16,7 @@ ItemStack itemstack = this.getInventory().removeFromSelected(p_108701_); this.connection.send(new ServerboundPlayerActionPacket(serverboundplayeractionpacket$action, BlockPos.ZERO, Direction.DOWN)); return !itemstack.isEmpty(); -@@ -491,7 +_,14 @@ +@@ -493,7 +_,14 @@ @Override public void playSound(SoundEvent p_108651_, float p_108652_, float p_108653_) { @@ -32,7 +32,7 @@ } @Override -@@ -683,6 +_,7 @@ +@@ -685,6 +_,7 @@ && (this.isShiftKeyDown() || !this.isSleeping() && !this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.STANDING)); float f = Mth.clamp(0.3F + EnchantmentHelper.getSneakingSpeedBonus(this), 0.0F, 1.0F); this.input.tick(this.isMovingSlowly(), f); @@ -40,7 +40,7 @@ this.minecraft.getTutorial().onInput(this.input); if (this.isUsingItem() && !this.isPassenger()) { this.input.leftImpulse *= 0.2F; -@@ -711,7 +_,7 @@ +@@ -713,7 +_,7 @@ boolean flag4 = this.canStartSprinting(); boolean flag5 = this.isPassenger() ? this.getVehicle().onGround() : this.onGround(); boolean flag6 = !flag1 && !flag2; @@ -49,7 +49,7 @@ if (this.sprintTriggerTime <= 0 && !this.minecraft.options.keySprint.isDown()) { this.sprintTriggerTime = 7; } else { -@@ -719,15 +_,15 @@ +@@ -721,15 +_,15 @@ } } @@ -68,18 +68,18 @@ this.setSprinting(false); } } else if (flag8) { -@@ -736,7 +_,7 @@ +@@ -738,7 +_,7 @@ } boolean flag9 = false; -- if (this.getAbilities().mayfly) { +- if (abilities.mayfly) { + if (this.mayFly()) { if (this.minecraft.gameMode.isAlwaysFlying()) { - if (!this.getAbilities().flying) { - this.getAbilities().flying = true; -@@ -757,14 +_,15 @@ + if (!abilities.flying) { + abilities.flying = true; +@@ -763,14 +_,15 @@ - if (this.input.jumping && !flag9 && !flag && !this.getAbilities().flying && !this.isPassenger() && !this.onClimbable()) { + if (this.input.jumping && !flag9 && !flag && !abilities.flying && !this.isPassenger() && !this.onClimbable()) { ItemStack itemstack = this.getItemBySlot(EquipmentSlot.CHEST); - if (itemstack.is(Items.ELYTRA) && ElytraItem.isFlyEnabled(itemstack) && this.tryToStartFallFlying()) { + if (itemstack.canElytraFly(this) && this.tryToStartFallFlying()) { @@ -96,15 +96,15 @@ } if (this.isEyeInFluid(FluidTags.WATER)) { -@@ -866,6 +_,7 @@ +@@ -872,6 +_,7 @@ @Override public void rideTick() { super.rideTick(); + if (this.wantsToStopRiding() && this.isPassenger()) this.input.shiftKeyDown = false; this.handsBusy = false; - Entity entity = this.getControlledVehicle(); - if (entity instanceof Boat boat) { -@@ -1053,7 +_,7 @@ + if (this.getControlledVehicle() instanceof Boat boat) { + boat.setInput(this.input.left, this.input.right, this.input.up, this.input.down); +@@ -1058,7 +_,7 @@ } private boolean hasEnoughFoodToStartSprinting() { diff --git a/patches/net/minecraft/client/player/RemotePlayer.java.patch b/patches/net/minecraft/client/player/RemotePlayer.java.patch index e9cd84229e6..afa4ad0f6c9 100644 --- a/patches/net/minecraft/client/player/RemotePlayer.java.patch +++ b/patches/net/minecraft/client/player/RemotePlayer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/player/RemotePlayer.java +++ b/net/minecraft/client/player/RemotePlayer.java -@@ -34,6 +_,7 @@ +@@ -33,6 +_,7 @@ @Override public boolean hurt(DamageSource p_108772_, float p_108773_) { diff --git a/patches/net/minecraft/client/renderer/EffectInstance.java.patch b/patches/net/minecraft/client/renderer/EffectInstance.java.patch index 05d55d24bbb..f6e93568763 100644 --- a/patches/net/minecraft/client/renderer/EffectInstance.java.patch +++ b/patches/net/minecraft/client/renderer/EffectInstance.java.patch @@ -3,12 +3,12 @@ @@ -58,7 +_,8 @@ private final EffectProgram fragmentProgram; - public EffectInstance(ResourceManager p_108941_, String p_108942_) throws IOException { + public EffectInstance(ResourceProvider p_331011_, String p_108942_) throws IOException { - ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_108942_ + ".json"); + ResourceLocation rl = ResourceLocation.tryParse(p_108942_); + ResourceLocation resourcelocation = new ResourceLocation(rl.getNamespace(), "shaders/program/" + rl.getPath() + ".json"); this.name = p_108942_; - Resource resource = p_108941_.getResourceOrThrow(resourcelocation); + Resource resource = p_331011_.getResourceOrThrow(resourcelocation); @@ -150,7 +_,8 @@ } else { @@ -17,6 +17,6 @@ - ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_172569_ + p_172568_.getExtension()); + ResourceLocation rl = ResourceLocation.tryParse(p_172569_); + ResourceLocation resourcelocation = new ResourceLocation(rl.getNamespace(), "shaders/program/" + rl.getPath() + p_172568_.getExtension()); - Resource resource = p_172567_.getResourceOrThrow(resourcelocation); + Resource resource = p_330579_.getResourceOrThrow(resourcelocation); try (InputStream inputstream = resource.open()) { diff --git a/patches/net/minecraft/client/renderer/GameRenderer.java.patch b/patches/net/minecraft/client/renderer/GameRenderer.java.patch index 2251fc4cbf8..68dc3755c14 100644 --- a/patches/net/minecraft/client/renderer/GameRenderer.java.patch +++ b/patches/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 -@@ -334,6 +_,8 @@ +@@ -310,6 +_,8 @@ this.loadEffect(new ResourceLocation("shaders/post/spider.json")); } else if (p_109107_ instanceof EnderMan) { this.loadEffect(new ResourceLocation("shaders/post/invert.json")); @@ -9,51 +9,15 @@ } } -@@ -759,6 +_,7 @@ - p_311462_ -> rendertypeBreezeWindShader = p_311462_ +@@ -735,6 +_,7 @@ ) ); -+ net.neoforged.fml.ModLoader.get().postEvent(new net.neoforged.neoforge.client.event.RegisterShadersEvent(p_250719_, list1)); + this.loadBlurEffect(p_250719_); ++ net.neoforged.fml.ModLoader.postEvent(new net.neoforged.neoforge.client.event.RegisterShadersEvent(p_250719_, list1)); } catch (IOException ioexception) { list1.forEach(p_172729_ -> p_172729_.getFirst().close()); throw new RuntimeException("could not reload shaders", ioexception); -@@ -834,12 +_,25 @@ - this.minecraft.getProfiler().push("pick"); - this.minecraft.crosshairPickEntity = null; - double d0 = (double)this.minecraft.gameMode.getPickRange(); -+ double entityReach = this.minecraft.player.getEntityReach(); // Note - MC-76493 - We must validate players cannot click-through objects. -+ d0 = Math.max(d0, entityReach); // Calculate hit results with the max of both reach distances, and compare against the individual ones later. This prevents click-through. - this.minecraft.hitResult = entity.pick(d0, p_109088_, false); - Vec3 vec3 = entity.getEyePosition(p_109088_); -+ if (false) { // These flags are unused with attributes. - boolean flag = this.minecraft.gameMode.hasFarPickRange(); - d0 = flag ? 6.0 : d0; - boolean flag1 = !flag; -- double d1 = this.minecraft.hitResult != null ? this.minecraft.hitResult.getLocation().distanceToSqr(vec3) : d0 * d0; -+ } -+ // If we picked a block, we need to ignore entities past that block. Added != MISS check to not truncate on failed picks. -+ // Also fixes MC-250858 -+ // Note: If vanilla ever actually fixes MC-250858 and adds this != MISS check, IPlayerExtension#getEntityReach needs to be updated from +2 to +3. -+ double d1 = this.minecraft.hitResult != null && this.minecraft.hitResult.getType() != HitResult.Type.MISS ? this.minecraft.hitResult.getLocation().distanceToSqr(vec3) : d0 * d0; -+ double blockReach = this.minecraft.player.getBlockReach(); -+ // Discard the block pick result as a miss if it is outside the block reach. -+ if (d1 > blockReach * blockReach) { -+ Vec3 pos = this.minecraft.hitResult.getLocation(); -+ this.minecraft.hitResult = BlockHitResult.miss(pos, Direction.getNearest(vec3.x, vec3.y, vec3.z), BlockPos.containing(pos)); -+ } - Vec3 vec31 = entity.getViewVector(1.0F); - Vec3 vec32 = vec3.add(vec31.x * d0, vec31.y * d0, vec31.z * d0); - float f = 1.0F; -@@ -850,7 +_,7 @@ - if (entityhitresult != null) { - Vec3 vec33 = entityhitresult.getLocation(); - double d2 = vec3.distanceToSqr(vec33); -- if (flag1 && d2 > 9.0) { -+ if (d2 > d1 || d2 > entityReach * entityReach) { // Discard if the result is behind a block, or past the entity reach max. The var "flag" no longer has a use. - this.minecraft.hitResult = BlockHitResult.miss(vec33, Direction.getNearest(vec31.x, vec31.y, vec31.z), BlockPos.containing(vec33)); - } else if (d2 < d1 || this.minecraft.hitResult == null) { - this.minecraft.hitResult = entityhitresult; -@@ -902,7 +_,7 @@ +@@ -893,7 +_,7 @@ d0 *= Mth.lerp(this.minecraft.options.fovEffectScale().get(), 1.0, 0.85714287F); } @@ -62,7 +26,7 @@ } } -@@ -919,6 +_,10 @@ +@@ -909,6 +_,10 @@ return; } @@ -70,10 +34,10 @@ + var lastSrc = livingentity.getLastDamageSource(); + if (lastSrc != null && lastSrc.is(net.neoforged.neoforge.common.Tags.DamageTypes.NO_FLINCH)) return; + - float f3 = f2 / (float)livingentity.hurtDuration; - float f4 = Mth.sin(f3 * f3 * f3 * f3 * (float) Math.PI); - float f5 = livingentity.getHurtDir(); -@@ -1074,13 +_,13 @@ + f2 /= (float)livingentity.hurtDuration; + f2 = Mth.sin(f2 * f2 * f2 * f2 * (float) Math.PI); + float f3 = livingentity.getHurtDir(); +@@ -1058,12 +_,12 @@ (float)((double)window.getHeight() / window.getGuiScale()), 0.0F, 1000.0F, @@ -81,15 +45,14 @@ + net.neoforged.neoforge.client.ClientHooks.getGuiFarPlane() ); RenderSystem.setProjectionMatrix(matrix4f, VertexSorting.ORTHOGRAPHIC_Z); - PoseStack posestack = RenderSystem.getModelViewStack(); - posestack.pushPose(); - posestack.setIdentity(); -- posestack.translate(0.0F, 0.0F, -11000.0F); -+ posestack.translate(0.0D, 0.0D, 10000F - net.neoforged.neoforge.client.ClientHooks.getGuiFarPlane()); + Matrix4fStack matrix4fstack = RenderSystem.getModelViewStack(); + matrix4fstack.pushMatrix(); +- matrix4fstack.translation(0.0F, 0.0F, -11000.0F); ++ matrix4fstack.translation(0.0F, 0.0F, 10000F - net.neoforged.neoforge.client.ClientHooks.getGuiFarPlane()); RenderSystem.applyModelViewMatrix(); Lighting.setupFor3DItems(); GuiGraphics guigraphics = new GuiGraphics(this.minecraft, this.renderBuffers.bufferSource()); -@@ -1114,7 +_,7 @@ +@@ -1097,7 +_,7 @@ } } else if (flag && this.minecraft.screen != null) { try { @@ -98,22 +61,21 @@ } catch (Throwable throwable1) { CrashReport crashreport1 = CrashReport.forThrowable(throwable1, "Rendering screen"); CrashReportCategory crashreportcategory1 = crashreport1.addCategory("Screen render details"); -@@ -1289,6 +_,9 @@ +@@ -1273,12 +_,16 @@ + } - Matrix4f matrix4f = posestack.last().pose(); this.resetProjectionMatrix(matrix4f); + net.neoforged.neoforge.client.event.ViewportEvent.ComputeCameraAngles cameraSetup = net.neoforged.neoforge.client.ClientHooks.onCameraSetup(this, camera, p_109090_); + camera.setAnglesInternal(cameraSetup.getYaw(), cameraSetup.getPitch()); -+ p_109092_.mulPose(Axis.ZP.rotationDegrees(cameraSetup.getRoll())); - p_109092_.mulPose(Axis.XP.rotationDegrees(camera.getXRot())); - p_109092_.mulPose(Axis.YP.rotationDegrees(camera.getYRot() + 180.0F)); - Matrix3f matrix3f = new Matrix3f(p_109092_.last().normal()).invert(); -@@ -1297,6 +_,8 @@ + Matrix4f matrix4f1 = new Matrix4f() +- .rotationXYZ(camera.getXRot() * (float) (Math.PI / 180.0), camera.getYRot() * (float) (Math.PI / 180.0) + (float) Math.PI, 0.0F); ++ .rotationXYZ(camera.getXRot() * (float) (Math.PI / 180.0), camera.getYRot() * (float) (Math.PI / 180.0) + (float) Math.PI, cameraSetup.getRoll() * (float) (Math.PI / 180.0)); + this.minecraft .levelRenderer - .prepareCullFrustum(p_109092_, camera.getPosition(), this.getProjectionMatrix(Math.max(d0, (double)this.minecraft.options.fov().get().intValue()))); - this.minecraft.levelRenderer.renderLevel(p_109092_, p_109090_, p_109091_, flag, camera, this, this.lightTexture, matrix4f); -+ this.minecraft.getProfiler().popPush("forge_render_last"); -+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_LEVEL, this.minecraft.levelRenderer, p_109092_, matrix4f, this.minecraft.levelRenderer.getTicks(), camera, this.minecraft.levelRenderer.getFrustum()); + .prepareCullFrustum(camera.getPosition(), matrix4f1, this.getProjectionMatrix(Math.max(d0, (double)this.minecraft.options.fov().get().intValue()))); + this.minecraft.levelRenderer.renderLevel(p_109090_, p_109091_, flag, camera, this, this.lightTexture, matrix4f1, matrix4f); ++ this.minecraft.getProfiler().popPush("neoforge_render_last"); ++ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_LEVEL, this.minecraft.levelRenderer, null, matrix4f1, matrix4f, this.minecraft.levelRenderer.getTicks(), camera, this.minecraft.levelRenderer.getFrustum()); this.minecraft.getProfiler().popPush("hand"); if (this.renderHand) { RenderSystem.clear(256, Minecraft.ON_OSX); diff --git a/patches/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch b/patches/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch index 99cf45c6bd7..8d7a25e7ae2 100644 --- a/patches/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch +++ b/patches/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch @@ -5,18 +5,18 @@ @OnlyIn(Dist.CLIENT) public class ItemBlockRenderTypes { + @Deprecated - private static final Map TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_311463_ -> { + private static final Map TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_323062_ -> { RenderType rendertype = RenderType.tripwire(); - p_311463_.put(Blocks.TRIPWIRE, rendertype); -@@ -335,6 +_,7 @@ - p_311463_.put(Blocks.BUBBLE_COLUMN, rendertype3); - p_311463_.put(Blocks.TINTED_GLASS, rendertype3); + p_323062_.put(Blocks.TRIPWIRE, rendertype); +@@ -336,6 +_,7 @@ + p_323062_.put(Blocks.BUBBLE_COLUMN, rendertype3); + p_323062_.put(Blocks.TINTED_GLASS, rendertype3); }); + @Deprecated private static final Map TYPE_BY_FLUID = Util.make(Maps.newHashMap(), p_109290_ -> { RenderType rendertype = RenderType.translucent(); p_109290_.put(Fluids.FLOWING_WATER, rendertype); -@@ -342,6 +_,8 @@ +@@ -343,6 +_,8 @@ }); private static boolean renderCutout; @@ -25,7 +25,7 @@ public static RenderType getChunkRenderType(BlockState p_109283_) { Block block = p_109283_.getBlock(); if (block instanceof LeavesBlock) { -@@ -352,6 +_,8 @@ +@@ -353,6 +_,8 @@ } } @@ -34,7 +34,7 @@ public static RenderType getMovingBlockRenderType(BlockState p_109294_) { Block block = p_109294_.getBlock(); if (block instanceof LeavesBlock) { -@@ -366,6 +_,8 @@ +@@ -367,6 +_,8 @@ } } @@ -43,7 +43,7 @@ public static RenderType getRenderType(BlockState p_109285_, boolean p_109286_) { RenderType rendertype = getChunkRenderType(p_109285_); if (rendertype == RenderType.translucent()) { -@@ -379,6 +_,8 @@ +@@ -380,6 +_,8 @@ } } @@ -52,7 +52,7 @@ public static RenderType getRenderType(ItemStack p_109280_, boolean p_109281_) { Item item = p_109280_.getItem(); if (item instanceof BlockItem) { -@@ -392,6 +_,67 @@ +@@ -393,6 +_,67 @@ public static RenderType getRenderLayer(FluidState p_109288_) { RenderType rendertype = TYPE_BY_FLUID.get(p_109288_.getType()); return rendertype != null ? rendertype : RenderType.solid(); diff --git a/patches/net/minecraft/client/renderer/ItemInHandRenderer.java.patch b/patches/net/minecraft/client/renderer/ItemInHandRenderer.java.patch index dc20cc69a18..ac3643b3fd9 100644 --- a/patches/net/minecraft/client/renderer/ItemInHandRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/ItemInHandRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/ItemInHandRenderer.java +++ b/net/minecraft/client/renderer/ItemInHandRenderer.java -@@ -329,12 +_,14 @@ +@@ -331,12 +_,14 @@ if (iteminhandrenderer$handrenderselection.renderMainHand) { float f4 = interactionhand == InteractionHand.MAIN_HAND ? f : 0.0F; float f5 = 1.0F - Mth.lerp(p_109315_, this.oMainHandHeight, this.mainHandHeight); @@ -15,7 +15,7 @@ this.renderArmWithItem(p_109318_, p_109315_, f1, InteractionHand.OFF_HAND, f6, this.offHandItem, f7, p_109316_, p_109317_, p_109319_); } -@@ -400,7 +_,7 @@ +@@ -402,7 +_,7 @@ } else { this.renderOneHandedMap(p_109379_, p_109380_, p_109381_, p_109378_, humanoidarm, p_109376_, p_109377_); } @@ -24,20 +24,20 @@ boolean flag1 = CrossbowItem.isCharged(p_109377_); boolean flag2 = humanoidarm == HumanoidArm.RIGHT; int i = flag2 ? 1 : -1; -@@ -450,6 +_,7 @@ +@@ -452,6 +_,7 @@ ); } else { boolean flag3 = humanoidarm == HumanoidArm.RIGHT; + if (!net.neoforged.neoforge.client.extensions.common.IClientItemExtensions.of(p_109377_).applyForgeHandTransform(p_109379_, minecraft.player, humanoidarm, p_109377_, p_109373_, p_109378_, p_109376_)) // FORGE: Allow items to define custom arm animation if (p_109372_.isUsingItem() && p_109372_.getUseItemRemainingTicks() > 0 && p_109372_.getUsedItemHand() == p_109375_) { int k = flag3 ? 1 : -1; - switch(p_109377_.getUseAnimation()) { -@@ -564,8 +_,16 @@ + switch (p_109377_.getUseAnimation()) { +@@ -566,8 +_,16 @@ this.offHandHeight = Mth.clamp(this.offHandHeight - 0.4F, 0.0F, 1.0F); } else { float f = localplayer.getAttackStrengthScale(1.0F); -- this.mainHandHeight += Mth.clamp((this.mainHandItem == itemstack ? f * f * f : 0.0F) - this.mainHandHeight, -0.4F, 0.4F); -- this.offHandHeight += Mth.clamp((float)(this.offHandItem == itemstack1 ? 1 : 0) - this.offHandHeight, -0.4F, 0.4F); +- this.mainHandHeight = this.mainHandHeight + Mth.clamp((this.mainHandItem == itemstack ? f * f * f : 0.0F) - this.mainHandHeight, -0.4F, 0.4F); +- this.offHandHeight = this.offHandHeight + Mth.clamp((float)(this.offHandItem == itemstack1 ? 1 : 0) - this.offHandHeight, -0.4F, 0.4F); + boolean requipM = net.neoforged.neoforge.client.ClientHooks.shouldCauseReequipAnimation(this.mainHandItem, itemstack, localplayer.getInventory().selected); + boolean requipO = net.neoforged.neoforge.client.ClientHooks.shouldCauseReequipAnimation(this.offHandItem, itemstack1, -1); + diff --git a/patches/net/minecraft/client/renderer/LevelRenderer.java.patch b/patches/net/minecraft/client/renderer/LevelRenderer.java.patch index bf24207d334..6a5e2a5737c 100644 --- a/patches/net/minecraft/client/renderer/LevelRenderer.java.patch +++ b/patches/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 -@@ -249,6 +_,8 @@ +@@ -251,6 +_,8 @@ } private void renderSnowAndRain(LightTexture p_109704_, float p_109705_, double p_109706_, double p_109707_, double p_109708_) { @@ -9,7 +9,7 @@ float f = this.minecraft.level.getRainLevel(p_109705_); if (!(f <= 0.0F)) { p_109704_.turnOnLightLayer(); -@@ -403,6 +_,8 @@ +@@ -405,6 +_,8 @@ } public void tickRain(Camera p_109694_) { @@ -18,29 +18,29 @@ float f = this.minecraft.level.getRainLevel(1.0F) / (Minecraft.useFancyGraphics() ? 1.0F : 2.0F); if (!(f <= 0.0F)) { RandomSource randomsource = RandomSource.create((long)this.ticks * 312987231L); -@@ -969,9 +_,11 @@ +@@ -966,9 +_,11 @@ RenderSystem.clear(16640, Minecraft.ON_OSX); float f1 = p_109605_.getRenderDistance(); boolean flag1 = this.minecraft.level.effects().isFoggyAt(Mth.floor(d0), Mth.floor(d1)) || this.minecraft.gui.getBossOverlay().shouldCreateWorldFog(); + FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag1, p_109601_); profilerfiller.popPush("sky"); RenderSystem.setShader(GameRenderer::getPositionShader); - this.renderSky(p_109600_, p_254120_, f, p_109604_, flag1, () -> FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f1, flag1, f)); -+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_SKY, this, p_109600_, p_254120_, this.ticks, p_109604_, frustum); + this.renderSky(p_254120_, p_323920_, f, p_109604_, flag1, () -> FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f1, flag1, f)); ++ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_SKY, this, null, p_254120_, p_323920_, this.ticks, p_109604_, frustum); profilerfiller.popPush("fog"); FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_TERRAIN, Math.max(f1, 32.0F), flag1, f); profilerfiller.popPush("terrain_setup"); -@@ -980,7 +_,9 @@ +@@ -977,7 +_,9 @@ this.compileSections(p_109604_); profilerfiller.popPush("terrain"); - this.renderSectionLayer(RenderType.solid(), p_109600_, d0, d1, d2, p_254120_); -+ this.minecraft.getModelManager().getAtlas(TextureAtlas.LOCATION_BLOCKS).setBlurMipmap(false, this.minecraft.options.mipmapLevels().get() > 0); // FORGE: fix flickering leaves when mods mess up the blurMipmap settings - this.renderSectionLayer(RenderType.cutoutMipped(), p_109600_, d0, d1, d2, p_254120_); + this.renderSectionLayer(RenderType.solid(), d0, d1, d2, p_254120_, p_323920_); ++ this.minecraft.getModelManager().getAtlas(TextureAtlas.LOCATION_BLOCKS).setBlurMipmap(false, this.minecraft.options.mipmapLevels().get() > 0); // Neo: fix flickering leaves when mods mess up the blurMipmap settings + this.renderSectionLayer(RenderType.cutoutMipped(), d0, d1, d2, p_254120_, p_323920_); + this.minecraft.getModelManager().getAtlas(TextureAtlas.LOCATION_BLOCKS).restoreLastBlurMipmap(); - this.renderSectionLayer(RenderType.cutout(), p_109600_, d0, d1, d2, p_254120_); + this.renderSectionLayer(RenderType.cutout(), d0, d1, d2, p_254120_, p_323920_); if (this.level.effects().constantAmbientLight()) { - Lighting.setupNetherLevel(p_109600_.last().pose()); -@@ -1034,6 +_,9 @@ + Lighting.setupNetherLevel(); +@@ -1036,6 +_,9 @@ int i = entity.getTeamColor(); outlinebuffersource.setColor(FastColor.ARGB32.red(i), FastColor.ARGB32.green(i), FastColor.ARGB32.blue(i), 255); } else { @@ -50,142 +50,142 @@ multibuffersource = multibuffersource$buffersource; } -@@ -1049,12 +_,14 @@ +@@ -1051,12 +_,14 @@ multibuffersource$buffersource.endBatch(RenderType.entityCutout(TextureAtlas.LOCATION_BLOCKS)); multibuffersource$buffersource.endBatch(RenderType.entityCutoutNoCull(TextureAtlas.LOCATION_BLOCKS)); multibuffersource$buffersource.endBatch(RenderType.entitySmoothCutout(TextureAtlas.LOCATION_BLOCKS)); -+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_ENTITIES, this, p_109600_, p_254120_, this.ticks, p_109604_, frustum); ++ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_ENTITIES, this, posestack, p_254120_, p_323920_, this.ticks, p_109604_, frustum); profilerfiller.popPush("blockentities"); - for(SectionRenderDispatcher.RenderSection sectionrenderdispatcher$rendersection : this.visibleSections) { + for (SectionRenderDispatcher.RenderSection sectionrenderdispatcher$rendersection : this.visibleSections) { List list = sectionrenderdispatcher$rendersection.getCompiled().getRenderableBlockEntities(); if (!list.isEmpty()) { - for(BlockEntity blockentity1 : list) { + for (BlockEntity blockentity1 : list) { + if (!net.neoforged.neoforge.client.ClientHooks.isBlockEntityRendererVisible(blockEntityRenderDispatcher, blockentity1, frustum)) continue; BlockPos blockpos4 = blockentity1.getBlockPos(); MultiBufferSource multibuffersource1 = multibuffersource$buffersource; - p_109600_.pushPose(); -@@ -1076,6 +_,9 @@ + posestack.pushPose(); +@@ -1075,6 +_,9 @@ }; } } -+ if (this.shouldShowEntityOutlines() && blockentity1.hasCustomOutlineRendering(this.minecraft.player)) { // FORGE: allow custom outline rendering ++ if (this.shouldShowEntityOutlines() && blockentity1.hasCustomOutlineRendering(this.minecraft.player)) { // Neo: allow custom outline rendering + flag2 = true; + } - this.blockEntityRenderDispatcher.render(blockentity1, f, p_109600_, multibuffersource1); - p_109600_.popPose(); -@@ -1085,9 +_,13 @@ + this.blockEntityRenderDispatcher.render(blockentity1, f, posestack, multibuffersource1); + posestack.popPose(); +@@ -1084,9 +_,13 @@ - synchronized(this.globalBlockEntities) { - for(BlockEntity blockentity : this.globalBlockEntities) { + synchronized (this.globalBlockEntities) { + for (BlockEntity blockentity : this.globalBlockEntities) { + if (!net.neoforged.neoforge.client.ClientHooks.isBlockEntityRendererVisible(blockEntityRenderDispatcher, blockentity, frustum)) continue; BlockPos blockpos3 = blockentity.getBlockPos(); - p_109600_.pushPose(); - p_109600_.translate((double)blockpos3.getX() - d0, (double)blockpos3.getY() - d1, (double)blockpos3.getZ() - d2); -+ if (this.shouldShowEntityOutlines() && blockentity.hasCustomOutlineRendering(this.minecraft.player)) { // FORGE: allow custom outline rendering + posestack.pushPose(); + posestack.translate((double)blockpos3.getX() - d0, (double)blockpos3.getY() - d1, (double)blockpos3.getZ() - d2); ++ if (this.shouldShowEntityOutlines() && blockentity.hasCustomOutlineRendering(this.minecraft.player)) { // Neo: allow custom outline rendering + flag2 = true; + } - this.blockEntityRenderDispatcher.render(blockentity, f, p_109600_, multibuffersource$buffersource); - p_109600_.popPose(); + this.blockEntityRenderDispatcher.render(blockentity, f, posestack, multibuffersource$buffersource); + posestack.popPose(); } -@@ -1110,6 +_,7 @@ +@@ -1109,6 +_,7 @@ this.minecraft.getMainRenderTarget().bindWrite(false); } -+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_BLOCK_ENTITIES, this, p_109600_, p_254120_, this.ticks, p_109604_, frustum); ++ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_BLOCK_ENTITIES, this, posestack, p_254120_, p_323920_, this.ticks, p_109604_, frustum); profilerfiller.popPush("destroyProgress"); - for(Entry> entry : this.destructionProgress.long2ObjectEntrySet()) { -@@ -1130,9 +_,10 @@ - posestack$pose1.normal(), - 1.0F + for (Entry> entry : this.destructionProgress.long2ObjectEntrySet()) { +@@ -1126,9 +_,10 @@ + VertexConsumer vertexconsumer1 = new SheetedDecalTextureGenerator( + this.renderBuffers.crumblingBufferSource().getBuffer(ModelBakery.DESTROY_TYPES.get(k)), posestack$pose1, 1.0F ); -+ net.neoforged.neoforge.client.model.data.ModelData modelData = level.getModelDataManager().getAtOrEmpty(blockpos2); ++ net.neoforged.neoforge.client.model.data.ModelData modelData = level.getModelData(blockpos2); this.minecraft .getBlockRenderer() -- .renderBreakingTexture(this.level.getBlockState(blockpos2), blockpos2, this.level, p_109600_, vertexconsumer1); -+ .renderBreakingTexture(this.level.getBlockState(blockpos2), blockpos2, this.level, p_109600_, vertexconsumer1, modelData); - p_109600_.popPose(); +- .renderBreakingTexture(this.level.getBlockState(blockpos2), blockpos2, this.level, posestack, vertexconsumer1); ++ .renderBreakingTexture(this.level.getBlockState(blockpos2), blockpos2, this.level, posestack, vertexconsumer1, modelData); + posestack.popPose(); } } -@@ -1144,10 +_,13 @@ +@@ -1140,10 +_,13 @@ profilerfiller.popPush("outline"); BlockPos blockpos1 = ((BlockHitResult)hitresult).getBlockPos(); BlockState blockstate = this.level.getBlockState(blockpos1); -+ if (!net.neoforged.neoforge.client.ClientHooks.onDrawHighlight(this, p_109604_, hitresult, p_109601_, p_109600_, multibuffersource$buffersource)) ++ if (!net.neoforged.neoforge.client.ClientHooks.onDrawHighlight(this, p_109604_, hitresult, p_109601_, posestack, multibuffersource$buffersource)) if (!blockstate.isAir() && this.level.getWorldBorder().isWithinBounds(blockpos1)) { VertexConsumer vertexconsumer2 = multibuffersource$buffersource.getBuffer(RenderType.lines()); - this.renderHitOutline(p_109600_, vertexconsumer2, p_109604_.getEntity(), d0, d1, d2, blockpos1, blockstate); + this.renderHitOutline(posestack, vertexconsumer2, p_109604_.getEntity(), d0, d1, d2, blockpos1, blockstate); } + } else if (hitresult != null && hitresult.getType() == HitResult.Type.ENTITY) { -+ net.neoforged.neoforge.client.ClientHooks.onDrawHighlight(this, p_109604_, hitresult, p_109601_, p_109600_, multibuffersource$buffersource); ++ net.neoforged.neoforge.client.ClientHooks.onDrawHighlight(this, p_109604_, hitresult, p_109601_, posestack, multibuffersource$buffersource); } - this.minecraft.debugRenderer.render(p_109600_, multibuffersource$buffersource, d0, d1, d2); -@@ -1179,7 +_,8 @@ + this.minecraft.debugRenderer.render(posestack, multibuffersource$buffersource, d0, d1, d2); +@@ -1173,7 +_,8 @@ this.particlesTarget.copyDepthFrom(this.minecraft.getMainRenderTarget()); RenderStateShard.PARTICLES_TARGET.setupRenderState(); profilerfiller.popPush("particles"); -- this.minecraft.particleEngine.render(p_109600_, multibuffersource$buffersource, p_109606_, p_109604_, f); -+ this.minecraft.particleEngine.render(p_109600_, multibuffersource$buffersource, p_109606_, p_109604_, f, frustum); -+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES, this, p_109600_, p_254120_, this.ticks, p_109604_, frustum); +- this.minecraft.particleEngine.render(p_109606_, p_109604_, f); ++ this.minecraft.particleEngine.render(p_109606_, p_109604_, f, frustum); ++ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES, this, posestack, p_254120_, p_323920_, this.ticks, p_109604_, frustum); RenderStateShard.PARTICLES_TARGET.clearRenderState(); } else { profilerfiller.popPush("translucent"); -@@ -1193,7 +_,8 @@ +@@ -1187,7 +_,8 @@ profilerfiller.popPush("string"); - this.renderSectionLayer(RenderType.tripwire(), p_109600_, d0, d1, d2, p_254120_); + this.renderSectionLayer(RenderType.tripwire(), d0, d1, d2, p_254120_, p_323920_); profilerfiller.popPush("particles"); -- this.minecraft.particleEngine.render(p_109600_, multibuffersource$buffersource, p_109606_, p_109604_, f); -+ this.minecraft.particleEngine.render(p_109600_, multibuffersource$buffersource, p_109606_, p_109604_, f, frustum); -+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES, this, p_109600_, p_254120_, this.ticks, p_109604_, frustum); +- this.minecraft.particleEngine.render(p_109606_, p_109604_, f); ++ this.minecraft.particleEngine.render(p_109606_, p_109604_, f, frustum); ++ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES, this, posestack, p_254120_, p_323920_, this.ticks, p_109604_, frustum); } - posestack.pushPose(); -@@ -1217,6 +_,7 @@ + if (this.minecraft.options.getCloudsType() != CloudStatus.OFF) { +@@ -1203,6 +_,7 @@ RenderStateShard.WEATHER_TARGET.setupRenderState(); profilerfiller.popPush("weather"); this.renderSnowAndRain(p_109606_, f, d0, d1, d2); -+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_WEATHER, this, p_109600_, p_254120_, this.ticks, p_109604_, frustum); ++ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_WEATHER, this, posestack, p_254120_, p_323920_, this.ticks, p_109604_, frustum); this.renderWorldBorder(p_109604_); RenderStateShard.WEATHER_TARGET.clearRenderState(); this.transparencyChain.process(f); -@@ -1225,6 +_,7 @@ +@@ -1211,6 +_,7 @@ RenderSystem.depthMask(false); profilerfiller.popPush("weather"); this.renderSnowAndRain(p_109606_, f, d0, d1, d2); -+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_WEATHER, this, p_109600_, p_254120_, this.ticks, p_109604_, frustum); ++ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(net.neoforged.neoforge.client.event.RenderLevelStageEvent.Stage.AFTER_WEATHER, this, posestack, p_254120_, p_323920_, this.ticks, p_109604_, frustum); this.renderWorldBorder(p_109604_); RenderSystem.depthMask(true); } -@@ -1379,6 +_,7 @@ +@@ -1365,6 +_,7 @@ shaderinstance.clear(); VertexBuffer.unbind(); this.minecraft.getProfiler().pop(); -+ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(p_294513_, this, p_294924_, p_294782_, this.ticks, this.minecraft.gameRenderer.getMainCamera(), this.getFrustum()); ++ net.neoforged.neoforge.client.ClientHooks.dispatchRenderStage(p_294513_, this, p_294782_, p_324517_, this.ticks, this.minecraft.gameRenderer.getMainCamera(), this.getFrustum()); p_294513_.clearRenderState(); } -@@ -1639,6 +_,8 @@ +@@ -1625,6 +_,8 @@ } - public void renderSky(PoseStack p_202424_, Matrix4f p_254034_, float p_202426_, Camera p_202427_, boolean p_202428_, Runnable p_202429_) { -+ if (level.effects().renderSky(level, ticks, p_202426_, p_202424_, p_202427_, p_254034_, p_202428_, p_202429_)) + public void renderSky(Matrix4f p_254034_, Matrix4f p_324386_, float p_202426_, Camera p_202427_, boolean p_202428_, Runnable p_202429_) { ++ if (level.effects().renderSky(level, ticks, p_202426_, p_254034_, p_202427_, p_324386_, p_202428_, p_202429_)) + return; p_202429_.run(); if (!p_202428_) { FogType fogtype = p_202427_.getFluidInCamera(); -@@ -1765,6 +_,8 @@ +@@ -1749,6 +_,8 @@ } - public void renderClouds(PoseStack p_254145_, Matrix4f p_254537_, float p_254364_, double p_253843_, double p_253663_, double p_253795_) { -+ if (level.effects().renderClouds(level, ticks, p_254364_, p_254145_, p_253843_, p_253663_, p_253795_, p_254537_)) + public void renderClouds(PoseStack p_254145_, Matrix4f p_254537_, Matrix4f p_324366_, float p_254364_, double p_253843_, double p_253663_, double p_253795_) { ++ if (level.effects().renderClouds(level, ticks, p_254364_, p_254145_, p_253843_, p_253663_, p_253795_, p_254537_, p_324366_)) + return; float f = this.level.effects().getCloudHeight(); if (!Float.isNaN(f)) { - RenderSystem.disableCull(); -@@ -2585,7 +_,32 @@ + float f1 = 12.0F; +@@ -2545,7 +_,32 @@ this.viewArea.setDirty(p_109502_, p_109503_, p_109504_, p_109505_); } @@ -218,7 +218,7 @@ SoundInstance soundinstance = this.playingRecords.get(p_109516_); if (soundinstance != null) { this.minecraft.getSoundManager().stop(soundinstance); -@@ -2593,7 +_,7 @@ +@@ -2553,7 +_,7 @@ } if (p_109515_ != null) { @@ -227,16 +227,16 @@ if (recorditem != null) { this.minecraft.gui.setNowPlaying(recorditem.getDisplayName()); } -@@ -2784,7 +_,7 @@ +@@ -2746,7 +_,7 @@ + break; case 1010: - Item item = Item.byId(p_234307_); - if (item instanceof RecordItem recorditem) { + if (Item.byId(p_234307_) instanceof RecordItem recorditem) { - this.playStreamingMusic(recorditem.getSound(), p_234306_); + this.playStreamingMusic(recorditem.getSound(), p_234306_, recorditem); } break; case 1011: -@@ -3090,8 +_,8 @@ +@@ -3052,8 +_,8 @@ break; case 2001: BlockState blockstate1 = Block.stateById(p_234307_); @@ -247,7 +247,7 @@ this.level .playLocalSound( p_234306_, soundtype.getBreakSound(), SoundSource.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F, false -@@ -3477,7 +_,7 @@ +@@ -3542,7 +_,7 @@ } else { int i = p_109538_.getBrightness(LightLayer.SKY, p_109540_); int j = p_109538_.getBrightness(LightLayer.BLOCK, p_109540_); diff --git a/patches/net/minecraft/client/renderer/LightTexture.java.patch b/patches/net/minecraft/client/renderer/LightTexture.java.patch index 904ae21ff72..72db3bdff61 100644 --- a/patches/net/minecraft/client/renderer/LightTexture.java.patch +++ b/patches/net/minecraft/client/renderer/LightTexture.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/LightTexture.java +++ b/net/minecraft/client/renderer/LightTexture.java -@@ -135,6 +_,8 @@ +@@ -129,6 +_,8 @@ } } @@ -9,7 +9,7 @@ if (f5 > 0.0F) { float f13 = Math.max(vector3f1.x(), Math.max(vector3f1.y(), vector3f1.z())); if (f13 < 1.0F) { -@@ -192,7 +_,7 @@ +@@ -186,7 +_,7 @@ } public static int block(int p_109884_) { diff --git a/patches/net/minecraft/client/renderer/PostChain.java.patch b/patches/net/minecraft/client/renderer/PostChain.java.patch index f57df3bce1d..d48800b6ebd 100644 --- a/patches/net/minecraft/client/renderer/PostChain.java.patch +++ b/patches/net/minecraft/client/renderer/PostChain.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/client/renderer/PostChain.java +++ b/net/minecraft/client/renderer/PostChain.java -@@ -155,7 +_,8 @@ +@@ -156,7 +_,8 @@ throw new ChainedJsonException("Render target '" + s4 + "' can't be used as depth buffer"); } - ResourceLocation resourcelocation = new ResourceLocation("textures/effect/" + s4 + ".png"); + ResourceLocation rl = ResourceLocation.tryParse(s4); + ResourceLocation resourcelocation = new ResourceLocation(rl.getNamespace(), "textures/effect/" + rl.getPath() + ".png"); - this.resourceManager + this.resourceProvider .getResource(resourcelocation) .orElseThrow(() -> new ChainedJsonException("Render target or texture '" + s4 + "' does not exist")); -@@ -256,6 +_,7 @@ +@@ -257,6 +_,7 @@ public void addTempTarget(String p_110039_, int p_110040_, int p_110041_) { RenderTarget rendertarget = new TextureTarget(p_110040_, p_110041_, true, Minecraft.ON_OSX); rendertarget.setClearColor(0.0F, 0.0F, 0.0F, 0.0F); diff --git a/patches/net/minecraft/client/renderer/RenderBuffers.java.patch b/patches/net/minecraft/client/renderer/RenderBuffers.java.patch index e3f79951f5c..7f0e742c9e1 100644 --- a/patches/net/minecraft/client/renderer/RenderBuffers.java.patch +++ b/patches/net/minecraft/client/renderer/RenderBuffers.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/renderer/RenderBuffers.java +++ b/net/minecraft/client/renderer/RenderBuffers.java @@ -39,6 +_,7 @@ - put(p_307112_, RenderType.waterMask()); + put((Object2ObjectLinkedOpenHashMap)p_307112_, RenderType.waterMask()); ModelBakery.DESTROY_TYPES.forEach(p_173062_ -> put(p_307112_, p_173062_)); }); -+ net.neoforged.fml.ModLoader.get().postEvent(new net.neoforged.neoforge.client.event.RegisterRenderBuffersEvent(sortedmap)); ++ net.neoforged.fml.ModLoader.postEvent(new net.neoforged.neoforge.client.event.RegisterRenderBuffersEvent(sortedmap)); this.crumblingBufferSource = MultiBufferSource.immediate(new BufferBuilder(1536)); this.bufferSource = MultiBufferSource.immediateWithBuffers(sortedmap, new BufferBuilder(786432)); this.outlineBufferSource = new OutlineBufferSource(this.bufferSource); diff --git a/patches/net/minecraft/client/renderer/RenderType.java.patch b/patches/net/minecraft/client/renderer/RenderType.java.patch index f4f8bf6b4ca..f8a092fa219 100644 --- a/patches/net/minecraft/client/renderer/RenderType.java.patch +++ b/patches/net/minecraft/client/renderer/RenderType.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/RenderType.java +++ b/net/minecraft/client/renderer/RenderType.java -@@ -970,7 +_,7 @@ +@@ -972,7 +_,7 @@ } public static RenderType text(ResourceLocation p_110498_) { @@ -9,7 +9,7 @@ } public static RenderType textBackground() { -@@ -978,19 +_,19 @@ +@@ -980,19 +_,19 @@ } public static RenderType textIntensity(ResourceLocation p_173238_) { @@ -33,7 +33,7 @@ } public static RenderType textBackgroundSeeThrough() { -@@ -998,7 +_,7 @@ +@@ -1000,7 +_,7 @@ } public static RenderType textIntensitySeeThrough(ResourceLocation p_173241_) { @@ -42,7 +42,7 @@ } public static RenderType lightning() { -@@ -1425,4 +_,17 @@ +@@ -1454,4 +_,17 @@ return this.name; } } diff --git a/patches/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch b/patches/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch index 7e62d562c00..c9e370e1215 100644 --- a/patches/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch @@ -37,7 +37,7 @@ + private static org.apache.commons.lang3.tuple.Pair getOverlayBlock(Player p_110717_) { BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); - for(int i = 0; i < 8; ++i) { + for (int i = 0; i < 8; i++) { @@ -58,7 +_,7 @@ blockpos$mutableblockpos.set(d0, d1, d2); BlockState blockstate = p_110717_.level().getBlockState(blockpos$mutableblockpos); diff --git a/patches/net/minecraft/client/renderer/ShaderInstance.java.patch b/patches/net/minecraft/client/renderer/ShaderInstance.java.patch index 5a9430c09c1..bd863abb721 100644 --- a/patches/net/minecraft/client/renderer/ShaderInstance.java.patch +++ b/patches/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 -@@ -98,10 +_,14 @@ +@@ -94,10 +_,14 @@ @Nullable public final Uniform CHUNK_OFFSET; @@ -17,7 +17,7 @@ try (Reader reader = p_173336_.openAsReader(resourcelocation)) { JsonObject jsonobject = GsonHelper.parse(reader); -@@ -208,8 +_,10 @@ +@@ -178,8 +_,10 @@ Program program1 = p_173342_.getPrograms().get(p_173343_); Program program; if (program1 == null) { @@ -30,7 +30,7 @@ try (InputStream inputstream = resource.open()) { final String s1 = FileUtil.getFullResourcePath(s); -@@ -218,11 +_,11 @@ +@@ -188,11 +_,11 @@ @Override public String applyImport(boolean p_173374_, String p_173375_) { @@ -45,7 +45,7 @@ try { String s2; -@@ -232,7 +_,8 @@ +@@ -202,7 +_,8 @@ return s2; } catch (IOException ioexception) { diff --git a/patches/net/minecraft/client/renderer/Sheets.java.patch b/patches/net/minecraft/client/renderer/Sheets.java.patch index 848152a2eb2..7674619faef 100644 --- a/patches/net/minecraft/client/renderer/Sheets.java.patch +++ b/patches/net/minecraft/client/renderer/Sheets.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/Sheets.java +++ b/net/minecraft/client/renderer/Sheets.java -@@ -172,11 +_,13 @@ +@@ -145,11 +_,13 @@ } private static Material createSignMaterial(WoodType p_173386_) { @@ -16,7 +16,7 @@ } public static Material getSignMaterial(WoodType p_173382_) { -@@ -237,6 +_,23 @@ +@@ -208,6 +_,23 @@ case SINGLE: default: return p_110773_; @@ -32,7 +32,7 @@ + } + + static { -+ if (net.neoforged.fml.ModLoader.isLoadingStateValid() && !net.neoforged.fml.ModLoader.get().hasCompletedState("LOAD_REGISTRIES")) { ++ if (net.neoforged.fml.ModLoader.isLoadingStateValid() && !net.neoforged.neoforge.internal.CommonModLoader.areRegistriesLoaded()) { + com.mojang.logging.LogUtils.getLogger().error( + "net.minecraft.client.renderer.Sheets loaded too early, modded registry-based materials may not work correctly", + new IllegalStateException("net.minecraft.client.renderer.Sheets loaded too early") diff --git a/patches/net/minecraft/client/renderer/block/BlockModelShaper.java.patch b/patches/net/minecraft/client/renderer/block/BlockModelShaper.java.patch index 2aae55e8f91..5d767ce41be 100644 --- a/patches/net/minecraft/client/renderer/block/BlockModelShaper.java.patch +++ b/patches/net/minecraft/client/renderer/block/BlockModelShaper.java.patch @@ -11,7 +11,7 @@ + } + + public TextureAtlasSprite getTexture(BlockState p_110883_, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) { -+ var data = level.getModelDataManager().getAtOrEmpty(pos); ++ var data = level.getModelData(pos); + BakedModel model = this.getBlockModel(p_110883_); + return model.getParticleIcon(model.getModelData(level, pos, p_110883_, data)); } diff --git a/patches/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch b/patches/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch index c2045b7daa6..5a277696bb1 100644 --- a/patches/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch +++ b/patches/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch @@ -78,7 +78,7 @@ + public void renderSingleBlock(BlockState p_110913_, PoseStack p_110914_, MultiBufferSource p_110915_, int p_110916_, int p_110917_, net.neoforged.neoforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType) { RenderShape rendershape = p_110913_.getRenderShape(); if (rendershape != RenderShape.INVISIBLE) { - switch(rendershape) { + switch (rendershape) { @@ -117,22 +_,25 @@ float f = (float)(i >> 16 & 0xFF) / 255.0F; float f1 = (float)(i >> 8 & 0xFF) / 255.0F; diff --git a/patches/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch b/patches/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch index eac90cab614..451d81cfeeb 100644 --- a/patches/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch @@ -80,7 +80,7 @@ ModelBlockRenderer.AmbientOcclusionFace modelblockrenderer$ambientocclusionface = new ModelBlockRenderer.AmbientOcclusionFace(); @@ -90,7 +_,7 @@ - for(Direction direction : DIRECTIONS) { + for (Direction direction : DIRECTIONS) { p_234398_.setSeed(p_234399_); - List list = p_234392_.getQuads(p_234393_, direction, p_234398_); + List list = p_234392_.getQuads(p_234393_, direction, p_234398_, modelData, renderType); @@ -127,7 +127,7 @@ BitSet bitset = new BitSet(3); BlockPos.MutableBlockPos blockpos$mutableblockpos = p_234405_.mutable(); - for(Direction direction : DIRECTIONS) { + for (Direction direction : DIRECTIONS) { p_234409_.setSeed(p_234410_); - List list = p_234403_.getQuads(p_234404_, direction, p_234409_); + List list = p_234403_.getQuads(p_234404_, direction, p_234409_, modelData, renderType); @@ -145,13 +145,13 @@ } @@ -158,6 +_,7 @@ ) { - for(BakedQuad bakedquad : p_111018_) { + for (BakedQuad bakedquad : p_111018_) { this.calculateShape(p_111013_, p_111014_, p_111015_, bakedquad.getVertices(), bakedquad.getDirection(), p_111019_, p_111020_); + if (!net.neoforged.neoforge.client.ClientHooks.calculateFaceWithoutAO(p_111013_, p_111014_, p_111015_, bakedquad, p_111020_.get(0), p_111021_.brightness, p_111021_.lightmap)) p_111021_.calculate(p_111013_, p_111014_, p_111015_, bakedquad.getDirection(), p_111019_, p_111020_, bakedquad.isShade()); this.putQuadData( p_111013_, -@@ -322,6 +_,7 @@ +@@ -323,6 +_,7 @@ } } @@ -159,7 +159,7 @@ public void renderModel( PoseStack.Pose p_111068_, VertexConsumer p_111069_, -@@ -333,16 +_,32 @@ +@@ -334,16 +_,32 @@ int p_111075_, int p_111076_ ) { @@ -182,7 +182,7 @@ RandomSource randomsource = RandomSource.create(); long i = 42L; - for(Direction direction : DIRECTIONS) { + for (Direction direction : DIRECTIONS) { randomsource.setSeed(42L); - renderQuadList(p_111068_, p_111069_, p_111072_, p_111073_, p_111074_, p_111071_.getQuads(p_111070_, direction, randomsource), p_111075_, p_111076_); + renderQuadList(p_111068_, p_111069_, p_111072_, p_111073_, p_111074_, p_111071_.getQuads(p_111070_, direction, randomsource, modelData, renderType), p_111075_, p_111076_); diff --git a/patches/net/minecraft/client/renderer/block/model/ItemOverrides.java.patch b/patches/net/minecraft/client/renderer/block/model/ItemOverrides.java.patch index ec3aafe5461..13a802c1110 100644 --- a/patches/net/minecraft/client/renderer/block/model/ItemOverrides.java.patch +++ b/patches/net/minecraft/client/renderer/block/model/ItemOverrides.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/block/model/ItemOverrides.java +++ b/net/minecraft/client/renderer/block/model/ItemOverrides.java -@@ -32,7 +_,15 @@ +@@ -31,7 +_,15 @@ this.properties = new ResourceLocation[0]; } @@ -16,16 +16,16 @@ this.properties = p_111743_.stream() .flatMap(ItemOverride::getPredicates) .map(ItemOverride.Predicate::getProperty) -@@ -48,7 +_,7 @@ +@@ -47,7 +_,7 @@ - for(int j = p_111743_.size() - 1; j >= 0; --j) { + for (int j = p_111743_.size() - 1; j >= 0; j--) { ItemOverride itemoverride = p_111743_.get(j); - BakedModel bakedmodel = this.bakeModel(p_251211_, p_111741_, itemoverride); + BakedModel bakedmodel = this.bakeModel(p_251211_, p_111741_, itemoverride, spriteGetter); ItemOverrides.PropertyMatcher[] aitemoverrides$propertymatcher = itemoverride.getPredicates().map(p_173477_ -> { int k = object2intmap.getInt(p_173477_.getProperty()); return new ItemOverrides.PropertyMatcher(k, p_173477_.getValue()); -@@ -60,9 +_,9 @@ +@@ -59,9 +_,9 @@ } @Nullable @@ -37,7 +37,7 @@ } @Nullable -@@ -95,6 +_,10 @@ +@@ -93,6 +_,10 @@ } return p_173465_; diff --git a/patches/net/minecraft/client/renderer/block/model/MultiVariant.java.patch b/patches/net/minecraft/client/renderer/block/model/MultiVariant.java.patch index 0f0ce9e47c9..438e6177819 100644 --- a/patches/net/minecraft/client/renderer/block/model/MultiVariant.java.patch +++ b/patches/net/minecraft/client/renderer/block/model/MultiVariant.java.patch @@ -3,7 +3,7 @@ @@ -68,7 +_,7 @@ WeightedBakedModel.Builder weightedbakedmodel$builder = new WeightedBakedModel.Builder(); - for(Variant variant : this.getVariants()) { + for (Variant variant : this.getVariants()) { - BakedModel bakedmodel = p_249016_.bake(variant.getModelLocation(), variant); + BakedModel bakedmodel = p_249016_.bake(variant.getModelLocation(), variant, p_111851_); weightedbakedmodel$builder.add(bakedmodel, variant.getWeight()); diff --git a/patches/net/minecraft/client/renderer/blockentity/BannerRenderer.java.patch b/patches/net/minecraft/client/renderer/blockentity/BannerRenderer.java.patch index 24c6c1cf43f..644d5953883 100644 --- a/patches/net/minecraft/client/renderer/blockentity/BannerRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/blockentity/BannerRenderer.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/client/renderer/blockentity/BannerRenderer.java +++ b/net/minecraft/client/renderer/blockentity/BannerRenderer.java @@ -139,4 +_,11 @@ - ); - } + float[] afloat = p_332728_.getTextureDiffuseColors(); + p_332732_.render(p_332737_, p_332704_.buffer(p_332758_, RenderType::entityNoOutline), p_332821_, p_332828_, afloat[0], afloat[1], afloat[2], 1.0F); } + + @Override diff --git a/patches/net/minecraft/client/renderer/blockentity/BeaconRenderer.java.patch b/patches/net/minecraft/client/renderer/blockentity/BeaconRenderer.java.patch index f3f7a07d914..7879238b33b 100644 --- a/patches/net/minecraft/client/renderer/blockentity/BeaconRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/blockentity/BeaconRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/blockentity/BeaconRenderer.java +++ b/net/minecraft/client/renderer/blockentity/BeaconRenderer.java -@@ -303,4 +_,10 @@ +@@ -293,4 +_,10 @@ public boolean shouldRender(BeaconBlockEntity p_173531_, Vec3 p_173532_) { return Vec3.atCenterOf(p_173531_.getBlockPos()).multiply(1.0, 0.0, 1.0).closerThan(p_173532_.multiply(1.0, 0.0, 1.0), (double)this.getViewDistance()); } diff --git a/patches/net/minecraft/client/renderer/blockentity/ChestRenderer.java.patch b/patches/net/minecraft/client/renderer/blockentity/ChestRenderer.java.patch index 1b5b8796a15..a79e2703192 100644 --- a/patches/net/minecraft/client/renderer/blockentity/ChestRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/blockentity/ChestRenderer.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/client/renderer/blockentity/ChestRenderer.java +++ b/net/minecraft/client/renderer/blockentity/ChestRenderer.java -@@ -133,7 +_,7 @@ +@@ -128,7 +_,7 @@ f1 = 1.0F - f1; f1 = 1.0F - f1 * f1 * f1; - int i = neighborcombineresult.apply(new BrightnessCombiner<>()).applyAsInt(p_112367_); + int i = neighborcombineresult.apply(new BrightnessCombiner<>()).applyAsInt(p_112367_); - Material material = Sheets.chooseMaterial(p_112363_, chesttype, this.xmasTextures); + Material material = this.getMaterial(p_112363_, chesttype); VertexConsumer vertexconsumer = material.buffer(p_112366_, RenderType::entityCutout); if (flag1) { if (chesttype == ChestType.LEFT) { -@@ -164,5 +_,15 @@ +@@ -159,5 +_,15 @@ p_112372_.render(p_112370_, p_112371_, p_112376_, p_112377_); p_112373_.render(p_112370_, p_112371_, p_112376_, p_112377_); p_112374_.render(p_112370_, p_112371_, p_112376_, p_112377_); diff --git a/patches/net/minecraft/client/renderer/blockentity/DecoratedPotRenderer.java.patch b/patches/net/minecraft/client/renderer/blockentity/DecoratedPotRenderer.java.patch index d0797364bdd..d8ab1868de1 100644 --- a/patches/net/minecraft/client/renderer/blockentity/DecoratedPotRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/blockentity/DecoratedPotRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/blockentity/DecoratedPotRenderer.java +++ b/net/minecraft/client/renderer/blockentity/DecoratedPotRenderer.java -@@ -148,4 +_,10 @@ +@@ -152,4 +_,10 @@ p_273495_.render(p_272899_, p_273173_.buffer(p_273582_, RenderType::entitySolid), p_273242_, p_273108_); } } diff --git a/patches/net/minecraft/client/renderer/blockentity/EnchantTableRenderer.java.patch b/patches/net/minecraft/client/renderer/blockentity/EnchantTableRenderer.java.patch index 76fb9bace77..c6716d8d5ea 100644 --- a/patches/net/minecraft/client/renderer/blockentity/EnchantTableRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/blockentity/EnchantTableRenderer.java.patch @@ -6,7 +6,7 @@ } + + @Override -+ public net.minecraft.world.phys.AABB getRenderBoundingBox(EnchantmentTableBlockEntity blockEntity) { ++ public net.minecraft.world.phys.AABB getRenderBoundingBox(EnchantingTableBlockEntity blockEntity) { + net.minecraft.core.BlockPos pos = blockEntity.getBlockPos(); + return new net.minecraft.world.phys.AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1., pos.getY() + 1.5, pos.getZ() + 1.); + } diff --git a/patches/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java.patch b/patches/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java.patch index 5e9bc751fd7..d738262caa0 100644 --- a/patches/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java.patch @@ -4,7 +4,7 @@ builder.put(SkullBlock.Types.CREEPER, new SkullModel(p_173662_.bakeLayer(ModelLayers.CREEPER_HEAD))); builder.put(SkullBlock.Types.DRAGON, new DragonHeadModel(p_173662_.bakeLayer(ModelLayers.DRAGON_SKULL))); builder.put(SkullBlock.Types.PIGLIN, new PiglinHeadModel(p_173662_.bakeLayer(ModelLayers.PIGLIN_HEAD))); -+ net.neoforged.fml.ModLoader.get().postEvent(new net.neoforged.neoforge.client.event.EntityRenderersEvent.CreateSkullModels(builder, p_173662_)); ++ net.neoforged.fml.ModLoader.postEvent(new net.neoforged.neoforge.client.event.EntityRenderersEvent.CreateSkullModels(builder, p_173662_)); return builder.build(); } diff --git a/patches/net/minecraft/client/renderer/chunk/RenderChunkRegion.java.patch b/patches/net/minecraft/client/renderer/chunk/RenderChunkRegion.java.patch index 20153ed5732..93cd569f97e 100644 --- a/patches/net/minecraft/client/renderer/chunk/RenderChunkRegion.java.patch +++ b/patches/net/minecraft/client/renderer/chunk/RenderChunkRegion.java.patch @@ -1,26 +1,25 @@ --- a/net/minecraft/client/renderer/chunk/RenderChunkRegion.java +++ b/net/minecraft/client/renderer/chunk/RenderChunkRegion.java -@@ -20,12 +_,19 @@ +@@ -20,12 +_,18 @@ private final int centerZ; protected final RenderChunk[][] chunks; protected final Level level; -+ @Nullable -+ private final net.neoforged.neoforge.client.model.data.ModelDataManager.Snapshot modelDataManager; ++ private final it.unimi.dsi.fastutil.longs.Long2ObjectFunction modelDataSnapshot; + @Deprecated RenderChunkRegion(Level p_200456_, int p_200457_, int p_200458_, RenderChunk[][] p_200459_) { -+ this(p_200456_, p_200457_, p_200458_, p_200459_, null); ++ this(p_200456_, p_200457_, p_200458_, p_200459_, net.neoforged.neoforge.client.model.data.ModelDataManager.EMPTY_SNAPSHOT); + } -+ RenderChunkRegion(Level p_200456_, int p_200457_, int p_200458_, RenderChunk[][] p_200459_, @Nullable net.neoforged.neoforge.client.model.data.ModelDataManager.Snapshot modelDataManager) { ++ RenderChunkRegion(Level p_200456_, int p_200457_, int p_200458_, RenderChunk[][] p_200459_, it.unimi.dsi.fastutil.longs.Long2ObjectFunction modelDataSnapshot) { this.level = p_200456_; this.centerX = p_200457_; this.centerZ = p_200458_; this.chunks = p_200459_; -+ this.modelDataManager = modelDataManager; ++ this.modelDataSnapshot = modelDataSnapshot; } @Override -@@ -73,5 +_,23 @@ +@@ -73,5 +_,22 @@ @Override public int getHeight() { return this.level.getHeight(); @@ -32,9 +31,8 @@ + } + + @Override -+ @Nullable -+ public net.neoforged.neoforge.client.model.data.ModelDataManager.Snapshot getModelDataManager() { -+ return modelDataManager; ++ public net.neoforged.neoforge.client.model.data.ModelData getModelData(BlockPos pos) { ++ return modelDataSnapshot.get(pos.asLong()); + } + + @Override diff --git a/patches/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java.patch b/patches/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java.patch index 30d2e8a6f61..9b380610c27 100644 --- a/patches/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java.patch +++ b/patches/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java +++ b/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java -@@ -431,8 +_,9 @@ +@@ -430,8 +_,9 @@ boolean flag = this.cancelTasks(); BlockPos blockpos = this.origin.immutable(); int i = 1; @@ -11,7 +11,7 @@ ); boolean flag1 = this.compiled.get() == SectionRenderDispatcher.CompiledSection.UNCOMPILED; if (flag1 && flag) { -@@ -440,7 +_,7 @@ +@@ -439,7 +_,7 @@ } this.lastRebuildTask = new SectionRenderDispatcher.RenderSection.RebuildTask( @@ -20,11 +20,10 @@ ); return this.lastRebuildTask; } -@@ -502,10 +_,20 @@ +@@ -501,10 +_,17 @@ class RebuildTask extends SectionRenderDispatcher.RenderSection.CompileTask { @Nullable protected RenderChunkRegion region; -+ private final net.neoforged.neoforge.client.model.data.ModelDataManager.Snapshot modelData; + private final List additionalRenderers; + @Deprecated @@ -35,26 +34,24 @@ + public RebuildTask(double p_294400_, @Nullable RenderChunkRegion p_294382_, boolean p_295207_, List additionalRenderers) { super(p_294400_, p_295207_); this.region = p_294382_; -+ var manager = p_294382_ != null ? p_294382_.getModelDataManager() : null; -+ this.modelData = manager != null ? manager : net.neoforged.neoforge.client.model.data.ModelDataManager.Snapshot.EMPTY; + this.additionalRenderers = additionalRenderers; } @Override -@@ -609,7 +_,11 @@ +@@ -606,7 +_,11 @@ } if (blockstate.getRenderShape() != RenderShape.INVISIBLE) { - RenderType rendertype2 = ItemBlockRenderTypes.getChunkRenderType(blockstate); + var model = blockrenderdispatcher.getBlockModel(blockstate); -+ var modelData = this.modelData.getAtOrEmpty(blockpos2); ++ var modelData = renderchunkregion.getModelData(blockpos2); + modelData = model.getModelData(renderchunkregion, blockpos2, blockstate, modelData); + randomsource.setSeed(blockstate.getSeed(blockpos2)); + for (RenderType rendertype2 : model.getRenderTypes(blockstate, randomsource, modelData)) { BufferBuilder bufferbuilder2 = p_294319_.builder(rendertype2); if (set.add(rendertype2)) { RenderSection.this.beginLayer(bufferbuilder2); -@@ -617,10 +_,20 @@ +@@ -614,10 +_,20 @@ posestack.pushPose(); posestack.translate((float)(blockpos2.getX() & 15), (float)(blockpos2.getY() & 15), (float)(blockpos2.getZ() & 15)); @@ -76,7 +73,7 @@ if (set.contains(RenderType.translucent())) { BufferBuilder bufferbuilder1 = p_294319_.builder(RenderType.translucent()); -@@ -651,9 +_,10 @@ +@@ -648,9 +_,10 @@ private void handleBlockEntity(SectionRenderDispatcher.RenderSection.RebuildTask.CompileResults p_294198_, E p_296214_) { BlockEntityRenderer blockentityrenderer = Minecraft.getInstance().getBlockEntityRenderDispatcher().getRenderer(p_296214_); if (blockentityrenderer != null) { diff --git a/patches/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java.patch b/patches/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java.patch index 2c0c422c151..42d3c4ed65a 100644 --- a/patches/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java.patch +++ b/patches/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java.patch @@ -10,12 +10,12 @@ double d1 = -Mth.lerp((double)p_114445_, p_114444_.yOld, p_114444_.getY()); double d2 = -Mth.lerp((double)p_114445_, p_114444_.zOld, p_114444_.getZ()); -- for(EnderDragonPart enderdragonpart : ((EnderDragon)p_114444_).getSubEntities()) { +- for (EnderDragonPart enderdragonpart : ((EnderDragon)p_114444_).getSubEntities()) { + for(net.neoforged.neoforge.entity.PartEntity enderdragonpart : p_114444_.getParts()) { p_114442_.pushPose(); double d3 = d0 + Mth.lerp((double)p_114445_, enderdragonpart.xOld, enderdragonpart.getX()); double d4 = d1 + Mth.lerp((double)p_114445_, enderdragonpart.yOld, enderdragonpart.getY()); -@@ -444,6 +_,10 @@ +@@ -438,6 +_,10 @@ return this.itemInHandRenderer; } @@ -26,10 +26,10 @@ @Override public void onResourceManagerReload(ResourceManager p_174004_) { EntityRendererProvider.Context entityrendererprovider$context = new EntityRendererProvider.Context( -@@ -451,5 +_,6 @@ +@@ -445,5 +_,6 @@ ); this.renderers = EntityRenderers.createEntityRenderers(entityrendererprovider$context); this.playerRenderers = EntityRenderers.createPlayerRenderers(entityrendererprovider$context); -+ net.neoforged.fml.ModLoader.get().postEvent(new net.neoforged.neoforge.client.event.EntityRenderersEvent.AddLayers(renderers, playerRenderers, entityrendererprovider$context)); ++ net.neoforged.fml.ModLoader.postEvent(new net.neoforged.neoforge.client.event.EntityRenderersEvent.AddLayers(renderers, playerRenderers, entityrendererprovider$context)); } } diff --git a/patches/net/minecraft/client/renderer/entity/EntityRenderer.java.patch b/patches/net/minecraft/client/renderer/entity/EntityRenderer.java.patch index e2a15d7dc29..f23d1e70fcb 100644 --- a/patches/net/minecraft/client/renderer/entity/EntityRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/entity/EntityRenderer.java.patch @@ -1,24 +1,24 @@ --- a/net/minecraft/client/renderer/entity/EntityRenderer.java +++ b/net/minecraft/client/renderer/entity/EntityRenderer.java -@@ -70,8 +_,10 @@ +@@ -71,8 +_,10 @@ } public void render(T p_114485_, float p_114486_, float p_114487_, PoseStack p_114488_, MultiBufferSource p_114489_, int p_114490_) { - if (this.shouldShowName(p_114485_)) { -- this.renderNameTag(p_114485_, p_114485_.getDisplayName(), p_114488_, p_114489_, p_114490_); +- this.renderNameTag(p_114485_, p_114485_.getDisplayName(), p_114488_, p_114489_, p_114490_, p_114487_); + var renderNameTagEvent = new net.neoforged.neoforge.client.event.RenderNameTagEvent(p_114485_, p_114485_.getDisplayName(), this, p_114488_, p_114489_, p_114490_, p_114487_); + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(renderNameTagEvent); + if (renderNameTagEvent.getResult() != net.neoforged.bus.api.Event.Result.DENY && (renderNameTagEvent.getResult() == net.neoforged.bus.api.Event.Result.ALLOW || this.shouldShowName(p_114485_))) { -+ this.renderNameTag(p_114485_, renderNameTagEvent.getContent(), p_114488_, p_114489_, p_114490_); ++ this.renderNameTag(p_114485_, renderNameTagEvent.getContent(), p_114488_, p_114489_, p_114490_, p_114487_); } } -@@ -87,7 +_,7 @@ +@@ -88,7 +_,7 @@ - protected void renderNameTag(T p_114498_, Component p_114499_, PoseStack p_114500_, MultiBufferSource p_114501_, int p_114502_) { + protected void renderNameTag(T p_114498_, Component p_114499_, PoseStack p_114500_, MultiBufferSource p_114501_, int p_114502_, float p_316698_) { double d0 = this.entityRenderDispatcher.distanceToSqr(p_114498_); - if (!(d0 > 4096.0)) { + if (net.neoforged.neoforge.client.ClientHooks.isNameplateInRenderDistance(p_114498_, d0)) { - boolean flag = !p_114498_.isDiscrete(); - float f = p_114498_.getNameTagOffsetY(); - int i = "deadmau5".equals(p_114499_.getString()) ? -10 : 0; + Vec3 vec3 = p_114498_.getAttachments().getNullable(EntityAttachment.NAME_TAG, 0, p_114498_.getViewYRot(p_316698_)); + if (vec3 != null) { + boolean flag = !p_114498_.isDiscrete(); diff --git a/patches/net/minecraft/client/renderer/entity/FishingHookRenderer.java.patch b/patches/net/minecraft/client/renderer/entity/FishingHookRenderer.java.patch index 37e459fe8e1..ab49997372b 100644 --- a/patches/net/minecraft/client/renderer/entity/FishingHookRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/entity/FishingHookRenderer.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/client/renderer/entity/FishingHookRenderer.java +++ b/net/minecraft/client/renderer/entity/FishingHookRenderer.java -@@ -49,7 +_,7 @@ - p_114708_.popPose(); - int i = player.getMainArm() == HumanoidArm.RIGHT ? 1 : -1; - ItemStack itemstack = player.getMainHandItem(); -- if (!itemstack.is(Items.FISHING_ROD)) { -+ if (!itemstack.canPerformAction(net.neoforged.neoforge.common.ToolActions.FISHING_ROD_CAST)) { - i = -i; - } +@@ -66,7 +_,7 @@ + private Vec3 getPlayerHandPos(Player p_340935_, float p_340872_, float p_341261_) { + int i = p_340935_.getMainArm() == HumanoidArm.RIGHT ? 1 : -1; + ItemStack itemstack = p_340935_.getMainHandItem(); +- if (!itemstack.is(Items.FISHING_ROD)) { ++ if (!itemstack.canPerformAction(net.neoforged.neoforge.common.ToolActions.FISHING_ROD_CAST)) { + i = -i; + } diff --git a/patches/net/minecraft/client/renderer/entity/ItemEntityRenderer.java.patch b/patches/net/minecraft/client/renderer/entity/ItemEntityRenderer.java.patch index c4726042b3f..7412c8c3ed1 100644 --- a/patches/net/minecraft/client/renderer/entity/ItemEntityRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/entity/ItemEntityRenderer.java.patch @@ -1,69 +1,24 @@ --- a/net/minecraft/client/renderer/entity/ItemEntityRenderer.java +++ b/net/minecraft/client/renderer/entity/ItemEntityRenderer.java -@@ -60,18 +_,15 @@ +@@ -45,7 +_,8 @@ + BakedModel bakedmodel = this.itemRenderer.getModel(itemstack, p_115036_.level(), null, p_115036_.getId()); boolean flag = bakedmodel.isGui3d(); - int j = this.getRenderAmount(itemstack); float f = 0.25F; - float f1 = Mth.sin(((float)p_115036_.getAge() + p_115038_) / 10.0F + p_115036_.bobOffs) * 0.1F + 0.1F; -+ float f1 = shouldBob() ? Mth.sin(((float)p_115036_.getAge() + p_115038_) / 10.0F + p_115036_.bobOffs) * 0.1F + 0.1F : 0; ++ boolean shouldBob = net.neoforged.neoforge.client.extensions.common.IClientItemExtensions.of(itemstack).shouldBobAsEntity(itemstack); ++ float f1 = shouldBob ? Mth.sin(((float)p_115036_.getAge() + p_115038_) / 10.0F + p_115036_.bobOffs) * 0.1F + 0.1F : 0; float f2 = bakedmodel.getTransforms().getTransform(ItemDisplayContext.GROUND).scale.y(); p_115039_.translate(0.0F, f1 + 0.25F * f2, 0.0F); float f3 = p_115036_.getSpin(p_115038_); - p_115039_.mulPose(Axis.YP.rotation(f3)); -- float f4 = bakedmodel.getTransforms().ground.scale.x(); -- float f5 = bakedmodel.getTransforms().ground.scale.y(); -- float f6 = bakedmodel.getTransforms().ground.scale.z(); - if (!flag) { -- float f7 = -0.0F * (float)(j - 1) * 0.5F * f4; -- float f8 = -0.0F * (float)(j - 1) * 0.5F * f5; -- float f9 = -0.09375F * (float)(j - 1) * 0.5F * f6; -+ float f7 = -0.0F * (float)(j - 1) * 0.5F; -+ float f8 = -0.0F * (float)(j - 1) * 0.5F; -+ float f9 = -0.09375F * (float)(j - 1) * 0.5F; - p_115039_.translate(f7, f8, f9); +@@ -100,9 +_,10 @@ + p_323733_.translate(f3, f4, f5); } -@@ -82,18 +_,18 @@ - float f11 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f13 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f10 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F; -- p_115039_.translate(f11, f13, f10); -+ p_115039_.translate(shouldSpreadItems() ? f11 : 0, shouldSpreadItems() ? f13 : 0, shouldSpreadItems() ? f10 : 0); - } else { - float f12 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F * 0.5F; - float f14 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F * 0.5F; -- p_115039_.translate(f12, f14, 0.0F); -+ p_115039_.translate(shouldSpreadItems() ? f12 : 0, shouldSpreadItems() ? f14 : 0, 0.0D); - } - } - - this.itemRenderer.render(itemstack, ItemDisplayContext.GROUND, false, p_115039_, p_115040_, p_115041_, OverlayTexture.NO_OVERLAY, bakedmodel); - p_115039_.popPose(); - if (!flag) { -- p_115039_.translate(0.0F * f4, 0.0F * f5, 0.09375F * f6); -+ p_115039_.translate(0.0, 0.0, 0.09375F); - } - } - -@@ -104,4 +_,21 @@ - public ResourceLocation getTextureLocation(ItemEntity p_115034_) { - return TextureAtlas.LOCATION_BLOCKS; - } -+ -+ /*==================================== FORGE START ===========================================*/ -+ -+ /** -+ * @return If items should spread out when rendered in 3D -+ */ -+ public boolean shouldSpreadItems() { -+ return true; -+ } -+ -+ /** -+ * @return If items should have a bob effect -+ */ -+ public boolean shouldBob() { -+ return true; -+ } -+ /*==================================== FORGE END =============================================*/ - } ++ boolean shouldSpread = net.neoforged.neoforge.client.extensions.common.IClientItemExtensions.of(p_323718_).shouldSpreadAsEntity(p_323718_); + for (int j = 0; j < i; j++) { + p_323733_.pushPose(); +- if (j > 0) { ++ if (j > 0 && shouldSpread) { + if (p_324462_) { + float f7 = (p_324565_.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f9 = (p_324565_.nextFloat() * 2.0F - 1.0F) * 0.15F; diff --git a/patches/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch b/patches/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch index 09add5e9eea..cc04e224a85 100644 --- a/patches/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/client/renderer/entity/ItemFrameRenderer.java +++ b/net/minecraft/client/renderer/entity/ItemFrameRenderer.java -@@ -83,25 +_,25 @@ +@@ -84,25 +_,25 @@ } if (!itemstack.isEmpty()) { -- OptionalInt optionalint = p_115076_.getFramedMapId(); +- MapId mapid = p_115076_.getFramedMapId(); + MapItemSavedData mapitemsaveddata = MapItem.getSavedData(itemstack, p_115076_.level()); if (flag) { p_115079_.translate(0.0F, 0.0F, 0.5F); @@ -12,26 +12,26 @@ p_115079_.translate(0.0F, 0.0F, 0.4375F); } -- int j = optionalint.isPresent() ? p_115076_.getRotation() % 4 * 2 : p_115076_.getRotation(); +- int j = mapid != null ? p_115076_.getRotation() % 4 * 2 : p_115076_.getRotation(); + int j = mapitemsaveddata != null ? p_115076_.getRotation() % 4 * 2 : p_115076_.getRotation(); p_115079_.mulPose(Axis.ZP.rotationDegrees((float)j * 360.0F / 8.0F)); -- if (optionalint.isPresent()) { +- if (mapid != null) { + if (!net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.client.event.RenderItemInFrameEvent(p_115076_, this, p_115079_, p_115080_, p_115081_)).isCanceled()) { + if (mapitemsaveddata != null) { p_115079_.mulPose(Axis.ZP.rotationDegrees(180.0F)); float f = 0.0078125F; p_115079_.scale(0.0078125F, 0.0078125F, 0.0078125F); p_115079_.translate(-64.0F, -64.0F, 0.0F); -- MapItemSavedData mapitemsaveddata = MapItem.getSavedData(optionalint.getAsInt(), p_115076_.level()); +- MapItemSavedData mapitemsaveddata = MapItem.getSavedData(mapid, p_115076_.level()); p_115079_.translate(0.0F, 0.0F, -1.0F); if (mapitemsaveddata != null) { int i = this.getLightVal(p_115076_, 15728850, p_115081_); -- Minecraft.getInstance().gameRenderer.getMapRenderer().render(p_115079_, p_115080_, optionalint.getAsInt(), mapitemsaveddata, true, i); -+ Minecraft.getInstance().gameRenderer.getMapRenderer().render(p_115079_, p_115080_, p_115076_.getFramedMapId().getAsInt(), mapitemsaveddata, true, i); +- Minecraft.getInstance().gameRenderer.getMapRenderer().render(p_115079_, p_115080_, mapid, mapitemsaveddata, true, i); ++ Minecraft.getInstance().gameRenderer.getMapRenderer().render(p_115079_, p_115080_, p_115076_.getFramedMapId(), mapitemsaveddata, true, i); } } else { int k = this.getLightVal(p_115076_, 15728880, p_115081_); -@@ -109,6 +_,7 @@ +@@ -110,6 +_,7 @@ this.itemRenderer .renderStatic(itemstack, ItemDisplayContext.FIXED, k, OverlayTexture.NO_OVERLAY, p_115079_, p_115080_, p_115076_.level(), p_115076_.getId()); } @@ -39,7 +39,7 @@ } p_115079_.popPose(); -@@ -120,7 +_,7 @@ +@@ -121,7 +_,7 @@ private ModelResourceLocation getFrameModelResourceLoc(T p_174213_, ItemStack p_174214_) { boolean flag = p_174213_.getType() == EntityType.GLOW_ITEM_FRAME; diff --git a/patches/net/minecraft/client/renderer/entity/ItemRenderer.java.patch b/patches/net/minecraft/client/renderer/entity/ItemRenderer.java.patch index aaa57bbb424..e78f85f3017 100644 --- a/patches/net/minecraft/client/renderer/entity/ItemRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/entity/ItemRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/entity/ItemRenderer.java +++ b/net/minecraft/client/renderer/entity/ItemRenderer.java -@@ -67,7 +_,7 @@ +@@ -68,7 +_,7 @@ public ItemRenderer(Minecraft p_266926_, TextureManager p_266774_, ModelManager p_266850_, ItemColors p_267016_, BlockEntityWithoutLevelRenderer p_267049_) { this.minecraft = p_266926_; this.textureManager = p_266774_; @@ -8,8 +8,8 @@ + this.itemModelShaper = new net.neoforged.neoforge.client.model.RegistryAwareItemModelShaper(p_266850_); this.blockEntityRenderer = p_267049_; - for(Item item : BuiltInRegistries.ITEM) { -@@ -117,7 +_,7 @@ + for (Item item : BuiltInRegistries.ITEM) { +@@ -118,7 +_,7 @@ } } @@ -18,18 +18,17 @@ p_115147_.translate(-0.5F, -0.5F, -0.5F); if (!p_115151_.isCustomRenderer() && (!p_115144_.is(Items.TRIDENT) || flag)) { boolean flag1; -@@ -127,8 +_,8 @@ - } else { +@@ -129,7 +_,8 @@ flag1 = true; } -- + - RenderType rendertype = ItemBlockRenderTypes.getRenderType(p_115144_, flag1); + for (var model : p_115151_.getRenderPasses(p_115144_, flag1)) { + for (var rendertype : model.getRenderTypes(p_115144_, flag1)) { VertexConsumer vertexconsumer; if (hasAnimatedTexture(p_115144_) && p_115144_.hasFoil()) { - p_115147_.pushPose(); -@@ -152,9 +_,11 @@ + PoseStack.Pose posestack$pose = p_115147_.last().copy(); +@@ -150,9 +_,11 @@ vertexconsumer = getFoilBuffer(p_115148_, rendertype, true, p_115144_.hasFoil()); } @@ -43,16 +42,16 @@ } p_115147_.popPose(); -@@ -218,7 +_,7 @@ - float f = (float)(i >> 16 & 0xFF) / 255.0F; - float f1 = (float)(i >> 8 & 0xFF) / 255.0F; - float f2 = (float)(i & 0xFF) / 255.0F; -- p_115164_.putBulkData(posestack$pose, bakedquad, f, f1, f2, p_115167_, p_115168_); -+ p_115164_.putBulkData(posestack$pose, bakedquad, f, f1, f2, 1.0F, p_115167_, p_115168_, true); +@@ -215,7 +_,7 @@ + float f1 = (float)FastColor.ARGB32.red(i) / 255.0F; + float f2 = (float)FastColor.ARGB32.green(i) / 255.0F; + float f3 = (float)FastColor.ARGB32.blue(i) / 255.0F; +- p_115164_.putBulkData(posestack$pose, bakedquad, f1, f2, f3, f, p_115167_, p_115168_); ++ p_115164_.putBulkData(posestack$pose, bakedquad, f1, f2, f3, f, p_115167_, p_115168_, true); // Neo: pass readExistingColor=true } } -@@ -271,5 +_,9 @@ +@@ -268,5 +_,9 @@ @Override public void onResourceManagerReload(ResourceManager p_115105_) { this.itemModelShaper.rebuildCache(); diff --git a/patches/net/minecraft/client/renderer/entity/LivingEntityRenderer.java.patch b/patches/net/minecraft/client/renderer/entity/LivingEntityRenderer.java.patch index 0270c0e1540..77ec1121791 100644 --- a/patches/net/minecraft/client/renderer/entity/LivingEntityRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/entity/LivingEntityRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/entity/LivingEntityRenderer.java +++ b/net/minecraft/client/renderer/entity/LivingEntityRenderer.java -@@ -51,14 +_,17 @@ +@@ -50,14 +_,16 @@ } public void render(T p_115308_, float p_115309_, float p_115310_, PoseStack p_115311_, MultiBufferSource p_115312_, int p_115313_) { @@ -8,28 +8,27 @@ p_115311_.pushPose(); this.model.attackTime = this.getAttackAnim(p_115308_, p_115310_); - this.model.riding = p_115308_.isPassenger(); -+ + boolean shouldSit = p_115308_.isPassenger() && (p_115308_.getVehicle() != null && p_115308_.getVehicle().shouldRiderSit()); + this.model.riding = shouldSit; this.model.young = p_115308_.isBaby(); float f = Mth.rotLerp(p_115310_, p_115308_.yBodyRotO, p_115308_.yBodyRot); float f1 = Mth.rotLerp(p_115310_, p_115308_.yHeadRotO, p_115308_.yHeadRot); float f2 = f1 - f; -- if (p_115308_.isPassenger()) { -+ if (shouldSit && p_115308_.getVehicle() instanceof LivingEntity) { - Entity $$14 = p_115308_.getVehicle(); - if ($$14 instanceof LivingEntity livingentity) { - f = Mth.rotLerp(p_115310_, livingentity.yBodyRotO, livingentity.yBodyRot); -@@ -102,7 +_,7 @@ +- if (p_115308_.isPassenger() && p_115308_.getVehicle() instanceof LivingEntity livingentity) { ++ if (shouldSit && p_115308_.getVehicle() instanceof LivingEntity livingentity) { + f = Mth.rotLerp(p_115310_, livingentity.yBodyRotO, livingentity.yBodyRot); + f2 = f1 - f; + float f7 = Mth.wrapDegrees(f2); +@@ -101,7 +_,7 @@ p_115311_.translate(0.0F, -1.501F, 0.0F); - float f8 = 0.0F; float f4 = 0.0F; + float f5 = 0.0F; - if (!p_115308_.isPassenger() && p_115308_.isAlive()) { + if (!shouldSit && p_115308_.isAlive()) { - f8 = p_115308_.walkAnimation.speed(p_115310_); - f4 = p_115308_.walkAnimation.position(p_115310_); + f4 = p_115308_.walkAnimation.speed(p_115310_); + f5 = p_115308_.walkAnimation.position(p_115310_); if (p_115308_.isBaby()) { -@@ -135,6 +_,7 @@ +@@ -134,6 +_,7 @@ p_115311_.popPose(); super.render(p_115308_, p_115309_, p_115310_, p_115311_, p_115312_, p_115313_); diff --git a/patches/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java.patch b/patches/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java.patch index b6145f70eda..fe1bbbde6f0 100644 --- a/patches/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java.patch +++ b/patches/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java.patch @@ -1,118 +1,85 @@ --- a/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java +++ b/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java -@@ -65,22 +_,24 @@ +@@ -66,6 +_,7 @@ if (armoritem.getEquipmentSlot() == p_117122_) { this.getParentModel().copyPropertiesTo(p_117124_); this.setPartVisibility(p_117124_, p_117122_); + net.minecraft.client.model.Model model = getArmorModelHook(p_117121_, itemstack, p_117122_, p_117124_); boolean flag = this.usesInnerModel(p_117122_); -- if (armoritem instanceof DyeableArmorItem dyeablearmoritem) { -+ if (armoritem instanceof net.minecraft.world.item.DyeableLeatherItem dyeablearmoritem) { - int i = dyeablearmoritem.getColor(itemstack); - float f = (float)(i >> 16 & 0xFF) / 255.0F; - float f1 = (float)(i >> 8 & 0xFF) / 255.0F; - float f2 = (float)(i & 0xFF) / 255.0F; -- this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, p_117124_, flag, f, f1, f2, null); -- this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, p_117124_, flag, 1.0F, 1.0F, 1.0F, "overlay"); -+ this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, model, flag, f, f1, f2, this.getArmorResource(p_117121_, itemstack, p_117122_, null)); -+ this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, model, flag, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_117121_, itemstack, p_117122_, "overlay")); - } else { -- this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, p_117124_, flag, 1.0F, 1.0F, 1.0F, null); -+ this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, model, flag, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_117121_, itemstack, p_117122_, null)); + ArmorMaterial armormaterial = armoritem.getMaterial().value(); + int i = itemstack.is(ItemTags.DYEABLE) ? DyedItemColor.getOrDefault(itemstack, -6265536) : -1; +@@ -84,16 +_,17 @@ + f2 = 1.0F; + } + +- this.renderModel(p_117119_, p_117120_, p_117123_, p_117124_, f, f1, f2, armormaterial$layer.texture(flag)); ++ var texture = net.neoforged.neoforge.client.ClientHooks.getArmorTexture(p_117121_, itemstack, armormaterial$layer, flag, p_117122_); ++ this.renderModel(p_117119_, p_117120_, p_117123_, model, f, f1, f2, texture); + } + + ArmorTrim armortrim = itemstack.get(DataComponents.TRIM); + if (armortrim != null) { +- this.renderTrim(armoritem.getMaterial(), p_117119_, p_117120_, p_117123_, armortrim, p_117124_, flag); ++ this.renderTrim(armoritem.getMaterial(), p_117119_, p_117120_, p_117123_, armortrim, model, flag); } - ArmorTrim.getTrim(p_117121_.level().registryAccess(), itemstack, true) -- .ifPresent(p_289638_ -> this.renderTrim(armoritem.getMaterial(), p_117119_, p_117120_, p_117123_, p_289638_, p_117124_, flag)); -+ .ifPresent(p_289638_ -> this.renderTrim(armoritem.getMaterial(), p_117119_, p_117120_, p_117123_, p_289638_, model, flag)); -+ if (itemstack.hasFoil()) { - this.renderGlint(p_117119_, p_117120_, p_117123_, p_117124_); + this.renderGlint(p_117119_, p_117120_, p_117123_, model); } } } -@@ -121,13 +_,19 @@ +@@ -132,6 +_,18 @@ float p_289693_, - @Nullable String p_289682_ + ResourceLocation p_324344_ ) { -- VertexConsumer vertexconsumer = p_289689_.getBuffer(RenderType.armorCutoutNoCull(this.getArmorLocation(p_289650_, p_289668_, p_289682_))); -+ renderModel(p_289664_, p_289689_, p_289681_, p_289650_, p_289658_, p_289668_, p_289678_, p_289674_, p_289693_, this.getArmorLocation(p_289650_, p_289668_, p_289682_)); ++ renderModel(p_289664_, p_289689_, p_289681_, (net.minecraft.client.model.Model) p_289658_, p_289678_, p_289674_, p_289693_, p_324344_); + } -+ private void renderModel(PoseStack p_289664_, MultiBufferSource p_289689_, int p_289681_, ArmorItem p_289650_, net.minecraft.client.model.Model p_289658_, boolean p_289668_, float p_289678_, float p_289674_, float p_289693_, ResourceLocation armorResource) { -+ VertexConsumer vertexconsumer = p_289689_.getBuffer(RenderType.armorCutoutNoCull(armorResource)); ++ private void renderModel( ++ PoseStack p_289664_, ++ MultiBufferSource p_289689_, ++ int p_289681_, ++ net.minecraft.client.model.Model p_289658_, ++ float p_289678_, ++ float p_289674_, ++ float p_289693_, ++ ResourceLocation p_324344_ ++ ) { + VertexConsumer vertexconsumer = p_289689_.getBuffer(RenderType.armorCutoutNoCull(p_324344_)); p_289658_.renderToBuffer(p_289664_, vertexconsumer, p_289681_, OverlayTexture.NO_OVERLAY, p_289678_, p_289674_, p_289693_, 1.0F); } - +@@ -139,6 +_,11 @@ private void renderTrim( - ArmorMaterial p_289690_, PoseStack p_289687_, MultiBufferSource p_289643_, int p_289683_, ArmorTrim p_289692_, A p_289663_, boolean p_289651_ + Holder p_323506_, PoseStack p_289687_, MultiBufferSource p_289643_, int p_289683_, ArmorTrim p_289692_, A p_289663_, boolean p_289651_ ) { -+ renderTrim(p_289690_, p_289687_, p_289643_, p_289683_, p_289692_, p_289663_, p_289651_); ++ renderTrim(p_323506_, p_289687_, p_289643_, p_289683_, p_289692_, (net.minecraft.client.model.Model) p_289663_, p_289651_); + } -+ private void renderTrim(ArmorMaterial p_289690_, PoseStack p_289687_, MultiBufferSource p_289643_, int p_289683_, ArmorTrim p_289692_, net.minecraft.client.model.Model p_289663_, boolean p_289651_) { ++ private void renderTrim( ++ Holder p_323506_, PoseStack p_289687_, MultiBufferSource p_289643_, int p_289683_, ArmorTrim p_289692_, net.minecraft.client.model.Model p_289663_, boolean p_289651_ ++ ) { TextureAtlasSprite textureatlassprite = this.armorTrimAtlas - .getSprite(p_289651_ ? p_289692_.innerTexture(p_289690_) : p_289692_.outerTexture(p_289690_)); + .getSprite(p_289651_ ? p_289692_.innerTexture(p_323506_) : p_289692_.outerTexture(p_323506_)); VertexConsumer vertexconsumer = textureatlassprite.wrap(p_289643_.getBuffer(Sheets.armorTrimsSheet(p_289692_.pattern().value().decal()))); -@@ -135,6 +_,9 @@ +@@ -146,6 +_,9 @@ } private void renderGlint(PoseStack p_289673_, MultiBufferSource p_289654_, int p_289649_, A p_289659_) { -+ renderGlint(p_289673_, p_289654_, p_289649_, p_289659_); ++ renderGlint(p_289673_, p_289654_, p_289649_, (net.minecraft.client.model.Model) p_289659_); + } + private void renderGlint(PoseStack p_289673_, MultiBufferSource p_289654_, int p_289649_, net.minecraft.client.model.Model p_289659_) { p_289659_.renderToBuffer(p_289673_, p_289654_.getBuffer(RenderType.armorEntityGlint()), p_289649_, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); } -@@ -146,6 +_,7 @@ - return p_117129_ == EquipmentSlot.LEGS; - } +@@ -155,5 +_,12 @@ -+ @Deprecated //Use the more sensitive version getArmorResource below - private ResourceLocation getArmorLocation(ArmorItem p_117081_, boolean p_117082_, @Nullable String p_117083_) { - String s = "textures/models/armor/" - + p_117081_.getMaterial().getName() -@@ -155,4 +_,45 @@ - + ".png"; - return ARMOR_LOCATION_CACHE.computeIfAbsent(s, ResourceLocation::new); - } -+ -+ /*=================================== FORGE START =========================================*/ + private boolean usesInnerModel(EquipmentSlot p_117129_) { + return p_117129_ == EquipmentSlot.LEGS; ++ } + + /** + * Hook to allow item-sensitive armor model. for HumanoidArmorLayer. + */ + protected net.minecraft.client.model.Model getArmorModelHook(T entity, ItemStack itemStack, EquipmentSlot slot, A model) { + return net.neoforged.neoforge.client.ClientHooks.getArmorModel(entity, itemStack, slot, model); -+ } -+ -+ /** -+ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. -+ * -+ * @param entity Entity wearing the armor -+ * @param stack ItemStack for the armor -+ * @param slot Slot ID that the item is in -+ * @param type Subtype, can be null or "overlay" -+ * @return ResourceLocation pointing at the armor's texture -+ */ -+ public ResourceLocation getArmorResource(net.minecraft.world.entity.Entity entity, ItemStack stack, EquipmentSlot slot, @Nullable String type) { -+ ArmorItem item = (ArmorItem)stack.getItem(); -+ String texture = item.getMaterial().getName(); -+ String domain = "minecraft"; -+ int idx = texture.indexOf(':'); -+ if (idx != -1) { -+ domain = texture.substring(0, idx); -+ texture = texture.substring(idx + 1); -+ } -+ String s1 = String.format(java.util.Locale.ROOT, "%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (usesInnerModel(slot) ? 2 : 1), type == null ? "" : String.format(java.util.Locale.ROOT, "_%s", type)); -+ -+ s1 = net.neoforged.neoforge.client.ClientHooks.getArmorTexture(entity, stack, s1, slot, type); -+ ResourceLocation resourcelocation = ARMOR_LOCATION_CACHE.get(s1); -+ -+ if (resourcelocation == null) { -+ resourcelocation = new ResourceLocation(s1); -+ ARMOR_LOCATION_CACHE.put(s1, resourcelocation); -+ } -+ -+ return resourcelocation; -+ } -+ /*=================================== FORGE END ===========================================*/ + } } diff --git a/patches/net/minecraft/client/renderer/entity/player/PlayerRenderer.java.patch b/patches/net/minecraft/client/renderer/entity/player/PlayerRenderer.java.patch index 0da78b0d707..7f8084039ed 100644 --- a/patches/net/minecraft/client/renderer/entity/player/PlayerRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/entity/player/PlayerRenderer.java.patch @@ -23,7 +23,7 @@ return HumanoidModel.ArmPose.ITEM; } -@@ -182,10 +_,12 @@ +@@ -185,10 +_,12 @@ } public void renderRightHand(PoseStack p_117771_, MultiBufferSource p_117772_, int p_117773_, AbstractClientPlayer p_117774_) { @@ -36,10 +36,10 @@ this.renderHand(p_117814_, p_117815_, p_117816_, p_117817_, this.model.leftArm, this.model.leftSleeve); } -@@ -227,7 +_,7 @@ +@@ -230,7 +_,7 @@ } } else if (f > 0.0F) { - super.setupRotations(p_117802_, p_117803_, p_117804_, p_117805_, p_117806_); + super.setupRotations(p_117802_, p_117803_, p_117804_, p_117805_, p_117806_, p_320048_); - float f4 = p_117802_.isInWater() ? -90.0F - f1 : -90.0F; + float f4 = p_117802_.isInWater() || p_117802_.isInFluidType((fluidType, height) -> p_117802_.canSwimInFluidType(fluidType)) ? -90.0F - p_117802_.getXRot() : -90.0F; float f5 = Mth.lerp(f, 0.0F, f4); diff --git a/patches/net/minecraft/client/renderer/item/ItemProperties.java.patch b/patches/net/minecraft/client/renderer/item/ItemProperties.java.patch index 1e56444a5dc..95f1563e80c 100644 --- a/patches/net/minecraft/client/renderer/item/ItemProperties.java.patch +++ b/patches/net/minecraft/client/renderer/item/ItemProperties.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/item/ItemProperties.java +++ b/net/minecraft/client/renderer/item/ItemProperties.java -@@ -43,6 +_,9 @@ +@@ -42,6 +_,9 @@ private static final Map> PROPERTIES = Maps.newHashMap(); private static ClampedItemPropertyFunction registerGeneric(ResourceLocation p_174582_, ClampedItemPropertyFunction p_174583_) { @@ -10,7 +10,7 @@ GENERIC_PROPERTIES.put(p_174582_, p_174583_); return p_174583_; } -@@ -52,6 +_,10 @@ +@@ -51,6 +_,10 @@ } private static void register(Item p_174571_, ResourceLocation p_174572_, ClampedItemPropertyFunction p_174573_) { diff --git a/patches/net/minecraft/client/renderer/texture/MipmapGenerator.java.patch b/patches/net/minecraft/client/renderer/texture/MipmapGenerator.java.patch index 19b2f6abbe2..5835dfec53a 100644 --- a/patches/net/minecraft/client/renderer/texture/MipmapGenerator.java.patch +++ b/patches/net/minecraft/client/renderer/texture/MipmapGenerator.java.patch @@ -5,7 +5,7 @@ boolean flag = hasTransparentPixel(anativeimage[0]); + int maxMipmapLevel = net.neoforged.neoforge.client.ClientHooks.getMaxMipmapLevel(anativeimage[0].getWidth(), anativeimage[0].getHeight()); - for(int i = 1; i <= p_252326_; ++i) { + for (int i = 1; i <= p_252326_; i++) { if (i < p_251300_.length) { anativeimage[i] = p_251300_[i]; } else { diff --git a/patches/net/minecraft/client/renderer/texture/SpriteContents.java.patch b/patches/net/minecraft/client/renderer/texture/SpriteContents.java.patch index cfb0dffde67..115bee7e580 100644 --- a/patches/net/minecraft/client/renderer/texture/SpriteContents.java.patch +++ b/patches/net/minecraft/client/renderer/texture/SpriteContents.java.patch @@ -14,7 +14,7 @@ @@ -120,6 +_,10 @@ void upload(int p_248895_, int p_250245_, int p_250458_, int p_251337_, NativeImage[] p_248825_) { - for(int i = 0; i < this.byMipLevel.length; ++i) { + for (int i = 0; i < this.byMipLevel.length; i++) { + // Forge: Skip uploading if the texture would be made invalid by mip level + if ((this.width >> i) <= 0 || (this.height >> i) <= 0) + break; @@ -23,7 +23,7 @@ .upload(i, p_248895_ >> i, p_250245_ >> i, p_250458_ >> i, p_251337_ >> i, this.width >> i, this.height >> i, this.byMipLevel.length > 1, false); } @@ -242,7 +_,8 @@ - for(int i = 0; i < this.activeFrame.length; ++i) { + for (int i = 0; i < this.activeFrame.length; i++) { int j = SpriteContents.this.width >> i; int k = SpriteContents.this.height >> i; - this.activeFrame[i] = new NativeImage(j, k, false); @@ -33,12 +33,12 @@ } @@ -257,6 +_,9 @@ - for(int k = 0; k < this.activeFrame.length; ++k) { + for (int k = 0; k < this.activeFrame.length; k++) { int l = SpriteContents.this.width >> k; int i1 = SpriteContents.this.height >> k; + // Forge: Guard against invalid texture size, because we allow generating mipmaps regardless of texture sizes + if (l < 1 || i1 < 1) + continue; - for(int j1 = 0; j1 < i1; ++j1) { - for(int k1 = 0; k1 < l; ++k1) { + for (int j1 = 0; j1 < i1; j1++) { + for (int k1 = 0; k1 < l; k1++) { diff --git a/patches/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches/net/minecraft/client/renderer/texture/Stitcher.java.patch index 78325c3d79e..9eee4107531 100644 --- a/patches/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -11,7 +11,7 @@ .thenComparing(p_247945_ -> p_247945_.entry.name()); @@ -48,6 +_,14 @@ - for(Stitcher.Holder holder : list) { + for (Stitcher.Holder holder : list) { if (!this.addToStorage(holder)) { + if (LOGGER.isInfoEnabled()) { + StringBuilder sb = new StringBuilder(); diff --git a/patches/net/minecraft/client/renderer/texture/atlas/SpriteSources.java.patch b/patches/net/minecraft/client/renderer/texture/atlas/SpriteSources.java.patch index c812aae9ebb..dab382df66c 100644 --- a/patches/net/minecraft/client/renderer/texture/atlas/SpriteSources.java.patch +++ b/patches/net/minecraft/client/renderer/texture/atlas/SpriteSources.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/texture/atlas/SpriteSources.java +++ b/net/minecraft/client/renderer/texture/atlas/SpriteSources.java -@@ -16,7 +_,7 @@ +@@ -17,7 +_,7 @@ @OnlyIn(Dist.CLIENT) public class SpriteSources { diff --git a/patches/net/minecraft/client/resources/model/ModelBakery.java.patch b/patches/net/minecraft/client/resources/model/ModelBakery.java.patch index 526b3a39516..88a7ff5876c 100644 --- a/patches/net/minecraft/client/resources/model/ModelBakery.java.patch +++ b/patches/net/minecraft/client/resources/model/ModelBakery.java.patch @@ -14,7 +14,7 @@ this.topLevelModels.values().forEach(p_247954_ -> p_247954_.resolveParents(this::getModel)); p_252014_.pop(); } -@@ -482,7 +_,17 @@ +@@ -481,7 +_,17 @@ } @Override @@ -32,7 +32,7 @@ ModelBakery.BakedCacheKey modelbakery$bakedcachekey = new ModelBakery.BakedCacheKey(p_252176_, p_249765_.getRotation(), p_249765_.isUvLocked()); BakedModel bakedmodel = ModelBakery.this.bakedCache.get(modelbakery$bakedcachekey); if (bakedmodel != null) { -@@ -491,11 +_,11 @@ +@@ -490,11 +_,11 @@ UnbakedModel unbakedmodel = this.getModel(p_252176_); if (unbakedmodel instanceof BlockModel blockmodel && blockmodel.getRootModel() == ModelBakery.GENERATION_MARKER) { return ModelBakery.ITEM_MODEL_GENERATOR diff --git a/patches/net/minecraft/client/resources/model/MultiPartBakedModel.java.patch b/patches/net/minecraft/client/resources/model/MultiPartBakedModel.java.patch index ce1b2b95c05..8404abbec30 100644 --- a/patches/net/minecraft/client/resources/model/MultiPartBakedModel.java.patch +++ b/patches/net/minecraft/client/resources/model/MultiPartBakedModel.java.patch @@ -53,7 +53,7 @@ + List> list = Lists.newArrayList(); long k = p_235052_.nextLong(); - for(int j = 0; j < bitset.length(); ++j) { + for (int j = 0; j < bitset.length(); j++) { if (bitset.get(j)) { - list.addAll(this.selectors.get(j).getRight().getQuads(p_235050_, p_235051_, RandomSource.create(k))); + var model = this.selectors.get(j).getRight(); @@ -67,20 +67,10 @@ } } -@@ -79,6 +_,26 @@ +@@ -79,6 +_,16 @@ } @Override -+ public boolean useAmbientOcclusion(BlockState state) { -+ return this.defaultModel.useAmbientOcclusion(state); -+ } -+ -+ @Override -+ public boolean useAmbientOcclusion(BlockState state, net.minecraft.client.renderer.RenderType renderType) { -+ return this.defaultModel.useAmbientOcclusion(state, renderType); -+ } -+ -+ @Override + public net.neoforged.neoforge.common.util.TriState useAmbientOcclusion(BlockState state, net.neoforged.neoforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType) { + return this.defaultModel.useAmbientOcclusion(state, modelData, renderType); + } diff --git a/patches/net/minecraft/client/resources/model/WeightedBakedModel.java.patch b/patches/net/minecraft/client/resources/model/WeightedBakedModel.java.patch index 0157292ca10..f96aeedb0e2 100644 --- a/patches/net/minecraft/client/resources/model/WeightedBakedModel.java.patch +++ b/patches/net/minecraft/client/resources/model/WeightedBakedModel.java.patch @@ -17,25 +17,15 @@ + // FORGE: Implement our overloads (here and below) so child models can have custom logic + public List getQuads(@Nullable BlockState p_235058_, @Nullable Direction p_235059_, RandomSource p_235060_, net.neoforged.neoforge.client.model.data.ModelData modelData, @org.jetbrains.annotations.Nullable net.minecraft.client.renderer.RenderType renderType) { return WeightedRandom.getWeightedItem(this.list, Math.abs((int)p_235060_.nextLong()) % this.totalWeight) -- .map(p_235065_ -> p_235065_.getData().getQuads(p_235058_, p_235059_, p_235060_)) -+ .map(p_235065_ -> p_235065_.getData().getQuads(p_235058_, p_235059_, p_235060_, modelData, renderType)) +- .map(p_337442_ -> p_337442_.data().getQuads(p_235058_, p_235059_, p_235060_)) ++ .map(p_235065_ -> p_235065_.data().getQuads(p_235058_, p_235059_, p_235060_, modelData, renderType)) .orElse(Collections.emptyList()); } -@@ -41,6 +_,21 @@ +@@ -41,6 +_,11 @@ } @Override -+ public boolean useAmbientOcclusion(BlockState state) { -+ return this.wrapped.useAmbientOcclusion(state); -+ } -+ -+ @Override -+ public boolean useAmbientOcclusion(BlockState state, net.minecraft.client.renderer.RenderType renderType) { -+ return this.wrapped.useAmbientOcclusion(state, renderType); -+ } -+ -+ @Override + public net.neoforged.neoforge.common.util.TriState useAmbientOcclusion(BlockState state, net.neoforged.neoforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType) { + return this.wrapped.useAmbientOcclusion(state, modelData, renderType); + } @@ -65,7 +55,7 @@ + @Override // FORGE: Get render types based on the active weighted model + public net.neoforged.neoforge.client.ChunkRenderTypeSet getRenderTypes(@org.jetbrains.annotations.NotNull BlockState state, @org.jetbrains.annotations.NotNull RandomSource rand, @org.jetbrains.annotations.NotNull net.neoforged.neoforge.client.model.data.ModelData data) { + return WeightedRandom.getWeightedItem(this.list, Math.abs((int)rand.nextLong()) % this.totalWeight) -+ .map((p_235065_) -> p_235065_.getData().getRenderTypes(state, rand, data)) ++ .map((p_235065_) -> p_235065_.data().getRenderTypes(state, rand, data)) + .orElse(net.neoforged.neoforge.client.ChunkRenderTypeSet.none()); } diff --git a/patches/net/minecraft/client/server/IntegratedServer.java.patch b/patches/net/minecraft/client/server/IntegratedServer.java.patch index d3b8fef2eb5..9d4300a0518 100644 --- a/patches/net/minecraft/client/server/IntegratedServer.java.patch +++ b/patches/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 -@@ -69,10 +_,12 @@ +@@ -72,10 +_,12 @@ this.setPvpAllowed(true); this.setFlightAllowed(true); this.initializeKeyPair(); @@ -13,11 +13,11 @@ return true; } -@@ -217,6 +_,7 @@ +@@ -224,6 +_,7 @@ @Override public void halt(boolean p_120053_) { + if (isRunning()) this.executeBlocking(() -> { - for(ServerPlayer serverplayer : Lists.newArrayList(this.getPlayerList().getPlayers())) { + for (ServerPlayer serverplayer : Lists.newArrayList(this.getPlayerList().getPlayers())) { if (!serverplayer.getUUID().equals(this.uuid)) { diff --git a/patches/net/minecraft/client/server/LanServerDetection.java.patch b/patches/net/minecraft/client/server/LanServerDetection.java.patch index dbb046a1ce5..40b5077b7fa 100644 --- a/patches/net/minecraft/client/server/LanServerDetection.java.patch +++ b/patches/net/minecraft/client/server/LanServerDetection.java.patch @@ -21,4 +21,4 @@ + } boolean flag = false; - for(LanServer lanserver : this.servers) { + for (LanServer lanserver : this.servers) { diff --git a/patches/net/minecraft/client/server/LanServerPinger.java.patch b/patches/net/minecraft/client/server/LanServerPinger.java.patch index 3029c1cd97e..1bff6736f85 100644 --- a/patches/net/minecraft/client/server/LanServerPinger.java.patch +++ b/patches/net/minecraft/client/server/LanServerPinger.java.patch @@ -16,7 +16,7 @@ private final String motd; @@ -40,7 +_,7 @@ - while(!this.isInterrupted() && this.isRunning) { + while (!this.isInterrupted() && this.isRunning) { try { - InetAddress inetaddress = InetAddress.getByName("224.0.2.60"); + InetAddress inetaddress = InetAddress.getByName(MULTICAST_GROUP); diff --git a/patches/net/minecraft/client/sounds/SoundEngine.java.patch b/patches/net/minecraft/client/sounds/SoundEngine.java.patch index a83a19e45ab..29678b9899a 100644 --- a/patches/net/minecraft/client/sounds/SoundEngine.java.patch +++ b/patches/net/minecraft/client/sounds/SoundEngine.java.patch @@ -4,7 +4,7 @@ this.soundManager = p_120236_; this.options = p_120237_; this.soundBuffers = new SoundBufferLibrary(p_249332_); -+ net.neoforged.fml.ModLoader.get().postEvent(new net.neoforged.neoforge.client.event.sound.SoundEngineLoadEvent(this)); ++ net.neoforged.fml.ModLoader.postEvent(new net.neoforged.neoforge.client.event.sound.SoundEngineLoadEvent(this)); } public void reload() { @@ -12,7 +12,7 @@ this.destroy(); this.loadLibrary(); -+ net.neoforged.fml.ModLoader.get().postEvent(new net.neoforged.neoforge.client.event.sound.SoundEngineLoadEvent(this)); ++ net.neoforged.fml.ModLoader.postEvent(new net.neoforged.neoforge.client.event.sound.SoundEngineLoadEvent(this)); } private synchronized void loadLibrary() { diff --git a/patches/net/minecraft/commands/Commands.java.patch b/patches/net/minecraft/commands/Commands.java.patch index 2e1818723c2..f78bc1e9333 100644 --- a/patches/net/minecraft/commands/Commands.java.patch +++ b/patches/net/minecraft/commands/Commands.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java -@@ -213,7 +_,7 @@ +@@ -215,7 +_,7 @@ JfrCommand.register(this.dispatcher); } @@ -8,8 +8,8 @@ + if (net.neoforged.neoforge.gametest.GameTestHooks.isGametestEnabled()) { TestCommand.register(this.dispatcher); ResetChunksCommand.register(this.dispatcher); - RaidCommand.register(this.dispatcher); -@@ -247,6 +_,7 @@ + RaidCommand.register(this.dispatcher, p_230944_); +@@ -250,6 +_,7 @@ if (p_230943_.includeIntegrated) { PublishCommand.register(this.dispatcher); } @@ -17,7 +17,7 @@ this.dispatcher.setConsumer(ExecutionCommandSource.resultConsumer()); } -@@ -264,6 +_,16 @@ +@@ -267,6 +_,16 @@ public void performCommand(ParseResults p_242844_, String p_242841_) { CommandSourceStack commandsourcestack = p_242844_.getContext().getSource(); @@ -34,7 +34,7 @@ commandsourcestack.getServer().getProfiler().push(() -> "/" + p_242841_); ContextChain contextchain = finishParsing(p_242844_, p_242841_, commandsourcestack); -@@ -361,7 +_,8 @@ +@@ -364,7 +_,8 @@ Map, CommandNode> map = Maps.newHashMap(); RootCommandNode rootcommandnode = new RootCommandNode<>(); map.put(this.dispatcher.getRoot(), rootcommandnode); diff --git a/patches/net/minecraft/commands/arguments/EntityArgument.java.patch b/patches/net/minecraft/commands/arguments/EntityArgument.java.patch index 766e2cf0f61..f5496e986c0 100644 --- a/patches/net/minecraft/commands/arguments/EntityArgument.java.patch +++ b/patches/net/minecraft/commands/arguments/EntityArgument.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/commands/arguments/EntityArgument.java +++ b/net/minecraft/commands/arguments/EntityArgument.java -@@ -120,7 +_,7 @@ - if (s instanceof SharedSuggestionProvider sharedsuggestionprovider) { +@@ -119,7 +_,7 @@ + if (p_91482_.getSource() instanceof SharedSuggestionProvider sharedsuggestionprovider) { StringReader stringreader = new StringReader(p_91483_.getInput()); stringreader.setCursor(p_91483_.getStart()); - EntitySelectorParser entityselectorparser = new EntitySelectorParser(stringreader, sharedsuggestionprovider.hasPermission(2)); diff --git a/patches/net/minecraft/commands/arguments/MessageArgument.java.patch b/patches/net/minecraft/commands/arguments/MessageArgument.java.patch index f6b48989870..6f7fe1907c7 100644 --- a/patches/net/minecraft/commands/arguments/MessageArgument.java.patch +++ b/patches/net/minecraft/commands/arguments/MessageArgument.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/commands/arguments/MessageArgument.java +++ b/net/minecraft/commands/arguments/MessageArgument.java -@@ -97,7 +_,7 @@ - } +@@ -84,7 +_,7 @@ + public static record Message(String text, MessageArgument.Part[] parts) { Component resolveComponent(CommandSourceStack p_232197_) throws CommandSyntaxException { - return this.toComponent(p_232197_, p_232197_.hasPermission(2)); + return this.toComponent(p_232197_, net.neoforged.neoforge.common.CommonHooks.canUseEntitySelectors(p_232197_)); diff --git a/patches/net/minecraft/commands/arguments/ResourceLocationArgument.java.patch b/patches/net/minecraft/commands/arguments/ResourceLocationArgument.java.patch index 31806309df5..676795818b4 100644 --- a/patches/net/minecraft/commands/arguments/ResourceLocationArgument.java.patch +++ b/patches/net/minecraft/commands/arguments/ResourceLocationArgument.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/commands/arguments/ResourceLocationArgument.java +++ b/net/minecraft/commands/arguments/ResourceLocationArgument.java -@@ -39,7 +_,7 @@ +@@ -29,7 +_,7 @@ public static AdvancementHolder getAdvancement(CommandContext p_106988_, String p_106989_) throws CommandSyntaxException { ResourceLocation resourcelocation = getId(p_106988_, p_106989_); @@ -9,7 +9,7 @@ if (advancementholder == null) { throw ERROR_UNKNOWN_ADVANCEMENT.create(resourcelocation); } else { -@@ -48,7 +_,7 @@ +@@ -38,7 +_,7 @@ } public static RecipeHolder getRecipe(CommandContext p_106995_, String p_106996_) throws CommandSyntaxException { diff --git a/patches/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch b/patches/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch index 8ed92ea7df2..e6e5725a603 100644 --- a/patches/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch +++ b/patches/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/commands/arguments/selector/EntitySelectorParser.java +++ b/net/minecraft/commands/arguments/selector/EntitySelectorParser.java -@@ -463,6 +_,9 @@ +@@ -457,6 +_,9 @@ } this.reader.skip(); @@ -10,7 +10,7 @@ this.parseSelector(); } else { this.parseNameOrUUID(); -@@ -478,6 +_,7 @@ +@@ -472,6 +_,7 @@ p_121248_.suggest("@r", Component.translatable("argument.entity.selector.randomPlayer")); p_121248_.suggest("@s", Component.translatable("argument.entity.selector.self")); p_121248_.suggest("@e", Component.translatable("argument.entity.selector.allEntities")); diff --git a/patches/net/minecraft/commands/synchronization/ArgumentTypeInfos.java.patch b/patches/net/minecraft/commands/synchronization/ArgumentTypeInfos.java.patch index 8ac5f634ff2..84278562e68 100644 --- a/patches/net/minecraft/commands/synchronization/ArgumentTypeInfos.java.patch +++ b/patches/net/minecraft/commands/synchronization/ArgumentTypeInfos.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/commands/synchronization/ArgumentTypeInfos.java +++ b/net/minecraft/commands/synchronization/ArgumentTypeInfos.java -@@ -66,6 +_,20 @@ +@@ -68,6 +_,20 @@ public class ArgumentTypeInfos { private static final Map, ArgumentTypeInfo> BY_CLASS = Maps.newHashMap(); @@ -21,10 +21,10 @@ private static , T extends ArgumentTypeInfo.Template> ArgumentTypeInfo register( Registry> p_235387_, String p_235388_, Class p_235389_, ArgumentTypeInfo p_235390_ ) { -@@ -123,12 +_,14 @@ - register(p_235385_, "template_mirror", TemplateMirrorArgument.class, SingletonArgumentInfo.contextFree(TemplateMirrorArgument::templateMirror)); - register(p_235385_, "template_rotation", TemplateRotationArgument.class, SingletonArgumentInfo.contextFree(TemplateRotationArgument::templateRotation)); - register(p_235385_, "heightmap", HeightmapTypeArgument.class, SingletonArgumentInfo.contextFree(HeightmapTypeArgument::heightmap)); +@@ -136,12 +_,14 @@ + register( + p_235385_, "loot_modifier", ResourceOrIdArgument.LootModifierArgument.class, SingletonArgumentInfo.contextAware(ResourceOrIdArgument::lootModifier) + ); - if (SharedConstants.IS_RUNNING_IN_IDE) { + // Forge: Register before gametest arguments to provide forge server <-> vanilla client interop and matching int ids + var uuidInfo = register(p_235385_, "uuid", UuidArgument.class, SingletonArgumentInfo.contextFree(UuidArgument::uuid)); diff --git a/patches/net/minecraft/core/Direction.java.patch b/patches/net/minecraft/core/Direction.java.patch deleted file mode 100644 index 71a09eb1ca7..00000000000 --- a/patches/net/minecraft/core/Direction.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/net/minecraft/core/Direction.java -+++ b/net/minecraft/core/Direction.java -@@ -325,6 +_,22 @@ - return direction; - } - -+ /** NeoForge: Version of {@link #getNearest(float, float, float)} that accounts for potential rounding errors. */ -+ public static Direction getNearestStable(float p_122373_, float p_122374_, float p_122375_) { -+ Direction direction = NORTH; -+ float f = Float.MIN_VALUE; -+ -+ for(Direction direction1 : VALUES) { -+ float f1 = p_122373_ * (float)direction1.normal.getX() + p_122374_ * (float)direction1.normal.getY() + p_122375_ * (float)direction1.normal.getZ(); -+ if (f1 > f + com.mojang.math.Constants.EPSILON) { -+ f = f1; -+ direction = direction1; -+ } -+ } -+ -+ return direction; -+ } -+ - @Override - public String toString() { - return this.name; diff --git a/patches/net/minecraft/core/Holder.java.patch b/patches/net/minecraft/core/Holder.java.patch index 5fd1f47e07b..43ab5b22703 100644 --- a/patches/net/minecraft/core/Holder.java.patch +++ b/patches/net/minecraft/core/Holder.java.patch @@ -9,18 +9,53 @@ T value(); boolean isBound(); -@@ -201,6 +_,14 @@ - } else { - this.value = p_249418_; - } -+ } +@@ -41,6 +_,15 @@ + return this.unwrapKey().map(p_316542_ -> p_316542_.location().toString()).orElse("[unregistered]"); + } + ++ /** ++ * {@return the holder that this holder wraps} ++ * ++ * Useful for holders that delegate to another holder. ++ */ ++ default Holder getDelegate() { ++ return this; ++ } + + static Holder direct(T p_205710_) { + return new Holder.Direct<>(p_205710_); + } +@@ -220,6 +_,14 @@ + } + } + + @org.jetbrains.annotations.Nullable + public A getData(net.neoforged.neoforge.registries.datamaps.DataMapType type) { + if (owner instanceof HolderLookup.RegistryLookup lookup) { + return lookup.getData(type, key()); + } + return null; ++ } ++ + public void bindTags(Collection> p_205770_) { + this.tags = Set.copyOf(p_205770_); + } +@@ -232,6 +_,18 @@ + @Override + public String toString() { + return "Reference{" + this.key + "=" + this.value + "}"; ++ } ++ ++ // Neo: Add DeferredHolder-compatible hashCode() and equals() overrides ++ @Override ++ public int hashCode() { ++ return key().hashCode(); ++ } ++ ++ @Override ++ public boolean equals(Object obj) { ++ if (this == obj) return true; ++ return obj instanceof Holder h && h.kind() == Kind.REFERENCE && h.unwrapKey().orElseThrow() == this.key(); } - public void bindTags(Collection> p_205770_) { + public static enum Type { diff --git a/patches/net/minecraft/core/HolderLookup.java.patch b/patches/net/minecraft/core/HolderLookup.java.patch index e23c4ba3d69..56c28b49b50 100644 --- a/patches/net/minecraft/core/HolderLookup.java.patch +++ b/patches/net/minecraft/core/HolderLookup.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/core/HolderLookup.java +++ b/net/minecraft/core/HolderLookup.java -@@ -117,6 +_,11 @@ - : this); +@@ -96,6 +_,11 @@ + }; } + @org.jetbrains.annotations.Nullable @@ -9,18 +9,18 @@ + return null; + } + - public abstract static class Delegate implements HolderLookup.RegistryLookup { - protected abstract HolderLookup.RegistryLookup parent(); + public interface Delegate extends HolderLookup.RegistryLookup { + HolderLookup.RegistryLookup parent(); -@@ -148,6 +_,12 @@ +@@ -127,6 +_,12 @@ @Override - public Stream> listTags() { + default Stream> listTags() { return this.parent().listTags(); + } + + @Override + @org.jetbrains.annotations.Nullable -+ public A getData(net.neoforged.neoforge.registries.datamaps.DataMapType attachment, ResourceKey key) { ++ default A getData(net.neoforged.neoforge.registries.datamaps.DataMapType attachment, ResourceKey key) { + return parent().getData(attachment, key); } } diff --git a/patches/net/minecraft/core/HolderSet.java.patch b/patches/net/minecraft/core/HolderSet.java.patch index 38c6d319f02..8459624a17e 100644 --- a/patches/net/minecraft/core/HolderSet.java.patch +++ b/patches/net/minecraft/core/HolderSet.java.patch @@ -9,7 +9,7 @@ Stream> stream(); int size(); -@@ -146,6 +_,9 @@ +@@ -174,6 +_,9 @@ public void bind(List> p_205836_) { this.contents = List.copyOf(p_205836_); @@ -19,7 +19,7 @@ } public TagKey key() { -@@ -180,6 +_,11 @@ +@@ -208,6 +_,11 @@ @Override public boolean canSerializeIn(HolderOwner p_256542_) { return this.owner.canSerializeIn(p_256542_); diff --git a/patches/net/minecraft/core/MappedRegistry.java.patch b/patches/net/minecraft/core/MappedRegistry.java.patch index 4a64933f6c3..a2dd254087a 100644 --- a/patches/net/minecraft/core/MappedRegistry.java.patch +++ b/patches/net/minecraft/core/MappedRegistry.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/core/MappedRegistry.java +++ b/net/minecraft/core/MappedRegistry.java -@@ -32,7 +_,7 @@ - import org.apache.commons.lang3.Validate; +@@ -31,7 +_,7 @@ + import net.minecraft.util.RandomSource; import org.slf4j.Logger; -public class MappedRegistry implements WritableRegistry { @@ -9,7 +9,7 @@ private static final Logger LOGGER = LogUtils.getLogger(); final ResourceKey> key; private final ObjectList> byId = new ObjectArrayList<>(256); -@@ -79,6 +_,12 @@ +@@ -75,6 +_,12 @@ public Stream> listTags() { return MappedRegistry.this.getTags().map(Pair::getSecond); } @@ -20,43 +20,47 @@ + return MappedRegistry.this.getData(type, key); + } }; + private final Object tagAdditionLock = new Object(); - public MappedRegistry(ResourceKey> p_249899_, Lifecycle p_252249_) { -@@ -127,6 +_,9 @@ - this.validateWrite(p_256594_); - Validate.notNull(p_256594_); - Validate.notNull(p_256374_); -+ if (p_256563_ > this.getMaxId()) -+ throw new IllegalStateException(String.format(java.util.Locale.ENGLISH, "Invalid id %d - maximum id range of %d exceeded.", p_256563_, this.getMaxId())); +@@ -114,9 +_,17 @@ + + @Override + public Holder.Reference register(ResourceKey p_256252_, T p_256591_, RegistrationInfo p_326235_) { ++ return register(this.byId.size(), p_256252_, p_256591_, p_326235_); ++ } + - if (this.byLocation.containsKey(p_256594_.location())) { - Util.pauseInIde(new IllegalStateException("Adding duplicate key '" + p_256594_ + "' to registry")); ++ public Holder.Reference register(int id, ResourceKey p_256252_, T p_256591_, RegistrationInfo p_326235_) { + this.validateWrite(p_256252_); + Objects.requireNonNull(p_256252_); + Objects.requireNonNull(p_256591_); ++ int i = id; ++ if (i > this.getMaxId()) ++ throw new IllegalStateException(String.format(java.util.Locale.ENGLISH, "Invalid id %d - maximum id range of %d exceeded.", i, this.getMaxId())); ++ + if (this.byLocation.containsKey(p_256252_.location())) { + Util.pauseInIde(new IllegalStateException("Adding duplicate key '" + p_256252_ + "' to registry")); } -@@ -145,12 +_,14 @@ - reference.bindKey(p_256594_); +@@ -135,16 +_,18 @@ + reference.bindKey(p_256252_); } else { - reference = this.byKey.computeIfAbsent(p_256594_, p_258168_ -> Holder.Reference.createStandAlone(this.holderOwner(), p_258168_)); + reference = this.byKey.computeIfAbsent(p_256252_, p_258168_ -> Holder.Reference.createStandAlone(this.holderOwner(), (ResourceKey)p_258168_)); + // Forge: Bind the value immediately so it can be queried while the registry is not frozen -+ reference.bindValue(p_256374_); ++ reference.bindValue(p_256591_); } - this.byKey.put(p_256594_, reference); - this.byLocation.put(p_256594_.location(), reference); - this.byValue.put(p_256374_, reference); -- this.byId.size(Math.max(this.byId.size(), p_256563_ + 1)); -+ while (this.byId.size() < (p_256563_ + 1)) this.byId.add(null); - this.byId.set(p_256563_, reference); - this.toId.put(p_256374_, p_256563_); - if (this.nextId <= p_256563_) { -@@ -160,6 +_,7 @@ - this.lifecycles.put(p_256374_, p_256469_); - this.registryLifecycle = this.registryLifecycle.add(p_256469_); - this.holdersInOrder = null; -+ this.addCallbacks.forEach(addCallback -> addCallback.onAdd(this, p_256563_, p_256594_, p_256374_)); + this.byKey.put(p_256252_, reference); + this.byLocation.put(p_256252_.location(), reference); + this.byValue.put(p_256591_, reference); +- int i = this.byId.size(); + this.byId.add(reference); + this.toId.put(p_256591_, i); + this.registrationInfos.put(p_256252_, p_326235_); + this.registryLifecycle = this.registryLifecycle.add(p_326235_.lifecycle()); ++ this.addCallbacks.forEach(addCallback -> addCallback.onAdd(this, i, p_256252_, p_256591_)); return reference; } -@@ -188,7 +_,7 @@ +@@ -168,7 +_,7 @@ @Nullable @Override public T get(@Nullable ResourceKey p_122714_) { @@ -65,7 +69,7 @@ } @Nullable -@@ -204,7 +_,7 @@ +@@ -189,7 +_,7 @@ @Override public Optional> getHolder(ResourceKey p_205905_) { @@ -74,7 +78,7 @@ } @Override -@@ -214,7 +_,7 @@ +@@ -199,7 +_,7 @@ } Holder.Reference getOrCreateHolderOrThrow(ResourceKey p_248831_) { @@ -83,7 +87,7 @@ if (this.unregisteredIntrusiveHolders != null) { throw new IllegalStateException("This registry can't create new holders without value"); } else { -@@ -247,7 +_,7 @@ +@@ -232,7 +_,7 @@ @Nullable @Override public T get(@Nullable ResourceLocation p_122739_) { @@ -92,7 +96,7 @@ return getValueFromNullable(reference); } -@@ -323,13 +_,18 @@ +@@ -316,13 +_,18 @@ return this.byKey.containsKey(p_175392_); } @@ -108,11 +112,11 @@ return this; } else { this.frozen = true; -- this.byValue.forEach((p_247989_, p_247990_) -> p_247990_.bindValue(p_247989_)); +- this.byValue.forEach((p_247989_, p_247990_) -> p_247990_.bindValue((T)p_247989_)); List list = this.byKey .entrySet() .stream() -@@ -345,8 +_,10 @@ +@@ -338,8 +_,10 @@ throw new IllegalStateException("Some intrusive holders were not registered: " + this.unregisteredIntrusiveHolders.values()); } @@ -124,7 +128,7 @@ return this; } -@@ -441,5 +_,59 @@ +@@ -435,5 +_,53 @@ @Override public HolderLookup.RegistryLookup asLookup() { return this.lookup; @@ -137,14 +141,11 @@ + super.clear(full); + this.byId.clear(); + this.toId.clear(); -+ nextId = 0; -+ if (holdersInOrder != null) holdersInOrder = null; + if (full) { + this.byLocation.clear(); + this.byKey.clear(); + this.byValue.clear(); + this.tags.clear(); -+ this.lifecycles.clear(); + if (unregisteredIntrusiveHolders != null) { + unregisteredIntrusiveHolders.clear(); + unregisteredIntrusiveHolders = null; @@ -160,9 +161,6 @@ + if (0 <= id && id < this.byId.size() && this.byId.get(id) != null) { // Don't use byId() method, it will return the default value if the entry is absent + throw new IllegalStateException("Duplicate id " + id + " for " + key + " and " + this.getKey(this.byId.get(id).value())); + } -+ if (this.nextId <= id) { -+ this.nextId = id + 1; -+ } + var holder = byKey.get(key); + while (this.byId.size() < (id + 1)) this.byId.add(null); + this.byId.set(id, holder); diff --git a/patches/net/minecraft/core/Registry.java.patch b/patches/net/minecraft/core/Registry.java.patch index 6883f61375d..7276d4d6872 100644 --- a/patches/net/minecraft/core/Registry.java.patch +++ b/patches/net/minecraft/core/Registry.java.patch @@ -9,3 +9,12 @@ ResourceKey> key(); default Codec byNameCodec() { +@@ -48,7 +_,7 @@ + } + + private DataResult> safeCastToReference(Holder p_326365_) { +- return p_326365_ instanceof Holder.Reference reference ++ return p_326365_.getDelegate() instanceof Holder.Reference reference + ? DataResult.success(reference) + : DataResult.error(() -> "Unregistered holder in " + this.key() + ": " + p_326365_); + } diff --git a/patches/net/minecraft/core/RegistryCodecs.java.patch b/patches/net/minecraft/core/RegistryCodecs.java.patch deleted file mode 100644 index ff132ff648f..00000000000 --- a/patches/net/minecraft/core/RegistryCodecs.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/core/RegistryCodecs.java -+++ b/net/minecraft/core/RegistryCodecs.java -@@ -48,7 +_,8 @@ - } - - public static Codec> fullCodec(ResourceKey> p_248884_, Lifecycle p_251810_, Codec p_250169_) { -- Codec, E>> codec = Codec.unboundedMap(ResourceKey.codec(p_248884_), p_250169_); -+ // FORGE: Fix MC-197860 -+ Codec, E>> codec = new net.neoforged.neoforge.common.LenientUnboundedMapCodec<>(ResourceKey.codec(p_248884_), p_250169_); - return codec.xmap(p_258184_ -> { - WritableRegistry writableregistry = new MappedRegistry<>(p_248884_, p_251810_); - p_258184_.forEach((p_258191_, p_258192_) -> writableregistry.register(p_258191_, p_258192_, p_251810_)); diff --git a/patches/net/minecraft/core/RegistrySetBuilder.java.patch b/patches/net/minecraft/core/RegistrySetBuilder.java.patch index a43236682de..163a1531b25 100644 --- a/patches/net/minecraft/core/RegistrySetBuilder.java.patch +++ b/patches/net/minecraft/core/RegistrySetBuilder.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/core/RegistrySetBuilder.java +++ b/net/minecraft/core/RegistrySetBuilder.java -@@ -79,6 +_,10 @@ +@@ -72,6 +_,10 @@ return this.add(p_256261_, Lifecycle.stable(), p_256010_); } @@ -11,7 +11,7 @@ private RegistrySetBuilder.BuildState createState(RegistryAccess p_256400_) { RegistrySetBuilder.BuildState registrysetbuilder$buildstate = RegistrySetBuilder.BuildState.create( p_256400_, this.entries.stream().map(RegistrySetBuilder.RegistryStub::key) -@@ -145,16 +_,22 @@ +@@ -185,16 +_,22 @@ lazyholder.supplier = () -> cloner.clone((T)p_311483_.value(), p_312115_, p_311797_.getValue()); map.put(resourcekey, lazyholder); }); @@ -40,19 +40,19 @@ + } else { + lifecycle = registrylookup.registryLifecycle(); + } - return lookupFromMap(p_311836_, lifecycle, map); + return lookupFromMap(p_311836_, lifecycle, p_312323_, map); } } -@@ -191,7 +_,7 @@ - RegistrySetBuilder.UniversalLookup registrysetbuilder$universallookup = new RegistrySetBuilder.UniversalLookup(registrysetbuilder$compositeowner); +@@ -236,7 +_,7 @@ + RegistrySetBuilder.UniversalLookup registrysetbuilder$universallookup = new RegistrySetBuilder.UniversalLookup(registrysetbuilder$universalowner); Builder> builder = ImmutableMap.builder(); p_255995_.registries() - .forEach(p_258197_ -> builder.put(p_258197_.key().location(), RegistrySetBuilder.wrapContextLookup(p_258197_.value().asLookup()))); + .forEach(p_258197_ -> builder.put(p_258197_.key().location(), net.neoforged.neoforge.common.CommonHooks.wrapRegistryLookup(p_258197_.value().asLookup()))); p_256495_.forEach(p_256603_ -> builder.put(p_256603_.location(), registrysetbuilder$universallookup)); return new RegistrySetBuilder.BuildState( - registrysetbuilder$compositeowner, registrysetbuilder$universallookup, builder.build(), new HashMap<>(), list -@@ -215,6 +_,11 @@ + registrysetbuilder$universalowner, registrysetbuilder$universallookup, builder.build(), new HashMap<>(), list +@@ -260,6 +_,11 @@ @Override public HolderGetter lookup(ResourceKey> p_255961_) { return (HolderGetter)BuildState.this.registries.getOrDefault(p_255961_.location(), BuildState.this.lookup); diff --git a/patches/net/minecraft/core/RegistrySynchronization.java.patch b/patches/net/minecraft/core/RegistrySynchronization.java.patch deleted file mode 100644 index f5965b8b3b9..00000000000 --- a/patches/net/minecraft/core/RegistrySynchronization.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/core/RegistrySynchronization.java -+++ b/net/minecraft/core/RegistrySynchronization.java -@@ -30,7 +_,7 @@ - put(builder, Registries.TRIM_MATERIAL, TrimMaterial.DIRECT_CODEC); - put(builder, Registries.DIMENSION_TYPE, DimensionType.DIRECT_CODEC); - put(builder, Registries.DAMAGE_TYPE, DamageType.CODEC); -- return builder.build(); -+ return net.neoforged.neoforge.registries.DataPackRegistriesHooks.grabNetworkableRegistries(builder); // FORGE: Keep the map so custom registries can be added later - }); - public static final Codec NETWORK_CODEC = makeNetworkCodec(); - diff --git a/patches/net/minecraft/core/cauldron/CauldronInteraction.java.patch b/patches/net/minecraft/core/cauldron/CauldronInteraction.java.patch deleted file mode 100644 index 861cdd219f7..00000000000 --- a/patches/net/minecraft/core/cauldron/CauldronInteraction.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/core/cauldron/CauldronInteraction.java -+++ b/net/minecraft/core/cauldron/CauldronInteraction.java -@@ -68,6 +_,7 @@ - if (p_175667_.hasTag()) { - itemstack.setTag(p_175667_.getTag().copy()); - } -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyStackAttachments(p_175667_, itemstack); - - p_175665_.setItemInHand(p_175666_, itemstack); - p_175665_.awardStat(Stats.CLEAN_SHULKER_BOX); diff --git a/patches/net/minecraft/core/component/DataComponentHolder.java.patch b/patches/net/minecraft/core/component/DataComponentHolder.java.patch new file mode 100644 index 00000000000..c1264738bad --- /dev/null +++ b/patches/net/minecraft/core/component/DataComponentHolder.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/core/component/DataComponentHolder.java ++++ b/net/minecraft/core/component/DataComponentHolder.java +@@ -2,7 +_,7 @@ + + import javax.annotation.Nullable; + +-public interface DataComponentHolder { ++public interface DataComponentHolder extends net.neoforged.neoforge.common.extensions.IDataComponentHolderExtension { + DataComponentMap getComponents(); + + @Nullable diff --git a/patches/net/minecraft/core/component/DataComponentMap.java.patch b/patches/net/minecraft/core/component/DataComponentMap.java.patch new file mode 100644 index 00000000000..dfa82944a8e --- /dev/null +++ b/patches/net/minecraft/core/component/DataComponentMap.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/core/component/DataComponentMap.java ++++ b/net/minecraft/core/component/DataComponentMap.java +@@ -126,7 +_,7 @@ + }; + } + +- public static class Builder { ++ public static class Builder implements net.neoforged.neoforge.common.extensions.IDataComponentMapBuilderExtensions { + private final Reference2ObjectMap, Object> map = new Reference2ObjectArrayMap<>(); + + Builder() { diff --git a/patches/net/minecraft/core/component/DataComponentPatch.java.patch b/patches/net/minecraft/core/component/DataComponentPatch.java.patch new file mode 100644 index 00000000000..5a40947168b --- /dev/null +++ b/patches/net/minecraft/core/component/DataComponentPatch.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/core/component/DataComponentPatch.java ++++ b/net/minecraft/core/component/DataComponentPatch.java +@@ -238,6 +_,7 @@ + } + + public DataComponentPatch.Builder set(DataComponentType p_332004_, T p_331566_) { ++ net.neoforged.neoforge.common.CommonHooks.validateComponent(p_331566_); + this.map.put(p_332004_, Optional.of(p_331566_)); + return this; + } diff --git a/patches/net/minecraft/core/component/PatchedDataComponentMap.java.patch b/patches/net/minecraft/core/component/PatchedDataComponentMap.java.patch new file mode 100644 index 00000000000..041019ddac1 --- /dev/null +++ b/patches/net/minecraft/core/component/PatchedDataComponentMap.java.patch @@ -0,0 +1,21 @@ +--- a/net/minecraft/core/component/PatchedDataComponentMap.java ++++ b/net/minecraft/core/component/PatchedDataComponentMap.java +@@ -64,6 +_,7 @@ + + @Nullable + public T set(DataComponentType p_330791_, @Nullable T p_330369_) { ++ net.neoforged.neoforge.common.CommonHooks.validateComponent(p_330369_); + this.ensureMapOwnership(); + T t = this.prototype.get((DataComponentType)p_330791_); + Optional optional; +@@ -192,6 +_,10 @@ + } + + return i; ++ } ++ ++ public boolean isPatchEmpty() { ++ return this.patch.isEmpty(); + } + + public DataComponentPatch asPatch() { diff --git a/patches/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch b/patches/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch index 81236cacfad..95711c01734 100644 --- a/patches/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch +++ b/patches/net/minecraft/core/dispenser/DispenseItemBehavior.java.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -368,7 +_,7 @@ - DispensibleContainerItem dispensiblecontaineritem = (DispensibleContainerItem)p_123562_.getItem(); - BlockPos blockpos = p_302435_.pos().relative(p_302435_.state().getValue(DispenserBlock.FACING)); - Level level = p_302435_.level(); +@@ -231,7 +_,7 @@ + DispensibleContainerItem dispensiblecontaineritem = (DispensibleContainerItem)p_338251_.getItem(); + BlockPos blockpos = p_338850_.pos().relative(p_338850_.state().getValue(DispenserBlock.FACING)); + Level level = p_338850_.level(); - if (dispensiblecontaineritem.emptyContents(null, level, blockpos, null)) { -+ if (dispensiblecontaineritem.emptyContents(null, level, blockpos, null, p_123562_)) { - dispensiblecontaineritem.checkExtraContent(null, level, p_123562_, blockpos); ++ if (dispensiblecontaineritem.emptyContents(null, level, blockpos, null, p_338251_)) { + dispensiblecontaineritem.checkExtraContent(null, level, p_338251_, blockpos); return new ItemStack(Items.BUCKET); } else { -@@ -431,9 +_,10 @@ +@@ -293,9 +_,10 @@ } else if (CampfireBlock.canLight(blockstate) || CandleBlock.canLight(blockstate) || CandleCakeBlock.canLight(blockstate)) { level.setBlockAndUpdate(blockpos, blockstate.setValue(BlockStateProperties.LIT, Boolean.valueOf(true))); level.gameEvent(null, GameEvent.BLOCK_CHANGE, blockpos); - } else if (blockstate.getBlock() instanceof TntBlock) { - TntBlock.explode(level, blockpos); - level.removeBlock(blockpos, false); -+ } else if (blockstate.isFlammable(level, blockpos, p_302453_.state().getValue(DispenserBlock.FACING).getOpposite())) { -+ blockstate.onCaughtFire(level, blockpos, p_302453_.state().getValue(DispenserBlock.FACING).getOpposite(), null); ++ } else if (blockstate.isFlammable(level, blockpos, p_338494_.state().getValue(DispenserBlock.FACING).getOpposite())) { ++ blockstate.onCaughtFire(level, blockpos, p_338494_.state().getValue(DispenserBlock.FACING).getOpposite(), null); + if (blockstate.getBlock() instanceof TntBlock) + level.removeBlock(blockpos, false); } else { diff --git a/patches/net/minecraft/core/particles/BlockParticleOption.java.patch b/patches/net/minecraft/core/particles/BlockParticleOption.java.patch index 233cf8ecae7..992032b6958 100644 --- a/patches/net/minecraft/core/particles/BlockParticleOption.java.patch +++ b/patches/net/minecraft/core/particles/BlockParticleOption.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/core/particles/BlockParticleOption.java +++ b/net/minecraft/core/particles/BlockParticleOption.java -@@ -50,4 +_,15 @@ +@@ -37,4 +_,15 @@ public BlockState getState() { return this.state; } diff --git a/patches/net/minecraft/core/particles/ItemParticleOption.java.patch b/patches/net/minecraft/core/particles/ItemParticleOption.java.patch index f34790fb34c..ba30506ce6d 100644 --- a/patches/net/minecraft/core/particles/ItemParticleOption.java.patch +++ b/patches/net/minecraft/core/particles/ItemParticleOption.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/core/particles/ItemParticleOption.java +++ b/net/minecraft/core/particles/ItemParticleOption.java -@@ -31,7 +_,7 @@ - - public ItemParticleOption(ParticleType p_123705_, ItemStack p_123706_) { - this.type = p_123705_; -- this.itemStack = p_123706_; -+ this.itemStack = p_123706_.copy(); //Forge: Fix stack updating after the fact causing particle changes. +@@ -24,7 +_,7 @@ + throw new IllegalArgumentException("Empty stacks are not allowed"); + } else { + this.type = p_123705_; +- this.itemStack = p_123706_; ++ this.itemStack = p_123706_.copy(); //Forge: Fix stack updating after the fact causing particle changes. + } } - @Override diff --git a/patches/net/minecraft/core/registries/BuiltInRegistries.java.patch b/patches/net/minecraft/core/registries/BuiltInRegistries.java.patch index 9c3a8ba12de..6ec146c2fa9 100644 --- a/patches/net/minecraft/core/registries/BuiltInRegistries.java.patch +++ b/patches/net/minecraft/core/registries/BuiltInRegistries.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/core/registries/BuiltInRegistries.java +++ b/net/minecraft/core/registries/BuiltInRegistries.java -@@ -346,6 +_,10 @@ +@@ -338,6 +_,10 @@ }); } @@ -10,4 +10,4 @@ + @FunctionalInterface interface RegistryBootstrap { - T run(Registry p_260128_); + Object run(Registry p_260128_); diff --git a/patches/net/minecraft/data/DataGenerator.java.patch b/patches/net/minecraft/data/DataGenerator.java.patch index a7b2da7f758..b1a6783a186 100644 --- a/patches/net/minecraft/data/DataGenerator.java.patch +++ b/patches/net/minecraft/data/DataGenerator.java.patch @@ -12,7 +12,7 @@ LOGGER.debug("Generator {} already run for version {}", p_254418_, this.version.getName()); } else { LOGGER.info("Starting provider: {}", p_254418_); -+ net.neoforged.fml.StartupMessageManager.addModMessage("Generating: " + p_254418_); ++ net.neoforged.fml.loading.progress.StartupNotificationManager.addModMessage("Generating: " + p_254418_); stopwatch1.start(); hashcache.applyUpdate(hashcache.generateUpdate(p_254418_, p_253750_::run).join()); stopwatch1.stop(); diff --git a/patches/net/minecraft/data/DataProvider.java.patch b/patches/net/minecraft/data/DataProvider.java.patch index 6dbb738d75a..aeed3b4140f 100644 --- a/patches/net/minecraft/data/DataProvider.java.patch +++ b/patches/net/minecraft/data/DataProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/DataProvider.java +++ b/net/minecraft/data/DataProvider.java -@@ -22,6 +_,8 @@ +@@ -24,6 +_,8 @@ public interface DataProvider { ToIntFunction FIXED_ORDER_FIELDS = Util.make(new Object2IntOpenHashMap<>(), p_236070_ -> { diff --git a/patches/net/minecraft/data/HashCache.java.patch b/patches/net/minecraft/data/HashCache.java.patch index 9d1c1908d0c..9ef15576d90 100644 --- a/patches/net/minecraft/data/HashCache.java.patch +++ b/patches/net/minecraft/data/HashCache.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/data/HashCache.java +++ b/net/minecraft/data/HashCache.java -@@ -37,6 +_,7 @@ +@@ -39,6 +_,7 @@ private final Path cacheDir; private final String versionId; private final Map caches; + private final Map originalCaches; private final Set cachesToWrite = new HashSet<>(); - private final Set cachePaths = new HashSet<>(); + final Set cachePaths = new HashSet<>(); private final int initialCount; -@@ -63,6 +_,7 @@ +@@ -65,6 +_,7 @@ } this.caches = map; @@ -16,7 +16,7 @@ this.initialCount = i; } -@@ -104,6 +_,8 @@ +@@ -106,6 +_,8 @@ this.caches.forEach((p_253378_, p_253379_) -> { if (this.cachesToWrite.contains(p_253378_)) { Path path = this.getProviderCachePath(p_253378_); @@ -25,11 +25,11 @@ p_253379_.save(this.rootDir, path, DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(LocalDateTime.now()) + "\t" + p_253378_); } -@@ -219,10 +_,11 @@ +@@ -222,10 +_,11 @@ bufferedwriter.write(p_236145_); bufferedwriter.newLine(); -- for(Entry entry : this.data.entrySet()) { +- for (Entry entry : this.data.entrySet()) { + // Forge: Standardize order of entries + for(Map.Entry entry : this.data.entrySet().stream().sorted(Map.Entry.comparingByKey()).toList()) { bufferedwriter.write(entry.getValue().toString()); diff --git a/patches/net/minecraft/data/Main.java.patch b/patches/net/minecraft/data/Main.java.patch index 4b87d8da939..4e6c37a6e7c 100644 --- a/patches/net/minecraft/data/Main.java.patch +++ b/patches/net/minecraft/data/Main.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/Main.java +++ b/net/minecraft/data/Main.java -@@ -79,8 +_,15 @@ +@@ -86,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); -@@ -88,9 +_,16 @@ +@@ -95,9 +_,16 @@ boolean flag3 = flag || optionset.has(optionspec3); boolean flag4 = flag || optionset.has(optionspec4); boolean flag5 = flag || optionset.has(optionspec5); @@ -36,7 +36,7 @@ flag1, flag2, flag3, -@@ -100,6 +_,7 @@ +@@ -107,6 +_,7 @@ true ); datagenerator.run(); diff --git a/patches/net/minecraft/data/advancements/AdvancementProvider.java.patch b/patches/net/minecraft/data/advancements/AdvancementProvider.java.patch index 76e3d3328fe..7a109aeaab1 100644 --- a/patches/net/minecraft/data/advancements/AdvancementProvider.java.patch +++ b/patches/net/minecraft/data/advancements/AdvancementProvider.java.patch @@ -13,11 +13,11 @@ private final PackOutput.PathProvider pathProvider; private final List subProviders; @@ -36,7 +_,7 @@ - throw new IllegalStateException("Duplicate advancement " + p_311516_.id()); + throw new IllegalStateException("Duplicate advancement " + p_339356_.id()); } else { - Path path = this.pathProvider.json(p_311516_.id()); -- list.add(DataProvider.saveStable(p_254268_, Advancement.CODEC, p_311516_.value(), path)); -+ list.add(DataProvider.saveStable(p_254268_, Advancement.CODEC, p_311516_.value(), path));// TODO: make conditional + Path path = this.pathProvider.json(p_339356_.id()); +- list.add(DataProvider.saveStable(p_254268_, p_323115_, Advancement.CODEC, p_339356_.value(), path)); ++ list.add(DataProvider.saveStable(p_254268_, p_323115_, Advancement.CODEC, p_339356_.value(), path));// TODO: make conditional } }; diff --git a/patches/net/minecraft/data/loot/BlockLootSubProvider.java.patch b/patches/net/minecraft/data/loot/BlockLootSubProvider.java.patch index f313a605515..3b759606f26 100644 --- a/patches/net/minecraft/data/loot/BlockLootSubProvider.java.patch +++ b/patches/net/minecraft/data/loot/BlockLootSubProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/loot/BlockLootSubProvider.java +++ b/net/minecraft/data/loot/BlockLootSubProvider.java -@@ -611,12 +_,16 @@ +@@ -618,12 +_,16 @@ protected abstract void generate(); @@ -9,12 +9,12 @@ + } + @Override - public void generate(BiConsumer p_249322_) { + public void generate(HolderLookup.Provider p_331472_, BiConsumer, LootTable.Builder> p_249322_) { this.generate(); - Set set = new HashSet<>(); + Set> set = new HashSet<>(); -- for(Block block : BuiltInRegistries.BLOCK) { +- for (Block block : BuiltInRegistries.BLOCK) { + for(Block block : getKnownBlocks()) { if (block.isEnabled(this.enabledFeatures)) { - ResourceLocation resourcelocation = block.getLootTable(); - if (resourcelocation != BuiltInLootTables.EMPTY && set.add(resourcelocation)) { + ResourceKey resourcekey = block.getLootTable(); + if (resourcekey != BuiltInLootTables.EMPTY && set.add(resourcekey)) { diff --git a/patches/net/minecraft/data/loot/EntityLootSubProvider.java.patch b/patches/net/minecraft/data/loot/EntityLootSubProvider.java.patch index a86c5434318..8f15bad49c7 100644 --- a/patches/net/minecraft/data/loot/EntityLootSubProvider.java.patch +++ b/patches/net/minecraft/data/loot/EntityLootSubProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/loot/EntityLootSubProvider.java +++ b/net/minecraft/data/loot/EntityLootSubProvider.java -@@ -59,12 +_,16 @@ +@@ -58,12 +_,16 @@ public abstract void generate(); @@ -9,9 +9,9 @@ + } + @Override - public void generate(BiConsumer p_251751_) { + public void generate(HolderLookup.Provider p_331660_, BiConsumer, LootTable.Builder> p_251751_) { this.generate(); - Set set = Sets.newHashSet(); + Set> set = new HashSet<>(); - BuiltInRegistries.ENTITY_TYPE - .holders() + this.getKnownEntityTypes() @@ -19,7 +19,7 @@ .forEach( p_266624_ -> { EntityType entitytype = p_266624_.value(); -@@ -114,7 +_,7 @@ +@@ -113,7 +_,7 @@ } } diff --git a/patches/net/minecraft/data/loot/LootTableProvider.java.patch b/patches/net/minecraft/data/loot/LootTableProvider.java.patch index 920bbd15a5e..273b0e7fe55 100644 --- a/patches/net/minecraft/data/loot/LootTableProvider.java.patch +++ b/patches/net/minecraft/data/loot/LootTableProvider.java.patch @@ -1,34 +1,49 @@ --- a/net/minecraft/data/loot/LootTableProvider.java +++ b/net/minecraft/data/loot/LootTableProvider.java -@@ -46,7 +_,7 @@ - public CompletableFuture run(CachedOutput p_254060_) { - final Map map = Maps.newHashMap(); - Map map1 = new Object2ObjectOpenHashMap<>(); -- this.subProviders.forEach(p_288263_ -> p_288263_.provider().get().generate((p_288259_, p_288260_) -> { -+ getTables().forEach(p_288263_ -> p_288263_.provider().get().generate((p_288259_, p_288260_) -> { - ResourceLocation resourcelocation1 = map1.put(RandomSequence.seedForKey(p_288259_), p_288259_); +@@ -62,33 +_,24 @@ + private CompletableFuture run(CachedOutput p_324447_, HolderLookup.Provider p_323978_) { + WritableRegistry writableregistry = new MappedRegistry<>(Registries.LOOT_TABLE, Lifecycle.experimental()); + Map map = new Object2ObjectOpenHashMap<>(); +- this.subProviders.forEach(p_329847_ -> p_329847_.provider().get().generate(p_323978_, (p_339366_, p_339367_) -> { +- ResourceLocation resourcelocation = sequenceIdForLootTable(p_339366_); ++ getTables().forEach(p_329847_ -> p_329847_.provider().get().generate(p_323978_, (p_335199_, p_335200_) -> { ++ ResourceLocation resourcelocation = sequenceIdForLootTable(p_335199_); + ResourceLocation resourcelocation1 = map.put(RandomSequence.seedForKey(resourcelocation), resourcelocation); if (resourcelocation1 != null) { - Util.logAndPauseIfInIde("Loot table random sequence seed collision on " + resourcelocation1 + " and " + p_288259_); -@@ -66,15 +_,8 @@ - } - }); +- Util.logAndPauseIfInIde("Loot table random sequence seed collision on " + resourcelocation1 + " and " + p_339366_.location()); ++ Util.logAndPauseIfInIde("Loot table random sequence seed collision on " + resourcelocation1 + " and " + p_335199_.location()); + } -- for(ResourceLocation resourcelocation : Sets.difference(this.requiredTables, map.keySet())) { -- problemreporter$collector.report("Missing built-in table: " + resourcelocation); +- p_339367_.setRandomSequence(resourcelocation); +- LootTable loottable = p_339367_.setParamSet(p_329847_.paramSet).build(); +- writableregistry.register(p_339366_, loottable, RegistrationInfo.BUILT_IN); ++ p_335200_.setRandomSequence(resourcelocation); ++ LootTable loottable = p_335200_.setParamSet(p_329847_.paramSet).build(); ++ writableregistry.register(p_335199_, loottable, RegistrationInfo.BUILT_IN); + })); + writableregistry.freeze(); + ProblemReporter.Collector problemreporter$collector = new ProblemReporter.Collector(); + HolderGetter.Provider holdergetter$provider = new RegistryAccess.ImmutableRegistryAccess(List.of(writableregistry)).freeze().asGetterLookup(); + ValidationContext validationcontext = new ValidationContext(problemreporter$collector, LootContextParamSets.ALL_PARAMS, holdergetter$provider); + +- for (ResourceKey resourcekey : Sets.difference(this.requiredTables, writableregistry.registryKeySet())) { +- problemreporter$collector.report("Missing built-in table: " + resourcekey.location()); - } -+ validate(map, validationcontext); ++ validate(writableregistry, validationcontext, problemreporter$collector); -- map.forEach( -- (p_278897_, p_278898_) -> p_278898_.validate( -- validationcontext.setParams(p_278898_.getParamSet()).enterElement("{" + p_278897_ + "}", new LootDataId<>(LootDataType.TABLE, p_278897_)) -- ) -- ); +- writableregistry.holders() +- .forEach( +- p_339369_ -> p_339369_.value() +- .validate( +- validationcontext.setParams(p_339369_.value().getParamSet()).enterElement("{" + p_339369_.key().location() + "}", p_339369_.key()) +- ) +- ); Multimap multimap = problemreporter$collector.get(); if (!multimap.isEmpty()) { multimap.forEach((p_124446_, p_124447_) -> LOGGER.warn("Found validation problem in {}: {}", p_124446_, p_124447_)); -@@ -87,6 +_,20 @@ - return DataProvider.saveStable(p_254060_, LootTable.CODEC, loottable, path); - }).toArray(p_253403_ -> new CompletableFuture[p_253403_])); +@@ -101,6 +_,20 @@ + return DataProvider.saveStable(p_324447_, p_323978_, LootTable.DIRECT_CODEC, loottable, path); + }).toArray(CompletableFuture[]::new)); } + } + @@ -36,14 +51,14 @@ + return this.subProviders; + } + -+ protected void validate(Map map, ValidationContext validationcontext) { -+ for(ResourceLocation resourcelocation : Sets.difference(this.requiredTables, map.keySet())) { -+ validationcontext.reportProblem("Missing built-in table: " + resourcelocation); ++ protected void validate(WritableRegistry writableregistry, ValidationContext validationcontext, ProblemReporter.Collector problemreporter$collector) { ++ for(ResourceKey resourcekey : Sets.difference(this.requiredTables, writableregistry.registryKeySet())) { ++ problemreporter$collector.report("Missing built-in table: " + resourcekey.location()); + } + -+ map.forEach((p_278897_, p_278898_) -> { -+ p_278898_.validate(validationcontext.setParams(p_278898_.getParamSet()).enterElement("{" + p_278897_ + "}", new LootDataId<>(LootDataType.TABLE, p_278897_))); ++ writableregistry.holders().forEach(p_335195_ -> { ++ p_335195_.value().validate(validationcontext.setParams(p_335195_.value().getParamSet()).enterElement("{" + p_335195_.key().location() + "}", p_335195_.key())); + }); } - @Override + private static ResourceLocation sequenceIdForLootTable(ResourceKey p_336172_) { diff --git a/patches/net/minecraft/data/recipes/RecipeProvider.java.patch b/patches/net/minecraft/data/recipes/RecipeProvider.java.patch index a636ba985d6..071fe89292f 100644 --- a/patches/net/minecraft/data/recipes/RecipeProvider.java.patch +++ b/patches/net/minecraft/data/recipes/RecipeProvider.java.patch @@ -1,45 +1,38 @@ --- a/net/minecraft/data/recipes/RecipeProvider.java +++ b/net/minecraft/data/recipes/RecipeProvider.java -@@ -66,6 +_,10 @@ - .put(BlockFamily.Variant.WALL, (p_248024_, p_248025_) -> wallBuilder(RecipeCategory.DECORATIONS, p_248024_, Ingredient.of(p_248025_))) - .build(); - -+ @Deprecated(forRemoval = true, since = "1.20.4") // TODO: remove in 1.20.5 -+ public RecipeProvider(PackOutput p_248933_, CompletableFuture lookupProvider) { -+ this(p_248933_); -+ } - public RecipeProvider(PackOutput p_248933_) { - this.recipePathProvider = p_248933_.createPathProvider(PackOutput.Target.DATA_PACK, "recipes"); - this.advancementPathProvider = p_248933_.createPathProvider(PackOutput.Target.DATA_PACK, "advancements"); -@@ -78,15 +_,15 @@ +@@ -83,18 +_,18 @@ this.buildRecipes( new RecipeOutput() { @Override - public void accept(ResourceLocation p_312039_, Recipe p_312254_, @Nullable AdvancementHolder p_311794_) { -+ public void accept(ResourceLocation p_312039_, Recipe p_312254_, @org.jetbrains.annotations.Nullable AdvancementHolder p_311794_, net.neoforged.neoforge.common.conditions.ICondition... conditions) { ++ public void accept(ResourceLocation p_312039_, Recipe p_312254_, @Nullable AdvancementHolder p_311794_, net.neoforged.neoforge.common.conditions.ICondition... conditions) { if (!set.add(p_312039_)) { throw new IllegalStateException("Duplicate recipe " + p_312039_); } else { -- list.add(DataProvider.saveStable(p_254020_, Recipe.CODEC, p_312254_, RecipeProvider.this.recipePathProvider.json(p_312039_))); -+ list.add(DataProvider.saveStable(p_254020_, Recipe.CONDITIONAL_CODEC, Optional.of(new net.neoforged.neoforge.common.conditions.WithConditions<>(p_312254_, conditions)), RecipeProvider.this.recipePathProvider.json(p_312039_))); +- list.add(DataProvider.saveStable(p_324494_, p_324248_, Recipe.CODEC, p_312254_, RecipeProvider.this.recipePathProvider.json(p_312039_))); ++ list.add(DataProvider.saveStable(p_324494_, p_324248_, Recipe.CONDITIONAL_CODEC, Optional.of(new net.neoforged.neoforge.common.conditions.WithConditions<>(p_312254_, conditions)), RecipeProvider.this.recipePathProvider.json(p_312039_))); if (p_311794_ != null) { list.add( DataProvider.saveStable( -- p_254020_, Advancement.CODEC, p_311794_.value(), RecipeProvider.this.advancementPathProvider.json(p_311794_.id()) -+ p_254020_, Advancement.CONDITIONAL_CODEC, Optional.of(new net.neoforged.neoforge.common.conditions.WithConditions<>(p_311794_.value(), conditions)), RecipeProvider.this.advancementPathProvider.json(p_311794_.id()) + p_324494_, + p_324248_, +- Advancement.CODEC, +- p_311794_.value(), ++ Advancement.CONDITIONAL_CODEC, ++ Optional.of(new net.neoforged.neoforge.common.conditions.WithConditions<>(p_311794_.value(), conditions)), + RecipeProvider.this.advancementPathProvider.json(p_311794_.id()) ) ); - } -@@ -103,12 +_,16 @@ +@@ -112,12 +_,16 @@ } - protected CompletableFuture buildAdvancement(CachedOutput p_253674_, AdvancementHolder p_301116_) { -- return DataProvider.saveStable(p_253674_, Advancement.CODEC, p_301116_.value(), this.advancementPathProvider.json(p_301116_.id())); -+ return buildAdvancement(p_253674_, p_301116_, new net.neoforged.neoforge.common.conditions.ICondition[0]); + protected CompletableFuture buildAdvancement(CachedOutput p_253674_, HolderLookup.Provider p_323646_, AdvancementHolder p_301116_) { +- return DataProvider.saveStable(p_253674_, p_323646_, Advancement.CODEC, p_301116_.value(), this.advancementPathProvider.json(p_301116_.id())); ++ return buildAdvancement(p_253674_, p_323646_, p_301116_, new net.neoforged.neoforge.common.conditions.ICondition[0]); + } + -+ protected CompletableFuture buildAdvancement(CachedOutput p_253674_, AdvancementHolder p_301116_, net.neoforged.neoforge.common.conditions.ICondition... conditions) { -+ return DataProvider.saveStable(p_253674_, Advancement.CONDITIONAL_CODEC, Optional.of(new net.neoforged.neoforge.common.conditions.WithConditions<>(p_301116_.value(), conditions)), this.advancementPathProvider.json(p_301116_.id())); ++ protected CompletableFuture buildAdvancement(CachedOutput p_253674_, HolderLookup.Provider p_323646_, AdvancementHolder p_301116_, net.neoforged.neoforge.common.conditions.ICondition... conditions) { ++ return DataProvider.saveStable(p_253674_, p_323646_, Advancement.CONDITIONAL_CODEC, Optional.of(new net.neoforged.neoforge.common.conditions.WithConditions<>(p_301116_.value(), conditions)), this.advancementPathProvider.json(p_301116_.id())); } protected abstract void buildRecipes(RecipeOutput p_301172_); diff --git a/patches/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java.patch b/patches/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java.patch index f99750cc3f7..fb0bc660cfe 100644 --- a/patches/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java.patch +++ b/patches/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java +++ b/net/minecraft/data/recipes/SimpleCookingRecipeBuilder.java -@@ -27,6 +_,7 @@ +@@ -28,6 +_,7 @@ private final RecipeCategory category; private final CookingBookCategory bookCategory; private final Item result; @@ -8,7 +8,7 @@ private final Ingredient ingredient; private final float experience; private final int cookingTime; -@@ -44,9 +_,22 @@ +@@ -45,9 +_,22 @@ int p_250189_, AbstractCookingRecipe.Factory p_311960_ ) { @@ -32,7 +32,7 @@ this.ingredient = p_250362_; this.experience = p_251204_; this.cookingTime = p_250189_; -@@ -85,6 +_,38 @@ +@@ -86,6 +_,38 @@ return new SimpleCookingRecipeBuilder(p_250319_, CookingBookCategory.FOOD, p_250377_, p_248930_, p_252329_, p_250482_, SmokingRecipe::new); } @@ -71,7 +71,7 @@ public SimpleCookingRecipeBuilder unlockedBy(String p_176792_, Criterion p_300970_) { this.criteria.put(p_176792_, p_300970_); return this; -@@ -110,7 +_,7 @@ +@@ -111,7 +_,7 @@ this.criteria.forEach(advancement$builder::addCriterion); AbstractCookingRecipe abstractcookingrecipe = this.factory .create( diff --git a/patches/net/minecraft/data/registries/RegistriesDatapackGenerator.java.patch b/patches/net/minecraft/data/registries/RegistriesDatapackGenerator.java.patch index 337301bfd68..201f615df9e 100644 --- a/patches/net/minecraft/data/registries/RegistriesDatapackGenerator.java.patch +++ b/patches/net/minecraft/data/registries/RegistriesDatapackGenerator.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/registries/RegistriesDatapackGenerator.java +++ b/net/minecraft/data/registries/RegistriesDatapackGenerator.java -@@ -19,12 +_,23 @@ +@@ -18,12 +_,23 @@ import net.minecraft.resources.ResourceKey; import org.slf4j.Logger; @@ -24,17 +24,17 @@ this.registries = p_255780_; this.output = p_256643_; } -@@ -36,8 +_,7 @@ - p_256533_ -> { - DynamicOps dynamicops = RegistryOps.create(JsonOps.INSTANCE, p_256533_); +@@ -35,8 +_,7 @@ + p_326736_ -> { + DynamicOps dynamicops = p_326736_.createSerializationContext(JsonOps.INSTANCE); return CompletableFuture.allOf( - RegistryDataLoader.WORLDGEN_REGISTRIES - .stream() -+ net.neoforged.neoforge.registries.DataPackRegistriesHooks.getDataPackRegistriesWithDimensions() - .flatMap(p_256552_ -> this.dumpRegistryCap(p_255785_, p_256533_, dynamicops, p_256552_).stream()) - .toArray(p_255809_ -> new CompletableFuture[p_255809_]) - ); -@@ -53,9 +_,10 @@ ++ net.neoforged.neoforge.registries.DataPackRegistriesHooks.getDataPackRegistriesWithDimensions() + .flatMap( + p_256552_ -> this.dumpRegistryCap(p_255785_, p_326736_, dynamicops, (RegistryDataLoader.RegistryData)p_256552_).stream() + ) +@@ -54,9 +_,10 @@ .map( p_255847_ -> { PackOutput.PathProvider packoutput$pathprovider = this.output diff --git a/patches/net/minecraft/data/registries/VanillaRegistries.java.patch b/patches/net/minecraft/data/registries/VanillaRegistries.java.patch index ace8e9ee5a4..8b05c87b0db 100644 --- a/patches/net/minecraft/data/registries/VanillaRegistries.java.patch +++ b/patches/net/minecraft/data/registries/VanillaRegistries.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/data/registries/VanillaRegistries.java +++ b/net/minecraft/data/registries/VanillaRegistries.java -@@ -56,6 +_,7 @@ - .add(Registries.TRIM_PATTERN, TrimPatterns::bootstrap) - .add(Registries.TRIM_MATERIAL, TrimMaterials::bootstrap) - .add(Registries.DAMAGE_TYPE, DamageTypes::bootstrap); +@@ -60,6 +_,7 @@ + .add(Registries.WOLF_VARIANT, WolfVariants::bootstrap) + .add(Registries.DAMAGE_TYPE, DamageTypes::bootstrap) + .add(Registries.BANNER_PATTERN, BannerPatterns::bootstrap); + public static final List>> DATAPACK_REGISTRY_KEYS = BUILDER.getEntryKeys(); private static void validateThatAllBiomeFeaturesHaveBiomeFilter(HolderLookup.Provider p_256242_) { diff --git a/patches/net/minecraft/data/tags/GameEventTagsProvider.java.patch b/patches/net/minecraft/data/tags/GameEventTagsProvider.java.patch index c963734247b..9b0020e2ed9 100644 --- a/patches/net/minecraft/data/tags/GameEventTagsProvider.java.patch +++ b/patches/net/minecraft/data/tags/GameEventTagsProvider.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/data/tags/GameEventTagsProvider.java +++ b/net/minecraft/data/tags/GameEventTagsProvider.java -@@ -53,8 +_,14 @@ - GameEvent.UNEQUIP - }; +@@ -55,8 +_,14 @@ + GameEvent.UNEQUIP.key() + ); -+ /** @deprecated Forge: Use the {@linkplain #GameEventTagsProvider(PackOutput, CompletableFuture, String, net.neoforged.neoforge.common.data.ExistingFileHelper) mod id variant} */ ++ /** @deprecated Neo: Use the {@linkplain #GameEventTagsProvider(PackOutput, CompletableFuture, String, net.neoforged.neoforge.common.data.ExistingFileHelper) mod id variant} */ + @Deprecated public GameEventTagsProvider(PackOutput p_256060_, CompletableFuture p_255621_) { -- super(p_256060_, Registries.GAME_EVENT, p_255621_, p_256368_ -> p_256368_.builtInRegistryHolder().key()); +- super(p_256060_, Registries.GAME_EVENT, p_255621_); + this(p_256060_, p_255621_, "vanilla", null); + } + + public GameEventTagsProvider(PackOutput p_256060_, CompletableFuture p_255621_, String modId, @org.jetbrains.annotations.Nullable net.neoforged.neoforge.common.data.ExistingFileHelper existingFileHelper) { -+ super(p_256060_, Registries.GAME_EVENT, p_255621_, p_256368_ -> p_256368_.builtInRegistryHolder().key(), modId, existingFileHelper); ++ super(p_256060_, Registries.GAME_EVENT, p_255621_, modId, existingFileHelper); } @Override diff --git a/patches/net/minecraft/data/tags/TagsProvider.java.patch b/patches/net/minecraft/data/tags/TagsProvider.java.patch index 4b6cb5a9d37..f4f7cbf52c3 100644 --- a/patches/net/minecraft/data/tags/TagsProvider.java.patch +++ b/patches/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 -@@ -37,26 +_,54 @@ +@@ -36,26 +_,54 @@ private final CompletableFuture> parentProvider; protected final ResourceKey> registryKey; protected final Map builders = Maps.newLinkedHashMap(); @@ -57,9 +57,9 @@ } protected abstract void addTags(HolderLookup.Provider p_256380_); -@@ -86,7 +_,10 @@ - ResourceLocation resourcelocation = p_255499_.getKey(); - TagBuilder tagbuilder = p_255499_.getValue(); +@@ -88,7 +_,10 @@ + ResourceLocation resourcelocation = p_323138_.getKey(); + TagBuilder tagbuilder = p_323138_.getValue(); List list = tagbuilder.build(); - List list1 = list.stream().filter(p_274771_ -> !p_274771_.verifyIfPresent(predicate, predicate1)).toList(); + List list1 = java.util.stream.Stream.concat(list.stream(), tagbuilder.getRemoveEntries()) @@ -69,23 +69,21 @@ if (!list1.isEmpty()) { throw new IllegalArgumentException( String.format( -@@ -97,10 +_,10 @@ +@@ -99,8 +_,10 @@ ) ); } else { -- JsonElement jsonelement = TagFile.CODEC -- .encodeStart(JsonOps.INSTANCE, new TagFile(list, false)) -- .getOrThrow(false, LOGGER::error); - Path path = this.pathProvider.json(resourcelocation); -+ var removed = tagbuilder.getRemoveEntries().toList(); -+ JsonElement jsonelement = TagFile.CODEC.encodeStart(JsonOps.INSTANCE, new TagFile(list, tagbuilder.isReplace(), removed)).getOrThrow(false, LOGGER::error); +- return DataProvider.saveStable(p_253684_, p_323140_.contents, TagFile.CODEC, new TagFile(list, false), path); + Path path = this.getPath(resourcelocation); -+ if (path == null) return CompletableFuture.completedFuture(null); // Forge: Allow running this data provider without writing it. Recipe provider needs valid tags. - return DataProvider.saveStable(p_253684_, jsonelement, path); ++ if (path == null) return CompletableFuture.completedFuture(null); // Neo: Allow running this data provider without writing it. Recipe provider needs valid tags. ++ var removed = tagbuilder.getRemoveEntries().toList(); ++ return DataProvider.saveStable(p_253684_, p_323140_.contents, TagFile.CODEC, new TagFile(list, tagbuilder.isReplace(), removed), path); } } -@@ -113,12 +_,24 @@ - + ) +@@ -110,12 +_,24 @@ + ); } + private boolean missing(TagEntry reference) { @@ -110,7 +108,7 @@ return this.builders.computeIfAbsent(p_236452_.location(), p_236442_ -> TagBuilder.create()); } -@@ -134,11 +_,13 @@ +@@ -131,11 +_,13 @@ }); } @@ -127,7 +125,7 @@ } public final TagsProvider.TagAppender add(ResourceKey p_256138_) { -@@ -168,6 +_,19 @@ +@@ -173,6 +_,19 @@ public TagsProvider.TagAppender addOptionalTag(ResourceLocation p_176842_) { this.builder.addOptionalTag(p_176842_); return this; diff --git a/patches/net/minecraft/data/worldgen/BootstapContext.java.patch b/patches/net/minecraft/data/worldgen/BootstapContext.java.patch deleted file mode 100644 index 4931d964582..00000000000 --- a/patches/net/minecraft/data/worldgen/BootstapContext.java.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- a/net/minecraft/data/worldgen/BootstapContext.java -+++ b/net/minecraft/data/worldgen/BootstapContext.java -@@ -14,4 +_,6 @@ - } - - HolderGetter lookup(ResourceKey> p_256410_); -+ -+ default java.util.Optional> registryLookup(ResourceKey> registry) { return java.util.Optional.empty(); } - } diff --git a/patches/net/minecraft/data/worldgen/BootstrapContext.java.patch b/patches/net/minecraft/data/worldgen/BootstrapContext.java.patch new file mode 100644 index 00000000000..1224885b1de --- /dev/null +++ b/patches/net/minecraft/data/worldgen/BootstrapContext.java.patch @@ -0,0 +1,9 @@ +--- a/net/minecraft/data/worldgen/BootstrapContext.java ++++ b/net/minecraft/data/worldgen/BootstrapContext.java +@@ -14,4 +_,6 @@ + } + + HolderGetter lookup(ResourceKey> p_321547_); ++ ++ default java.util.Optional> registryLookup(ResourceKey> registry) { return java.util.Optional.empty(); } + } diff --git a/patches/net/minecraft/data/worldgen/biome/OverworldBiomes.java.patch b/patches/net/minecraft/data/worldgen/biome/OverworldBiomes.java.patch index 1c5f9ef50dd..135123b5f5f 100644 --- a/patches/net/minecraft/data/worldgen/biome/OverworldBiomes.java.patch +++ b/patches/net/minecraft/data/worldgen/biome/OverworldBiomes.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/worldgen/biome/OverworldBiomes.java +++ b/net/minecraft/data/worldgen/biome/OverworldBiomes.java -@@ -23,6 +_,8 @@ +@@ -24,6 +_,8 @@ import net.minecraft.world.level.levelgen.placement.PlacedFeature; public class OverworldBiomes { diff --git a/patches/net/minecraft/gametest/framework/GameTest.java.patch b/patches/net/minecraft/gametest/framework/GameTest.java.patch index c6979572226..bd0ecb0109f 100644 --- a/patches/net/minecraft/gametest/framework/GameTest.java.patch +++ b/patches/net/minecraft/gametest/framework/GameTest.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/gametest/framework/GameTest.java +++ b/net/minecraft/gametest/framework/GameTest.java -@@ -16,6 +_,11 @@ +@@ -20,6 +_,11 @@ - boolean required() default true; + boolean manualOnly() default false; + /** + * The namespace of where to grab the structure from, generally a mod id. diff --git a/patches/net/minecraft/gametest/framework/GameTestHelper.java.patch b/patches/net/minecraft/gametest/framework/GameTestHelper.java.patch deleted file mode 100644 index 35c72b0dfc6..00000000000 --- a/patches/net/minecraft/gametest/framework/GameTestHelper.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/gametest/framework/GameTestHelper.java -+++ b/net/minecraft/gametest/framework/GameTestHelper.java -@@ -836,7 +_,8 @@ - - public void forEveryBlockInStructure(Consumer p_177293_) { - AABB aabb = this.getRelativeBounds(); -- BlockPos.MutableBlockPos.betweenClosedStream(aabb.move(0.0, 1.0, 0.0)).forEach(p_177293_); -+ // Neo: Shrink AABB by one as an aabb surrounding two blocks is increased by one compared to the actual positions -+ BlockPos.MutableBlockPos.betweenClosedStream(aabb.contract(1.0, 1.0, 1.0)).forEach(p_177293_); - } - - public void onEachTick(Runnable p_177424_) { diff --git a/patches/net/minecraft/gametest/framework/GameTestInfo.java.patch b/patches/net/minecraft/gametest/framework/GameTestInfo.java.patch index 8d771415990..6d77cc9d234 100644 --- a/patches/net/minecraft/gametest/framework/GameTestInfo.java.patch +++ b/patches/net/minecraft/gametest/framework/GameTestInfo.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/gametest/framework/GameTestInfo.java +++ b/net/minecraft/gametest/framework/GameTestInfo.java -@@ -247,6 +_,7 @@ - public void prepareTestStructure(BlockPos p_309710_) { - this.structureBlockEntity = StructureUtils.prepareTestStructure(this, p_309710_, this.getRotation(), this.level); +@@ -264,6 +_,7 @@ + BlockPos blockpos = this.getOrCalculateNorthwestCorner(); + this.structureBlockEntity = StructureUtils.prepareTestStructure(this, blockpos, this.getRotation(), this.level); this.structureBlockPos = this.structureBlockEntity.getBlockPos(); + this.structureBlockEntity.setMetaData(this.getTestName()); // Neo: set the test name as metadata as it isn't always RL-compatible StructureUtils.addCommandBlockAndButtonToStartTest(this.structureBlockPos, new BlockPos(1, 0, -1), this.getRotation(), this.level); + StructureUtils.encaseStructure(this.getStructureBounds(), this.level, !this.testFunction.skyAccess()); this.listeners.forEach(p_127630_ -> p_127630_.testStructureLoaded(this)); - } diff --git a/patches/net/minecraft/gametest/framework/GameTestRegistry.java.patch b/patches/net/minecraft/gametest/framework/GameTestRegistry.java.patch index 5a3e4ab6e5d..eab23f3bf4b 100644 --- a/patches/net/minecraft/gametest/framework/GameTestRegistry.java.patch +++ b/patches/net/minecraft/gametest/framework/GameTestRegistry.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/gametest/framework/GameTestRegistry.java +++ b/net/minecraft/gametest/framework/GameTestRegistry.java -@@ -26,21 +_,33 @@ +@@ -25,21 +_,33 @@ private static final Map> AFTER_BATCH_FUNCTIONS = Maps.newHashMap(); - private static final Collection LAST_FAILED_TESTS = Sets.newHashSet(); + private static final Set LAST_FAILED_TESTS = Sets.newHashSet(); + /** @deprecated Forge: Use {@link net.neoforged.neoforge.event.RegisterGameTestsEvent RegisterGameTestsEvent} to register game tests */ + @Deprecated @@ -31,12 +31,12 @@ - TEST_FUNCTIONS.addAll(useTestGeneratorMethod(p_177504_)); + Collection testFunctions = new java.util.ArrayList<>(useTestGeneratorMethod(p_177504_)); + if (!allowedNamespaces.isEmpty()) -+ testFunctions.removeIf(t -> !allowedNamespaces.contains(new net.minecraft.resources.ResourceLocation(t.getStructureName()).getNamespace())); ++ testFunctions.removeIf(t -> !allowedNamespaces.contains(new net.minecraft.resources.ResourceLocation(t.structureName()).getNamespace())); + TEST_FUNCTIONS.addAll(testFunctions); TEST_CLASS_NAMES.add(s); } -@@ -102,7 +_,9 @@ +@@ -101,7 +_,9 @@ private static Collection useTestGeneratorMethod(Method p_177514_) { try { @@ -47,7 +47,7 @@ return (Collection)p_177514_.invoke(object); } catch (ReflectiveOperationException reflectiveoperationexception) { throw new RuntimeException(reflectiveoperationexception); -@@ -113,8 +_,9 @@ +@@ -112,8 +_,9 @@ GameTest gametest = p_177516_.getAnnotation(GameTest.class); String s = p_177516_.getDeclaringClass().getSimpleName(); String s1 = s.toLowerCase(); @@ -59,7 +59,7 @@ String s4 = gametest.batch(); Rotation rotation = StructureUtils.getRotationForRotationSteps(gametest.rotationSteps()); return new TestFunction( -@@ -134,7 +_,9 @@ +@@ -135,7 +_,9 @@ private static Consumer turnMethodIntoConsumer(Method p_177520_) { return p_177512_ -> { try { diff --git a/patches/net/minecraft/gametest/framework/GameTestServer.java.patch b/patches/net/minecraft/gametest/framework/GameTestServer.java.patch index 8529f970584..018a60ab85d 100644 --- a/patches/net/minecraft/gametest/framework/GameTestServer.java.patch +++ b/patches/net/minecraft/gametest/framework/GameTestServer.java.patch @@ -1,13 +1,14 @@ --- a/net/minecraft/gametest/framework/GameTestServer.java +++ b/net/minecraft/gametest/framework/GameTestServer.java -@@ -136,12 +_,14 @@ +@@ -149,6 +_,7 @@ public boolean initServer() { this.setPlayerList(new PlayerList(this, this.registries(), this.playerDataStorage, 1) { }); + net.neoforged.neoforge.server.ServerLifecycleHooks.handleServerAboutToStart(this); this.loadLevel(); ServerLevel serverlevel = this.overworld(); - serverlevel.setDefaultSpawnPos(this.spawnPos, 0.0F); + this.testBatches = Lists.newArrayList(GameTestBatchFactory.fromTestFunction(this.testFunctions, serverlevel)); +@@ -156,6 +_,7 @@ int i = 20000000; serverlevel.setWeatherParameters(20000000, 20000000, false, false); LOGGER.info("Started game test server"); diff --git a/patches/net/minecraft/gametest/framework/TestCommand.java.patch b/patches/net/minecraft/gametest/framework/TestCommand.java.patch index 000f085553c..8e77c005ebb 100644 --- a/patches/net/minecraft/gametest/framework/TestCommand.java.patch +++ b/patches/net/minecraft/gametest/framework/TestCommand.java.patch @@ -1,21 +1,11 @@ --- a/net/minecraft/gametest/framework/TestCommand.java +++ b/net/minecraft/gametest/framework/TestCommand.java -@@ -341,7 +_,7 @@ - - private static void runTest(ServerLevel p_127930_, BlockPos p_127931_, @Nullable MultipleTestTracker p_127932_, boolean p_304927_) { - StructureBlockEntity structureblockentity = (StructureBlockEntity)p_127930_.getBlockEntity(p_127931_); -- String s = structureblockentity.getMetaData(); -+ String s = structureblockentity.getMetaData().isBlank() ? structureblockentity.getStructureName() : structureblockentity.getMetaData(); // Neo: use the metadata for the structure name - Optional optional = GameTestRegistry.findTestFunction(s); - if (optional.isEmpty()) { - say(p_127930_, "Test function for test " + s + " could not be found", ChatFormatting.RED); -@@ -544,8 +_,8 @@ - } - - private static int importTestStructure(CommandSourceStack p_128016_, String p_128017_) { -- Path path = Paths.get(StructureUtils.testStructuresDir, p_128017_ + ".snbt"); - ResourceLocation resourcelocation = new ResourceLocation(p_128017_); -+ Path path = Paths.get(StructureUtils.testStructuresDir, resourcelocation.getPath() + ".snbt"); - Path path1 = p_128016_.getLevel().getStructureManager().getPathToGeneratedStructure(resourcelocation, ".nbt"); - - try { +@@ -343,7 +_,7 @@ + } else { + BlockPos blockpos1 = blockpos.subtract(optional.get()); + String s = blockpos1.getX() + ", " + blockpos1.getY() + ", " + blockpos1.getZ(); +- String s1 = structureblockentity.getMetaData(); ++ String s1 = structureblockentity.getMetaData().isBlank() ? structureblockentity.getStructureName() : structureblockentity.getMetaData(); // Neo: use the metadata for the structure name + Component component = Component.literal(s) + .setStyle( + Style.EMPTY diff --git a/patches/net/minecraft/nbt/CompoundTag.java.patch b/patches/net/minecraft/nbt/CompoundTag.java.patch index 170db8e2c95..dc97869d833 100644 --- a/patches/net/minecraft/nbt/CompoundTag.java.patch +++ b/patches/net/minecraft/nbt/CompoundTag.java.patch @@ -14,7 +14,7 @@ Map map = Maps.newHashMap(); byte b0; -- while((b0 = p_302338_.readByte()) != 0) { +- while ((b0 = p_302338_.readByte()) != 0) { - String s = readString(p_302338_, p_302362_); + while((b0 = readNamedTagType(p_302338_, p_302362_)) != 0) { + String s = p_302362_.readUTF(p_302338_.readUTF()); diff --git a/patches/net/minecraft/nbt/NbtIo.java.patch b/patches/net/minecraft/nbt/NbtIo.java.patch index e183a204de3..0dec753d04a 100644 --- a/patches/net/minecraft/nbt/NbtIo.java.patch +++ b/patches/net/minecraft/nbt/NbtIo.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/nbt/NbtIo.java +++ b/net/minecraft/nbt/NbtIo.java -@@ -172,10 +_,12 @@ +@@ -178,10 +_,12 @@ private static Tag readUnnamedTag(DataInput p_128931_, NbtAccounter p_128933_) throws IOException { byte b0 = p_128931_.readByte(); diff --git a/patches/net/minecraft/network/CompressionEncoder.java.patch b/patches/net/minecraft/network/CompressionEncoder.java.patch index de46b3fbdcb..07c23607a43 100644 --- a/patches/net/minecraft/network/CompressionEncoder.java.patch +++ b/patches/net/minecraft/network/CompressionEncoder.java.patch @@ -9,16 +9,16 @@ public CompressionEncoder(int p_129448_) { this.threshold = p_129448_; -@@ -21,6 +_,12 @@ - VarInt.write(p_129454_, 0); - p_129454_.writeBytes(p_129453_); +@@ -17,6 +_,12 @@ + + protected void encode(ChannelHandlerContext p_129452_, ByteBuf p_129453_, ByteBuf p_129454_) { + int i = p_129453_.readableBytes(); ++ if (!DISABLE_PACKET_DEBUG && i > net.minecraft.network.CompressionDecoder.MAXIMUM_UNCOMPRESSED_LENGTH) { ++ p_129453_.markReaderIndex(); ++ LOGGER.error("Attempted to send packet over maximum protocol size: {} > {}\nData:\n{}", i, net.minecraft.network.CompressionDecoder.MAXIMUM_UNCOMPRESSED_LENGTH, ++ net.neoforged.neoforge.logging.PacketDump.getContentDump(p_129453_)); ++ p_129453_.resetReaderIndex(); ++ } + if (i > 8388608) { + throw new IllegalArgumentException("Packet too big (is " + i + ", should be less than 8388608)"); } else { -+ if (!DISABLE_PACKET_DEBUG && i > net.minecraft.network.CompressionDecoder.MAXIMUM_UNCOMPRESSED_LENGTH) { -+ p_129453_.markReaderIndex(); -+ LOGGER.error("Attempted to send packet over maximum protocol size: {} > {}\nData:\n{}", i, net.minecraft.network.CompressionDecoder.MAXIMUM_UNCOMPRESSED_LENGTH, -+ net.neoforged.neoforge.logging.PacketDump.getContentDump(p_129453_)); -+ p_129453_.resetReaderIndex(); -+ } - byte[] abyte = new byte[i]; - p_129453_.readBytes(abyte); - VarInt.write(p_129454_, abyte.length); diff --git a/patches/net/minecraft/network/Connection.java.patch b/patches/net/minecraft/network/Connection.java.patch index deab3659629..e5dbc2b89a0 100644 --- a/patches/net/minecraft/network/Connection.java.patch +++ b/patches/net/minecraft/network/Connection.java.patch @@ -1,14 +1,21 @@ --- a/net/minecraft/network/Connection.java +++ b/net/minecraft/network/Connection.java -@@ -110,6 +_,7 @@ +@@ -107,6 +_,8 @@ + private volatile Component delayedDisconnect; + @Nullable + BandwidthDebugMonitor bandwidthDebugMonitor; ++ @Nullable ++ private ProtocolInfo inboundProtocol; + + public Connection(PacketFlow p_129482_) { + this.receiving = p_129482_; +@@ -120,11 +_,13 @@ if (this.delayedDisconnect != null) { this.disconnect(this.delayedDisconnect); } + net.neoforged.neoforge.network.connection.ConnectionUtils.setConnection(p_129525_, this); } - public static void setInitialProtocolAttributes(Channel p_294962_) { -@@ -120,6 +_,7 @@ @Override public void channelInactive(ChannelHandlerContext p_129527_) { this.disconnect(Component.translatable("disconnect.endOfStream")); @@ -16,7 +23,7 @@ } @Override -@@ -135,6 +_,14 @@ +@@ -140,6 +_,14 @@ this.disconnect(Component.translatable("disconnect.timeout")); } else { Component component = Component.translatable("disconnect.genericReason", "Internal Exception: " + p_129534_); @@ -31,7 +38,29 @@ if (flag) { LOGGER.debug("Failed to sent packet", p_129534_); if (this.getSending() == PacketFlow.CLIENTBOUND) { -@@ -380,7 +_,7 @@ +@@ -218,6 +_,7 @@ + if (p_320903_.flow() != this.getReceiving()) { + throw new IllegalStateException("Invalid inbound protocol: " + p_320903_.id()); + } else { ++ this.inboundProtocol = p_320903_; + this.packetListener = p_320940_; + this.disconnectListener = null; + UnconfiguredPipelineHandler.InboundConfigurationTask unconfiguredpipelinehandler$inboundconfigurationtask = UnconfiguredPipelineHandler.setupInboundProtocol( +@@ -246,7 +_,12 @@ + if (bundlerinfo != null) { + PacketBundleUnpacker packetbundleunpacker = new PacketBundleUnpacker(bundlerinfo); + unconfiguredpipelinehandler$outboundconfigurationtask = unconfiguredpipelinehandler$outboundconfigurationtask.andThen( +- p_319516_ -> p_319516_.pipeline().addAfter("encoder", "unbundler", packetbundleunpacker) ++ p_319516_ -> { ++ p_319516_.pipeline().addAfter("encoder", "unbundler", packetbundleunpacker); ++ // Neo: our handlers must be between the encoder and the unbundler, so re-inject them ++ // Note, this call must be inside the .andThen lambda, or it will actually run before the unbundler gets added. ++ net.neoforged.neoforge.network.filters.NetworkFilters.injectIfNecessary(this); ++ } + ); + } + +@@ -419,7 +_,7 @@ if (this.address == null) { return "local"; } else { @@ -40,7 +69,7 @@ } } -@@ -419,6 +_,7 @@ +@@ -458,6 +_,7 @@ } public static ChannelFuture connect(InetSocketAddress p_290034_, boolean p_290035_, final Connection p_290031_) { @@ -48,10 +77,10 @@ Class oclass; EventLoopGroup eventloopgroup; if (Epoll.isAvailable() && p_290035_) { -@@ -569,6 +_,14 @@ +@@ -626,5 +_,17 @@ - public float getAverageSentPackets() { - return this.averageSentPackets; + public void setBandwidthLogger(LocalSampleLogger p_323799_) { + this.bandwidthDebugMonitor = new BandwidthDebugMonitor(p_323799_); + } + + public Channel channel() { @@ -60,6 +89,9 @@ + + public PacketFlow getDirection() { + return this.receiving; ++ } ++ ++ public ProtocolInfo getInboundProtocol() { ++ return Objects.requireNonNull(this.inboundProtocol, "Inbound protocol not set?"); } - - public void setBandwidthLogger(SampleLogger p_299187_) { + } diff --git a/patches/net/minecraft/network/ConnectionProtocol.java.patch b/patches/net/minecraft/network/ConnectionProtocol.java.patch index e68f14ccaa7..fedefcf3b94 100644 --- a/patches/net/minecraft/network/ConnectionProtocol.java.patch +++ b/patches/net/minecraft/network/ConnectionProtocol.java.patch @@ -1,181 +1,14 @@ --- a/net/minecraft/network/ConnectionProtocol.java +++ b/net/minecraft/network/ConnectionProtocol.java -@@ -243,7 +_,7 @@ - .addPacket(ClientboundContainerSetSlotPacket.class, ClientboundContainerSetSlotPacket::new) - .addPacket(ClientboundCooldownPacket.class, ClientboundCooldownPacket::new) - .addPacket(ClientboundCustomChatCompletionsPacket.class, ClientboundCustomChatCompletionsPacket::new) -- .addPacket(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new) -+ .addContextualPacket(ClientboundCustomPayloadPacket.class, (buf, context) -> new ClientboundCustomPayloadPacket(buf, context, ConnectionProtocol.play())) - .addPacket(ClientboundDamageEventPacket.class, ClientboundDamageEventPacket::new) - .addPacket(ClientboundDeleteChatPacket.class, ClientboundDeleteChatPacket::new) - .addPacket(ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new) -@@ -356,7 +_,7 @@ - .addPacket(ServerboundContainerClickPacket.class, ServerboundContainerClickPacket::new) - .addPacket(ServerboundContainerClosePacket.class, ServerboundContainerClosePacket::new) - .addPacket(ServerboundContainerSlotStateChangedPacket.class, ServerboundContainerSlotStateChangedPacket::new) -- .addPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new) -+ .addContextualPacket(ServerboundCustomPayloadPacket.class, (buf, context) -> new ServerboundCustomPayloadPacket(buf, context, ConnectionProtocol.play())) - .addPacket(ServerboundEditBookPacket.class, ServerboundEditBookPacket::new) - .addPacket(ServerboundEntityTagQuery.class, ServerboundEntityTagQuery::new) - .addPacket(ServerboundInteractPacket.class, ServerboundInteractPacket::new) -@@ -440,7 +_,7 @@ - .addFlow( - PacketFlow.CLIENTBOUND, - new ConnectionProtocol.PacketSet() -- .addPacket(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new) -+ .addContextualPacket(ClientboundCustomPayloadPacket.class, (buf, context) -> new ClientboundCustomPayloadPacket(buf, context, ConnectionProtocol.configuration())) - .addPacket(ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new) - .addPacket(ClientboundFinishConfigurationPacket.class, ClientboundFinishConfigurationPacket::new) - .addPacket(ClientboundKeepAlivePacket.class, ClientboundKeepAlivePacket::new) -@@ -455,7 +_,7 @@ - PacketFlow.SERVERBOUND, - new ConnectionProtocol.PacketSet() - .addPacket(ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new) -- .addPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new) -+ .addContextualPacket(ServerboundCustomPayloadPacket.class, (buf, context) -> new ServerboundCustomPayloadPacket(buf, context, ConnectionProtocol.configuration())) - .addPacket(ServerboundFinishConfigurationPacket.class, ServerboundFinishConfigurationPacket::new) - .addPacket(ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new) - .addPacket(ServerboundPongPacket.class, ServerboundPongPacket::new) -@@ -467,6 +_,22 @@ - private final String id; - private final Map> flows; - -+ private static ConnectionProtocol play() { -+ return PLAY; -+ } -+ -+ private static ConnectionProtocol configuration() { -+ return CONFIGURATION; -+ } +@@ -16,4 +_,11 @@ + public String id() { + return this.id; + } + + public boolean isPlay() { + return this == PLAY; + } -+ + public boolean isConfiguration() { + return this == CONFIGURATION; + } -+ - private static ConnectionProtocol.ProtocolBuilder protocol() { - return new ConnectionProtocol.ProtocolBuilder(); - } -@@ -524,11 +_,28 @@ - return int2objectmap; - } - -+ /** -+ * @deprecated Use {@link #createPacket(int, FriendlyByteBuf, io.netty.channel.ChannelHandlerContext)} instead, which provides the channel context for creating custom packet payloads. -+ */ - @Nullable -+ @Deprecated - public Packet createPacket(int p_294972_, FriendlyByteBuf p_296217_) { - return this.packetSet.createPacket(p_294972_, p_296217_); - } - -+ /** -+ * Creates a new packet from the discriminator and the buffer. -+ * -+ * @param p_294972_ The discriminator -+ * @param p_296217_ The buffer -+ * @param p_130535_ The channel context -+ * @return The packet -+ */ -+ @Nullable -+ public Packet createPacket(int p_294972_, FriendlyByteBuf p_296217_, io.netty.channel.ChannelHandlerContext p_130535_) { -+ return this.packetSet.createPacket(p_294972_, p_296217_, p_130535_); -+ } -+ - public boolean isValidPacketType(Packet p_294142_) { - return this.packetSet.isKnownPacket(p_294142_.getClass()); - } -@@ -539,12 +_,22 @@ - final Object2IntMap>> classToId = Util.make( - new Object2IntOpenHashMap<>(), p_129613_ -> p_129613_.defaultReturnValue(-1) - ); -+ /** -+ * @deprecated Use {@link #contextualIdToDeserializer} instead it allows for context to be passed to the deserializer -+ */ -+ @Deprecated - private final List>> idToDeserializer = Lists.newArrayList(); -+ private final List>> contextualIdToDeserializer = Lists.newArrayList(); - private BundlerInfo bundlerInfo = BundlerInfo.EMPTY; - private final Set>> extraClasses = new HashSet<>(); - - public

> ConnectionProtocol.PacketSet addPacket(Class

p_178331_, Function p_178332_) { - int i = this.idToDeserializer.size(); -+ int k = this.contextualIdToDeserializer.size(); -+ if (i != k) { -+ throw new IllegalStateException("Deserializer lists must be equal in length! Somebody externally modified the registration!"); -+ } -+ - int j = this.classToId.put(p_178331_, i); - if (j != -1) { - String s = "Packet " + p_178331_ + " is already registered to ID " + j; -@@ -552,11 +_,33 @@ - throw new IllegalArgumentException(s); - } else { - this.idToDeserializer.add(p_178332_); -- return this; -- } -- } -- -- public

> ConnectionProtocol.PacketSet withBundlePacket(Class

p_265034_, Function>, P> p_265591_) { -+ this.contextualIdToDeserializer.add((p_296217_, p_130535_) -> p_178332_.apply(p_296217_)); //NeoForge: We always want to be able to create a packet from a buffer, even if we don't have a channel context -+ return this; -+ } -+ } -+ -+ public

> ConnectionProtocol.PacketSet addContextualPacket(Class

p_178331_, java.util.function.BiFunction readerBuilder) { -+ int i = this.contextualIdToDeserializer.size(); -+ int k = this.idToDeserializer.size(); -+ if (i != k) { -+ throw new IllegalStateException("Deserializer lists must be equal in length! Somebody externally modified the registration!"); -+ } -+ -+ int j = this.classToId.put(p_178331_, i); -+ if (j != -1) { -+ String s = "Packet " + p_178331_ + " is already registered to ID " + j; -+ LOGGER.error(LogUtils.FATAL_MARKER, s); -+ throw new IllegalArgumentException(s); -+ } else { -+ this.idToDeserializer.add((buffer -> { -+ throw new IllegalStateException("Cannot deserialize contextual packet: " + p_178331_.getSimpleName() + " without context"); -+ })); -+ this.contextualIdToDeserializer.add(readerBuilder); -+ return this; -+ } -+ } -+ -+ public

> ConnectionProtocol.PacketSet withBundlePacket(Class

p_265034_, Function>, P> p_265591_) { - if (this.bundlerInfo != BundlerInfo.EMPTY) { - throw new IllegalStateException("Bundle packet already configured"); - } else { -@@ -576,10 +_,28 @@ - return this.classToId.containsKey(p_295070_) || this.extraClasses.contains(p_295070_); - } - -+ /** -+ * @deprecated Use {@link #createPacket(int, FriendlyByteBuf, io.netty.channel.ChannelHandlerContext)} instead, which provides the channel context for creating custom packet payloads. -+ */ -+ @Deprecated - @Nullable - public Packet createPacket(int p_178328_, FriendlyByteBuf p_178329_) { - Function> function = this.idToDeserializer.get(p_178328_); - return function != null ? function.apply(p_178329_) : null; -+ } -+ -+ /** -+ * Creates a new packet from the given discriminator and buffer. -+ * -+ * @param p_178328_ The discriminator -+ * @param p_178329_ The buffer -+ * @param p_130535_ The channel context -+ * @return The packet, or null if no packet could be read. -+ */ -+ @Nullable -+ public Packet createPacket(int p_178328_, FriendlyByteBuf p_178329_, io.netty.channel.ChannelHandlerContext p_130535_) { -+ java.util.function.BiFunction> function = this.contextualIdToDeserializer.get(p_178328_); -+ return function != null ? function.apply(p_178329_, p_130535_) : null; - } - - public BundlerInfo bundlerInfo() { + } diff --git a/patches/net/minecraft/network/FriendlyByteBuf.java.patch b/patches/net/minecraft/network/FriendlyByteBuf.java.patch index 1713996a56c..5f72bfa0a51 100644 --- a/patches/net/minecraft/network/FriendlyByteBuf.java.patch +++ b/patches/net/minecraft/network/FriendlyByteBuf.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/network/FriendlyByteBuf.java +++ b/net/minecraft/network/FriendlyByteBuf.java -@@ -80,7 +_,7 @@ +@@ -67,7 +_,7 @@ import org.joml.Quaternionf; import org.joml.Vector3f; @@ -9,26 +9,14 @@ public static final int DEFAULT_NBT_QUOTA = 2097152; private final ByteBuf source; public static final short MAX_STRING_LENGTH = 32767; -@@ -572,9 +_,10 @@ - this.writeId(BuiltInRegistries.ITEM, item); - this.writeByte(p_130056_.getCount()); - CompoundTag compoundtag = null; -- if (item.canBeDepleted() || item.shouldOverrideMultiplayerNbt()) { -+ if (item.isDamageable(p_130056_) || item.shouldOverrideMultiplayerNbt()) { - compoundtag = p_130056_.getTag(); - } -+ compoundtag = net.neoforged.neoforge.attachment.AttachmentInternals.addAttachmentsToTag(compoundtag, p_130056_, false); - - this.writeNbt(compoundtag); - } -@@ -588,9 +_,7 @@ - } else { - Item item = this.readById(BuiltInRegistries.ITEM); - int i = this.readByte(); -- ItemStack itemstack = new ItemStack(item, i); -- itemstack.setTag(this.readNbt()); -- return itemstack; -+ return net.neoforged.neoforge.attachment.AttachmentInternals.reconstructItemStack(item, i, this.readNbt()); - } +@@ -1588,5 +_,10 @@ + @Override + public boolean release(int p_130347_) { + return this.source.release(p_130347_); ++ } ++ ++ @org.jetbrains.annotations.ApiStatus.Internal ++ public ByteBuf getSource() { ++ return this.source; } - + } diff --git a/patches/net/minecraft/network/PacketBundleUnpacker.java.patch b/patches/net/minecraft/network/PacketBundleUnpacker.java.patch index 1c153d15a80..a26060545bf 100644 --- a/patches/net/minecraft/network/PacketBundleUnpacker.java.patch +++ b/patches/net/minecraft/network/PacketBundleUnpacker.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/network/PacketBundleUnpacker.java +++ b/net/minecraft/network/PacketBundleUnpacker.java -@@ -20,7 +_,7 @@ - if (bundlerinfo$provider == null) { - throw new EncoderException("Bundler not configured: " + p_265038_); - } else { -- bundlerinfo$provider.bundlerInfo().unbundlePacket(p_265038_, p_265735_::add); -+ bundlerinfo$provider.bundlerInfo().unbundlePacket(p_265038_, p_265735_::add, p_265691_); - } +@@ -14,7 +_,7 @@ } - } + + protected void encode(ChannelHandlerContext p_265691_, Packet p_265038_, List p_265735_) throws Exception { +- this.bundlerInfo.unbundlePacket(p_265038_, p_265735_::add); ++ this.bundlerInfo.unbundlePacket(p_265038_, p_265735_::add, p_265691_); + if (p_265038_.isTerminal()) { + p_265691_.pipeline().remove(p_265691_.name()); + } diff --git a/patches/net/minecraft/network/PacketDecoder.java.patch b/patches/net/minecraft/network/PacketDecoder.java.patch deleted file mode 100644 index fd0a0ecc06d..00000000000 --- a/patches/net/minecraft/network/PacketDecoder.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/network/PacketDecoder.java -+++ b/net/minecraft/network/PacketDecoder.java -@@ -28,7 +_,7 @@ - ConnectionProtocol.CodecData codecdata = attribute.get(); - FriendlyByteBuf friendlybytebuf = new FriendlyByteBuf(p_130536_); - int j = friendlybytebuf.readVarInt(); -- Packet packet = codecdata.createPacket(j, friendlybytebuf); -+ Packet packet = codecdata.createPacket(j, friendlybytebuf, p_130535_); - if (packet == null) { - throw new IOException("Bad packet id " + j); - } else { diff --git a/patches/net/minecraft/network/PacketEncoder.java.patch b/patches/net/minecraft/network/PacketEncoder.java.patch index 294ee0f07a2..0c13e42719a 100644 --- a/patches/net/minecraft/network/PacketEncoder.java.patch +++ b/patches/net/minecraft/network/PacketEncoder.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/network/PacketEncoder.java +++ b/net/minecraft/network/PacketEncoder.java -@@ -46,7 +_,7 @@ - - JvmProfiler.INSTANCE.onPacketSent(codecdata.protocol(), i, p_130545_.channel().remoteAddress(), k); - } catch (Throwable throwable) { -- LOGGER.error("Error receiving packet {}", i, throwable); -+ LOGGER.error("Error sending packet {}", i, throwable); // Neo: fix flipped log message - if (p_130546_.isSkippable()) { - throw new SkipPacketException(throwable); - } +@@ -41,4 +_,8 @@ + ProtocolSwapHandler.handleOutboundTerminalPacket(p_130545_, p_130546_); + } + } ++ ++ public ProtocolInfo getProtocolInfo() { ++ return protocolInfo; ++ } + } diff --git a/patches/net/minecraft/network/chat/SignableCommand.java.patch b/patches/net/minecraft/network/chat/SignableCommand.java.patch index 50a699bb1cf..84b38e3dab0 100644 --- a/patches/net/minecraft/network/chat/SignableCommand.java.patch +++ b/patches/net/minecraft/network/chat/SignableCommand.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/network/chat/SignableCommand.java +++ b/net/minecraft/network/chat/SignableCommand.java -@@ -22,7 +_,8 @@ - (commandcontextbuilder2 = commandcontextbuilder1.getChild()) != null; - commandcontextbuilder1 = commandcontextbuilder2 - ) { -- boolean flag = commandcontextbuilder2.getRootNode() != commandcontextbuilder.getRootNode(); +@@ -24,7 +_,8 @@ + + CommandContextBuilder commandcontextbuilder2; + while ( +- (commandcontextbuilder2 = commandcontextbuilder1.getChild()) != null && commandcontextbuilder2.getRootNode() != commandcontextbuilder.getRootNode() + // NEO: Check if the command node is a RootCommandNode, instead of simply being the original root node; fixes #186 -+ boolean flag = !(commandcontextbuilder2.getRootNode() instanceof com.mojang.brigadier.tree.RootCommandNode); - if (!flag) { - break; - } ++ (commandcontextbuilder2 = commandcontextbuilder1.getChild()) != null && !(commandcontextbuilder2.getRootNode() instanceof com.mojang.brigadier.tree.RootCommandNode) + ) { + list.addAll(collectArguments(s, commandcontextbuilder2)); + commandcontextbuilder1 = commandcontextbuilder2; diff --git a/patches/net/minecraft/network/chat/contents/TranslatableContents.java.patch b/patches/net/minecraft/network/chat/contents/TranslatableContents.java.patch index 96c278f8a7f..faf12f6e869 100644 --- a/patches/net/minecraft/network/chat/contents/TranslatableContents.java.patch +++ b/patches/net/minecraft/network/chat/contents/TranslatableContents.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/network/chat/contents/TranslatableContents.java +++ b/net/minecraft/network/chat/contents/TranslatableContents.java -@@ -139,6 +_,11 @@ - } +@@ -140,6 +_,11 @@ + j = l; } + if (j == 0) { -+ // Forge has some special formatting handlers defined in ForgeI18n, use those if no %s replacements present. ++ // Neo has some special formatting handlers defined in I18nExtension, use those if no %s replacements present. + j = net.neoforged.neoforge.internal.TextComponentMessageFormatHandler.handle(this, p_237517_, this.args, p_237516_); + } + diff --git a/patches/net/minecraft/network/codec/ByteBufCodecs.java.patch b/patches/net/minecraft/network/codec/ByteBufCodecs.java.patch new file mode 100644 index 00000000000..c497b82a8e9 --- /dev/null +++ b/patches/net/minecraft/network/codec/ByteBufCodecs.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/network/codec/ByteBufCodecs.java ++++ b/net/minecraft/network/codec/ByteBufCodecs.java +@@ -463,7 +_,11 @@ + ) { + return new StreamCodec() { + private IdMap getRegistryOrThrow(RegistryFriendlyByteBuf p_330361_) { +- return p_320353_.apply(p_330361_.registryAccess().registryOrThrow(p_319942_)); ++ var registry = p_330361_.registryAccess().registryOrThrow(p_319942_); ++ if (net.neoforged.neoforge.registries.RegistryManager.isNonSyncedBuiltInRegistry(registry)) { ++ throw new IllegalStateException("Cannot use ID syncing for non-synced built-in registry: " + registry.key()); ++ } ++ return p_320353_.apply(registry); + } + + public R decode(RegistryFriendlyByteBuf p_331253_) { diff --git a/patches/net/minecraft/network/protocol/BundlePacket.java.patch b/patches/net/minecraft/network/protocol/BundlePacket.java.patch index e14526cf497..a2af013714d 100644 --- a/patches/net/minecraft/network/protocol/BundlePacket.java.patch +++ b/patches/net/minecraft/network/protocol/BundlePacket.java.patch @@ -1,20 +1,11 @@ --- a/net/minecraft/network/protocol/BundlePacket.java +++ b/net/minecraft/network/protocol/BundlePacket.java -@@ -4,13 +_,13 @@ - import net.minecraft.network.PacketListener; +@@ -6,7 +_,7 @@ + private final Iterable> packets; - public abstract class BundlePacket implements Packet { -- private final Iterable> packets; -+ private final Iterable> packets; - -- protected BundlePacket(Iterable> p_265290_) { + protected BundlePacket(Iterable> p_265290_) { - this.packets = p_265290_; -+ protected BundlePacket(Iterable> p_265290_) { + this.packets = net.neoforged.neoforge.network.bundle.BundlePacketUtils.flatten(p_265290_); } -- public final Iterable> subPackets() { -+ public final Iterable> subPackets() { - return this.packets; - } - + public final Iterable> subPackets() { diff --git a/patches/net/minecraft/network/protocol/BundlerInfo.java.patch b/patches/net/minecraft/network/protocol/BundlerInfo.java.patch index 99ac4915d5c..701c418536d 100644 --- a/patches/net/minecraft/network/protocol/BundlerInfo.java.patch +++ b/patches/net/minecraft/network/protocol/BundlerInfo.java.patch @@ -1,23 +1,14 @@ --- a/net/minecraft/network/protocol/BundlerInfo.java +++ b/net/minecraft/network/protocol/BundlerInfo.java -@@ -23,7 +_,7 @@ - }; - - static > BundlerInfo createForPacket( -- final Class

p_265438_, final Function>, P> p_265627_, final BundleDelimiterPacket p_265373_ -+ final Class

p_265438_, final Function>, P> p_265627_, final BundleDelimiterPacket p_265373_ - ) { - return new BundlerInfo() { - @Override -@@ -38,11 +_,31 @@ +@@ -26,6 +_,26 @@ } } + @Override + public void unbundlePacket(Packet bundlePacket, Consumer> packetSender, io.netty.channel.ChannelHandlerContext context) { -+ if (bundlePacket.getClass() == p_265438_) { ++ if (bundlePacket.type() == p_320816_) { + P p = (P)bundlePacket; -+ java.util.List> packets = net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().filterGameBundlePackets(context, p.subPackets()); ++ java.util.List> packets = net.neoforged.neoforge.network.registration.NetworkRegistry.filterGameBundlePackets(context, p.subPackets()); + if (packets.isEmpty()) { + return; + } @@ -35,14 +26,8 @@ + @Nullable @Override - public BundlerInfo.Bundler startPacketBundling(Packet p_265097_) { - return p_265097_ == p_265373_ ? new BundlerInfo.Bundler() { -- private final List> bundlePackets = new ArrayList<>(); -+ private final List> bundlePackets = new ArrayList<>(); - - @Nullable - @Override -@@ -61,7 +_,24 @@ + public BundlerInfo.Bundler startPacketBundling(Packet p_265749_) { +@@ -49,7 +_,24 @@ }; } diff --git a/patches/net/minecraft/network/protocol/PacketFlow.java.patch b/patches/net/minecraft/network/protocol/PacketFlow.java.patch index 5daa6529526..1a455bdb82b 100644 --- a/patches/net/minecraft/network/protocol/PacketFlow.java.patch +++ b/patches/net/minecraft/network/protocol/PacketFlow.java.patch @@ -5,6 +5,6 @@ -public enum PacketFlow { +public enum PacketFlow implements net.neoforged.neoforge.common.extensions.IPacketFlowExtension { - SERVERBOUND, - CLIENTBOUND; + SERVERBOUND("serverbound"), + CLIENTBOUND("clientbound"); diff --git a/patches/net/minecraft/network/protocol/common/ClientCommonPacketListener.java.patch b/patches/net/minecraft/network/protocol/common/ClientCommonPacketListener.java.patch index f63e14ba203..f9a18764ed4 100644 --- a/patches/net/minecraft/network/protocol/common/ClientCommonPacketListener.java.patch +++ b/patches/net/minecraft/network/protocol/common/ClientCommonPacketListener.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/network/protocol/common/ClientCommonPacketListener.java +++ b/net/minecraft/network/protocol/common/ClientCommonPacketListener.java -@@ -2,7 +_,7 @@ - +@@ -3,7 +_,7 @@ import net.minecraft.network.ClientboundPacketListener; + import net.minecraft.network.protocol.cookie.ClientCookiePacketListener; --public interface ClientCommonPacketListener extends ClientboundPacketListener { -+public interface ClientCommonPacketListener extends ClientboundPacketListener, net.neoforged.neoforge.common.extensions.IClientCommonPacketListenerExtension { +-public interface ClientCommonPacketListener extends ClientCookiePacketListener, ClientboundPacketListener { ++public interface ClientCommonPacketListener extends ClientCookiePacketListener, ClientboundPacketListener, net.neoforged.neoforge.common.extensions.IClientCommonPacketListenerExtension { void handleKeepAlive(ClientboundKeepAlivePacket p_295236_); void handlePing(ClientboundPingPacket p_296451_); diff --git a/patches/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java.patch b/patches/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java.patch index c7be664e92a..f17a187ea5a 100644 --- a/patches/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java.patch +++ b/patches/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java.patch @@ -1,46 +1,21 @@ --- a/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java +++ b/net/minecraft/network/protocol/common/ClientboundCustomPayloadPacket.java -@@ -53,10 +_,43 @@ - .put(WorldGenAttemptDebugPayload.ID, WorldGenAttemptDebugPayload::new) - .build(); +@@ -60,12 +_,16 @@ + ), + p_333492_ -> { + } +- ) ++ ), ++ net.minecraft.network.ConnectionProtocol.PLAY, ++ net.minecraft.network.protocol.PacketFlow.CLIENTBOUND + ) + .map(ClientboundCustomPayloadPacket::new, ClientboundCustomPayloadPacket::payload); + public static final StreamCodec CONFIG_STREAM_CODEC = CustomPacketPayload.codec( + p_320228_ -> DiscardedPayload.codec(p_320228_, 1048576), +- List.of(new CustomPacketPayload.TypeAndCodec<>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)) ++ List.of(new CustomPacketPayload.TypeAndCodec<>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)), ++ net.minecraft.network.ConnectionProtocol.CONFIGURATION, ++ net.minecraft.network.protocol.PacketFlow.CLIENTBOUND + ) + .map(ClientboundCustomPayloadPacket::new, ClientboundCustomPayloadPacket::payload); -+ /** -+ * @deprecated Use {@link #ClientboundCustomPayloadPacket(FriendlyByteBuf, io.netty.channel.ChannelHandlerContext, net.minecraft.network.ConnectionProtocol)} instead, as this variant can only read vanilla payloads. -+ */ -+ @Deprecated() - public ClientboundCustomPayloadPacket(FriendlyByteBuf p_295835_) { - this(readPayload(p_295835_.readResourceLocation(), p_295835_)); - } - -+ /** -+ * Reads a custom payload packet from the given buffer. -+ * -+ * @param buffer The buffer to read from -+ * @param context The context of the channel in which this packet is read -+ * @param protocol The protocol of the connection -+ */ -+ public ClientboundCustomPayloadPacket(FriendlyByteBuf buffer, io.netty.channel.ChannelHandlerContext context, net.minecraft.network.ConnectionProtocol protocol) { -+ this(readPayload(buffer.readResourceLocation(), buffer, context, protocol)); -+ } -+ -+ /** -+ * Reads the payload from the given buffer. -+ * -+ * @param p_294367_ The id of the payload -+ * @param p_294321_ The buffer to read from -+ * @param context The context of the channel in which this packet is read -+ * @param protocol The protocol of the connection -+ * @return The payload -+ */ -+ private static CustomPacketPayload readPayload(ResourceLocation p_294367_, FriendlyByteBuf p_294321_, io.netty.channel.ChannelHandlerContext context, net.minecraft.network.ConnectionProtocol protocol) { -+ FriendlyByteBuf.Reader reader = net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().getReader(p_294367_, context, protocol, KNOWN_TYPES); -+ return (CustomPacketPayload)(reader != null ? reader.apply(p_294321_) : readUnknownPayload(p_294367_, p_294321_)); -+ } -+ -+ /** -+ * @deprecated Use {@link #readPayload(ResourceLocation, FriendlyByteBuf, io.netty.channel.ChannelHandlerContext, net.minecraft.network.ConnectionProtocol)} instead, as this variant can only read vanilla payloads. -+ */ -+ @Deprecated - private static CustomPacketPayload readPayload(ResourceLocation p_294802_, FriendlyByteBuf p_294886_) { - FriendlyByteBuf.Reader reader = KNOWN_TYPES.get(p_294802_); - return (CustomPacketPayload)(reader != null ? reader.apply(p_294886_) : readUnknownPayload(p_294802_, p_294886_)); diff --git a/patches/net/minecraft/network/protocol/common/ServerCommonPacketListener.java.patch b/patches/net/minecraft/network/protocol/common/ServerCommonPacketListener.java.patch index 535b26b1c83..bb57676d72c 100644 --- a/patches/net/minecraft/network/protocol/common/ServerCommonPacketListener.java.patch +++ b/patches/net/minecraft/network/protocol/common/ServerCommonPacketListener.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/network/protocol/common/ServerCommonPacketListener.java +++ b/net/minecraft/network/protocol/common/ServerCommonPacketListener.java -@@ -2,7 +_,7 @@ - +@@ -3,7 +_,7 @@ + import net.minecraft.network.protocol.cookie.ServerCookiePacketListener; import net.minecraft.network.protocol.game.ServerPacketListener; --public interface ServerCommonPacketListener extends ServerPacketListener { -+public interface ServerCommonPacketListener extends ServerPacketListener, net.neoforged.neoforge.common.extensions.IServerCommonPacketListenerExtension { +-public interface ServerCommonPacketListener extends ServerCookiePacketListener, ServerPacketListener { ++public interface ServerCommonPacketListener extends ServerCookiePacketListener, ServerPacketListener, net.neoforged.neoforge.common.extensions.IServerCommonPacketListenerExtension { void handleKeepAlive(ServerboundKeepAlivePacket p_296457_); void handlePong(ServerboundPongPacket p_294309_); diff --git a/patches/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch b/patches/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch index 18ad269406c..133c107221c 100644 --- a/patches/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch +++ b/patches/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch @@ -1,52 +1,21 @@ --- a/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java +++ b/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java -@@ -17,10 +_,49 @@ - .put(BrandPayload.ID, BrandPayload::new) - .build(); +@@ -17,7 +_,17 @@ + public static final StreamCodec STREAM_CODEC = CustomPacketPayload.codec( + p_319841_ -> DiscardedPayload.codec(p_319841_, 32767), + Util.make(Lists.newArrayList(new CustomPacketPayload.TypeAndCodec<>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)), p_333493_ -> { +- }) ++ }), ++ net.minecraft.network.ConnectionProtocol.PLAY, ++ net.minecraft.network.protocol.PacketFlow.SERVERBOUND ++ ) ++ .map(ServerboundCustomPayloadPacket::new, ServerboundCustomPayloadPacket::payload); ++ public static final StreamCodec CONFIG_STREAM_CODEC = CustomPacketPayload.codec( ++ p_319841_ -> DiscardedPayload.codec(p_319841_, 32767), ++ Util.make(Lists.newArrayList(new CustomPacketPayload.TypeAndCodec<>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)), p_333493_ -> { ++ }), ++ net.minecraft.network.ConnectionProtocol.CONFIGURATION, ++ net.minecraft.network.protocol.PacketFlow.SERVERBOUND + ) + .map(ServerboundCustomPayloadPacket::new, ServerboundCustomPayloadPacket::payload); -+ /** -+ * Creates a new packet with a custom payload from the network. -+ * @param p_296108_ The buffer to read the packet from. -+ * @deprecated Use {@link #ServerboundCustomPayloadPacket(FriendlyByteBuf, io.netty.channel.ChannelHandlerContext, net.minecraft.network.ConnectionProtocol)} instead, as this variant can only read vanilla payloads. -+ */ -+ @Deprecated - public ServerboundCustomPayloadPacket(FriendlyByteBuf p_296108_) { - this(readPayload(p_296108_.readResourceLocation(), p_296108_)); - } - -+ /** -+ * Creates a new packet with a custom payload from the network. -+ * -+ * @param p_296108_ The buffer to read the packet from. -+ * @param context The context of the channel handler -+ * @param protocol The protocol of the connection -+ */ -+ public ServerboundCustomPayloadPacket(FriendlyByteBuf p_296108_, io.netty.channel.ChannelHandlerContext context, net.minecraft.network.ConnectionProtocol protocol) { -+ this(readPayload(p_296108_.readResourceLocation(), p_296108_, context, protocol)); -+ } -+ -+ /** -+ * Reads the payload from the given buffer. -+ * -+ * @param p_294367_ The id of the payload -+ * @param p_294321_ The buffer to read from -+ * @param context The context of the channel handler -+ * @param protocol The protocol of the connection -+ * @return The payload -+ */ -+ private static CustomPacketPayload readPayload(ResourceLocation p_294367_, FriendlyByteBuf p_294321_, io.netty.channel.ChannelHandlerContext context, net.minecraft.network.ConnectionProtocol protocol) { -+ FriendlyByteBuf.Reader reader = net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().getReader(p_294367_, context, protocol, KNOWN_TYPES); -+ return (CustomPacketPayload)(reader != null ? reader.apply(p_294321_) : readUnknownPayload(p_294367_, p_294321_)); -+ } -+ -+ /** -+ * Reads the payload from the given buffer. -+ * @param p_294367_ The id of the payload -+ * @param p_294321_ The buffer to read from -+ * @return The payload -+ * @deprecated Use {@link #readPayload(ResourceLocation, FriendlyByteBuf, io.netty.channel.ChannelHandlerContext, net.minecraft.network.ConnectionProtocol)} instead, as this variant can only read vanilla payloads. -+ */ -+ @Deprecated - private static CustomPacketPayload readPayload(ResourceLocation p_294367_, FriendlyByteBuf p_294321_) { - FriendlyByteBuf.Reader reader = KNOWN_TYPES.get(p_294367_); - return (CustomPacketPayload)(reader != null ? reader.apply(p_294321_) : readUnknownPayload(p_294367_, p_294321_)); diff --git a/patches/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java.patch b/patches/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java.patch new file mode 100644 index 00000000000..9d0e7d14458 --- /dev/null +++ b/patches/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java.patch @@ -0,0 +1,42 @@ +--- a/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java ++++ b/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java +@@ -22,20 +_,25 @@ + } + + static StreamCodec codec( +- final CustomPacketPayload.FallbackProvider p_319839_, List> p_320495_ ++ final CustomPacketPayload.FallbackProvider p_319839_, List> p_320495_, net.minecraft.network.ConnectionProtocol protocol, net.minecraft.network.protocol.PacketFlow packetFlow + ) { + final Map> map = p_320495_.stream() + .collect(Collectors.toUnmodifiableMap(p_320895_ -> p_320895_.type().id(), CustomPacketPayload.TypeAndCodec::codec)); + return new StreamCodec() { + private StreamCodec findCodec(ResourceLocation p_320938_) { + StreamCodec streamcodec = map.get(p_320938_); ++ if (streamcodec == null) streamcodec = net.neoforged.neoforge.network.registration.NetworkRegistry.getCodec(p_320938_, protocol, packetFlow); + return streamcodec != null ? streamcodec : p_319839_.create(p_320938_); + } + + private void writeCap(B p_320565_, CustomPacketPayload.Type p_320917_, CustomPacketPayload p_320112_) { + p_320565_.writeResourceLocation(p_320917_.id()); + StreamCodec streamcodec = (StreamCodec)this.findCodec(p_320917_.id); ++ try { + streamcodec.encode(p_320565_, (T)p_320112_); ++ } catch (RuntimeException e) { ++ throw new RuntimeException("Failed encoding custom payload " + p_320917_.id() + ": " + e, e); // Make it easier to debug which mod payload failed to be encoded ++ } + } + + public void encode(B p_320490_, CustomPacketPayload p_319776_) { +@@ -44,7 +_,11 @@ + + public CustomPacketPayload decode(B p_320227_) { + ResourceLocation resourcelocation = p_320227_.readResourceLocation(); +- return (CustomPacketPayload)this.findCodec(resourcelocation).decode(p_320227_); ++ try { ++ return (CustomPacketPayload)this.findCodec(resourcelocation).decode(p_320227_); ++ } catch (RuntimeException e) { ++ throw new RuntimeException("Failed decoding custom payload " + resourcelocation + ": " + e, e); // Make it easier to debug which mod payload failed to be decoded ++ } + } + }; + } diff --git a/patches/net/minecraft/network/protocol/configuration/ConfigurationProtocols.java.patch b/patches/net/minecraft/network/protocol/configuration/ConfigurationProtocols.java.patch new file mode 100644 index 00000000000..f17f4a678ac --- /dev/null +++ b/patches/net/minecraft/network/protocol/configuration/ConfigurationProtocols.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/network/protocol/configuration/ConfigurationProtocols.java ++++ b/net/minecraft/network/protocol/configuration/ConfigurationProtocols.java +@@ -27,7 +_,7 @@ + ConnectionProtocol.CONFIGURATION, + p_325554_ -> p_325554_.addPacket(CommonPacketTypes.SERVERBOUND_CLIENT_INFORMATION, ServerboundClientInformationPacket.STREAM_CODEC) + .addPacket(CookiePacketTypes.SERVERBOUND_COOKIE_RESPONSE, ServerboundCookieResponsePacket.STREAM_CODEC) +- .addPacket(CommonPacketTypes.SERVERBOUND_CUSTOM_PAYLOAD, ServerboundCustomPayloadPacket.STREAM_CODEC) ++ .addPacket(CommonPacketTypes.SERVERBOUND_CUSTOM_PAYLOAD, ServerboundCustomPayloadPacket.CONFIG_STREAM_CODEC) // Neo: use protocol-aware stream codec instead + .addPacket(ConfigurationPacketTypes.SERVERBOUND_FINISH_CONFIGURATION, ServerboundFinishConfigurationPacket.STREAM_CODEC) + .addPacket(CommonPacketTypes.SERVERBOUND_KEEP_ALIVE, ServerboundKeepAlivePacket.STREAM_CODEC) + .addPacket(CommonPacketTypes.SERVERBOUND_PONG, ServerboundPongPacket.STREAM_CODEC) diff --git a/patches/net/minecraft/network/protocol/game/ClientboundBundlePacket.java.patch b/patches/net/minecraft/network/protocol/game/ClientboundBundlePacket.java.patch deleted file mode 100644 index 076aea75d69..00000000000 --- a/patches/net/minecraft/network/protocol/game/ClientboundBundlePacket.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/network/protocol/game/ClientboundBundlePacket.java -+++ b/net/minecraft/network/protocol/game/ClientboundBundlePacket.java -@@ -4,7 +_,7 @@ - import net.minecraft.network.protocol.Packet; - - public class ClientboundBundlePacket extends BundlePacket { -- public ClientboundBundlePacket(Iterable> p_265231_) { -+ public ClientboundBundlePacket(Iterable> p_265231_) { - super(p_265231_); - } - diff --git a/patches/net/minecraft/network/protocol/game/ServerGamePacketListener.java.patch b/patches/net/minecraft/network/protocol/game/ServerGamePacketListener.java.patch index 294239c1f58..f24f3d2b43e 100644 --- a/patches/net/minecraft/network/protocol/game/ServerGamePacketListener.java.patch +++ b/patches/net/minecraft/network/protocol/game/ServerGamePacketListener.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/network/protocol/game/ServerGamePacketListener.java +++ b/net/minecraft/network/protocol/game/ServerGamePacketListener.java -@@ -3,7 +_,7 @@ - import net.minecraft.network.ConnectionProtocol; +@@ -4,7 +_,7 @@ import net.minecraft.network.protocol.common.ServerCommonPacketListener; + import net.minecraft.network.protocol.ping.ServerPingPacketListener; --public interface ServerGamePacketListener extends ServerPingPacketListener, ServerCommonPacketListener { -+public interface ServerGamePacketListener extends ServerPingPacketListener, ServerCommonPacketListener, net.neoforged.neoforge.common.extensions.IServerGamePacketListenerExtension { +-public interface ServerGamePacketListener extends ServerCommonPacketListener, ServerPingPacketListener { ++public interface ServerGamePacketListener extends ServerCommonPacketListener, ServerPingPacketListener, net.neoforged.neoforge.common.extensions.IServerGamePacketListenerExtension { @Override default ConnectionProtocol protocol() { return ConnectionProtocol.PLAY; diff --git a/patches/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java.patch b/patches/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java.patch index ec00a70e1c4..db8640a673e 100644 --- a/patches/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java.patch +++ b/patches/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java.patch @@ -1,21 +1,24 @@ --- a/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java +++ b/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java -@@ -3,13 +_,19 @@ - import net.minecraft.network.FriendlyByteBuf; +@@ -5,16 +_,22 @@ import net.minecraft.network.protocol.Packet; + import net.minecraft.network.protocol.PacketType; -public record ClientboundStatusResponsePacket(ServerStatus status) implements Packet { +public record ClientboundStatusResponsePacket(ServerStatus status, @org.jetbrains.annotations.Nullable String cachedStatus) implements Packet { + public static final StreamCodec STREAM_CODEC = Packet.codec( + ClientboundStatusResponsePacket::write, ClientboundStatusResponsePacket::new + ); + + public ClientboundStatusResponsePacket(ServerStatus status) { + this(status, null); + } + - public ClientboundStatusResponsePacket(FriendlyByteBuf p_179834_) { + private ClientboundStatusResponsePacket(FriendlyByteBuf p_179834_) { this(p_179834_.readJsonWithCodec(ServerStatus.CODEC)); } - @Override - public void write(FriendlyByteBuf p_134899_) { + private void write(FriendlyByteBuf p_134899_) { + if (cachedStatus != null) p_134899_.writeUtf(cachedStatus); + else p_134899_.writeJsonWithCodec(ServerStatus.CODEC, this.status); diff --git a/patches/net/minecraft/network/protocol/status/ServerStatus.java.patch b/patches/net/minecraft/network/protocol/status/ServerStatus.java.patch index e689a1900ee..8d6b09b9b5f 100644 --- a/patches/net/minecraft/network/protocol/status/ServerStatus.java.patch +++ b/patches/net/minecraft/network/protocol/status/ServerStatus.java.patch @@ -9,14 +9,14 @@ + boolean isModded ) { public static final Codec CODEC = RecordCodecBuilder.create( - p_304170_ -> p_304170_.group( + p_337519_ -> p_337519_.group( @@ -29,7 +_,8 @@ - ServerStatus.Players.CODEC.optionalFieldOf("players").forGetter(ServerStatus::players), - ServerStatus.Version.CODEC.optionalFieldOf("version").forGetter(ServerStatus::version), - ServerStatus.Favicon.CODEC.optionalFieldOf("favicon").forGetter(ServerStatus::favicon), -- Codec.BOOL.optionalFieldOf("enforcesSecureChat", Boolean.valueOf(false)).forGetter(ServerStatus::enforcesSecureChat) + ServerStatus.Players.CODEC.lenientOptionalFieldOf("players").forGetter(ServerStatus::players), + ServerStatus.Version.CODEC.lenientOptionalFieldOf("version").forGetter(ServerStatus::version), + ServerStatus.Favicon.CODEC.lenientOptionalFieldOf("favicon").forGetter(ServerStatus::favicon), +- Codec.BOOL.lenientOptionalFieldOf("enforcesSecureChat", Boolean.valueOf(false)).forGetter(ServerStatus::enforcesSecureChat) + Codec.BOOL.optionalFieldOf("enforcesSecureChat", Boolean.valueOf(false)).forGetter(ServerStatus::enforcesSecureChat), + Codec.BOOL.optionalFieldOf("isModded", Boolean.FALSE).forGetter(ServerStatus::isModded) ) - .apply(p_304170_, ServerStatus::new) + .apply(p_337519_, ServerStatus::new) ); diff --git a/patches/net/minecraft/network/syncher/EntityDataSerializers.java.patch b/patches/net/minecraft/network/syncher/EntityDataSerializers.java.patch index 7812a367873..7a567aeba4b 100644 --- a/patches/net/minecraft/network/syncher/EntityDataSerializers.java.patch +++ b/patches/net/minecraft/network/syncher/EntityDataSerializers.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/network/syncher/EntityDataSerializers.java +++ b/net/minecraft/network/syncher/EntityDataSerializers.java -@@ -156,17 +_,29 @@ - FriendlyByteBuf::writeQuaternion, FriendlyByteBuf::readQuaternion - ); +@@ -133,17 +_,29 @@ + public static final EntityDataSerializer VECTOR3 = EntityDataSerializer.forValueType(ByteBufCodecs.VECTOR3F); + public static final EntityDataSerializer QUATERNION = EntityDataSerializer.forValueType(ByteBufCodecs.QUATERNIONF); + private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger(); + private static final StackWalker STACK_WALKER = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE); @@ -13,8 +13,8 @@ public static void registerSerializer(EntityDataSerializer p_135051_) { - SERIALIZERS.add(p_135051_); + if (!STACK_WALKER.getCallerClass().equals(EntityDataSerializers.class)) { -+ // TODO 1.20.5: throw an exception in dev instead -+ LOGGER.error("Modded EntityDataSerializers must be registered to NeoForgeRegistries.ENTITY_DATA_SERIALIZERS instead to prevent ID mismatches between client and server!", new Throwable()); ++ LOGGER.error("Modded EntityDataSerializers must be registered to NeoForgeRegistries.ENTITY_DATA_SERIALIZERS instead to prevent ID mismatches between client and server!"); ++ throw new UnsupportedOperationException("Modded EntityDataSerializers must be registered to NeoForgeRegistries.ENTITY_DATA_SERIALIZERS instead to prevent ID mismatches between client and server!"); + } + + if (SERIALIZERS.add(p_135051_) >= net.neoforged.neoforge.common.CommonHooks.VANILLA_SERIALIZER_LIMIT) diff --git a/patches/net/minecraft/network/syncher/SynchedEntityData.java.patch b/patches/net/minecraft/network/syncher/SynchedEntityData.java.patch index 9219d9abfa9..2e15f885e1d 100644 --- a/patches/net/minecraft/network/syncher/SynchedEntityData.java.patch +++ b/patches/net/minecraft/network/syncher/SynchedEntityData.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/network/syncher/SynchedEntityData.java +++ b/net/minecraft/network/syncher/SynchedEntityData.java -@@ -36,11 +_,13 @@ +@@ -27,11 +_,13 @@ } - public static EntityDataAccessor defineId(Class p_135354_, EntityDataSerializer p_135355_) { + public static EntityDataAccessor defineId(Class p_135354_, EntityDataSerializer p_135355_) { - if (LOGGER.isDebugEnabled()) { + if (true || LOGGER.isDebugEnabled()) { // Forge: This is very useful for mods that register keys on classes that are not their own try { diff --git a/patches/net/minecraft/recipebook/PlaceRecipe.java.patch b/patches/net/minecraft/recipebook/PlaceRecipe.java.patch index 14ebb938d1b..1abbdfb98ae 100644 --- a/patches/net/minecraft/recipebook/PlaceRecipe.java.patch +++ b/patches/net/minecraft/recipebook/PlaceRecipe.java.patch @@ -1,15 +1,11 @@ --- a/net/minecraft/recipebook/PlaceRecipe.java +++ b/net/minecraft/recipebook/PlaceRecipe.java -@@ -11,9 +_,9 @@ +@@ -9,7 +_,7 @@ + default void placeRecipe(int p_135409_, int p_135410_, int p_135411_, RecipeHolder p_301225_, Iterator p_135413_, int p_135414_) { int i = p_135409_; int j = p_135410_; - Recipe recipe = p_301225_.value(); -- if (recipe instanceof ShapedRecipe shapedrecipe) { -- i = shapedrecipe.getWidth(); -- j = shapedrecipe.getHeight(); -+ if (recipe instanceof net.neoforged.neoforge.common.crafting.IShapedRecipe shapedrecipe) { -+ i = shapedrecipe.getRecipeWidth(); -+ j = shapedrecipe.getRecipeHeight(); +- if (p_301225_.value() instanceof ShapedRecipe shapedrecipe) { ++ if (p_301225_.value() instanceof net.neoforged.neoforge.common.crafting.IShapedRecipe shapedrecipe) { + i = shapedrecipe.getWidth(); + j = shapedrecipe.getHeight(); } - - int k1 = 0; diff --git a/patches/net/minecraft/resources/HolderSetCodec.java.patch b/patches/net/minecraft/resources/HolderSetCodec.java.patch index 257cc7d72cd..4cdd27b37f1 100644 --- a/patches/net/minecraft/resources/HolderSetCodec.java.patch +++ b/patches/net/minecraft/resources/HolderSetCodec.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/resources/HolderSetCodec.java +++ b/net/minecraft/resources/HolderSetCodec.java -@@ -22,6 +_,8 @@ +@@ -21,6 +_,8 @@ private final Codec> elementCodec; private final Codec>> homogenousListCodec; private final Codec, List>>> registryAwareCodec; @@ -8,32 +8,39 @@ + private final Codec, Either, List>>>> combinedCodec; private static Codec>> homogenousList(Codec> p_206668_, boolean p_206669_) { - Codec>> codec = ExtraCodecs.validate(p_206668_.listOf(), ExtraCodecs.ensureHomogenous(Holder::kind)); -@@ -43,6 +_,10 @@ + Codec>> codec = p_206668_.listOf().validate(ExtraCodecs.ensureHomogenous(Holder::kind)); +@@ -42,6 +_,10 @@ this.elementCodec = p_206661_; this.homogenousListCodec = homogenousList(p_206661_, p_206662_); this.registryAwareCodec = Codec.either(TagKey.hashedCodec(p_206660_), this.homogenousListCodec); + // FORGE: make registry-specific dispatch codec and make forge-or-vanilla either codec + this.forgeDispatchCodec = net.neoforged.neoforge.registries.NeoForgeRegistries.HOLDER_SET_TYPES.byNameCodec() + .dispatch(net.neoforged.neoforge.registries.holdersets.ICustomHolderSet::type, type -> type.makeCodec(p_206660_, p_206661_, p_206662_)); -+ this.combinedCodec = new ExtraCodecs.EitherCodec<>(this.forgeDispatchCodec, this.registryAwareCodec); ++ this.combinedCodec = Codec.either(this.forgeDispatchCodec, this.registryAwareCodec); } @Override -@@ -51,9 +_,9 @@ +@@ -50,14 +_,17 @@ Optional> optional = registryops.getter(this.registryKey); if (optional.isPresent()) { HolderGetter holdergetter = optional.get(); - return this.registryAwareCodec - .decode(p_206696_, p_206697_) -- .map(p_206682_ -> p_206682_.mapFirst(p_206679_ -> p_206679_.map(holdergetter::getOrThrow, HolderSet::direct))); -+ // FORGE: use the wrapped codec to decode custom/tag/list instead of just tag/list ++ // NEO: use the wrapped codec to decode custom/tag/list instead of just tag/list + return this.combinedCodec.decode(p_206696_, p_206697_) -+ .map(p_206682_ -> p_206682_.mapFirst(p_206679_ -> p_206679_.map(java.util.function.Function.identity(), tagOrList -> tagOrList.map(holdergetter::getOrThrow, HolderSet::direct)))); - } - } - -@@ -68,6 +_,9 @@ + .flatMap( + p_337522_ -> { + DataResult> dataresult = p_337522_.getFirst() + .map( ++ DataResult::success, ++ tagOrList -> tagOrList.map( + p_332559_ -> lookupTag(holdergetter, (TagKey)p_332559_), + p_332564_ -> DataResult.success(HolderSet.direct((List>)p_332564_)) ++ ) + ); + return dataresult.map(p_332563_ -> Pair.of((HolderSet)p_332563_, (T)p_337522_.getSecond())); + } +@@ -82,6 +_,9 @@ return DataResult.error(() -> "HolderSet " + p_206674_ + " is not valid in current registry set"); } diff --git a/patches/net/minecraft/resources/RegistryDataLoader.java.patch b/patches/net/minecraft/resources/RegistryDataLoader.java.patch index 280c7e26f2b..ffb556750a2 100644 --- a/patches/net/minecraft/resources/RegistryDataLoader.java.patch +++ b/patches/net/minecraft/resources/RegistryDataLoader.java.patch @@ -1,6 +1,24 @@ --- a/net/minecraft/resources/RegistryDataLoader.java +++ b/net/minecraft/resources/RegistryDataLoader.java -@@ -143,7 +_,7 @@ +@@ -92,7 +_,7 @@ + public static final List> DIMENSION_REGISTRIES = List.of( + new RegistryDataLoader.RegistryData<>(Registries.LEVEL_STEM, LevelStem.CODEC) + ); +- public static final List> SYNCHRONIZED_REGISTRIES = List.of( ++ public static final List> SYNCHRONIZED_REGISTRIES = net.neoforged.neoforge.registries.DataPackRegistriesHooks.grabNetworkableRegistries(List.of( + new RegistryDataLoader.RegistryData<>(Registries.BIOME, Biome.NETWORK_CODEC), + new RegistryDataLoader.RegistryData<>(Registries.CHAT_TYPE, ChatType.DIRECT_CODEC), + new RegistryDataLoader.RegistryData<>(Registries.TRIM_PATTERN, TrimPattern.DIRECT_CODEC), +@@ -101,7 +_,7 @@ + new RegistryDataLoader.RegistryData<>(Registries.DIMENSION_TYPE, DimensionType.DIRECT_CODEC), + new RegistryDataLoader.RegistryData<>(Registries.DAMAGE_TYPE, DamageType.DIRECT_CODEC), + new RegistryDataLoader.RegistryData<>(Registries.BANNER_PATTERN, BannerPattern.DIRECT_CODEC) +- ); ++ )); // Neo: Keep the list so custom registries can be added later + + public static RegistryAccess.Frozen load(ResourceManager p_252046_, RegistryAccess p_249916_, List> p_250344_) { + return load((p_321412_, p_321413_) -> p_321412_.loadFromResources(p_252046_, p_321413_), p_249916_, p_250344_); +@@ -182,7 +_,7 @@ } private static String registryDirPath(ResourceLocation p_252033_) { @@ -8,30 +26,32 @@ + return net.neoforged.neoforge.common.CommonHooks.prefixNamespace(p_252033_); // FORGE: add non-vanilla registry namespace to loader directory, same format as tag directory (see net.minecraft.tags.TagManager#getTagDir(ResourceKey)) } - static void loadRegistryContents( -@@ -156,7 +_,8 @@ + private static void loadElementFromResource( +@@ -193,11 +_,16 @@ + Resource p_326141_, + RegistrationInfo p_326033_ + ) throws IOException { ++ Decoder> decoder = net.neoforged.neoforge.common.conditions.ConditionalOps.createConditionalCodec(net.neoforged.neoforge.common.util.NeoForgeExtraCodecs.decodeOnly(p_326476_)); + try (Reader reader = p_326141_.openAsReader()) { + JsonElement jsonelement = JsonParser.parseReader(reader); +- DataResult dataresult = p_326476_.parse(p_325932_, jsonelement); +- E e = dataresult.getOrThrow(); ++ DataResult> dataresult = decoder.parse(p_325932_, jsonelement); ++ Optional candidate = dataresult.getOrThrow(); ++ candidate.ifPresentOrElse(e -> { + p_326195_.register(p_326054_, e, p_326033_); ++ }, () -> { ++ LOGGER.debug("Skipping loading registry entry {} as its conditions were not met", p_326054_); ++ }); + } + } + +@@ -210,7 +_,7 @@ ) { - String s = registryDirPath(p_255792_.location()); + String s = registryDirPath(p_321557_.key().location()); FileToIdConverter filetoidconverter = FileToIdConverter.json(s); -- RegistryOps registryops = RegistryOps.create(JsonOps.INSTANCE, p_256369_); -+ RegistryOps registryops = net.neoforged.neoforge.common.conditions.ConditionalOps.create(RegistryOps.create(JsonOps.INSTANCE, p_256369_), net.neoforged.neoforge.common.conditions.ICondition.IContext.TAGS_INVALID); -+ Decoder> decoder = net.neoforged.neoforge.common.conditions.ConditionalOps.createConditionalCodec(net.neoforged.neoforge.common.util.NeoForgeExtraCodecs.decodeOnly(p_256232_)); +- RegistryOps registryops = RegistryOps.create(JsonOps.INSTANCE, p_321612_); ++ RegistryOps registryops = new net.neoforged.neoforge.common.conditions.ConditionalOps<>(RegistryOps.create(JsonOps.INSTANCE, p_321612_), net.neoforged.neoforge.common.conditions.ICondition.IContext.TAGS_INVALID); - for(Entry entry : filetoidconverter.listMatchingResources(p_256349_).entrySet()) { + for (Entry entry : filetoidconverter.listMatchingResources(p_321535_).entrySet()) { ResourceLocation resourcelocation = entry.getKey(); -@@ -165,10 +_,12 @@ - - try (Reader reader = resource.openAsReader()) { - JsonElement jsonelement = JsonParser.parseReader(reader); -- DataResult dataresult = p_256232_.parse(registryops, jsonelement); -- E e = dataresult.getOrThrow(false, p_248715_ -> { -+ DataResult> dataresult = decoder.parse(registryops, jsonelement); -+ Optional candidate = dataresult.getOrThrow(true, p_248715_ -> { - }); -- p_256211_.register(resourcekey, e, resource.isBuiltin() ? Lifecycle.stable() : dataresult.lifecycle()); -+ candidate.ifPresentOrElse(e -> { -+ p_256211_.register(resourcekey, e, resource.isBuiltin() ? Lifecycle.stable() : dataresult.lifecycle()); -+ }, () -> LOGGER.debug("Skipping loading registry entry {} as it's conditions were not met", resourcelocation)); - } catch (Exception exception) { - p_255884_.put( - resourcekey, diff --git a/patches/net/minecraft/resources/RegistryOps.java.patch b/patches/net/minecraft/resources/RegistryOps.java.patch index c62b8d5abd4..e433e8dcc75 100644 --- a/patches/net/minecraft/resources/RegistryOps.java.patch +++ b/patches/net/minecraft/resources/RegistryOps.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/resources/RegistryOps.java +++ b/net/minecraft/resources/RegistryOps.java -@@ -46,6 +_,11 @@ +@@ -35,6 +_,11 @@ this.lookupProvider = p_255799_; } -+ protected RegistryOps(RegistryOps p_256313_) { -+ super(p_256313_); -+ this.lookupProvider = p_256313_.lookupProvider; ++ protected RegistryOps(RegistryOps other) { ++ super(other); ++ this.lookupProvider = other.lookupProvider; + } + - public Optional> owner(ResourceKey> p_255757_) { - return this.lookupProvider.lookup(p_255757_).map(RegistryOps.RegistryInfo::owner); + public RegistryOps withParent(DynamicOps p_330654_) { + return (RegistryOps)(p_330654_ == this.delegate ? this : new RegistryOps<>(p_330654_, this.lookupProvider)); } -@@ -64,6 +_,20 @@ +@@ -74,6 +_,20 @@ : DataResult.error(() -> "Not a registry ops") ) .forGetter(p_255526_ -> null); diff --git a/patches/net/minecraft/resources/ResourceKey.java.patch b/patches/net/minecraft/resources/ResourceKey.java.patch index 3cffe45f10e..f4deb2c344d 100644 --- a/patches/net/minecraft/resources/ResourceKey.java.patch +++ b/patches/net/minecraft/resources/ResourceKey.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/resources/ResourceKey.java +++ b/net/minecraft/resources/ResourceKey.java -@@ -7,7 +_,7 @@ - import net.minecraft.core.Registry; +@@ -9,7 +_,7 @@ import net.minecraft.core.registries.Registries; + import net.minecraft.network.codec.StreamCodec; -public class ResourceKey { +public class ResourceKey implements Comparable> { private static final ConcurrentMap> VALUES = new MapMaker().weakValues().makeMap(); private final ResourceLocation registryName; private final ResourceLocation location; -@@ -54,6 +_,13 @@ +@@ -64,6 +_,13 @@ - public ResourceLocation registry() { - return this.registryName; + public ResourceKey> registryKey() { + return createRegistryKey(this.registryName); + } + + @Override diff --git a/patches/net/minecraft/resources/ResourceLocation.java.patch b/patches/net/minecraft/resources/ResourceLocation.java.patch index 1ddc7854b42..aee9d7e8be2 100644 --- a/patches/net/minecraft/resources/ResourceLocation.java.patch +++ b/patches/net/minecraft/resources/ResourceLocation.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/resources/ResourceLocation.java +++ b/net/minecraft/resources/ResourceLocation.java -@@ -146,6 +_,12 @@ +@@ -149,6 +_,12 @@ return i; } diff --git a/patches/net/minecraft/server/Bootstrap.java.patch b/patches/net/minecraft/server/Bootstrap.java.patch index 6054c58ba24..e775eb5eea4 100644 --- a/patches/net/minecraft/server/Bootstrap.java.patch +++ b/patches/net/minecraft/server/Bootstrap.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/Bootstrap.java +++ b/net/minecraft/server/Bootstrap.java -@@ -55,6 +_,8 @@ +@@ -53,6 +_,8 @@ CauldronInteraction.bootStrap(); BuiltInRegistries.bootStrap(); CreativeModeTabs.validate(); @@ -9,7 +9,7 @@ wrapStreams(); bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis()); } -@@ -121,7 +_,6 @@ +@@ -119,7 +_,6 @@ Commands.validate(); } diff --git a/patches/net/minecraft/server/Main.java.patch b/patches/net/minecraft/server/Main.java.patch index ec057615184..1905ccd297a 100644 --- a/patches/net/minecraft/server/Main.java.patch +++ b/patches/net/minecraft/server/Main.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/Main.java +++ b/net/minecraft/server/Main.java -@@ -63,7 +_,7 @@ +@@ -64,7 +_,7 @@ private static final Logger LOGGER = LogUtils.getLogger(); @DontObfuscate @@ -9,10 +9,10 @@ SharedConstants.tryDetectVersion(); OptionParser optionparser = new OptionParser(); OptionSpec optionspec = optionparser.accepts("nogui"); -@@ -81,6 +_,15 @@ - OptionSpec optionspec12 = optionparser.accepts("jfrProfile"); - OptionSpec optionspec13 = optionparser.accepts("pidFile").withRequiredArg().withValuesConvertedBy(new PathConverter()); - OptionSpec optionspec14 = optionparser.nonOptions(); +@@ -83,6 +_,15 @@ + OptionSpec optionspec13 = optionparser.accepts("jfrProfile"); + OptionSpec optionspec14 = optionparser.accepts("pidFile").withRequiredArg().withValuesConvertedBy(new PathConverter()); + OptionSpec optionspec15 = optionparser.nonOptions(); + optionparser.accepts("allowUpdates").withRequiredArg().ofType(Boolean.class).defaultsTo(Boolean.TRUE); // Forge: allow mod updates to proceed + optionparser.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File(".")); //Forge: Consume this argument, we use it in the launcher, and the client side. + final OptionSpec spawnPosOpt; @@ -25,7 +25,7 @@ try { OptionSet optionset = optionparser.parse(p_129699_); -@@ -88,6 +_,13 @@ +@@ -90,6 +_,13 @@ optionparser.printHelpOn(System.err); return; } @@ -37,15 +37,16 @@ + return; + } - Path path = optionset.valueOf(optionspec13); + Path path = optionset.valueOf(optionspec14); if (path != null) { -@@ -103,23 +_,21 @@ +@@ -105,24 +_,22 @@ Bootstrap.validate(); Util.startTimerHackThread(); Path path1 = Paths.get("server.properties"); + if (!optionset.has(optionspec1)) net.neoforged.neoforge.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 DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(path1); dedicatedserversettings.forceSave(); + RegionFileVersion.configure(dedicatedserversettings.getProperties().regionFileComression); - Path path2 = Paths.get("eula.txt"); - Eula eula = new Eula(path2); if (optionset.has(optionspec1)) { @@ -58,9 +59,9 @@ - return; - } - - File file1 = new File(optionset.valueOf(optionspec8)); + File file1 = new File(optionset.valueOf(optionspec9)); Services services = Services.create(new YggdrasilAuthenticationService(Proxy.NO_PROXY), file1); - String s = Optional.ofNullable(optionset.valueOf(optionspec9)).orElse(dedicatedserversettings.getProperties().levelName); + String s = Optional.ofNullable(optionset.valueOf(optionspec10)).orElse(dedicatedserversettings.getProperties().levelName); + if (s == null || s.isEmpty() || new File(file1, s).getAbsolutePath().equals(new File(s).getAbsolutePath())) { + LOGGER.error("Invalid world directory specified, must not be null, empty or the same directory as your universe! " + s); + return; @@ -68,7 +69,7 @@ LevelStorageSource levelstoragesource = LevelStorageSource.createDefault(file1.toPath()); LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess = levelstoragesource.validateAndCreateAccess(s); Dynamic dynamic; -@@ -128,6 +_,7 @@ +@@ -131,6 +_,7 @@ try { dynamic = levelstoragesource$levelstorageaccess.getDataTag(); levelsummary = levelstoragesource$levelstorageaccess.getSummary(dynamic); @@ -76,7 +77,7 @@ } catch (NbtException | ReportedNbtException | IOException ioexception1) { LevelStorageSource.LevelDirectory levelstoragesource$leveldirectory = levelstoragesource$levelstorageaccess.getLevelDirectory(); LOGGER.warn("Failed to load world data from {}", levelstoragesource$leveldirectory.dataFile(), ioexception1); -@@ -136,6 +_,7 @@ +@@ -139,6 +_,7 @@ try { dynamic = levelstoragesource$levelstorageaccess.getDataTagFallback(); levelsummary = levelstoragesource$levelstorageaccess.getSummary(dynamic); @@ -84,19 +85,17 @@ } catch (NbtException | ReportedNbtException | IOException ioexception) { LOGGER.error("Failed to load world data from {}", levelstoragesource$leveldirectory.oldDataFile(), ioexception); LOGGER.error( -@@ -210,7 +_,10 @@ - : dedicatedserverproperties.worldOptions; +@@ -214,6 +_,9 @@ worlddimensions = dedicatedserverproperties.createDimensions(p_307161_.datapackWorldgen()); } -- -+ -+ //Forge: Do a write-read-cycle to inject modded dimensions on first start of a dedicated server into its generated world dimensions list. + ++ // Neo: Do a write-read-cycle to inject modded dimensions on first start of a dedicated server into its generated world dimensions list. + var registryOps = net.minecraft.resources.RegistryOps.create(net.minecraft.nbt.NbtOps.INSTANCE, p_307161_.datapackWorldgen()); + worlddimensions = WorldDimensions.CODEC.encoder().encodeStart(registryOps, worlddimensions).flatMap((writtenPayloadWithModdedDimensions) -> WorldDimensions.CODEC.decoder().parse(registryOps, writtenPayloadWithModdedDimensions)).resultOrPartial(LOGGER::error).orElse(worlddimensions); WorldDimensions.Complete worlddimensions$complete = worlddimensions.bake(registry); Lifecycle lifecycle = worlddimensions$complete.lifecycle().add(p_307161_.datapackWorldgen().allRegistriesLifecycle()); return new WorldLoader.DataLoadOutput<>( -@@ -246,24 +_,23 @@ +@@ -246,24 +_,22 @@ WorldData worlddata = worldstem.worldData(); levelstoragesource$levelstorageaccess.saveDataTag(registryaccess$frozen, worlddata); @@ -111,27 +110,26 @@ - dedicatedserversettings, - DataFixers.getDataFixer(), - services, -- LoggerChunkProgressListener::new +- LoggerChunkProgressListener::createFromGameruleRadius - ); + MinecraftServer dedicatedserver1; + if (gametestEnabled) { + net.neoforged.neoforge.gametest.GameTestHooks.registerGametests(); -+ java.util.Collection testBatches = net.minecraft.gametest.framework.GameTestRunner.groupTestsIntoBatches(net.minecraft.gametest.framework.GameTestRegistry.getAllTestFunctions()); + net.minecraft.core.BlockPos spawnPos = optionset.valueOf(spawnPosOpt); -+ dedicatedserver1 = net.minecraft.gametest.framework.GameTestServer.create(p_293760_, levelstoragesource$levelstorageaccess, packrepository, testBatches, spawnPos); ++ dedicatedserver1 = net.minecraft.gametest.framework.GameTestServer.create(p_293760_, levelstoragesource$levelstorageaccess, packrepository, net.minecraft.gametest.framework.GameTestRegistry.getAllTestFunctions(), spawnPos); + } else { -+ dedicatedserver1 = new DedicatedServer(p_293760_, levelstoragesource$levelstorageaccess, packrepository, worldstem, dedicatedserversettings, DataFixers.getDataFixer(), services, LoggerChunkProgressListener::new); ++ dedicatedserver1 = new DedicatedServer(p_293760_, levelstoragesource$levelstorageaccess, packrepository, worldstem, dedicatedserversettings, DataFixers.getDataFixer(), services, LoggerChunkProgressListener::createFromGameruleRadius); + } - dedicatedserver1.setPort(optionset.valueOf(optionspec10)); + dedicatedserver1.setPort(optionset.valueOf(optionspec11)); dedicatedserver1.setDemo(optionset.has(optionspec2)); - dedicatedserver1.setId(optionset.valueOf(optionspec11)); - boolean flag1 = !optionset.has(optionspec) && !optionset.valuesOf(optionspec14).contains("nogui"); -- if (flag1 && !GraphicsEnvironment.isHeadless()) { + dedicatedserver1.setId(optionset.valueOf(optionspec12)); + boolean flag2 = !optionset.has(optionspec) && !optionset.valuesOf(optionspec15).contains("nogui"); +- if (flag2 && !GraphicsEnvironment.isHeadless()) { - dedicatedserver1.showGui(); + if (dedicatedserver1 instanceof DedicatedServer dedicatedServer && flag1 && !GraphicsEnvironment.isHeadless()) { + dedicatedServer.showGui(); } - + return dedicatedserver1; @@ -272,7 +_,10 @@ Thread thread = new Thread("Server Shutdown Thread") { diff --git a/patches/net/minecraft/server/MinecraftServer.java.patch b/patches/net/minecraft/server/MinecraftServer.java.patch index c10f110d958..caa911ba000 100644 --- a/patches/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/net/minecraft/server/MinecraftServer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -252,7 +_,7 @@ +@@ -258,7 +_,7 @@ public static S spin(Function p_129873_) { AtomicReference atomicreference = new AtomicReference<>(); @@ -9,7 +9,7 @@ thread.setUncaughtExceptionHandler((p_177909_, p_177910_) -> LOGGER.error("Uncaught exception in server thread", p_177910_)); if (Runtime.getRuntime().availableProcessors() > 4) { thread.setPriority(8); -@@ -358,6 +_,7 @@ +@@ -366,6 +_,7 @@ this.readScoreboard(dimensiondatastorage); this.commandStorage = new CommandStorage(dimensiondatastorage); WorldBorder worldborder = serverlevel.getWorldBorder(); @@ -17,7 +17,7 @@ if (!serverleveldata.isInitialized()) { try { setInitialSpawn(serverlevel, serverleveldata, worldoptions.generateBonusChest(), flag); -@@ -407,6 +_,7 @@ +@@ -415,6 +_,7 @@ ); worldborder.addListener(new BorderChangeListener.DelegateBorderChangeListener(serverlevel1.getWorldBorder())); this.levels.put(resourcekey1, serverlevel1); @@ -25,7 +25,7 @@ } } -@@ -418,6 +_,7 @@ +@@ -426,6 +_,7 @@ p_177898_.setSpawn(BlockPos.ZERO.above(80), 0.0F); } else { ServerChunkCache serverchunkcache = p_177897_.getChunkSource(); @@ -33,23 +33,23 @@ ChunkPos chunkpos = new ChunkPos(serverchunkcache.randomState().sampler().findSpawnPosition()); int i = serverchunkcache.getGenerator().getSpawnHeight(p_177897_); if (i < p_177897_.getMinBuildHeight()) { -@@ -506,6 +_,7 @@ - ChunkPos chunkpos = new ChunkPos(i); +@@ -507,6 +_,7 @@ + ChunkPos chunkpos = new ChunkPos(k); serverlevel1.getChunkSource().updateChunkForced(chunkpos, true); } + net.neoforged.neoforge.common.world.chunk.ForcedChunkManager.reinstatePersistentChunks(serverlevel1, forcedchunkssaveddata); } } -@@ -613,6 +_,7 @@ - for(ServerLevel serverlevel2 : this.getAllLevels()) { +@@ -614,6 +_,7 @@ + for (ServerLevel serverlevel2 : this.getAllLevels()) { if (serverlevel2 != null) { try { + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.LevelEvent.Unload(serverlevel2)); serverlevel2.close(); } catch (IOException ioexception1) { LOGGER.error("Exception closing the level", (Throwable)ioexception1); -@@ -659,9 +_,11 @@ +@@ -660,9 +_,11 @@ throw new IllegalStateException("Failed to initialize server"); } @@ -59,9 +59,9 @@ this.status = this.buildServerStatus(); + resetStatusCache(status); - while(this.running) { + while (this.running) { long i; -@@ -704,6 +_,8 @@ +@@ -708,6 +_,8 @@ this.isReady = true; JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis); } @@ -70,7 +70,7 @@ } catch (Throwable throwable1) { LOGGER.error("Encountered an unexpected exception", throwable1); CrashReport crashreport = constructOrExtractCrashReport(throwable1); -@@ -715,6 +_,7 @@ +@@ -719,6 +_,7 @@ LOGGER.error("We were unable to save this crash report to disk."); } @@ -78,7 +78,7 @@ this.onServerCrash(crashreport); } finally { try { -@@ -727,6 +_,7 @@ +@@ -731,6 +_,7 @@ this.services.profileCache().clearExecutor(); } @@ -86,12 +86,11 @@ this.onServerExit(); } } -@@ -838,12 +_,14 @@ - +@@ -877,11 +_,13 @@ public void tickServer(BooleanSupplier p_129871_) { long i = Util.getNanos(); -+ net.neoforged.neoforge.event.EventHooks.onPreServerTick(p_129871_, this); - ++this.tickCount; + this.tickCount++; ++ net.neoforged.neoforge.event.EventHooks.fireServerTickPre(p_129871_, this); this.tickRateManager.tick(); this.tickChildren(p_129871_); if (i - this.lastServerStatus >= STATUS_EXPIRE_TIME_NANOS) { @@ -100,26 +99,33 @@ + resetStatusCache(status); } - --this.ticksUntilAutosave; -@@ -866,6 +_,17 @@ - long l = Util.getNanos(); - this.logTickTime(l - i); + this.ticksUntilAutosave--; +@@ -903,6 +_,7 @@ + this.smoothedTickTimeMillis = this.smoothedTickTimeMillis * 0.8F + (float)j / (float)TimeUtil.NANOSECONDS_PER_MILLISECOND * 0.19999999F; + this.logTickMethodTime(i); this.profiler.pop(); -+ net.neoforged.neoforge.event.EventHooks.onPostServerTick(p_129871_, this); -+ } -+ ++ net.neoforged.neoforge.event.EventHooks.fireServerTickPost(p_129871_, this); + } + + private void logTickMethodTime(long p_321837_) { +@@ -911,6 +_,16 @@ + } + } + + private static final com.google.gson.Gson GSON = new com.google.gson.Gson(); -+ private String cachedServerStatus; // FORGE: cache the server status json in case a client spams requests ++ private String cachedServerStatus; // NEO: cache the server status json in case a client spams requests + private void resetStatusCache(ServerStatus status) { + this.cachedServerStatus = GSON.toJson(ServerStatus.CODEC.encodeStart(com.mojang.serialization.JsonOps.INSTANCE, status) -+ .result().orElseThrow()); ++ .result().orElseThrow()); + } + public String getStatusJson() { + return cachedServerStatus; - } - ++ } ++ private int computeNextAutosaveInterval() { -@@ -898,7 +_,8 @@ + float f; + if (this.tickRateManager.isSprinting()) { +@@ -942,7 +_,8 @@ Optional.of(serverstatus$players), Optional.of(ServerStatus.Version.current()), Optional.ofNullable(this.statusIcon), @@ -129,29 +135,29 @@ ); } -@@ -928,7 +_,8 @@ +@@ -972,7 +_,8 @@ this.getFunctions().tick(); this.profiler.popPush("levels"); -- for(ServerLevel serverlevel : this.getAllLevels()) { +- for (ServerLevel serverlevel : this.getAllLevels()) { + for(ServerLevel serverlevel : this.getWorldArray()) { + long tickStart = Util.getNanos(); this.profiler.push(() -> serverlevel + " " + serverlevel.dimension().location()); if (this.tickCount % 20 == 0) { this.profiler.push("timeSync"); -@@ -937,6 +_,7 @@ +@@ -981,6 +_,7 @@ } this.profiler.push("tick"); -+ net.neoforged.neoforge.event.EventHooks.onPreLevelTick(serverlevel, p_129954_); ++ net.neoforged.neoforge.event.EventHooks.fireLevelTickPre(serverlevel, p_129954_); try { serverlevel.tick(p_129954_); -@@ -945,16 +_,18 @@ +@@ -989,16 +_,18 @@ serverlevel.fillReportDetails(crashreport); throw new ReportedException(crashreport); } -+ net.neoforged.neoforge.event.EventHooks.onPostLevelTick(serverlevel, p_129954_); ++ net.neoforged.neoforge.event.EventHooks.fireLevelTickPost(serverlevel, p_129954_); this.profiler.pop(); this.profiler.pop(); @@ -167,7 +173,7 @@ GameTestTicker.SINGLETON.tick(); } -@@ -1050,7 +_,7 @@ +@@ -1094,7 +_,7 @@ @DontObfuscate public String getServerModName() { @@ -176,16 +182,16 @@ } public SystemReport fillSystemReport(SystemReport p_177936_) { -@@ -1379,7 +_,7 @@ +@@ -1417,7 +_,7 @@ + public CompletableFuture reloadResources(Collection p_129862_) { - RegistryAccess.Frozen registryaccess$frozen = this.registries.getAccessForLoading(RegistryLayer.RELOADABLE); CompletableFuture completablefuture = CompletableFuture.supplyAsync( - () -> p_129862_.stream().map(this.packRepository::getPack).filter(Objects::nonNull).map(Pack::open).collect(ImmutableList.toImmutableList()), + () -> p_129862_.stream().map(this.packRepository::getPack).filter(Objects::nonNull).flatMap(Pack::streamSelfAndChildren).map(Pack::open).collect(ImmutableList.toImmutableList()), this ) .thenCompose( -@@ -1416,6 +_,7 @@ +@@ -1454,6 +_,7 @@ this.getPlayerList().reloadResources(); this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary()); this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager); @@ -193,21 +199,19 @@ }, this ); -@@ -1430,9 +_,11 @@ - PackRepository p_248681_, DataPackConfig p_248920_, boolean p_249869_, FeatureFlagSet p_251243_ - ) { +@@ -1471,8 +_,10 @@ + FeatureFlagSet featureflagset = p_249869_ ? FeatureFlagSet.of() : p_341632_.enabledFeatures(); + FeatureFlagSet featureflagset1 = p_249869_ ? FeatureFlags.REGISTRY.allFlags() : p_341632_.enabledFeatures(); p_248681_.reload(); + DataPackConfig.DEFAULT.addModPacks(net.neoforged.neoforge.common.CommonHooks.getModDataPacks()); -+ p_248920_.addModPacks(net.neoforged.neoforge.common.CommonHooks.getModDataPacks()); - if (p_249869_) { -- p_248681_.setSelected(Collections.singleton("vanilla")); -- return WorldDataConfiguration.DEFAULT; -+ p_248681_.setSelected(net.neoforged.neoforge.common.CommonHooks.getModDataPacksWithVanilla()); -+ return new WorldDataConfiguration(new DataPackConfig(net.neoforged.neoforge.common.CommonHooks.getModDataPacksWithVanilla(), ImmutableList.of()), FeatureFlags.DEFAULT_FLAGS); ++ datapackconfig.addModPacks(net.neoforged.neoforge.common.CommonHooks.getModDataPacks()); + if (p_341620_) { +- return configureRepositoryWithSelection(p_248681_, List.of("vanilla"), featureflagset, false); ++ return configureRepositoryWithSelection(p_248681_, net.neoforged.neoforge.common.CommonHooks.getModDataPacksWithVanilla(), featureflagset, false); } else { Set set = Sets.newLinkedHashSet(); -@@ -1616,6 +_,31 @@ +@@ -1688,6 +_,31 @@ public abstract boolean isSingleplayerOwner(GameProfile p_129840_); @@ -239,7 +243,7 @@ public void dumpServerProperties(Path p_177911_) throws IOException { } -@@ -1777,6 +_,10 @@ +@@ -1849,6 +_,10 @@ public WorldData getWorldData() { return this.worldData; diff --git a/patches/net/minecraft/server/PlayerAdvancements.java.patch b/patches/net/minecraft/server/PlayerAdvancements.java.patch index 4c983fd1322..46f7de7d737 100644 --- a/patches/net/minecraft/server/PlayerAdvancements.java.patch +++ b/patches/net/minecraft/server/PlayerAdvancements.java.patch @@ -16,9 +16,9 @@ + net.neoforged.neoforge.event.EventHooks.onAdvancementProgressedEvent(this.player, p_300979_, advancementprogress, p_135990_, net.neoforged.neoforge.event.entity.player.AdvancementEvent.AdvancementProgressEvent.ProgressType.GRANT); if (!flag1 && advancementprogress.isDone()) { p_300979_.value().rewards().grant(this.player); - p_300979_.value().display().ifPresent(p_311529_ -> { - if (p_311529_.shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { - this.playerList.broadcastSystemMessage(p_311529_.getType().createAnnouncement(p_300979_, this.player), false); + p_300979_.value().display().ifPresent(p_337526_ -> { + if (p_337526_.shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { + this.playerList.broadcastSystemMessage(p_337526_.getType().createAnnouncement(p_300979_, this.player), false); } + net.neoforged.neoforge.event.EventHooks.onAdvancementEarnedEvent(this.player, p_300979_); }); diff --git a/patches/net/minecraft/server/ReloadableServerResources.java.patch b/patches/net/minecraft/server/ReloadableServerResources.java.patch index 6e04d8f8f5d..cf23f14fbcb 100644 --- a/patches/net/minecraft/server/ReloadableServerResources.java.patch +++ b/patches/net/minecraft/server/ReloadableServerResources.java.patch @@ -1,58 +1,19 @@ --- a/net/minecraft/server/ReloadableServerResources.java +++ b/net/minecraft/server/ReloadableServerResources.java -@@ -44,6 +_,9 @@ - this.commands = new Commands(p_206858_, this.commandBuildContext); - this.commandBuildContext.missingTagAccessPolicy(CommandBuildContext.MissingTagAccessPolicy.CREATE_NEW); +@@ -49,6 +_,8 @@ + this.commands = new Commands(p_206858_, CommandBuildContext.simple(this.registryLookup, p_250695_)); + this.advancements = new ServerAdvancementManager(this.registryLookup); this.functionLibrary = new ServerFunctionLibrary(p_206859_, this.commands.getDispatcher()); -+ // Neo: Create context object and inject it into listeners that need it -+ this.registryAccess = p_206857_; ++ // Neo: Create context object + this.context = new net.neoforged.neoforge.common.conditions.ConditionContext(this.tagManager); } public ServerFunctionLibrary getFunctionLibrary() { -@@ -80,19 +_,33 @@ - Executor p_249601_ - ) { - ReloadableServerResources reloadableserverresources = new ReloadableServerResources(p_251163_, p_250212_, p_249301_, p_251126_); -+ List listeners = new java.util.ArrayList<>(reloadableserverresources.listeners()); -+ listeners.addAll(net.neoforged.neoforge.event.EventHooks.onResourceReload(reloadableserverresources, p_251163_)); -+ listeners.forEach(rl -> { -+ if (rl instanceof net.neoforged.neoforge.resource.ContextAwareReloadListener srl) srl.injectContext(reloadableserverresources.context, reloadableserverresources.registryAccess); -+ }); - return SimpleReloadInstance.create( -- p_248588_, reloadableserverresources.listeners(), p_249136_, p_249601_, DATA_RELOAD_INITIAL_TASK, LOGGER.isDebugEnabled() -+ p_248588_, listeners, p_249136_, p_249601_, DATA_RELOAD_INITIAL_TASK, LOGGER.isDebugEnabled() - ) - .done() - .whenComplete( - (p_255534_, p_255535_) -> reloadableserverresources.commandBuildContext.missingTagAccessPolicy(CommandBuildContext.MissingTagAccessPolicy.FAIL) - ) -+ .thenRun(() -> { -+ // Clear context after reload complete -+ listeners.forEach(rl -> { -+ if (rl instanceof net.neoforged.neoforge.resource.ContextAwareReloadListener srl) { -+ srl.injectContext(net.neoforged.neoforge.common.conditions.ICondition.IContext.EMPTY, RegistryAccess.EMPTY); -+ } -+ }); -+ }) - .thenApply(p_214306_ -> reloadableserverresources); +@@ -75,6 +_,24 @@ + return List.of(this.tagManager, this.recipes, this.functionLibrary, this.advancements); } - public void updateRegistryTags(RegistryAccess p_206869_) { - this.tagManager.getResult().forEach(p_214315_ -> updateRegistryTags(p_206869_, p_214315_)); - Blocks.rebuildCache(); -+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.TagsUpdatedEvent(p_206869_, false, false)); - } - - private static void updateRegistryTags(RegistryAccess p_206871_, TagManager.LoadResult p_206872_) { -@@ -106,5 +_,23 @@ - ) - ); - p_206871_.registryOrThrow(resourcekey).bindTags(map); -+ } -+ + private final net.neoforged.neoforge.common.conditions.ICondition.IContext context; -+ private final net.minecraft.core.RegistryAccess registryAccess; + + /** + * Exposes the current condition context for usage in other reload listeners.
@@ -62,10 +23,51 @@ + public net.neoforged.neoforge.common.conditions.ICondition.IContext getConditionContext() { + return this.context; + } ++ + /** -+ * {@return the registry access for the currently active reload} -+ */ -+ public net.minecraft.core.RegistryAccess getRegistryAccess() { -+ return this.registryAccess; ++ * {@return the lookup provider access for the currently active reload} ++ */ ++ public HolderLookup.Provider getRegistryLookup() { ++ return this.registryLookup; ++ } ++ + public static CompletableFuture loadResources( + ResourceManager p_248588_, + LayeredRegistryAccess p_335667_, +@@ -90,14 +_,27 @@ + ReloadableServerResources reloadableserverresources = new ReloadableServerResources( + p_335211_.compositeAccess(), p_250212_, p_249301_, p_251126_ + ); ++ List listeners = new java.util.ArrayList<>(reloadableserverresources.listeners()); ++ listeners.addAll(net.neoforged.neoforge.event.EventHooks.onResourceReload(reloadableserverresources, p_335211_.compositeAccess())); ++ listeners.forEach(rl -> { ++ if (rl instanceof net.neoforged.neoforge.resource.ContextAwareReloadListener srl) srl.injectContext(reloadableserverresources.context, reloadableserverresources.registryLookup); ++ }); + return SimpleReloadInstance.create( +- p_248588_, reloadableserverresources.listeners(), p_249136_, p_249601_, DATA_RELOAD_INITIAL_TASK, LOGGER.isDebugEnabled() ++ p_248588_, listeners, p_249136_, p_249601_, DATA_RELOAD_INITIAL_TASK, LOGGER.isDebugEnabled() + ) + .done() + .whenComplete( + (p_323178_, p_323179_) -> reloadableserverresources.registryLookup + .missingTagAccessPolicy(ReloadableServerResources.MissingTagAccessPolicy.FAIL) + ) ++ .thenRun(() -> { ++ // Clear context after reload completes ++ listeners.forEach(rl -> { ++ if (rl instanceof net.neoforged.neoforge.resource.ContextAwareReloadListener srl) { ++ srl.injectContext(net.neoforged.neoforge.common.conditions.ICondition.IContext.EMPTY, RegistryAccess.EMPTY); ++ } ++ }); ++ }) + .thenApply(p_214306_ -> reloadableserverresources); + } + ); +@@ -107,6 +_,7 @@ + this.tagManager.getResult().forEach(p_335204_ -> updateRegistryTags(this.fullRegistryHolder.get(), (TagManager.LoadResult)p_335204_)); + AbstractFurnaceBlockEntity.invalidateCache(); + Blocks.rebuildCache(); ++ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.TagsUpdatedEvent(this.fullRegistryHolder.get(), false, false)); } - } + + private static void updateRegistryTags(RegistryAccess p_206871_, TagManager.LoadResult p_206872_) { diff --git a/patches/net/minecraft/server/ServerAdvancementManager.java.patch b/patches/net/minecraft/server/ServerAdvancementManager.java.patch index 211b7f3ad9e..73decf3369f 100644 --- a/patches/net/minecraft/server/ServerAdvancementManager.java.patch +++ b/patches/net/minecraft/server/ServerAdvancementManager.java.patch @@ -1,19 +1,20 @@ --- a/net/minecraft/server/ServerAdvancementManager.java +++ b/net/minecraft/server/ServerAdvancementManager.java -@@ -41,10 +_,15 @@ +@@ -41,11 +_,15 @@ } protected void apply(Map p_136034_, ResourceManager p_136035_, ProfilerFiller p_136036_) { -+ var ops = this.makeConditionalOps(); +- RegistryOps registryops = this.registries.createSerializationContext(JsonOps.INSTANCE); ++ RegistryOps registryops = this.makeConditionalOps(); // Neo: add condition context Builder builder = ImmutableMap.builder(); - p_136034_.forEach((p_311532_, p_311533_) -> { + p_136034_.forEach((p_337529_, p_337530_) -> { try { -- Advancement advancement = Util.getOrThrow(Advancement.CODEC.parse(JsonOps.INSTANCE, p_311533_), JsonParseException::new); -+ Advancement advancement = net.neoforged.neoforge.common.conditions.ICondition.getWithWithConditionsCodec(Advancement.CONDITIONAL_CODEC, ops, p_311533_).orElse(null); +- Advancement advancement = Advancement.CODEC.parse(registryops, p_337530_).getOrThrow(JsonParseException::new); ++ Advancement advancement = net.neoforged.neoforge.common.conditions.ICondition.getWithWithConditionsCodec(Advancement.CONDITIONAL_CODEC, registryops, p_337530_).orElse(null); + if (advancement == null) { -+ LOGGER.debug("Skipping loading advancement {} as its conditions were not met", p_311532_); ++ LOGGER.debug("Skipping loading advancement {} as its conditions were not met", p_337529_); + return; + } - this.validate(p_311532_, advancement); - builder.put(p_311532_, new AdvancementHolder(p_311532_, advancement)); + this.validate(p_337529_, advancement); + builder.put(p_337529_, new AdvancementHolder(p_337529_, advancement)); } catch (Exception exception) { diff --git a/patches/net/minecraft/server/WorldLoader.java.patch b/patches/net/minecraft/server/WorldLoader.java.patch index cd597d89ecb..67180986ab9 100644 --- a/patches/net/minecraft/server/WorldLoader.java.patch +++ b/patches/net/minecraft/server/WorldLoader.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/WorldLoader.java +++ b/net/minecraft/server/WorldLoader.java -@@ -35,7 +_,7 @@ +@@ -33,7 +_,7 @@ CloseableResourceManager closeableresourcemanager = pair.getSecond(); LayeredRegistryAccess layeredregistryaccess = RegistryLayer.createRegistryAccess(); LayeredRegistryAccess layeredregistryaccess1 = loadAndReplaceLayer( diff --git a/patches/net/minecraft/server/commands/DataPackCommand.java.patch b/patches/net/minecraft/server/commands/DataPackCommand.java.patch index ec062a79daa..0a43913de10 100644 --- a/patches/net/minecraft/server/commands/DataPackCommand.java.patch +++ b/patches/net/minecraft/server/commands/DataPackCommand.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/commands/DataPackCommand.java +++ b/net/minecraft/server/commands/DataPackCommand.java -@@ -183,7 +_,7 @@ +@@ -186,7 +_,7 @@ private static int listEnabledPacks(CommandSourceStack p_136866_) { PackRepository packrepository = p_136866_.getServer().getPackRepository(); packrepository.reload(); diff --git a/patches/net/minecraft/server/commands/SpreadPlayersCommand.java.patch b/patches/net/minecraft/server/commands/SpreadPlayersCommand.java.patch index 4c3ed4dccd0..9f297b76ee2 100644 --- a/patches/net/minecraft/server/commands/SpreadPlayersCommand.java.patch +++ b/patches/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 -@@ -257,15 +_,22 @@ +@@ -259,15 +_,22 @@ spreadplayerscommand$position = p_138732_[i++]; } @@ -30,4 +30,4 @@ + } double d2 = Double.MAX_VALUE; - for(SpreadPlayersCommand.Position spreadplayerscommand$position1 : p_138732_) { + for (SpreadPlayersCommand.Position spreadplayerscommand$position1 : p_138732_) { diff --git a/patches/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/net/minecraft/server/dedicated/DedicatedServer.java.patch index f366de9e258..40836552ae5 100644 --- a/patches/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -68,6 +_,8 @@ - private MinecraftServerGui gui; +@@ -77,6 +_,8 @@ + private RemoteSampleLogger tickTimeLogger; @Nullable - private final TextFilterClient textFilterClient; + private DebugSampleSubscriptionTracker debugSampleSubscriptionTracker; + @Nullable + private net.minecraft.client.server.LanServerPinger dediLanPinger; public DedicatedServer( Thread p_214789_, -@@ -90,6 +_,7 @@ +@@ -99,6 +_,7 @@ Thread thread = new Thread("Server console handler") { @Override public void run() { @@ -17,7 +17,7 @@ BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)); String s1; -@@ -168,11 +_,13 @@ +@@ -181,11 +_,13 @@ long i = Util.getNanos(); SkullBlockEntity.setup(this.services, this); GameProfileCache.setUsesAuthentication(this.usesAuthentication()); @@ -31,7 +31,7 @@ if (dedicatedserverproperties.announcePlayerAchievements != null) { this.getGameRules().getRule(GameRules.RULE_ANNOUNCE_ADVANCEMENTS).set(dedicatedserverproperties.announcePlayerAchievements, this); } -@@ -200,6 +_,12 @@ +@@ -213,6 +_,12 @@ LOGGER.info("JMX monitoring enabled"); } @@ -44,7 +44,7 @@ return true; } } -@@ -278,6 +_,10 @@ +@@ -291,6 +_,10 @@ if (this.queryThreadGs4 != null) { this.queryThreadGs4.stop(); } @@ -55,7 +55,7 @@ } @Override -@@ -531,7 +_,12 @@ +@@ -544,7 +_,12 @@ @Override public void stopServer() { diff --git a/patches/net/minecraft/server/dedicated/ServerWatchdog.java.patch b/patches/net/minecraft/server/dedicated/ServerWatchdog.java.patch index b778e30ed2a..bc6f5a8bc9f 100644 --- a/patches/net/minecraft/server/dedicated/ServerWatchdog.java.patch +++ b/patches/net/minecraft/server/dedicated/ServerWatchdog.java.patch @@ -7,7 +7,7 @@ - Error error = new Error("Watchdog"); + Error error = new Error(String.format(java.util.Locale.ENGLISH, "ServerHangWatchdog detected that a single server tick took %.2f seconds (should be max 0.05)", k / 1000F)); // Forge: don't just make a crash report with a seemingly-inexplicable Error - for(ThreadInfo threadinfo : athreadinfo) { + for (ThreadInfo threadinfo : athreadinfo) { if (threadinfo.getThreadId() == this.server.getRunningThread().getId()) { error.setStackTrace(threadinfo.getStackTrace()); } diff --git a/patches/net/minecraft/server/level/ChunkHolder.java.patch b/patches/net/minecraft/server/level/ChunkHolder.java.patch index f3c2095e678..28db7d98ba8 100644 --- a/patches/net/minecraft/server/level/ChunkHolder.java.patch +++ b/patches/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 -@@ -69,6 +_,7 @@ +@@ -62,6 +_,7 @@ private final ChunkHolder.LevelChangeListener onLevelChange; private final ChunkHolder.PlayerProvider playerProvider; private boolean wasAccessibleSinceLastSave; diff --git a/patches/net/minecraft/server/level/ChunkMap.java.patch b/patches/net/minecraft/server/level/ChunkMap.java.patch index cb555e6d2ba..e85a64ef7da 100644 --- a/patches/net/minecraft/server/level/ChunkMap.java.patch +++ b/patches/net/minecraft/server/level/ChunkMap.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java -@@ -414,6 +_,7 @@ +@@ -422,6 +_,7 @@ this.modified = true; } @@ -8,7 +8,7 @@ return p_140179_; } } -@@ -528,6 +_,7 @@ +@@ -535,6 +_,7 @@ if (this.pendingUnloads.remove(p_140182_, p_140183_) && p_203002_ != null) { if (p_203002_ instanceof LevelChunk) { ((LevelChunk)p_203002_).setLoaded(false); @@ -16,38 +16,38 @@ } this.save(p_203002_); -@@ -737,11 +_,22 @@ - } +@@ -735,11 +_,22 @@ + } - levelchunk.setFullStatus(() -> ChunkLevel.fullStatus(p_140384_.getTicketLevel())); + levelchunk.setFullStatus(() -> ChunkLevel.fullStatus(p_140384_.getTicketLevel())); ++ try { ++ p_140384_.currentlyLoading = levelchunk; // Neo: bypass the future chain when getChunk is called, this prevents deadlocks. + levelchunk.runPostLoad(); ++ } finally { ++ p_140384_.currentlyLoading = null; // Neo: Stop bypassing the future chain. ++ } + if (this.entitiesInLevel.add(chunkpos.toLong())) { + levelchunk.setLoaded(true); + try { + p_140384_.currentlyLoading = levelchunk; // Neo: bypass the future chain when getChunk is called, this prevents deadlocks. - levelchunk.runPostLoad(); + levelchunk.registerAllBlockEntitiesAfterLevelLoad(); + levelchunk.registerTickContainerInLevel(this.level); ++ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkEvent.Load(levelchunk, !(protochunk instanceof ImposterProtoChunk))); + } finally { -+ p_140384_.currentlyLoading = null; // Neo: Stop bypassing the future chain. ++ p_140384_.currentlyLoading = null; // Neo: Stop bypassing the future chain. + } - if (this.entitiesInLevel.add(chunkpos.toLong())) { - levelchunk.setLoaded(true); -+ try { -+ p_140384_.currentlyLoading = levelchunk; // Neo: bypass the future chain when getChunk is called, this prevents deadlocks. - levelchunk.registerAllBlockEntitiesAfterLevelLoad(); - levelchunk.registerTickContainerInLevel(this.level); -+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkEvent.Load(levelchunk, !(protochunk instanceof ImposterProtoChunk))); -+ } finally { -+ p_140384_.currentlyLoading = null; // Neo: Stop bypassing the future chain. -+ } - } + } - return levelchunk; -@@ -844,6 +_,7 @@ + return levelchunk; +@@ -839,6 +_,7 @@ this.level.getProfiler().incrementCounter("chunkSave"); CompoundTag compoundtag = ChunkSerializer.write(this.level, p_140259_); -+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkDataEvent.Save(p_140259_, p_140259_.getWorldForge() != null ? p_140259_.getWorldForge() : this.level, compoundtag)); - this.write(chunkpos, compoundtag); - this.markPosition(chunkpos, chunkstatus.getChunkType()); - return true; -@@ -902,9 +_,11 @@ ++ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkDataEvent.Save(p_140259_, p_140259_.getLevel() != null ? p_140259_.getLevel() : this.level, compoundtag)); + this.write(chunkpos, compoundtag).exceptionallyAsync(p_329914_ -> { + this.level.getServer().reportChunkSaveFailure(chunkpos); + return null; +@@ -901,9 +_,11 @@ private static void markChunkPendingToSend(ServerPlayer p_295834_, LevelChunk p_296281_) { p_295834_.connection.chunkSender.markChunkPendingToSend(p_296281_); @@ -59,7 +59,7 @@ p_294215_.connection.chunkSender.dropChunk(p_294215_, p_294758_); } -@@ -1099,6 +_,7 @@ +@@ -1102,6 +_,7 @@ this.playerMap.unIgnorePlayer(p_140185_); } @@ -67,7 +67,7 @@ this.updateChunkTracking(p_140185_); } } -@@ -1151,7 +_,7 @@ +@@ -1153,7 +_,7 @@ } protected void addEntity(Entity p_140200_) { diff --git a/patches/net/minecraft/server/level/DistanceManager.java.patch b/patches/net/minecraft/server/level/DistanceManager.java.patch index bb0299fdd69..37443552960 100644 --- a/patches/net/minecraft/server/level/DistanceManager.java.patch +++ b/patches/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 -@@ -55,6 +_,8 @@ +@@ -54,6 +_,8 @@ private long ticketTickCounter; private int simulationDistance = 10; @@ -9,7 +9,7 @@ protected DistanceManager(Executor p_140774_, Executor p_140775_) { ProcessorHandle processorhandle = ProcessorHandle.of("player ticket throttler", p_140775_::execute); ChunkTaskPriorityQueueSorter chunktaskpriorityqueuesorter = new ChunkTaskPriorityQueueSorter(ImmutableList.of(processorhandle), p_140774_, 4); -@@ -152,6 +_,10 @@ +@@ -151,6 +_,10 @@ if (p_140786_.getTicketLevel() < i) { this.ticketTracker.update(p_140785_, p_140786_.getTicketLevel(), true); } @@ -20,7 +20,7 @@ } void removeTicket(long p_140819_, Ticket p_140820_) { -@@ -164,6 +_,13 @@ +@@ -163,6 +_,13 @@ } this.ticketTracker.update(p_140819_, getTicketLevelAt(sortedarrayset), false); @@ -34,7 +34,7 @@ } public void addTicket(TicketType p_140793_, ChunkPos p_140794_, int p_140795_, T p_140796_) { -@@ -176,14 +_,20 @@ +@@ -175,14 +_,20 @@ } public void addRegionTicket(TicketType p_140841_, ChunkPos p_140842_, int p_140843_, T p_140844_) { @@ -57,7 +57,7 @@ long i = p_140851_.toLong(); this.removeTicket(i, ticket); this.tickingTicketsTracker.removeTicket(i, ticket); -@@ -267,6 +_,11 @@ +@@ -266,6 +_,11 @@ public String getDebugStatus() { return this.ticketThrottler.getDebugStatus(); diff --git a/patches/net/minecraft/server/level/ServerChunkCache.java.patch b/patches/net/minecraft/server/level/ServerChunkCache.java.patch index 736014f0952..54d36f092f7 100644 --- a/patches/net/minecraft/server/level/ServerChunkCache.java.patch +++ b/patches/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 -@@ -45,7 +_,7 @@ +@@ -44,7 +_,7 @@ import net.minecraft.world.level.storage.DimensionDataStorage; import net.minecraft.world.level.storage.LevelStorageSource; @@ -9,7 +9,7 @@ private static final List CHUNK_STATUSES = ChunkStatus.getStatusList(); private final DistanceManager distanceManager; public final ServerLevel level; -@@ -150,6 +_,10 @@ +@@ -149,6 +_,10 @@ } } @@ -18,18 +18,18 @@ + return chunkholder.currentlyLoading; // Neo: If the requested chunk is loading, bypass the future chain to prevent a deadlock. + profilerfiller.incrementCounter("getChunkCacheMiss"); - CompletableFuture> completablefuture = this.getChunkFutureMainThread( - p_8360_, p_8361_, p_8362_, p_8363_ -@@ -187,6 +_,7 @@ + CompletableFuture> completablefuture = this.getChunkFutureMainThread(p_8360_, p_8361_, p_330876_, p_8363_); + this.mainThreadProcessor.managedBlock(completablefuture::isDone); +@@ -183,6 +_,7 @@ if (chunkholder == null) { return null; } else { + if (chunkholder.currentlyLoading != null) return chunkholder.currentlyLoading; // Forge: If the requested chunk is loading, bypass the future chain to prevent a deadlock. - Either either = chunkholder.getFutureIfPresent(ChunkStatus.FULL).getNow(null); - if (either == null) { + ChunkResult chunkresult = chunkholder.getFutureIfPresent(ChunkStatus.FULL).getNow(null); + if (chunkresult == null) { return null; -@@ -383,7 +_,7 @@ - for(ServerChunkCache.ChunkAndHolder serverchunkcache$chunkandholder : list) { +@@ -375,7 +_,7 @@ + for (ServerChunkCache.ChunkAndHolder serverchunkcache$chunkandholder : list) { LevelChunk levelchunk1 = serverchunkcache$chunkandholder.chunk; ChunkPos chunkpos = levelchunk1.getPos(); - if (this.level.isNaturalSpawningAllowed(chunkpos) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkpos)) { @@ -37,7 +37,7 @@ levelchunk1.incrementInhabitedTime(j); if (flag1 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkpos)) { NaturalSpawner.spawnForChunk(this.level, levelchunk1, naturalspawner$spawnstate, this.spawnFriendlies, this.spawnEnemies, flag); -@@ -462,11 +_,17 @@ +@@ -454,11 +_,17 @@ } public void addRegionTicket(TicketType p_8388_, ChunkPos p_8389_, int p_8390_, T p_8391_) { diff --git a/patches/net/minecraft/server/level/ServerEntity.java.patch b/patches/net/minecraft/server/level/ServerEntity.java.patch index 7936973d004..b58ca16a465 100644 --- a/patches/net/minecraft/server/level/ServerEntity.java.patch +++ b/patches/net/minecraft/server/level/ServerEntity.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java -@@ -97,9 +_,9 @@ - Entity $$11 = this.entity; - if ($$11 instanceof ItemFrame itemframe && this.tickCount % 10 == 0) { +@@ -100,9 +_,9 @@ + + if (this.entity instanceof ItemFrame itemframe && this.tickCount % 10 == 0) { ItemStack itemstack = itemframe.getItem(); - if (itemstack.getItem() instanceof MapItem) { + if (true) { - Integer integer = MapItem.getMapId(itemstack); -- MapItemSavedData mapitemsaveddata = MapItem.getSavedData(integer, this.level); + MapId mapid = itemstack.get(DataComponents.MAP_ID); +- MapItemSavedData mapitemsaveddata = MapItem.getSavedData(mapid, this.level); + MapItemSavedData mapitemsaveddata = MapItem.getSavedData(itemstack, this.level); if (mapitemsaveddata != null) { - for(ServerPlayer serverplayer : this.level.players()) { + for (ServerPlayer serverplayer : this.level.players()) { mapitemsaveddata.tickCarriedBy(serverplayer, itemstack); -@@ -219,16 +_,18 @@ +@@ -230,16 +_,18 @@ public void removePairing(ServerPlayer p_8535_) { this.entity.stopSeenByPlayer(p_8535_); p_8535_.connection.send(new ClientboundRemoveEntitiesPacket(this.entity.getId())); @@ -20,9 +20,8 @@ } public void addPairing(ServerPlayer p_8542_) { -- List> list = new ArrayList<>(); + List> list = new ArrayList<>(); - this.sendPairingData(p_8542_, list::add); -+ List> list = new ArrayList<>(); + this.sendPairingData(p_8542_, new net.neoforged.neoforge.network.bundle.PacketAndPayloadAcceptor<>(list::add)); p_8542_.connection.send(new ClientboundBundlePacket(list)); this.entity.startSeenByPlayer(p_8542_); @@ -34,7 +33,7 @@ if (this.entity.isRemoved()) { LOGGER.warn("Fetching packet for removed entity {}", this.entity); } -@@ -236,6 +_,7 @@ +@@ -247,6 +_,7 @@ Packet packet = this.entity.getAddEntityPacket(); this.yHeadRotp = Mth.floor(this.entity.getYHeadRot() * 256.0F / 360.0F); p_289563_.accept(packet); diff --git a/patches/net/minecraft/server/level/ServerLevel.java.patch b/patches/net/minecraft/server/level/ServerLevel.java.patch index 9d5d3a3df5b..71bfa4bf8d6 100644 --- a/patches/net/minecraft/server/level/ServerLevel.java.patch +++ b/patches/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 -@@ -190,7 +_,7 @@ +@@ -198,7 +_,7 @@ private final List customSpawners; @Nullable private EndDragonFight dragonFight; @@ -9,7 +9,7 @@ private final StructureManager structureManager; private final StructureCheck structureCheck; private final boolean tickTime; -@@ -281,6 +_,8 @@ +@@ -297,6 +_,8 @@ this.randomSequences = Objects.requireNonNullElseGet( p_288977_, () -> this.getDataStorage().computeIfAbsent(RandomSequences.factory(i), "random_sequences") ); @@ -18,7 +18,7 @@ } @Deprecated -@@ -325,7 +_,7 @@ +@@ -341,7 +_,7 @@ if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) { if (this.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) { long j = this.levelData.getDayTime() + 24000L; @@ -27,7 +27,7 @@ } this.wakeUpAllPlayers(); -@@ -363,7 +_,7 @@ +@@ -379,7 +_,7 @@ this.handlingTick = false; profilerfiller.pop(); @@ -36,7 +36,7 @@ if (flag1) { this.resetEmptyTime(); } -@@ -395,7 +_,9 @@ +@@ -411,7 +_,9 @@ } profilerfiller.push("tick"); @@ -47,7 +47,7 @@ profilerfiller.pop(); } } -@@ -527,6 +_,7 @@ +@@ -541,6 +_,7 @@ BlockPos blockpos = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, p_295060_); BlockPos blockpos1 = blockpos.below(); Biome biome = this.getBiome(blockpos).value(); @@ -55,7 +55,7 @@ if (biome.shouldFreeze(this, blockpos1)) { this.setBlockAndUpdate(blockpos1, Blocks.ICE.defaultBlockState()); } -@@ -699,15 +_,19 @@ +@@ -713,15 +_,19 @@ .broadcastAll(new ClientboundGameEventPacket(ClientboundGameEventPacket.THUNDER_LEVEL_CHANGE, this.thunderLevel), this.dimension()); } @@ -79,15 +79,19 @@ } } -@@ -760,6 +_,7 @@ - ProfilerFiller profilerfiller = this.getProfiler(); - profilerfiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(p_8664_.getType()).toString()); - profilerfiller.incrementCounter("tickPassenger"); -+ if (p_8664_.canUpdate()) - p_8664_.rideTick(); - profilerfiller.pop(); +@@ -757,7 +_,10 @@ + p_8648_.tickCount++; + this.getProfiler().push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(p_8648_.getType()).toString()); + profilerfiller.incrementCounter("tickNonPassenger"); +- p_8648_.tick(); ++ // Neo: Permit cancellation of Entity#tick via EntityTickEvent.Pre ++ if (!net.neoforged.neoforge.event.EventHooks.fireEntityTickPre(p_8648_).isCanceled()) { ++ p_8648_.tick(); ++ } + this.getProfiler().pop(); -@@ -792,6 +_,7 @@ + for (Entity entity : p_8648_.getPassengers()) { +@@ -806,6 +_,7 @@ } else { this.entityManager.autoSave(); } @@ -95,7 +99,7 @@ } } -@@ -885,6 +_,7 @@ +@@ -899,6 +_,7 @@ } private void addPlayer(ServerPlayer p_8854_) { @@ -103,7 +107,7 @@ Entity entity = this.getEntities().get(p_8854_.getUUID()); if (entity != null) { LOGGER.warn("Force-added player with duplicate UUID {}", p_8854_.getUUID()); -@@ -892,7 +_,8 @@ +@@ -906,7 +_,8 @@ this.removePlayerImmediately((ServerPlayer)entity, Entity.RemovalReason.DISCARDED); } @@ -113,7 +117,7 @@ } private boolean addEntity(Entity p_8873_) { -@@ -900,7 +_,12 @@ +@@ -914,7 +_,12 @@ LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityType.getKey(p_8873_.getType())); return false; } else { @@ -127,7 +131,7 @@ } } -@@ -948,6 +_,12 @@ +@@ -962,6 +_,12 @@ float p_263390_, long p_263403_ ) { @@ -140,7 +144,7 @@ this.server .getPlayerList() .broadcast( -@@ -965,6 +_,12 @@ +@@ -979,6 +_,12 @@ public void playSeededSound( @Nullable Player p_263545_, Entity p_263544_, Holder p_263491_, SoundSource p_263542_, float p_263530_, float p_263520_, long p_263490_ ) { @@ -153,15 +157,15 @@ this.server .getPlayerList() .broadcast( -@@ -1008,6 +_,7 @@ +@@ -1022,6 +_,7 @@ @Override - public void gameEvent(GameEvent p_215041_, Vec3 p_215042_, GameEvent.Context p_215043_) { -+ if (!net.neoforged.neoforge.common.CommonHooks.onVanillaGameEvent(this, p_215041_, p_215042_, p_215043_)) return; - this.gameEventDispatcher.post(p_215041_, p_215042_, p_215043_); + public void gameEvent(Holder p_316597_, Vec3 p_215042_, GameEvent.Context p_215043_) { ++ if (!net.neoforged.neoforge.common.CommonHooks.onVanillaGameEvent(this, p_316597_, p_215042_, p_215043_)) return; + this.gameEventDispatcher.post(p_316597_, p_215042_, p_215043_); } -@@ -1045,11 +_,16 @@ +@@ -1060,11 +_,16 @@ @Override public void updateNeighborsAt(BlockPos p_215045_, Block p_215046_) { @@ -178,18 +182,18 @@ this.neighborUpdater.updateNeighborsAtExceptFromFacing(p_215052_, p_215053_, p_215054_); } -@@ -1695,8 +_,8 @@ +@@ -1727,8 +_,8 @@ ServerLevel.this.navigatingMobs.add(mob); } - if (p_143371_ instanceof EnderDragon enderdragon) { -- for(EnderDragonPart enderdragonpart : enderdragon.getSubEntities()) { +- for (EnderDragonPart enderdragonpart : enderdragon.getSubEntities()) { + if (p_143371_.isMultipartEntity()) { + for(net.neoforged.neoforge.entity.PartEntity enderdragonpart : p_143371_.getParts()) { ServerLevel.this.dragonParts.put(enderdragonpart.getId(), enderdragonpart); } } -@@ -1715,24 +_,61 @@ +@@ -1747,24 +_,61 @@ if (ServerLevel.this.isUpdatingNavigations) { String s = "onTrackingStart called during navigation iteration"; Util.logAndPauseIfInIde( @@ -202,7 +206,7 @@ } - if (p_143375_ instanceof EnderDragon enderdragon) { -- for(EnderDragonPart enderdragonpart : enderdragon.getSubEntities()) { +- for (EnderDragonPart enderdragonpart : enderdragon.getSubEntities()) { + if (p_143375_.isMultipartEntity()) { + for(net.neoforged.neoforge.entity.PartEntity enderdragonpart : p_143375_.getParts()) { ServerLevel.this.dragonParts.remove(enderdragonpart.getId()); diff --git a/patches/net/minecraft/server/level/ServerPlayer.java.patch b/patches/net/minecraft/server/level/ServerPlayer.java.patch index dc55b4f7002..dfa8ebad7c3 100644 --- a/patches/net/minecraft/server/level/ServerPlayer.java.patch +++ b/patches/net/minecraft/server/level/ServerPlayer.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -234,6 +_,10 @@ +@@ -250,6 +_,10 @@ } private void broadcastDataValue(AbstractContainerMenu p_143455_, int p_143456_, int p_143457_) { -+ if (ServerPlayer.this.connection.isConnected(net.neoforged.neoforge.network.payload.AdvancedContainerSetDataPayload.ID)) { -+ ServerPlayer.this.connection.send(new net.neoforged.neoforge.network.payload.AdvancedContainerSetDataPayload(p_143455_.containerId, p_143456_, p_143457_)); ++ if (ServerPlayer.this.connection.hasChannel(net.neoforged.neoforge.network.payload.AdvancedContainerSetDataPayload.TYPE)) { ++ ServerPlayer.this.connection.send(new net.neoforged.neoforge.network.payload.AdvancedContainerSetDataPayload((byte) p_143455_.containerId, (short) p_143456_, p_143457_)); + return; + } ServerPlayer.this.connection.send(new ClientboundContainerSetDataPacket(p_143455_.containerId, p_143456_, p_143457_)); } }; -@@ -546,6 +_,11 @@ +@@ -599,6 +_,11 @@ this.connection.send(new ClientboundSetExperiencePacket(this.experienceProgress, this.totalExperience, this.experienceLevel)); } @@ -23,7 +23,7 @@ if (this.tickCount % 20 == 0) { CriteriaTriggers.LOCATION.trigger(this); } -@@ -594,6 +_,7 @@ +@@ -650,6 +_,7 @@ @Override public void die(DamageSource p_9035_) { this.gameEvent(GameEvent.ENTITY_DIE); @@ -31,7 +31,7 @@ boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES); if (flag) { Component component = this.getCombatTracker().getDeathMessage(); -@@ -740,11 +_,12 @@ +@@ -793,11 +_,12 @@ @Nullable @Override @@ -46,7 +46,7 @@ this.unRide(); this.serverLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); if (!this.wonGame) { -@@ -761,13 +_,14 @@ +@@ -814,13 +_,14 @@ PlayerList playerlist = this.server.getPlayerList(); playerlist.sendPlayerPermissionLevel(this); serverlevel.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); @@ -64,7 +64,7 @@ this.createEndPlatform(p_9180_, BlockPos.containing(portalinfo.pos)); } -@@ -779,6 +_,9 @@ +@@ -832,6 +_,9 @@ p_9180_.addDuringPortalTeleport(this); serverlevel.getProfiler().pop(); this.triggerDimensionChangeTriggers(serverlevel); @@ -74,8 +74,8 @@ this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities())); playerlist.sendLevelInfo(this, p_9180_); playerlist.sendAllPlayerInfo(this); -@@ -787,10 +_,12 @@ - this.connection.send(new ClientboundUpdateMobEffectPacket(this.getId(), mobeffectinstance)); +@@ -840,10 +_,12 @@ + this.connection.send(new ClientboundUpdateMobEffectPacket(this.getId(), mobeffectinstance, false)); } + if (teleporter.playTeleportSound(this, serverlevel, p_9180_)) @@ -87,7 +87,7 @@ } return this; -@@ -859,6 +_,9 @@ +@@ -912,6 +_,9 @@ @Override public Either startSleepInBed(BlockPos p_9115_) { @@ -97,7 +97,7 @@ Direction direction = this.level().getBlockState(p_9115_).getValue(HorizontalDirectionalBlock.FACING); if (this.isSleeping() || !this.isAlive()) { return Either.left(Player.BedSleepingProblem.OTHER_PROBLEM); -@@ -870,7 +_,7 @@ +@@ -923,7 +_,7 @@ return Either.left(Player.BedSleepingProblem.OBSTRUCTED); } else { this.setRespawnPosition(this.level().dimension(), p_9115_, this.getYRot(), false, true); @@ -106,7 +106,7 @@ return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW); } else { if (!this.isCreative()) { -@@ -909,6 +_,7 @@ +@@ -962,6 +_,7 @@ } private boolean bedInRange(BlockPos p_9117_, Direction p_9118_) { @@ -114,15 +114,15 @@ return this.isReachableBedBlock(p_9117_) || this.isReachableBedBlock(p_9117_.relative(p_9118_.getOpposite())); } -@@ -983,11 +_,19 @@ +@@ -1052,11 +_,19 @@ @Override public OptionalInt openMenu(@Nullable MenuProvider p_9033_) { -+ return openMenu(p_9033_, (java.util.function.Consumer) null); ++ return openMenu(p_9033_, (java.util.function.Consumer) null); + } + + @Override -+ public OptionalInt openMenu(@Nullable MenuProvider p_9033_, @Nullable java.util.function.Consumer extraDataWriter) { ++ public OptionalInt openMenu(@Nullable MenuProvider p_9033_, @Nullable java.util.function.Consumer extraDataWriter) { if (p_9033_ == null) { return OptionalInt.empty(); } else { @@ -134,7 +134,7 @@ } this.nextContainerCounter(); -@@ -999,10 +_,16 @@ +@@ -1068,10 +_,16 @@ return OptionalInt.empty(); } else { @@ -143,7 +143,7 @@ .send(new ClientboundOpenScreenPacket(abstractcontainermenu.containerId, abstractcontainermenu.getType(), p_9033_.getDisplayName())); + } else { + this.connection -+ .send(new net.neoforged.neoforge.network.payload.AdvancedOpenScreenPayload(abstractcontainermenu.containerId, abstractcontainermenu.getType(), p_9033_.getDisplayName(), extraDataWriter)); ++ .send(new net.neoforged.neoforge.network.payload.AdvancedOpenScreenPayload(abstractcontainermenu.containerId, abstractcontainermenu.getType(), p_9033_.getDisplayName(), net.neoforged.neoforge.common.util.FriendlyByteBufUtil.writeCustomData(extraDataWriter, registryAccess()))); + } this.initMenu(abstractcontainermenu); this.containerMenu = abstractcontainermenu; @@ -151,7 +151,7 @@ return OptionalInt.of(this.containerCounter); } } -@@ -1023,6 +_,7 @@ +@@ -1092,6 +_,7 @@ this.connection.send(new ClientboundHorseScreenOpenPacket(this.containerCounter, p_9060_.getContainerSize(), p_9059_.getId())); this.containerMenu = new HorseInventoryMenu(this.containerCounter, this.getInventory(), p_9060_, p_9059_); this.initMenu(this.containerMenu); @@ -159,7 +159,7 @@ } @Override -@@ -1051,6 +_,7 @@ +@@ -1120,6 +_,7 @@ public void doCloseContainer() { this.containerMenu.removed(this); this.inventoryMenu.transferState(this.containerMenu); @@ -167,7 +167,7 @@ this.containerMenu = this.inventoryMenu; } -@@ -1276,6 +_,15 @@ +@@ -1345,6 +_,15 @@ this.setShoulderEntityLeft(p_9016_.getShoulderEntityLeft()); this.setShoulderEntityRight(p_9016_.getShoulderEntityRight()); this.setLastDeathLocation(p_9016_.getLastDeathLocation()); @@ -183,7 +183,7 @@ } @Override -@@ -1369,6 +_,8 @@ +@@ -1438,6 +_,8 @@ } public boolean setGameMode(GameType p_143404_) { @@ -192,15 +192,15 @@ if (!this.gameMode.changeGameModeForPlayer(p_143404_)) { return false; } else { -@@ -1517,6 +_,7 @@ +@@ -1582,6 +_,7 @@ public void setCamera(@Nullable Entity p_9214_) { Entity entity = this.getCamera(); this.camera = (Entity)(p_9214_ == null ? this : p_9214_); -+ while (this.camera instanceof net.neoforged.neoforge.entity.PartEntity partEntity) this.camera = partEntity.getParent(); // FORGE: fix MC-46486 ++ while (this.camera instanceof net.neoforged.neoforge.entity.PartEntity partEntity) this.camera = partEntity.getParent(); // Neo: fix MC-46486 if (entity != this.camera) { - Level level = this.camera.level(); - if (level instanceof ServerLevel serverlevel) { -@@ -1554,7 +_,11 @@ + if (this.camera.level() instanceof ServerLevel serverlevel) { + this.teleportTo(serverlevel, this.camera.getX(), this.camera.getY(), this.camera.getZ(), Set.of(), this.getYRot(), this.getXRot()); +@@ -1618,7 +_,11 @@ @Nullable public Component getTabListDisplayName() { @@ -213,7 +213,7 @@ } @Override -@@ -1580,21 +_,23 @@ +@@ -1644,21 +_,23 @@ this.stopRiding(); if (p_9000_ == this.level()) { this.connection.teleport(p_9001_, p_9002_, p_9003_, p_9004_, p_9005_); @@ -239,7 +239,7 @@ } } -@@ -1616,6 +_,7 @@ +@@ -1680,6 +_,7 @@ } public void setRespawnPosition(ResourceKey p_9159_, @Nullable BlockPos p_9160_, float p_9161_, boolean p_9162_, boolean p_9163_) { @@ -247,7 +247,7 @@ if (p_9160_ != null) { boolean flag = p_9160_.equals(this.respawnPosition) && p_9159_.equals(this.respawnDimension); if (p_9163_ && !flag) { -@@ -1673,6 +_,8 @@ +@@ -1737,6 +_,8 @@ if (itementity == null) { return null; } else { @@ -256,7 +256,7 @@ this.level().addFreshEntity(itementity); ItemStack itemstack = itementity.getItem(); if (p_9087_) { -@@ -1687,6 +_,75 @@ +@@ -1751,6 +_,75 @@ } } @@ -332,7 +332,7 @@ public TextFilter getTextFilter() { return this.textFilter; } -@@ -1751,9 +_,12 @@ +@@ -1811,9 +_,12 @@ public boolean drop(boolean p_182295_) { Inventory inventory = this.getInventory(); diff --git a/patches/net/minecraft/server/level/ServerPlayerGameMode.java.patch b/patches/net/minecraft/server/level/ServerPlayerGameMode.java.patch index f06c2b6a555..39a1a26532a 100644 --- a/patches/net/minecraft/server/level/ServerPlayerGameMode.java.patch +++ b/patches/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 -@@ -65,7 +_,10 @@ +@@ -68,7 +_,10 @@ protected void setGameModeForPlayer(GameType p_9274_, @Nullable GameType p_9275_) { this.previousGameModeForPlayer = p_9275_; this.gameModeForPlayer = p_9274_; @@ -11,20 +11,18 @@ } public GameType getGameModeForPlayer() { -@@ -126,7 +_,11 @@ +@@ -129,6 +_,10 @@ } public void handleBlockBreakAction(BlockPos p_215120_, ServerboundPlayerActionPacket.Action p_215121_, Direction p_215122_, int p_215123_, int p_215124_) { -- if (this.player.getEyePosition().distanceToSqr(Vec3.atCenterOf(p_215120_)) > ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) { + net.neoforged.neoforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.neoforged.neoforge.common.CommonHooks.onLeftClickBlock(player, p_215120_, p_215122_, p_215121_); + if (event.isCanceled() || (!this.isCreative() && event.getResult() == net.neoforged.bus.api.Event.Result.DENY)) { + return; + } -+ if (!this.player.canReach(p_215120_, 1.5)) { // Vanilla check is eye-to-center distance < 6, so padding is 6 - 4.5 = 1.5 + if (!this.player.canInteractWithBlock(p_215120_, 1.0)) { this.debugLogging(p_215120_, false, p_215124_, "too far"); } else if (p_215120_.getY() >= p_215123_) { - this.player.connection.send(new ClientboundBlockUpdatePacket(p_215120_, this.level.getBlockState(p_215120_))); -@@ -154,6 +_,7 @@ +@@ -157,6 +_,7 @@ float f = 1.0F; BlockState blockstate = this.level.getBlockState(p_215120_); if (!blockstate.isAir()) { @@ -32,7 +30,7 @@ blockstate.attack(this.level, p_215120_, this.player); f = blockstate.getDestroyProgress(this.player, this.player.level(), p_215120_); } -@@ -221,7 +_,8 @@ +@@ -224,7 +_,8 @@ public boolean destroyBlock(BlockPos p_9281_) { BlockState blockstate1 = this.level.getBlockState(p_9281_); @@ -42,7 +40,7 @@ return false; } else { BlockEntity blockentity = this.level.getBlockEntity(p_9281_); -@@ -229,30 +_,44 @@ +@@ -232,30 +_,44 @@ if (block instanceof GameMasterBlock && !this.player.canUseGameMasterBlocks()) { this.level.sendBlockUpdated(p_9281_, blockstate1, blockstate1, 3); return false; @@ -93,7 +91,7 @@ } public InteractionResult useItem(ServerPlayer p_9262_, Level p_9263_, ItemStack p_9264_, InteractionHand p_9265_) { -@@ -261,6 +_,8 @@ +@@ -264,6 +_,8 @@ } else if (p_9262_.getCooldowns().isOnCooldown(p_9264_.getItem())) { return InteractionResult.PASS; } else { @@ -102,7 +100,7 @@ int i = p_9264_.getCount(); int j = p_9264_.getDamageValue(); InteractionResultHolder interactionresultholder = p_9264_.use(p_9263_, p_9262_, p_9265_); -@@ -299,7 +_,10 @@ +@@ -295,7 +_,10 @@ BlockState blockstate = p_9267_.getBlockState(blockpos); if (!blockstate.getBlock().isEnabled(p_9267_.enabledFeatures())) { return InteractionResult.FAIL; @@ -114,7 +112,7 @@ MenuProvider menuprovider = blockstate.getMenuProvider(p_9267_, blockpos); if (menuprovider != null) { p_9266_.openMenu(menuprovider); -@@ -308,10 +_,15 @@ +@@ -304,10 +_,15 @@ return InteractionResult.PASS; } } else { @@ -129,10 +127,10 @@ ItemStack itemstack = p_9268_.copy(); - if (!flag1) { + if (event.getUseBlock() == net.neoforged.bus.api.Event.Result.ALLOW || (event.getUseBlock() != net.neoforged.bus.api.Event.Result.DENY && !flag1)) { - InteractionResult interactionresult = blockstate.use(p_9267_, p_9266_, p_9269_, p_9270_); - if (interactionresult.consumesAction()) { + ItemInteractionResult iteminteractionresult = blockstate.useItemOn(p_9266_.getItemInHand(p_9269_), p_9267_, p_9266_, p_9269_, p_9270_); + if (iteminteractionresult.consumesAction()) { CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(p_9266_, blockpos, itemstack); -@@ -319,8 +_,8 @@ +@@ -323,8 +_,8 @@ } } diff --git a/patches/net/minecraft/server/level/Ticket.java.patch b/patches/net/minecraft/server/level/Ticket.java.patch index 642b8d78be5..4e9481d89b2 100644 --- a/patches/net/minecraft/server/level/Ticket.java.patch +++ b/patches/net/minecraft/server/level/Ticket.java.patch @@ -15,29 +15,29 @@ } public int compareTo(Ticket p_9432_) { -@@ -32,18 +_,18 @@ - return false; +@@ -31,18 +_,18 @@ } else { - Ticket ticket = (Ticket)p_9439_; -- return this.ticketLevel == ticket.ticketLevel && Objects.equals(this.type, ticket.type) && Objects.equals(this.key, ticket.key); -+ return this.ticketLevel == ticket.ticketLevel && Objects.equals(this.type, ticket.type) && Objects.equals(this.key, ticket.key) && this.forceTicks == ticket.forceTicks; + return !(p_9439_ instanceof Ticket ticket) + ? false +- : this.ticketLevel == ticket.ticketLevel && Objects.equals(this.type, ticket.type) && Objects.equals(this.key, ticket.key); ++ : this.ticketLevel == ticket.ticketLevel && Objects.equals(this.type, ticket.type) && Objects.equals(this.key, ticket.key) && this.forceTicks == ticket.forceTicks; } } @Override public int hashCode() { - return Objects.hash(this.type, this.ticketLevel, this.key); -+ return Objects.hash(this.type, this.ticketLevel, this.key, forceTicks); ++ return Objects.hash(this.type, this.ticketLevel, this.key, this.forceTicks); } @Override public String toString() { - return "Ticket[" + this.type + " " + this.ticketLevel + " (" + this.key + ")] at " + this.createdTick; -+ return "Ticket[" + this.type + " " + this.ticketLevel + " (" + this.key + ")] at " + this.createdTick + " force ticks " + forceTicks; ++ return "Ticket[" + this.type + " " + this.ticketLevel + " (" + this.key + ")] at " + this.createdTick + " force ticks " + this.forceTicks; } public TicketType getType() { -@@ -61,5 +_,12 @@ +@@ -60,5 +_,12 @@ protected boolean timedOut(long p_9435_) { long i = this.type.timeout(); return i != 0L && p_9435_ - this.createdTick > i; diff --git a/patches/net/minecraft/server/level/WorldGenRegion.java.patch b/patches/net/minecraft/server/level/WorldGenRegion.java.patch index 7c12ce987aa..7088fd0b6b3 100644 --- a/patches/net/minecraft/server/level/WorldGenRegion.java.patch +++ b/patches/net/minecraft/server/level/WorldGenRegion.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/WorldGenRegion.java +++ b/net/minecraft/server/level/WorldGenRegion.java -@@ -328,6 +_,7 @@ +@@ -325,6 +_,7 @@ @Override public boolean addFreshEntity(Entity p_9580_) { diff --git a/patches/net/minecraft/server/network/CommonListenerCookie.java.patch b/patches/net/minecraft/server/network/CommonListenerCookie.java.patch index 7a0a60af217..52c6459edad 100644 --- a/patches/net/minecraft/server/network/CommonListenerCookie.java.patch +++ b/patches/net/minecraft/server/network/CommonListenerCookie.java.patch @@ -1,20 +1,19 @@ --- a/net/minecraft/server/network/CommonListenerCookie.java +++ b/net/minecraft/server/network/CommonListenerCookie.java -@@ -3,7 +_,16 @@ +@@ -3,7 +_,15 @@ import com.mojang.authlib.GameProfile; import net.minecraft.server.level.ClientInformation; --public record CommonListenerCookie(GameProfile gameProfile, int latency, ClientInformation clientInformation) { -+public record CommonListenerCookie(GameProfile gameProfile, int latency, ClientInformation clientInformation, net.neoforged.neoforge.network.connection.ConnectionType connectionType) { -+ +-public record CommonListenerCookie(GameProfile gameProfile, int latency, ClientInformation clientInformation, boolean transferred) { ++public record CommonListenerCookie(GameProfile gameProfile, int latency, ClientInformation clientInformation, boolean transferred, net.neoforged.neoforge.network.connection.ConnectionType connectionType) { + /** -+ * @deprecated Use {@link #CommonListenerCookie(GameProfile, int, ClientInformation, net.neoforged.neoforge.network.connection.ConnectionType)} instead, to indicate whether the connection is modded. ++ * @deprecated Use {@link #CommonListenerCookie(GameProfile, int, ClientInformation, boolean, net.neoforged.neoforge.network.connection.ConnectionType)} instead, to indicate whether the connection is modded. + */ + @Deprecated -+ public CommonListenerCookie(GameProfile gameProfile, int latency, ClientInformation clientInformation) { -+ this(gameProfile, latency, clientInformation, net.neoforged.neoforge.network.connection.ConnectionType.VANILLA); ++ public CommonListenerCookie(GameProfile gameProfile, int latency, ClientInformation clientInformation, boolean transferred) { ++ this(gameProfile, latency, clientInformation, transferred, net.neoforged.neoforge.network.connection.ConnectionType.VANILLA); + } + - public static CommonListenerCookie createInitial(GameProfile p_302024_) { - return new CommonListenerCookie(p_302024_, 0, ClientInformation.createDefault()); + public static CommonListenerCookie createInitial(GameProfile p_302024_, boolean p_320180_) { + return new CommonListenerCookie(p_302024_, 0, ClientInformation.createDefault(), p_320180_); } diff --git a/patches/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch b/patches/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch index 7e68fe50712..796e8dddfc7 100644 --- a/patches/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch +++ b/patches/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch @@ -1,19 +1,62 @@ --- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -109,7 +_,12 @@ - this.send(p_294278_, null); +@@ -41,6 +_,10 @@ + private boolean closed = false; + private int latency; + private volatile boolean suspendFlushingOnServerThread = false; ++ /** ++ * Holds the current connection type, based on the types of payloads that have been received so far. ++ */ ++ protected net.neoforged.neoforge.network.connection.ConnectionType connectionType; + + public ServerCommonPacketListenerImpl(MinecraftServer p_295057_, Connection p_294822_, CommonListenerCookie p_301980_) { + this.server = p_295057_; +@@ -48,6 +_,8 @@ + this.keepAliveTime = Util.getMillis(); + this.latency = p_301980_.latency(); + this.transferred = p_301980_.transferred(); ++ // Neo: Set the connection type based on the cookie from the previous phase. ++ this.connectionType = p_301980_.connectionType(); } -+ @Override - public void send(Packet p_295099_, @Nullable PacketSendListener p_296321_) { -+ if (!net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().canSendPacket(p_295099_, this)) { + private void close() { +@@ -82,6 +_,24 @@ + + @Override + public void handleCustomPayload(ServerboundCustomPayloadPacket p_294276_) { ++ // Neo: Unconditionally handle register/unregister payloads and update the connection type accordingly. ++ if (p_294276_.payload() instanceof net.neoforged.neoforge.network.payload.MinecraftRegisterPayload minecraftRegisterPayload) { ++ this.connectionType = this.connectionType.withMinecraftRegisterPayload(); ++ net.neoforged.neoforge.network.registration.NetworkRegistry.onMinecraftRegister(this.getConnection(), minecraftRegisterPayload.newChannels()); + return; + } + - boolean flag = !this.suspendFlushingOnServerThread || !this.server.isSameThread(); ++ if (p_294276_.payload() instanceof net.neoforged.neoforge.network.payload.MinecraftUnregisterPayload minecraftUnregisterPayload) { ++ this.connectionType = this.connectionType.withMinecraftRegisterPayload(); ++ net.neoforged.neoforge.network.registration.NetworkRegistry.onMinecraftUnregister(this.getConnection(), minecraftUnregisterPayload.forgottenChannels()); ++ return; ++ } ++ ++ // Neo: Handle modded payloads on modded connections. Vanilla payloads do not get sent to the modded handling pass. ++ if (this.connectionType.isNotVanilla() && !"minecraft".equals(p_294276_.payload().type().id().getNamespace())) { ++ net.neoforged.neoforge.network.registration.NetworkRegistry.handleModdedPayload(this, p_294276_); ++ return; ++ } + } + + @Override +@@ -140,7 +_,10 @@ + this.send(p_294278_, null); + } - try { -@@ -143,7 +_,36 @@ ++ @Override + public void send(Packet p_295099_, @Nullable PacketSendListener p_296321_) { ++ net.neoforged.neoforge.network.registration.NetworkRegistry.checkPacket(p_295099_, this); ++ + if (p_295099_.isTerminal()) { + this.close(); + } +@@ -178,7 +_,41 @@ return this.latency; } @@ -26,7 +69,7 @@ + */ + @Deprecated protected CommonListenerCookie createCookie(ClientInformation p_301973_) { - return new CommonListenerCookie(this.playerProfile(), this.latency, p_301973_); + return new CommonListenerCookie(this.playerProfile(), this.latency, p_301973_, this.transferred); + } + + /** @@ -37,7 +80,7 @@ + * @return The cookie. + */ + protected CommonListenerCookie createCookie(ClientInformation p_301973_, net.neoforged.neoforge.network.connection.ConnectionType connectionType) { -+ return new CommonListenerCookie(this.playerProfile(), this.latency, p_301973_, connectionType); ++ return new CommonListenerCookie(this.playerProfile(), this.latency, p_301973_, this.transferred, connectionType); + } + + @Override @@ -48,5 +91,10 @@ + @Override + public net.minecraft.util.thread.ReentrantBlockableEventLoop getMainThreadEventLoop() { + return server; ++ } ++ ++ @Override ++ public net.neoforged.neoforge.network.connection.ConnectionType getConnectionType() { ++ return connectionType; } } diff --git a/patches/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java.patch b/patches/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java.patch index 7e5a1fe4fce..0bbe0543bfd 100644 --- a/patches/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java.patch +++ b/patches/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java.patch @@ -1,75 +1,53 @@ --- a/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java -@@ -41,6 +_,8 @@ - @Nullable - private ConfigurationTask currentTask; - private ClientInformation clientInformation; -+ private net.neoforged.neoforge.network.connection.ConnectionType connectionType = net.neoforged.neoforge.network.connection.ConnectionType.VANILLA; -+ private boolean isHandlingModdedConfigurationPhase = false; - - public ServerConfigurationPacketListenerImpl(MinecraftServer p_294645_, Connection p_295787_, CommonListenerCookie p_302003_) { - super(p_294645_, p_295787_, p_302003_); -@@ -65,6 +_,14 @@ +@@ -69,10 +_,21 @@ } public void startConfiguration() { -+ //Unregister all known play channels, and register all known configuration channels, then run negotiation. -+ this.send(new net.neoforged.neoforge.network.payload.MinecraftUnregisterPayload(net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().getInitialServerUnregisterChannels())); -+ this.send(new net.neoforged.neoforge.network.payload.MinecraftRegisterPayload(net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().getInitialServerListeningChannels())); -+ this.send(new net.neoforged.neoforge.network.payload.ModdedNetworkQueryPayload()); ++ // Neo: Before starting vanilla configuration, reset ad-hoc channels and run modded channel negotiation. ++ this.send(new net.neoforged.neoforge.network.payload.MinecraftUnregisterPayload(net.neoforged.neoforge.network.registration.NetworkRegistry.getInitialServerUnregisterChannels())); ++ this.send(new net.neoforged.neoforge.network.payload.MinecraftRegisterPayload(net.neoforged.neoforge.network.registration.NetworkRegistry.getInitialServerListeningChannels())); ++ this.send(new net.neoforged.neoforge.network.payload.ModdedNetworkQueryPayload(java.util.Map.of())); + this.send(new net.minecraft.network.protocol.common.ClientboundPingPacket(0)); + } + ++ // Neo: Hide vanilla's startConfiguration() in this method so we can call it in handlePong below. + private void runConfiguration() { this.send(new ClientboundCustomPayloadPacket(new BrandPayload(this.server.getServerModName()))); LayeredRegistryAccess layeredregistryaccess = this.server.registries(); + List list = this.server.getResourceManager().listPacks().flatMap(p_325637_ -> p_325637_.location().knownPackInfo().stream()).toList(); this.send(new ClientboundUpdateEnabledFeaturesPacket(FeatureFlags.REGISTRY.toNames(this.server.getWorldData().enabledFeatures()))); -@@ -86,6 +_,53 @@ ++ // Neo: we must sync the registries before vanilla sends tags in SynchronizeRegistriesTask! ++ net.neoforged.neoforge.network.ConfigurationInitialization.configureEarlyTasks(this, this.configurationTasks::add); + this.synchronizeRegistriesTask = new SynchronizeRegistriesTask(list, layeredregistryaccess); + this.configurationTasks.add(this.synchronizeRegistriesTask); + this.addOptionalTasks(); +@@ -87,6 +_,33 @@ private void addOptionalTasks() { this.server.getServerResourcePack().ifPresent(p_296496_ -> this.configurationTasks.add(new ServerResourcePackConfigurationTask(p_296496_))); -+ -+ this.configurationTasks.add(new net.neoforged.neoforge.network.configuration.ModdedConfigurationPhaseStarted(this)); -+ this.configurationTasks.addAll(net.neoforged.fml.ModLoader.get().postEventWithReturn(new net.neoforged.neoforge.network.event.OnGameConfigurationEvent(this)).getConfigurationTasks()); -+ this.configurationTasks.add(new net.neoforged.neoforge.network.configuration.ModdedConfigurationPhaseCompleted(this)); ++ // Neo: Gather modded configuration tasks and schedule them for execution ++ this.configurationTasks.addAll(net.neoforged.fml.ModLoader.postEventWithReturn(new net.neoforged.neoforge.network.event.RegisterConfigurationTasksEvent(this)).getConfigurationTasks()); + } + + @Override + public void handleCustomPayload(net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket p_294276_) { -+ if (p_294276_.payload() instanceof net.neoforged.neoforge.network.payload.MinecraftRegisterPayload minecraftRegisterPayload) { -+ this.connectionType = this.connectionType.withMinecraftRegisterPayload(); -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onMinecraftRegister(this, minecraftRegisterPayload.newChannels()); -+ return; -+ } -+ if (p_294276_.payload() instanceof net.neoforged.neoforge.network.payload.MinecraftUnregisterPayload minecraftUnregisterPayload) { -+ this.connectionType = this.connectionType.withMinecraftRegisterPayload(); -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onMinecraftUnregister(this, minecraftUnregisterPayload.forgottenChannels()); -+ return; -+ } ++ // Neo: Perform modded network initialization when the client sends their channel list. + if (p_294276_.payload() instanceof net.neoforged.neoforge.network.payload.ModdedNetworkQueryPayload moddedEnvironmentPayload) { + this.connectionType = this.connectionType.withNeoForgeQueryPayload(); -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance() -+ .onModdedConnectionDetectedAtServer( -+ this, -+ moddedEnvironmentPayload.configuration(), -+ moddedEnvironmentPayload.play() -+ ); ++ net.neoforged.neoforge.network.registration.NetworkRegistry.initializeModdedConnection(this, moddedEnvironmentPayload.queries()); + return; + } + -+ if (!isHandlingModdedConfigurationPhase) { -+ super.handleCustomPayload(p_294276_); -+ return; -+ } -+ -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onModdedPacketAtServer(this, p_294276_); ++ super.handleCustomPayload(p_294276_); // Neo: Call super to invoke modded payload handling. + } + + @Override + public void handlePong(net.minecraft.network.protocol.common.ServerboundPongPacket p_295142_) { + super.handlePong(p_295142_); ++ // During startConfiguration() we send a ping with id 0, if we get a pong back, we initiate the connection. + if (p_295142_.getId() == 0) { -+ if (!this.connectionType.isNeoForge() && !net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onVanillaOrOtherConnectionDetectedAtServer(this)) { ++ if (!this.connectionType.isNeoForge() && !net.neoforged.neoforge.network.registration.NetworkRegistry.initializeNonModdedConnection(this)) { + return; + } + @@ -78,44 +56,25 @@ } @Override -@@ -103,6 +_,11 @@ - - @Override - public void handleConfigurationFinished(ServerboundFinishConfigurationPacket p_294283_) { +@@ -118,6 +_,12 @@ + PacketUtils.ensureRunningOnSameThread(p_294283_, this, this.server); + this.finishCurrentTask(JoinWorldTask.TYPE); + this.connection.setupOutboundProtocol(GameProtocols.CLIENTBOUND.bind(RegistryFriendlyByteBuf.decorator(this.server.registryAccess()))); ++ // Packets can only be sent after the outbound protocol is set up again + if (this.connectionType == net.neoforged.neoforge.network.connection.ConnectionType.OTHER) { + //We need to also initialize this here, as the client may have sent the packet before we have finished our configuration. -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onModdedConnectionDetectedAtServer(this, java.util.Set.of(), java.util.Set.of()); ++ net.neoforged.neoforge.network.registration.NetworkRegistry.initializeModdedConnection(this, java.util.Map.of()); + } -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onConfigurationFinished(this); - this.connection.suspendInboundAfterProtocolChange(); - PacketUtils.ensureRunningOnSameThread(p_294283_, this, this.server); - this.finishCurrentTask(JoinWorldTask.TYPE); -@@ -121,7 +_,7 @@ ++ net.neoforged.neoforge.network.registration.NetworkRegistry.onConfigurationFinished(this); + + try { + PlayerList playerlist = this.server.getPlayerList(); +@@ -133,7 +_,7 @@ } ServerPlayer serverplayer = playerlist.getPlayerForLogin(this.gameProfile, this.clientInformation); - playerlist.placeNewPlayer(this.connection, serverplayer, this.createCookie(this.clientInformation)); + playerlist.placeNewPlayer(this.connection, serverplayer, this.createCookie(this.clientInformation, this.connectionType)); - this.connection.resumeInboundAfterProtocolChange(); } catch (Exception exception) { LOGGER.error("Couldn't place player in world", (Throwable)exception); -@@ -155,5 +_,19 @@ - this.currentTask = null; - this.startNextTask(); - } -+ } -+ -+ public void onModdedConfigurationPhaseStarted() { -+ isHandlingModdedConfigurationPhase = true; -+ finishCurrentTask(net.neoforged.neoforge.network.configuration.ModdedConfigurationPhaseStarted.TYPE); -+ } -+ -+ public void onModdedConfigurationPhaseEnded() { -+ isHandlingModdedConfigurationPhase = false; -+ finishCurrentTask(net.neoforged.neoforge.network.configuration.ModdedConfigurationPhaseCompleted.TYPE); -+ } -+ -+ public net.neoforged.neoforge.network.connection.ConnectionType getConnectionType() { -+ return connectionType; - } - } + this.connection.send(new ClientboundDisconnectPacket(DISCONNECT_REASON_INVALID_DATA)); diff --git a/patches/net/minecraft/server/network/ServerConnectionListener.java.patch b/patches/net/minecraft/server/network/ServerConnectionListener.java.patch index 1a375ea7051..db197d541fa 100644 --- a/patches/net/minecraft/server/network/ServerConnectionListener.java.patch +++ b/patches/net/minecraft/server/network/ServerConnectionListener.java.patch @@ -21,15 +21,15 @@ public void startTcpServerListener(@Nullable InetAddress p_9712_, int p_9713_) throws IOException { + if (p_9712_ == null) p_9712_ = new java.net.InetSocketAddress(p_9713_).getAddress(); + net.neoforged.neoforge.network.DualStackUtils.checkIPv6(p_9712_); - synchronized(this.channels) { + synchronized (this.channels) { Class oclass; EventLoopGroup eventloopgroup; -@@ -94,7 +_,7 @@ - } - - ChannelPipeline channelpipeline = p_9729_.pipeline() -- .addLast("timeout", new ReadTimeoutHandler(30)) -+ .addLast("timeout", new ReadTimeoutHandler(READ_TIMEOUT)) - .addLast("legacy_query", new LegacyQueryHandler(ServerConnectionListener.this.getServer())); - Connection.configureSerialization(channelpipeline, PacketFlow.SERVERBOUND, null); - int i = ServerConnectionListener.this.server.getRateLimitPacketsPerSecond(); +@@ -86,7 +_,7 @@ + } catch (ChannelException channelexception) { + } + +- ChannelPipeline channelpipeline = p_9729_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)); ++ ChannelPipeline channelpipeline = p_9729_.pipeline().addLast("timeout", new ReadTimeoutHandler(READ_TIMEOUT)); + if (ServerConnectionListener.this.server.repliesToStatus()) { + channelpipeline.addLast("legacy_query", new LegacyQueryHandler(ServerConnectionListener.this.getServer())); + } diff --git a/patches/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch b/patches/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch index 976dee8343d..83e3aeab9fd 100644 --- a/patches/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch +++ b/patches/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch @@ -1,35 +1,6 @@ --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -187,6 +_,12 @@ - ServerPlayerConnection, - TickablePacketListener { - static final Logger LOGGER = LogUtils.getLogger(); -+ /** -+ * Forge: Deprecated in favor of range/reach attributes. -+ * @see net.neoforged.neoforge.common.NeoForgeMod#BLOCK_REACH -+ * @see net.neoforged.neoforge.common.NeoForgeMod#ENTITY_REACH -+ */ -+ @Deprecated - public static final double MAX_INTERACTION_DISTANCE = Mth.square(6.0); - private static final int NO_BLOCK_UPDATES_TO_ACK = -1; - private static final int TRACKED_MESSAGE_DISCONNECT_THRESHOLD = 4096; -@@ -228,6 +_,7 @@ - private final MessageSignatureCache messageSignatureCache = MessageSignatureCache.createDefault(); - private final FutureChain chatMessageChain; - private boolean waitingForSwitchToConfig; -+ private net.neoforged.neoforge.network.connection.ConnectionType connectionType; - - public ServerGamePacketListenerImpl(MinecraftServer p_9770_, Connection p_9771_, ServerPlayer p_9772_, CommonListenerCookie p_301978_) { - super(p_9770_, p_9771_, p_301978_); -@@ -238,6 +_,7 @@ - p_9772_.getTextFilter().join(); - this.signedMessageDecoder = SignedMessageChain.Decoder.unsigned(p_9772_.getUUID(), p_9770_::enforceSecureProfile); - this.chatMessageChain = new FutureChain(p_9770_); -+ this.connectionType = p_301978_.connectionType(); - } - - @Override -@@ -424,9 +_,11 @@ +@@ -438,9 +_,11 @@ } entity.absMoveTo(d3, d4, d5, f, f1); @@ -41,7 +12,7 @@ this.send(new ClientboundMoveVehiclePacket(entity)); return; } -@@ -445,6 +_,23 @@ +@@ -459,6 +_,23 @@ } } @@ -65,24 +36,16 @@ private boolean noBlocksAround(Entity p_9794_) { return p_9794_.level() .getBlockStates(p_9794_.getBoundingBox().inflate(0.0625).expandTowards(0.0, -0.55, 0.0)) -@@ -770,6 +_,7 @@ - if (compoundtag != null) { - itemstack1.setTag(compoundtag.copy()); - } -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyStackAttachments(itemstack, itemstack1); - - itemstack1.addTagElement("author", StringTag.valueOf(this.player.getName().getString())); - if (this.player.isTextFilteringEnabled()) { -@@ -952,7 +_,7 @@ - && !flag +@@ -936,7 +_,7 @@ + && !flag1 && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR && !this.server.isFlightAllowed() - && !this.player.getAbilities().mayfly + && !this.player.mayFly() && !this.player.hasEffect(MobEffects.LEVITATION) - && !this.player.isFallFlying() - && !this.player.isAutoSpinAttack() -@@ -1028,8 +_,10 @@ + && !flag + && !flag3 +@@ -1019,8 +_,10 @@ case SWAP_ITEM_WITH_OFFHAND: if (!this.player.isSpectator()) { ItemStack itemstack = this.player.getItemInHand(InteractionHand.OFF_HAND); @@ -95,7 +58,7 @@ this.player.stopUsingItem(); } -@@ -1057,7 +_,7 @@ +@@ -1048,7 +_,7 @@ .handleBlockBreakAction( blockpos, serverboundplayeractionpacket$action, p_9889_.getDirection(), this.player.level().getMaxBuildHeight(), p_9889_.getSequence() ); @@ -104,7 +67,7 @@ return; default: throw new IllegalArgumentException("Invalid player action"); -@@ -1076,7 +_,7 @@ +@@ -1067,7 +_,7 @@ @Override public void handleUseItemOn(ServerboundUseItemOnPacket p_9930_) { PacketUtils.ensureRunningOnSameThread(p_9930_, this, this.player.serverLevel()); @@ -113,37 +76,19 @@ ServerLevel serverlevel = this.player.serverLevel(); InteractionHand interactionhand = p_9930_.getHand(); ItemStack itemstack = this.player.getItemInHand(interactionhand); -@@ -1085,7 +_,7 @@ - Vec3 vec3 = blockhitresult.getLocation(); - BlockPos blockpos = blockhitresult.getBlockPos(); - Vec3 vec31 = Vec3.atCenterOf(blockpos); -- if (!(this.player.getEyePosition().distanceToSqr(vec31) > MAX_INTERACTION_DISTANCE)) { -+ if (this.player.canReach(blockpos, 1.5)) { // Vanilla uses eye-to-center distance < 6, which implies a padding of 1.5 - Vec3 vec32 = vec3.subtract(vec31); - double d0 = 1.0000001; - if (Math.abs(vec32.x()) < 1.0000001 && Math.abs(vec32.y()) < 1.0000001 && Math.abs(vec32.z()) < 1.0000001) { -@@ -1225,8 +_,9 @@ - } +@@ -1213,8 +_,9 @@ + } - CompletableFuture completablefuture = this.filterTextPacket(playerchatmessage.signedContent()); -- Component component = this.server.getChatDecorator().decorate(this.player, playerchatmessage.decoratedContent()); -+ Component component = net.neoforged.neoforge.common.CommonHooks.getServerChatSubmittedDecorator().decorate(this.player, playerchatmessage.decoratedContent()); - this.chatMessageChain.append(completablefuture, p_300785_ -> { -+ if (component == null) return; // Forge: ServerChatEvent was canceled if this is null. - PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent(component).filter(p_300785_.mask()); - this.broadcastChatMessage(playerchatmessage1); - }); -@@ -1478,7 +_,7 @@ - } + CompletableFuture completablefuture = this.filterTextPacket(playerchatmessage.signedContent()); +- Component component = this.server.getChatDecorator().decorate(this.player, playerchatmessage.decoratedContent()); ++ Component component = net.neoforged.neoforge.common.CommonHooks.getServerChatSubmittedDecorator().decorate(this.player, playerchatmessage.decoratedContent()); + this.chatMessageChain.append(completablefuture, p_300785_ -> { ++ if (component == null) return; // Forge: ServerChatEvent was canceled if this is null. + PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent(component).filter(p_300785_.mask()); + this.broadcastChatMessage(playerchatmessage1); + }); +@@ -1541,7 +_,11 @@ - AABB aabb = entity.getBoundingBox(); -- if (aabb.distanceToSqr(this.player.getEyePosition()) < MAX_INTERACTION_DISTANCE) { -+ if (this.player.canReach(entity, 3)) { // Vanilla padding is 3.0 (distSq < 6.0 * 6.0) - p_9866_.dispatch( - new ServerboundInteractPacket.Handler() { - private void performInteraction(InteractionHand p_143679_, ServerGamePacketListenerImpl.EntityInteraction p_143680_) { -@@ -1502,7 +_,11 @@ - @Override public void onInteraction(InteractionHand p_143682_, Vec3 p_143683_) { - this.performInteraction(p_143682_, (p_143686_, p_143687_, p_143688_) -> p_143687_.interactAt(p_143686_, p_143683_, p_143688_)); @@ -153,9 +98,9 @@ + return p_143687_.interactAt(p_143686_, p_143683_, p_143688_); + }); } - + @Override -@@ -1688,7 +_,7 @@ +@@ -1733,7 +_,7 @@ @Override public void handlePlayerAbilities(ServerboundPlayerAbilitiesPacket p_9887_) { PacketUtils.ensureRunningOnSameThread(p_9887_, this, this.player.serverLevel()); @@ -164,46 +109,20 @@ } @Override -@@ -1745,7 +_,7 @@ - throw new IllegalStateException("Client acknowledged config, but none was requested"); - } else { +@@ -1792,7 +_,7 @@ this.connection -- .setListener(new ServerConfigurationPacketListenerImpl(this.server, this.connection, this.createCookie(this.player.clientInformation()))); -+ .setListener(new ServerConfigurationPacketListenerImpl(this.server, this.connection, this.createCookie(this.player.clientInformation(), this.connectionType))); + .setupInboundProtocol( + ConfigurationProtocols.SERVERBOUND, +- new ServerConfigurationPacketListenerImpl(this.server, this.connection, this.createCookie(this.player.clientInformation())) ++ new ServerConfigurationPacketListenerImpl(this.server, this.connection, this.createCookie(this.player.clientInformation(), this.connectionType)) + ); } } +@@ -1827,6 +_,7 @@ -@@ -1779,5 +_,33 @@ - @FunctionalInterface - interface EntityInteraction { - InteractionResult run(ServerPlayer p_143695_, Entity p_143696_, InteractionHand p_143697_); -+ } -+ -+ @Override -+ public void handleCustomPayload(net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket p_294276_) { -+ if (p_294276_.payload() instanceof net.neoforged.neoforge.network.payload.MinecraftRegisterPayload minecraftRegisterPayload) { -+ this.connectionType = this.connectionType.withMinecraftRegisterPayload(); -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onMinecraftRegister(this, minecraftRegisterPayload.newChannels()); -+ return; -+ } -+ -+ if (p_294276_.payload() instanceof net.neoforged.neoforge.network.payload.MinecraftUnregisterPayload minecraftUnregisterPayload) { -+ this.connectionType = this.connectionType.withMinecraftRegisterPayload(); -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onMinecraftUnregister(this, minecraftUnregisterPayload.forgottenChannels()); -+ return; -+ } -+ -+ if (this.connectionType.isVanilla()) { -+ super.handleCustomPayload(p_294276_); -+ return; -+ } -+ -+ net.neoforged.neoforge.network.registration.NetworkRegistry.getInstance().onModdedPacketAtServer( -+ this, p_294276_ -+ ); -+ } -+ -+ public net.neoforged.neoforge.network.connection.ConnectionType getConnectionType() { -+ return connectionType; + @Override + public void handleCustomPayload(ServerboundCustomPayloadPacket p_333887_) { ++ super.handleCustomPayload(p_333887_); // Neo: Call super to invoke modded payload handling. } - } + + @Override diff --git a/patches/net/minecraft/server/packs/AbstractPackResources.java.patch b/patches/net/minecraft/server/packs/AbstractPackResources.java.patch index a40bb252b0d..226fe4b923d 100644 --- a/patches/net/minecraft/server/packs/AbstractPackResources.java.patch +++ b/patches/net/minecraft/server/packs/AbstractPackResources.java.patch @@ -1,13 +1,12 @@ --- a/net/minecraft/server/packs/AbstractPackResources.java +++ b/net/minecraft/server/packs/AbstractPackResources.java -@@ -70,4 +_,10 @@ - public boolean isBuiltin() { - return this.isBuiltin; +@@ -63,4 +_,9 @@ + public PackLocationInfo location() { + return this.location; } + + @Override -+ public String toString() -+ { -+ return String.format(java.util.Locale.ROOT, "%s: %s", getClass().getName(), this.name); ++ public String toString() { ++ return String.format(java.util.Locale.ROOT, "%s: %s", getClass().getName(), location.id()); + } } diff --git a/patches/net/minecraft/server/packs/OverlayMetadataSection.java.patch b/patches/net/minecraft/server/packs/OverlayMetadataSection.java.patch index 6c47a12d1a8..2e54cc8665d 100644 --- a/patches/net/minecraft/server/packs/OverlayMetadataSection.java.patch +++ b/patches/net/minecraft/server/packs/OverlayMetadataSection.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/packs/OverlayMetadataSection.java +++ b/net/minecraft/server/packs/OverlayMetadataSection.java -@@ -13,7 +_,7 @@ +@@ -12,7 +_,7 @@ public record OverlayMetadataSection(List overlays) { private static final Pattern DIR_VALIDATOR = Pattern.compile("[-_a-zA-Z0-9.]+"); private static final Codec CODEC = RecordCodecBuilder.create( diff --git a/patches/net/minecraft/server/packs/PackResources.java.patch b/patches/net/minecraft/server/packs/PackResources.java.patch index 296632d3bee..9ad60847cd9 100644 --- a/patches/net/minecraft/server/packs/PackResources.java.patch +++ b/patches/net/minecraft/server/packs/PackResources.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/packs/PackResources.java +++ b/net/minecraft/server/packs/PackResources.java -@@ -9,7 +_,7 @@ - import net.minecraft.server.packs.metadata.MetadataSectionSerializer; +@@ -11,7 +_,7 @@ + import net.minecraft.server.packs.repository.KnownPack; import net.minecraft.server.packs.resources.IoSupplier; -public interface PackResources extends AutoCloseable { diff --git a/patches/net/minecraft/server/packs/metadata/pack/PackMetadataSection.java.patch b/patches/net/minecraft/server/packs/metadata/pack/PackMetadataSection.java.patch index 76317be154b..e34e6e1a5a0 100644 --- a/patches/net/minecraft/server/packs/metadata/pack/PackMetadataSection.java.patch +++ b/patches/net/minecraft/server/packs/metadata/pack/PackMetadataSection.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/packs/metadata/pack/PackMetadataSection.java +++ b/net/minecraft/server/packs/metadata/pack/PackMetadataSection.java @@ -19,4 +_,8 @@ - .apply(p_304321_, PackMetadataSection::new) + .apply(p_337567_, PackMetadataSection::new) ); public static final MetadataSectionType TYPE = MetadataSectionType.fromCodec("pack", CODEC); + diff --git a/patches/net/minecraft/server/packs/repository/BuiltInPackSource.java.patch b/patches/net/minecraft/server/packs/repository/BuiltInPackSource.java.patch index 69c1b3332de..304892b0bf9 100644 --- a/patches/net/minecraft/server/packs/repository/BuiltInPackSource.java.patch +++ b/patches/net/minecraft/server/packs/repository/BuiltInPackSource.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/server/packs/repository/BuiltInPackSource.java +++ b/net/minecraft/server/packs/repository/BuiltInPackSource.java -@@ -105,4 +_,18 @@ +@@ -106,4 +_,18 @@ } }; } + -+ public static Pack.ResourcesSupplier fromName(final Function onName) { ++ public static Pack.ResourcesSupplier fromName(final Function onName) { + return new Pack.ResourcesSupplier() { + @Override -+ public PackResources openPrimary(String p_294636_) { ++ public PackResources openPrimary(PackLocationInfo p_294636_) { + return onName.apply(p_294636_); + } + + @Override -+ public PackResources openFull(String p_251717_, Pack.Info p_294956_) { ++ public PackResources openFull(PackLocationInfo p_251717_, Pack.Metadata p_294956_) { + return onName.apply(p_251717_); + } + }; diff --git a/patches/net/minecraft/server/packs/repository/Pack.java.patch b/patches/net/minecraft/server/packs/repository/Pack.java.patch index bea5e8183ee..4778f9100e2 100644 --- a/patches/net/minecraft/server/packs/repository/Pack.java.patch +++ b/patches/net/minecraft/server/packs/repository/Pack.java.patch @@ -1,32 +1,22 @@ --- a/net/minecraft/server/packs/repository/Pack.java +++ b/net/minecraft/server/packs/repository/Pack.java -@@ -29,6 +_,8 @@ - private final Pack.Position defaultPosition; - private final boolean required; - private final boolean fixedPosition; +@@ -23,6 +_,8 @@ + private final Pack.ResourcesSupplier resources; + private final Pack.Metadata metadata; + private final PackSelectionConfig selectionConfig; + private final boolean hidden; // Neo: Allow packs to be hidden from the UI entirely + private final List children; // Neo: Allows packs to specify packs which will always be placed beneath them; must be hidden - private final PackSource packSource; @Nullable -@@ -69,6 +_,33 @@ - boolean p_249753_, - PackSource p_251608_ - ) { -+ this(p_252218_, p_248829_, p_249377_, p_251718_, p_250162_, p_251298_, p_249753_, p_251608_, List.of()); + public static Pack readMetaAndCreate(PackLocationInfo p_326065_, Pack.ResourcesSupplier p_252210_, PackType p_250595_, PackSelectionConfig p_326429_) { +@@ -32,6 +_,23 @@ + } + + public Pack(PackLocationInfo p_326123_, Pack.ResourcesSupplier p_249377_, Pack.Metadata p_326375_, PackSelectionConfig p_326282_) { ++ this(p_326123_, p_249377_, p_326375_, p_326282_, List.of()); + } + -+ private Pack( -+ String p_252218_, -+ boolean p_248829_, -+ Pack.ResourcesSupplier p_249377_, -+ Component p_251718_, -+ Pack.Info p_250162_, -+ Pack.Position p_251298_, -+ boolean p_249753_, -+ PackSource p_251608_, -+ List children -+ ) { ++ private Pack(PackLocationInfo p_326123_, Pack.ResourcesSupplier p_249377_, Pack.Metadata p_326375_, PackSelectionConfig p_326282_, List children) { + List flattenedChildren = new java.util.ArrayList<>(); + List remainingChildren = children; + // recursively flatten children @@ -39,26 +29,30 @@ + } + } + this.children = List.copyOf(flattenedChildren); -+ this.hidden = p_250162_.isHidden(); - this.id = p_252218_; ++ this.hidden = p_326375_.isHidden(); + this.location = p_326123_; this.resources = p_249377_; - this.title = p_251718_; -@@ -96,7 +_,7 @@ - PackCompatibility packcompatibility = PackCompatibility.forVersion(inclusiverange, p_294759_); + this.metadata = p_326375_; +@@ -55,7 +_,7 @@ + PackCompatibility packcompatibility = PackCompatibility.forVersion(inclusiverange, p_326341_); OverlayMetadataSection overlaymetadatasection = packresources.getMetadataSection(OverlayMetadataSection.TYPE); - List list = overlaymetadatasection != null ? overlaymetadatasection.overlaysForVersion(p_294759_) : List.of(); -- pack$info = new Pack.Info(packmetadatasection.description(), packcompatibility, featureflagset, list); -+ pack$info = new Pack.Info(packmetadatasection.description(), packcompatibility, featureflagset, list, packresources.isHidden()); + List list = overlaymetadatasection != null ? overlaymetadatasection.overlaysForVersion(p_326341_) : List.of(); +- pack$metadata = new Pack.Metadata(packmetadatasection.description(), packcompatibility, featureflagset, list); ++ pack$metadata = new Pack.Metadata(packmetadatasection.description(), packcompatibility, featureflagset, list, packresources.isHidden()); } - return pack$info; -@@ -172,6 +_,37 @@ - return this.packSource; + return pack$metadata; +@@ -132,6 +_,38 @@ + return this.location.source(); } -+ public boolean isHidden() { return hidden; } ++ public boolean isHidden() { ++ return hidden; ++ } + -+ public List getChildren() { return children; } ++ public List getChildren() { ++ return children; ++ } + + public java.util.stream.Stream streamSelfAndChildren() { + return java.util.stream.Stream.concat(java.util.stream.Stream.of(this), children.stream()); @@ -68,7 +62,7 @@ + * {@return a copy of the pack with the provided children in place of any children this pack currently has} + */ + public Pack withChildren(List children) { -+ return new Pack(this.id, this.required, this.resources, this.title, this.info, this.defaultPosition, this.fixedPosition, this.packSource, children); ++ return new Pack(this.location, this.resources, this.metadata, this.selectionConfig, children); + } + + /** @@ -76,26 +70,28 @@ + */ + public Pack hidden() { + return new Pack( -+ this.id, this.required, this.resources, this.title, -+ new Info( -+ this.info.description(), -+ info.compatibility(), -+ info.requestedFeatures(), -+ info.overlays(), -+ true -+ ), -+ this.defaultPosition, this.fixedPosition, this.packSource, this.children); ++ new PackLocationInfo(this.location.id(), this.location.title(), this.location.source(), this.location.knownPackInfo()), ++ this.resources, ++ new Metadata(this.metadata.description, this.metadata.compatibility, this.metadata.requestedFeatures, this.metadata.overlays, this.metadata.isHidden), ++ new PackSelectionConfig(this.selectionConfig.required(), this.selectionConfig.defaultPosition(), this.selectionConfig.fixedPosition()), ++ this.children ++ ); + } + @Override public boolean equals(Object p_10448_) { if (this == p_10448_) { -@@ -189,7 +_,7 @@ - return this.id.hashCode(); +@@ -146,7 +_,12 @@ + return this.location.hashCode(); } -- public static record Info(Component description, PackCompatibility compatibility, FeatureFlagSet requestedFeatures, List overlays) { -+ public static record Info(Component description, PackCompatibility compatibility, FeatureFlagSet requestedFeatures, List overlays, boolean isHidden) { +- public static record Metadata(Component description, PackCompatibility compatibility, FeatureFlagSet requestedFeatures, List overlays) { ++ public static record Metadata(Component description, PackCompatibility compatibility, FeatureFlagSet requestedFeatures, List overlays, boolean isHidden) { ++ /** @deprecated Neo: use {@link #Metadata(Component,PackCompatibility,FeatureFlagSet,List,boolean)} instead */ ++ @Deprecated ++ public Metadata(Component description, PackCompatibility compatibility, FeatureFlagSet requestedFeatures, List overlays) { ++ this(description, compatibility, requestedFeatures, overlays, false); ++ } } public static enum Position { diff --git a/patches/net/minecraft/server/packs/repository/PackRepository.java.patch b/patches/net/minecraft/server/packs/repository/PackRepository.java.patch index 8b48bb78c1c..52d07a8250d 100644 --- a/patches/net/minecraft/server/packs/repository/PackRepository.java.patch +++ b/patches/net/minecraft/server/packs/repository/PackRepository.java.patch @@ -8,8 +8,8 @@ + this.sources = new java.util.LinkedHashSet<>(List.of(p_251886_)); //Neo: This needs to be a mutable set, so that we can add to it later on. } - public void reload() { -@@ -33,10 +_,13 @@ + public static String displayPackList(Collection p_341622_) { +@@ -39,10 +_,13 @@ } private Map discoverAvailable() { @@ -17,7 +17,7 @@ + // Neo: sort packs within a source by name, between sources according to source order + Map map = Maps.newLinkedHashMap(); - for(RepositorySource repositorysource : this.sources) { + for (RepositorySource repositorysource : this.sources) { - repositorysource.loadPacks(p_143903_ -> map.put(p_143903_.getId(), p_143903_)); + Map sourceMap = Maps.newTreeMap(); + repositorysource.loadPacks(p_143903_ -> sourceMap.put(p_143903_.getId(), p_143903_)); @@ -25,22 +25,22 @@ } return ImmutableMap.copyOf(map); -@@ -71,11 +_,12 @@ +@@ -77,11 +_,12 @@ } private List rebuildSelected(Collection p_10518_) { -- List list = this.getAvailablePacks(p_10518_).collect(Collectors.toList()); -+ List list = this.getAvailablePacks(p_10518_).flatMap(p -> Stream.concat(Stream.of(p), p.getChildren().stream())).collect(Collectors.toList()); +- List list = this.getAvailablePacks(p_10518_).collect(Util.toMutableList()); ++ List list = this.getAvailablePacks(p_10518_).flatMap(p -> Stream.concat(Stream.of(p), p.getChildren().stream())).collect(java.util.stream.Collectors.toList()); - for(Pack pack : this.available.values()) { + for (Pack pack : this.available.values()) { if (pack.isRequired() && !list.contains(pack)) { -- pack.getDefaultPosition().insert(list, pack, Functions.identity(), false); -+ int i = pack.getDefaultPosition().insert(list, pack, Functions.identity(), false); +- pack.getDefaultPosition().insert(list, pack, Pack::selectionConfig, false); ++ int i = pack.getDefaultPosition().insert(list, pack, Pack::selectionConfig, false); + list.addAll(i + 1, pack.getChildren()); } } -@@ -95,7 +_,7 @@ +@@ -101,7 +_,7 @@ } public Collection getSelectedIds() { @@ -49,7 +49,7 @@ } public FeatureFlagSet getRequestedFeatureFlags() { -@@ -109,6 +_,10 @@ +@@ -115,6 +_,10 @@ @Nullable public Pack getPack(String p_10508_) { return this.available.get(p_10508_); diff --git a/patches/net/minecraft/server/packs/repository/ServerPacksSource.java.patch b/patches/net/minecraft/server/packs/repository/ServerPacksSource.java.patch index 321df4c3253..ec137e5e5dd 100644 --- a/patches/net/minecraft/server/packs/repository/ServerPacksSource.java.patch +++ b/patches/net/minecraft/server/packs/repository/ServerPacksSource.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/packs/repository/ServerPacksSource.java +++ b/net/minecraft/server/packs/repository/ServerPacksSource.java -@@ -64,7 +_,9 @@ +@@ -72,7 +_,9 @@ } public static PackRepository createPackRepository(Path p_251569_, DirectoryValidator p_295336_) { diff --git a/patches/net/minecraft/server/players/PlayerList.java.patch b/patches/net/minecraft/server/players/PlayerList.java.patch index e9f26950173..1cd707fe18b 100644 --- a/patches/net/minecraft/server/players/PlayerList.java.patch +++ b/patches/net/minecraft/server/players/PlayerList.java.patch @@ -1,22 +1,22 @@ --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -126,6 +_,7 @@ - private boolean allowCheatsForAllPlayers; +@@ -128,6 +_,7 @@ + private boolean allowCommandsForAllPlayers; private static final boolean ALLOW_LOGOUTIVATOR = false; private int sendAllPlayerInfoIn; + private final List playersView = java.util.Collections.unmodifiableList(players); public PlayerList(MinecraftServer p_203842_, LayeredRegistryAccess p_251844_, PlayerDataStorage p_203844_, int p_203845_) { this.server = p_203842_; -@@ -194,6 +_,7 @@ +@@ -201,6 +_,7 @@ servergamepacketlistenerimpl.send(new ClientboundChangeDifficultyPacket(leveldata.getDifficulty(), leveldata.isDifficultyLocked())); servergamepacketlistenerimpl.send(new ClientboundPlayerAbilitiesPacket(p_11263_.getAbilities())); servergamepacketlistenerimpl.send(new ClientboundSetCarriedItemPacket(p_11263_.getInventory().selected)); + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.OnDatapackSyncEvent(this, p_11263_)); - servergamepacketlistenerimpl.send(new ClientboundUpdateRecipesPacket(this.server.getRecipeManager().getRecipes())); + servergamepacketlistenerimpl.send(new ClientboundUpdateRecipesPacket(this.server.getRecipeManager().getOrderedRecipes())); this.sendPlayerPermissionLevel(p_11263_); p_11263_.getStats().markAllDirty(); -@@ -262,6 +_,7 @@ +@@ -269,6 +_,7 @@ } p_11263_.initInventoryMenu(); @@ -24,15 +24,15 @@ } protected void updateEntireScoreboard(ServerScoreboard p_11274_, ServerPlayer p_11275_) { -@@ -328,6 +_,7 @@ - compoundtag1 = compoundtag; +@@ -334,6 +_,7 @@ + optional = Optional.of(compoundtag); p_11225_.load(compoundtag); LOGGER.debug("loading single player"); + net.neoforged.neoforge.event.EventHooks.firePlayerLoadingEvent(p_11225_, this.playerIo, p_11225_.getUUID().toString()); } else { - compoundtag1 = this.playerIo.load(p_11225_); + optional = this.playerIo.load(p_11225_); } -@@ -336,6 +_,7 @@ +@@ -342,6 +_,7 @@ } protected void save(ServerPlayer p_11277_) { @@ -40,7 +40,7 @@ this.playerIo.save(p_11277_); ServerStatsCounter serverstatscounter = this.stats.get(p_11277_.getUUID()); if (serverstatscounter != null) { -@@ -349,6 +_,7 @@ +@@ -355,6 +_,7 @@ } public void remove(ServerPlayer p_11287_) { @@ -48,7 +48,7 @@ ServerLevel serverlevel = p_11287_.serverLevel(); p_11287_.awardStat(Stats.LEAVE_GAME); this.save(p_11287_); -@@ -499,6 +_,7 @@ +@@ -505,6 +_,7 @@ this.playersByUUID.put(serverplayer.getUUID(), serverplayer); serverplayer.initInventoryMenu(); serverplayer.setHealth(serverplayer.getHealth()); @@ -56,7 +56,7 @@ if (flag2) { serverplayer.connection .send( -@@ -590,6 +_,7 @@ +@@ -596,6 +_,7 @@ } public void op(GameProfile p_11254_) { @@ -64,7 +64,7 @@ this.ops.add(new ServerOpListEntry(p_11254_, this.server.getOperatorUserPermissionLevel(), this.ops.canBypassPlayerLimit(p_11254_))); ServerPlayer serverplayer = this.getPlayer(p_11254_.getId()); if (serverplayer != null) { -@@ -598,6 +_,7 @@ +@@ -604,6 +_,7 @@ } public void deop(GameProfile p_11281_) { @@ -72,7 +72,7 @@ this.ops.remove(p_11281_); ServerPlayer serverplayer = this.getPlayer(p_11281_.getId()); if (serverplayer != null) { -@@ -816,13 +_,6 @@ +@@ -822,13 +_,6 @@ if (serverstatscounter == null) { File file1 = this.server.getWorldPath(LevelResource.PLAYER_STATS_DIR).toFile(); File file2 = new File(file1, uuid + ".json"); @@ -86,7 +86,7 @@ serverstatscounter = new ServerStatsCounter(this.server, file2); this.stats.put(uuid, serverstatscounter); -@@ -840,6 +_,8 @@ +@@ -846,6 +_,8 @@ this.advancements.put(uuid, playeradvancements); } @@ -95,7 +95,7 @@ playeradvancements.setPlayer(p_11297_); return playeradvancements; } -@@ -867,7 +_,7 @@ +@@ -873,7 +_,7 @@ } public List getPlayers() { @@ -104,11 +104,11 @@ } @Nullable -@@ -884,6 +_,7 @@ +@@ -890,6 +_,7 @@ playeradvancements.reload(this.server.getAdvancements()); } + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.OnDatapackSyncEvent(this, null)); this.broadcastAll(new ClientboundUpdateTagsPacket(TagNetworkSerialization.serializeTagsToNetwork(this.registries))); - ClientboundUpdateRecipesPacket clientboundupdaterecipespacket = new ClientboundUpdateRecipesPacket(this.server.getRecipeManager().getRecipes()); + ClientboundUpdateRecipesPacket clientboundupdaterecipespacket = new ClientboundUpdateRecipesPacket(this.server.getRecipeManager().getOrderedRecipes()); diff --git a/patches/net/minecraft/server/rcon/thread/RconClient.java.patch b/patches/net/minecraft/server/rcon/thread/RconClient.java.patch index 5a2dde166a5..25199a3e9e7 100644 --- a/patches/net/minecraft/server/rcon/thread/RconClient.java.patch +++ b/patches/net/minecraft/server/rcon/thread/RconClient.java.patch @@ -17,6 +17,6 @@ + this.send(p_11595_, 0, new String(java.util.Arrays.copyOfRange(whole, start, j+start), StandardCharsets.UTF_8)); + i -= j; + start += j; - } while(0 != i); + } while (0 != i); } diff --git a/patches/net/minecraft/stats/RecipeBookSettings.java.patch b/patches/net/minecraft/stats/RecipeBookSettings.java.patch index 9c29dfd1500..4e0a5a31e17 100644 --- a/patches/net/minecraft/stats/RecipeBookSettings.java.patch +++ b/patches/net/minecraft/stats/RecipeBookSettings.java.patch @@ -20,7 +20,7 @@ private final Map states; private RecipeBookSettings(Map p_12730_) { -@@ -159,5 +_,9 @@ +@@ -158,5 +_,9 @@ public String toString() { return "[open=" + this.open + ", filtering=" + this.filtering + "]"; } diff --git a/patches/net/minecraft/tags/BlockTags.java.patch b/patches/net/minecraft/tags/BlockTags.java.patch index ef836380c8e..0d9202d3c36 100644 --- a/patches/net/minecraft/tags/BlockTags.java.patch +++ b/patches/net/minecraft/tags/BlockTags.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tags/BlockTags.java +++ b/net/minecraft/tags/BlockTags.java -@@ -184,4 +_,8 @@ +@@ -194,4 +_,8 @@ private static TagKey create(String p_203847_) { return TagKey.create(Registries.BLOCK, new ResourceLocation(p_203847_)); } diff --git a/patches/net/minecraft/tags/ItemTags.java.patch b/patches/net/minecraft/tags/ItemTags.java.patch index cf0c2fd5372..e9d95e32364 100644 --- a/patches/net/minecraft/tags/ItemTags.java.patch +++ b/patches/net/minecraft/tags/ItemTags.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tags/ItemTags.java +++ b/net/minecraft/tags/ItemTags.java -@@ -111,4 +_,8 @@ +@@ -160,4 +_,8 @@ private static TagKey bind(String p_203855_) { return TagKey.create(Registries.ITEM, new ResourceLocation(p_203855_)); } diff --git a/patches/net/minecraft/tags/TagLoader.java.patch b/patches/net/minecraft/tags/TagLoader.java.patch index 854abb284c0..6e7fa7b78fb 100644 --- a/patches/net/minecraft/tags/TagLoader.java.patch +++ b/patches/net/minecraft/tags/TagLoader.java.patch @@ -16,7 +16,7 @@ + var builder = new java.util.LinkedHashSet(); // Set must retain insertion order, some tag consumers rely on this being the case (see NeoForge#256) List list = new ArrayList<>(); - for(TagLoader.EntryWithSource tagloader$entrywithsource : p_215980_) { + for (TagLoader.EntryWithSource tagloader$entrywithsource : p_215980_) { - if (!tagloader$entrywithsource.entry().build(p_215979_, builder::add)) { + if (!tagloader$entrywithsource.entry().build(p_215979_, tagloader$entrywithsource.remove() ? builder::remove : builder::add)) { + if (!tagloader$entrywithsource.remove()) // Treat all removals as optional at runtime. If it was missing, then it could of never been added. @@ -29,7 +29,7 @@ } public Map> build(Map> p_203899_) { -@@ -102,7 +_,7 @@ +@@ -104,7 +_,7 @@ p_215977_ -> LOGGER.error( "Couldn't load tag {} as it is missing following references: {}", p_284682_, @@ -37,8 +37,8 @@ + p_215977_.stream().map(Objects::toString).collect(Collectors.joining("\n\t", "\n\t", "")) ) ) - .ifRight(p_216001_ -> map.put(p_284682_, p_216001_)) -@@ -114,7 +_,8 @@ + .ifRight(p_216001_ -> map.put(p_284682_, (Collection)p_216001_)) +@@ -116,7 +_,8 @@ return this.build(this.load(p_203901_)); } diff --git a/patches/net/minecraft/util/SpawnUtil.java.patch b/patches/net/minecraft/util/SpawnUtil.java.patch index e7ba1ae3ffe..9b3eea749e3 100644 --- a/patches/net/minecraft/util/SpawnUtil.java.patch +++ b/patches/net/minecraft/util/SpawnUtil.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/util/SpawnUtil.java @@ -35,7 +_,7 @@ && moveToPossibleSpawnPosition(p_216406_, p_216410_, blockpos$mutableblockpos, p_216411_)) { - T t = p_216404_.create(p_216406_, null, null, blockpos$mutableblockpos, p_216405_, false, false); + T t = (T)p_216404_.create(p_216406_, null, blockpos$mutableblockpos, p_216405_, false, false); if (t != null) { - if (t.checkSpawnRules(p_216406_, p_216405_) && t.checkSpawnObstruction(p_216406_)) { + if (net.neoforged.neoforge.event.EventHooks.checkSpawnPosition(t, p_216406_, p_216405_)) { diff --git a/patches/net/minecraft/util/datafix/DataFixers.java.patch b/patches/net/minecraft/util/datafix/DataFixers.java.patch new file mode 100644 index 00000000000..8b6544371f0 --- /dev/null +++ b/patches/net/minecraft/util/datafix/DataFixers.java.patch @@ -0,0 +1,57 @@ +--- a/net/minecraft/util/datafix/DataFixers.java ++++ b/net/minecraft/util/datafix/DataFixers.java +@@ -1280,10 +_,35 @@ + Schema schema199 = p_14514_.addSchema(3800, SAME_NAMESPACED); + UnaryOperator unaryoperator2 = createRenamer(Map.of("minecraft:scute", "minecraft:turtle_scute")); + p_14514_.addFixer(ItemRenameFix.create(schema199, "Rename scute item to turtle_scute", unaryoperator2)); ++ ++ // Neo: Remove step height attribute, which cannot be sanely updated ++ // Happens in 23w51a ++ Schema neoSchema3801 = p_14514_.addSchema(3801, SAME_NAMESPACED); ++ p_14514_.addFixer(new net.neoforged.neoforge.common.data.fixes.NeoForgeEntityLegacyAttributesFix( ++ "(Neo) Remove step height attribute", ++ neoSchema3801, ++ java.util.List.of( ++ "neoforge:step_height" ++ ) ++ )); ++ + Schema schema200 = p_14514_.addSchema(3803, SAME_NAMESPACED); + p_14514_.addFixer( + new RenameEnchantmentsFix(schema200, "Rename sweeping enchant to sweeping_edge", Map.of("minecraft:sweeping", "minecraft:sweeping_edge")) + ); ++ ++ // Neo: rename neo attributes to new MC attributes ++ // Happens in 24w03a ++ Schema neoSchema3804 = p_14514_.addSchema(3804, SAME_NAMESPACED); ++ p_14514_.addFixer(new AttributesRename( ++ neoSchema3804, ++ "(Neo) Rename reach attributes to vanilla", ++ createRenamer(ImmutableMap.of( ++ "neoforge:entity_reach", "minecraft:player.entity_interaction_range", ++ "neoforge:block_reach", "minecraft:player.block_interaction_range" ++ )) ++ )); ++ + Schema schema201 = p_14514_.addSchema(3807, V3807::new); + p_14514_.addFixer(new AddNewChoices(schema201, "Added Vault", References.BLOCK_ENTITY)); + Schema schema202 = p_14514_.addSchema(3807, 1, SAME_NAMESPACED); +@@ -1302,6 +_,18 @@ + p_14514_.addFixer( + new AttributesRename(schema208, "Rename jump strength attribute", createRenamer("minecraft:horse.jump_strength", "minecraft:generic.jump_strength")) + ); ++ ++ // Neo: rename neo attributes to new MC attributes ++ // Happens in 24w06a ++ Schema neoSchema3815 = p_14514_.addSchema(3815, SAME_NAMESPACED); ++ p_14514_.addFixer(new AttributesRename( ++ neoSchema3815, ++ "(Neo) Rename gravity attribute to vanilla", ++ createRenamer( ++ "neoforge:entity_gravity", "minecraft:generic.gravity" ++ ) ++ )); ++ + Schema schema209 = p_14514_.addSchema(3816, V3816::new); + p_14514_.addFixer(new AddNewChoices(schema209, "Added Bogged", References.ENTITY)); + Schema schema210 = p_14514_.addSchema(3818, V3818::new); diff --git a/patches/net/minecraft/util/datafix/fixes/MobEffectIdFix.java.patch b/patches/net/minecraft/util/datafix/fixes/MobEffectIdFix.java.patch index 1129f3c268b..7e41a6ccbb0 100644 --- a/patches/net/minecraft/util/datafix/fixes/MobEffectIdFix.java.patch +++ b/patches/net/minecraft/util/datafix/fixes/MobEffectIdFix.java.patch @@ -1,29 +1,33 @@ --- a/net/minecraft/util/datafix/fixes/MobEffectIdFix.java +++ b/net/minecraft/util/datafix/fixes/MobEffectIdFix.java -@@ -88,8 +_,16 @@ +@@ -76,8 +_,20 @@ return updateMobEffectIdField(p_299001_, p_298420_, p_299001_, p_299179_); } + private static Dynamic updateMobEffectIdFieldConsideringForge(Dynamic p_298948_, String p_299234_, Dynamic p_298832_, String p_298487_, String forgeFieldId) { + final var forgeField = p_298948_.get(forgeFieldId).result(); + if (forgeField.isPresent()) { -+ return setFieldIfPresent((p_298948_ == p_298832_ ? p_298948_.remove(forgeFieldId) : p_298832_), p_298487_, forgeField); -+ } ++ return setFieldIfPresent((p_298948_ == p_298832_ ? p_298948_.remove(forgeFieldId) : p_298832_), p_298487_, forgeField); ++ } + return updateMobEffectIdField(p_298948_, p_299234_, p_298832_, p_298487_); + } ++ ++ private static Dynamic setFieldIfPresent(Dynamic dynamic, String s, Optional> optional) { ++ return optional.isEmpty() ? dynamic : dynamic.set(s, optional.get()); ++ } + private static Dynamic updateMobEffectInstance(Dynamic p_298320_) { - p_298320_ = updateMobEffectIdField(p_298320_, "Id", "id"); + p_298320_ = updateMobEffectIdFieldConsideringForge(p_298320_, "Id", p_298320_, "id", "forge:id"); - p_298320_ = renameField(p_298320_, "Ambient", "ambient"); - p_298320_ = renameField(p_298320_, "Amplifier", "amplifier"); - p_298320_ = renameField(p_298320_, "Duration", "duration"); -@@ -109,7 +_,7 @@ + p_298320_ = p_298320_.renameField("Ambient", "ambient"); + p_298320_ = p_298320_.renameField("Amplifier", "amplifier"); + p_298320_ = p_298320_.renameField("Duration", "duration"); +@@ -96,7 +_,7 @@ } private static Dynamic updateSuspiciousStewEntry(Dynamic p_298902_, Dynamic p_299113_) { - p_299113_ = updateMobEffectIdField(p_298902_, "EffectId", p_299113_, "id"); + p_299113_ = updateMobEffectIdFieldConsideringForge(p_298902_, "EffectId", p_299113_, "id", "forge:effect_id"); Optional> optional = p_298902_.get("EffectDuration").result(); - return replaceField(p_299113_, "EffectDuration", "duration", optional); + return p_299113_.replaceField("EffectDuration", "duration", optional); } diff --git a/patches/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch b/patches/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch index 26c2259db07..6aa98a6459e 100644 --- a/patches/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch +++ b/patches/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java.patch @@ -1,13 +1,14 @@ --- a/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java +++ b/net/minecraft/util/datafix/fixes/StructuresBecomeConfiguredFix.java -@@ -177,7 +_,10 @@ - private Dynamic findUpdatedStructureType(Pair, Dynamic> p_207724_, Dynamic p_207725_) { - String s = p_207724_.getFirst().asString("UNKNOWN").toLowerCase(Locale.ROOT); +@@ -179,7 +_,11 @@ + private Dynamic findUpdatedStructureType(Dynamic p_207725_, Dynamic p_339616_) { + String s = p_207725_.asString("UNKNOWN").toLowerCase(Locale.ROOT); StructuresBecomeConfiguredFix.Conversion structuresbecomeconfiguredfix$conversion = CONVERSION_MAP.get(s); -+ if (structuresbecomeconfiguredfix$conversion == null) structuresbecomeconfiguredfix$conversion = net.neoforged.neoforge.common.CommonHooks.getStructureConversion(s); // Forge: hook for mods to register conversions through RegisterStructureConversionsEvent ++ if (structuresbecomeconfiguredfix$conversion == null) structuresbecomeconfiguredfix$conversion = net.neoforged.neoforge.common.CommonHooks.getStructureConversion(s); // Neo: hook for mods to register conversions through RegisterStructureConversionsEvent if (structuresbecomeconfiguredfix$conversion == null) { -+ if (net.neoforged.neoforge.common.CommonHooks.checkStructureNamespace(s)) return p_207724_.getSecond().createString(s); // Forge: pass-through structure IDs which have a non-"minecraft" namespace -+ if (true) return p_207724_.getSecond().createString("unknown." + s); // Forge: Pass-through with "unknown." prefix, so deserializer logs and ignores rather than fixer throwing an exception and dropping chunk data - throw new IllegalStateException("Found unknown structure: " + s); ++ // Porting 1.20.5 check if this is correct ++ if (net.neoforged.neoforge.common.CommonHooks.checkStructureNamespace(s)) return p_339616_.createString(s); // Neo: pass-through structure IDs which have a non-"minecraft" namespace ++ if (true) return p_339616_.createString("unknown." + s); // Neo: Pass-through with "unknown." prefix, so deserializer logs and ignores rather than fixer throwing an exception and dropping chunk data + return null; } else { - Dynamic dynamic = p_207724_.getSecond(); + String s1 = structuresbecomeconfiguredfix$conversion.fallback; diff --git a/patches/net/minecraft/util/thread/BlockableEventLoop.java.patch b/patches/net/minecraft/util/thread/BlockableEventLoop.java.patch index ec01fca6b8a..39297f647aa 100644 --- a/patches/net/minecraft/util/thread/BlockableEventLoop.java.patch +++ b/patches/net/minecraft/util/thread/BlockableEventLoop.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/util/thread/BlockableEventLoop.java +++ b/net/minecraft/util/thread/BlockableEventLoop.java -@@ -55,10 +_,15 @@ +@@ -56,10 +_,15 @@ } public CompletableFuture submitAsync(Runnable p_18690_) { @@ -17,4 +17,4 @@ + }); } - public CompletableFuture submit(Runnable p_18708_) { + @CheckReturnValue diff --git a/patches/net/minecraft/world/damagesource/CombatTracker.java.patch b/patches/net/minecraft/world/damagesource/CombatTracker.java.patch index dc2ed5c5b17..9559ffb29a6 100644 --- a/patches/net/minecraft/world/damagesource/CombatTracker.java.patch +++ b/patches/net/minecraft/world/damagesource/CombatTracker.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/damagesource/CombatTracker.java +++ b/net/minecraft/world/damagesource/CombatTracker.java -@@ -90,6 +_,11 @@ +@@ -91,6 +_,11 @@ DamageSource damagesource = combatentry.source(); CombatEntry combatentry1 = this.getMostSignificantFall(); DeathMessageType deathmessagetype = damagesource.type().deathMessageType(); diff --git a/patches/net/minecraft/world/damagesource/DamageEffects.java.patch b/patches/net/minecraft/world/damagesource/DamageEffects.java.patch index ef84a9cff7e..e5e7b48a373 100644 --- a/patches/net/minecraft/world/damagesource/DamageEffects.java.patch +++ b/patches/net/minecraft/world/damagesource/DamageEffects.java.patch @@ -14,7 +14,7 @@ FREEZING("freezing", SoundEvents.PLAYER_HURT_FREEZE); - public static final Codec CODEC = StringRepresentable.fromEnum(DamageEffects::values); -+ public static final Codec CODEC = net.minecraft.util.ExtraCodecs.lazyInitializedCodec(() -> StringRepresentable.fromEnum(DamageEffects::values)); ++ public static final Codec CODEC = Codec.lazyInitialized(() -> StringRepresentable.fromEnum(DamageEffects::values)); private final String id; + @Deprecated // Neo: Always set to null. Use the getter. private final SoundEvent sound; diff --git a/patches/net/minecraft/world/damagesource/DamageScaling.java.patch b/patches/net/minecraft/world/damagesource/DamageScaling.java.patch index 53cdba8e792..d6c682a1706 100644 --- a/patches/net/minecraft/world/damagesource/DamageScaling.java.patch +++ b/patches/net/minecraft/world/damagesource/DamageScaling.java.patch @@ -11,7 +11,7 @@ ALWAYS("always"); - public static final Codec CODEC = StringRepresentable.fromEnum(DamageScaling::values); -+ public static final Codec CODEC = net.minecraft.util.ExtraCodecs.lazyInitializedCodec(() -> StringRepresentable.fromEnum(DamageScaling::values)); ++ public static final Codec CODEC = Codec.lazyInitialized(() -> StringRepresentable.fromEnum(DamageScaling::values)); private final String id; private DamageScaling(String p_270266_) { diff --git a/patches/net/minecraft/world/damagesource/DamageSource.java.patch b/patches/net/minecraft/world/damagesource/DamageSource.java.patch index 3af1ab51bda..7703c72fb16 100644 --- a/patches/net/minecraft/world/damagesource/DamageSource.java.patch +++ b/patches/net/minecraft/world/damagesource/DamageSource.java.patch @@ -9,5 +9,5 @@ + */ + @Deprecated(since = "1.20.1") public boolean scalesWithDifficulty() { - return switch(this.type().scaling()) { + return switch (this.type().scaling()) { case NEVER -> false; diff --git a/patches/net/minecraft/world/damagesource/DeathMessageType.java.patch b/patches/net/minecraft/world/damagesource/DeathMessageType.java.patch index 27b44bb6624..3095a21a68f 100644 --- a/patches/net/minecraft/world/damagesource/DeathMessageType.java.patch +++ b/patches/net/minecraft/world/damagesource/DeathMessageType.java.patch @@ -11,7 +11,7 @@ INTENTIONAL_GAME_DESIGN("intentional_game_design"); - public static final Codec CODEC = StringRepresentable.fromEnum(DeathMessageType::values); -+ public static final Codec CODEC = net.minecraft.util.ExtraCodecs.lazyInitializedCodec(() -> StringRepresentable.fromEnum(DeathMessageType::values)); ++ public static final Codec CODEC = Codec.lazyInitialized(() -> StringRepresentable.fromEnum(DeathMessageType::values)); private final String id; private DeathMessageType(String p_270201_) { diff --git a/patches/net/minecraft/world/effect/MobEffect.java.patch b/patches/net/minecraft/world/effect/MobEffect.java.patch index 9343c7f2b32..45952530cd8 100644 --- a/patches/net/minecraft/world/effect/MobEffect.java.patch +++ b/patches/net/minecraft/world/effect/MobEffect.java.patch @@ -1,33 +1,33 @@ --- a/net/minecraft/world/effect/MobEffect.java +++ b/net/minecraft/world/effect/MobEffect.java -@@ -18,7 +_,7 @@ - import net.minecraft.world.entity.ai.attributes.AttributeMap; - import net.minecraft.world.entity.ai.attributes.AttributeModifier; +@@ -30,7 +_,7 @@ + import net.minecraft.world.flag.FeatureFlagSet; + import net.minecraft.world.flag.FeatureFlags; --public class MobEffect { -+public class MobEffect implements net.neoforged.neoforge.common.extensions.IMobEffectExtension { - private final Map attributeModifiers = Maps.newHashMap(); +-public class MobEffect implements FeatureElement { ++public class MobEffect implements FeatureElement, net.neoforged.neoforge.common.extensions.IMobEffectExtension { + private static final int AMBIENT_ALPHA = Mth.floor(38.25F); + private final Map, MobEffect.AttributeTemplate> attributeModifiers = new Object2ObjectOpenHashMap<>(); private final MobEffectCategory category; - private final int color; -@@ -30,6 +_,7 @@ - protected MobEffect(MobEffectCategory p_19451_, int p_19452_) { - this.category = p_19451_; - this.color = p_19452_; +@@ -49,6 +_,7 @@ + int i = p_333517_.isAmbient() ? AMBIENT_ALPHA : 255; + return ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, FastColor.ARGB32.color(i, p_19452_)); + }; + initClient(); } - public Optional createFactorData() { -@@ -114,6 +_,31 @@ - public boolean isBeneficial() { - return this.category == MobEffectCategory.BENEFICIAL; + protected MobEffect(MobEffectCategory p_333963_, int p_333864_, ParticleOptions p_333716_) { +@@ -174,6 +_,28 @@ + public FeatureFlagSet requiredFeatures() { + return this.requiredFeatures; } + -+ // FORGE START ++ // NEO START + private Object effectRenderer; + + /* -+ DO NOT CALL, IT WILL DISAPPEAR IN THE FUTURE -+ Call RenderProperties.getEffectRenderer instead ++ * DO NOT CALL, IT WILL DISAPPEAR IN THE FUTURE ++ * Call RenderProperties.getEffectRenderer instead + */ + public Object getEffectRendererInternal() { + return effectRenderer; @@ -36,16 +36,13 @@ + private void initClient() { + // Minecraft instance isn't available in datagen, so don't call initializeClient if in datagen + if (net.neoforged.fml.loading.FMLEnvironment.dist == net.neoforged.api.distmarker.Dist.CLIENT && !net.neoforged.fml.loading.FMLLoader.getLaunchHandler().isData()) { -+ initializeClient(properties -> { -+ this.effectRenderer = properties; -+ }); ++ initializeClient(properties -> this.effectRenderer = properties); + } + } + + public void initializeClient(java.util.function.Consumer consumer) { + } -+ // END FORGE -+ ++ // END NEO - @Deprecated - public Holder.Reference builtInRegistryHolder() { + static record AttributeTemplate(UUID id, double amount, AttributeModifier.Operation operation) { + public AttributeModifier create(String p_316465_, int p_316614_) { diff --git a/patches/net/minecraft/world/effect/MobEffectInstance.java.patch b/patches/net/minecraft/world/effect/MobEffectInstance.java.patch index 82196a218b4..d2ce3a50579 100644 --- a/patches/net/minecraft/world/effect/MobEffectInstance.java.patch +++ b/patches/net/minecraft/world/effect/MobEffectInstance.java.patch @@ -1,14 +1,33 @@ --- a/net/minecraft/world/effect/MobEffectInstance.java +++ b/net/minecraft/world/effect/MobEffectInstance.java -@@ -78,6 +_,7 @@ - this.showIcon = p_216892_; - this.hiddenEffect = p_216893_; - this.factorData = p_216894_; -+ this.effect.fillEffectCures(this.cures, this); +@@ -86,6 +_,7 @@ + this.visible = p_19532_; + this.showIcon = p_19533_; + this.hiddenEffect = p_316863_; ++ this.effect.value().fillEffectCures(this.cures, this); } public MobEffectInstance(MobEffectInstance p_19543_) { -@@ -96,6 +_,8 @@ +@@ -103,6 +_,8 @@ + p_324529_.showIcon(), + p_324529_.hiddenEffect().map(p_323227_ -> new MobEffectInstance(p_324441_, p_323227_)).orElse(null) + ); ++ this.cures.clear(); ++ p_324529_.cures().ifPresent(this.cures::addAll); + } + + private MobEffectInstance.Details asDetails() { +@@ -112,7 +_,8 @@ + this.isAmbient(), + this.isVisible(), + this.showIcon(), +- Optional.ofNullable(this.hiddenEffect).map(MobEffectInstance::asDetails) ++ Optional.ofNullable(this.hiddenEffect).map(MobEffectInstance::asDetails), ++ Optional.of(this.getCures()).filter(cures -> !cures.isEmpty()) + ); + } + +@@ -130,6 +_,8 @@ this.ambient = p_19549_.ambient; this.visible = p_19549_.visible; this.showIcon = p_19549_.showIcon; @@ -17,46 +36,24 @@ } public boolean update(MobEffectInstance p_19559_) { -@@ -272,6 +_,7 @@ - public CompoundTag save(CompoundTag p_19556_) { - ResourceLocation resourcelocation = BuiltInRegistries.MOB_EFFECT.getKey(this.effect); - p_19556_.putString("id", resourcelocation.toString()); -+ net.neoforged.neoforge.common.CommonHooks.saveMobEffect(p_19556_, "neoforge:id", this.getEffect()); - this.writeDetailsTo(p_19556_); - return p_19556_; - } -@@ -295,6 +_,8 @@ - .resultOrPartial(LOGGER::error) - .ifPresent(p_216906_ -> p_19568_.put("factor_calculation_data", p_216906_)) - ); -+ -+ writeCures(p_19568_); - } - - @Nullable -@@ -332,7 +_,7 @@ - optional = Optional.empty(); - } - -- return new MobEffectInstance(p_19546_, j, Math.max(i, 0), flag, flag1, flag2, mobeffectinstance, optional); -+ return new MobEffectInstance(p_19546_, j, Math.max(i, 0), flag, flag1, flag2, mobeffectinstance, optional).readCures(p_19547_); - } - - public int compareTo(MobEffectInstance p_19566_) { -@@ -342,12 +_,42 @@ +@@ -326,11 +_,11 @@ .compareFalseFirst(this.isAmbient(), p_19566_.isAmbient()) .compareFalseFirst(this.isInfiniteDuration(), p_19566_.isInfiniteDuration()) .compare(this.getDuration(), p_19566_.getDuration()) -- .compare(this.getEffect().getColor(), p_19566_.getEffect().getColor()) -+ .compare(this.getEffect().getSortOrder(this), p_19566_.getEffect().getSortOrder(p_19566_)) +- .compare(this.getEffect().value().getColor(), p_19566_.getEffect().value().getColor()) ++ .compare(this.getEffect().value().getSortOrder(this), p_19566_.getEffect().value().getSortOrder(p_19566_)) .result() : ComparisonChain.start() .compare(this.isAmbient(), p_19566_.isAmbient()) -- .compare(this.getEffect().getColor(), p_19566_.getEffect().getColor()) -+ .compare(this.getEffect().getSortOrder(this), p_19566_.getEffect().getSortOrder(p_19566_)) +- .compare(this.getEffect().value().getColor(), p_19566_.getEffect().value().getColor()) ++ .compare(this.getEffect().value().getSortOrder(this), p_19566_.getEffect().value().getSortOrder(p_19566_)) .result(); -+ } -+ + } + +@@ -350,6 +_,15 @@ + this.blendState.setImmediate(this); + } + + private final java.util.Set cures = com.google.common.collect.Sets.newIdentityHashSet(); + + /** @@ -66,25 +63,52 @@ + return cures; + } + -+ private MobEffectInstance readCures(CompoundTag tag) { -+ cures.clear(); // Overwrite cures with ones stored in NBT, if any -+ if (tag.contains("neoforge:cures", Tag.TAG_LIST)) { -+ net.minecraft.nbt.ListTag list = tag.getList("neoforge:cures", Tag.TAG_STRING); -+ for (int i = 0; i < list.size(); i++) { -+ cures.add(net.neoforged.neoforge.common.EffectCure.get(list.getString(i))); -+ } -+ } -+ return this; -+ } -+ -+ private void writeCures(CompoundTag tag) { -+ if (!cures.isEmpty()) { -+ net.minecraft.nbt.ListTag list = new net.minecraft.nbt.ListTag(); -+ for (net.neoforged.neoforge.common.EffectCure cure : cures) { -+ list.add(net.minecraft.nbt.StringTag.valueOf(cure.name())); -+ } -+ tag.put("neoforge:cures", list); -+ } + static class BlendState { + private float factor; + private float factorPreviousFrame; +@@ -397,8 +_,7 @@ } - public static class FactorData { + static record Details( +- int amplifier, int duration, boolean ambient, boolean showParticles, boolean showIcon, Optional hiddenEffect +- ) { ++ int amplifier, int duration, boolean ambient, boolean showParticles, boolean showIcon, Optional hiddenEffect, Optional> cures) { + public static final MapCodec MAP_CODEC = MapCodec.recursive( + "MobEffectInstance.Details", + p_323465_ -> RecordCodecBuilder.mapCodec( +@@ -408,13 +_,14 @@ + Codec.BOOL.optionalFieldOf("ambient", Boolean.valueOf(false)).forGetter(MobEffectInstance.Details::ambient), + Codec.BOOL.optionalFieldOf("show_particles", Boolean.valueOf(true)).forGetter(MobEffectInstance.Details::showParticles), + Codec.BOOL.optionalFieldOf("show_icon").forGetter(p_323788_ -> Optional.of(p_323788_.showIcon())), +- p_323465_.optionalFieldOf("hidden_effect").forGetter(MobEffectInstance.Details::hiddenEffect) ++ p_323465_.optionalFieldOf("hidden_effect").forGetter(MobEffectInstance.Details::hiddenEffect), ++ net.neoforged.neoforge.common.util.NeoForgeExtraCodecs.setOf(net.neoforged.neoforge.common.EffectCure.CODEC).optionalFieldOf("neoforge:cures").forGetter(MobEffectInstance.Details::cures) + ) + .apply(p_324063_, MobEffectInstance.Details::create) + ) + ); + public static final StreamCodec STREAM_CODEC = StreamCodec.recursive( +- p_329990_ -> StreamCodec.composite( ++ p_329990_ -> net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs.composite( + ByteBufCodecs.VAR_INT, + MobEffectInstance.Details::amplifier, + ByteBufCodecs.VAR_INT, +@@ -427,14 +_,16 @@ + MobEffectInstance.Details::showIcon, + p_329990_.apply(ByteBufCodecs::optional), + MobEffectInstance.Details::hiddenEffect, ++ net.neoforged.neoforge.common.EffectCure.STREAM_CODEC.>apply(ByteBufCodecs.collection(java.util.HashSet::new)).apply(ByteBufCodecs::optional), ++ MobEffectInstance.Details::cures, + MobEffectInstance.Details::new + ) + ); + + private static MobEffectInstance.Details create( +- int p_323657_, int p_324205_, boolean p_324263_, boolean p_324000_, Optional p_323607_, Optional p_324604_ ++ int p_323657_, int p_324205_, boolean p_324263_, boolean p_324000_, Optional p_323607_, Optional p_324604_, Optional> cures + ) { +- return new MobEffectInstance.Details(p_323657_, p_324205_, p_324263_, p_324000_, p_323607_.orElse(p_324000_), p_324604_); ++ return new MobEffectInstance.Details(p_323657_, p_324205_, p_324263_, p_324000_, p_323607_.orElse(p_324000_), p_324604_, cures); + } + } + } diff --git a/patches/net/minecraft/world/effect/PoisonMobEffect.java.patch b/patches/net/minecraft/world/effect/PoisonMobEffect.java.patch index dc091ccb47c..39db38e109c 100644 --- a/patches/net/minecraft/world/effect/PoisonMobEffect.java.patch +++ b/patches/net/minecraft/world/effect/PoisonMobEffect.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/effect/PoisonMobEffect.java +++ b/net/minecraft/world/effect/PoisonMobEffect.java -@@ -11,7 +_,12 @@ - public void applyEffectTick(LivingEntity p_296276_, int p_296233_) { - super.applyEffectTick(p_296276_, p_296233_); +@@ -10,7 +_,12 @@ + @Override + public boolean applyEffectTick(LivingEntity p_296276_, int p_296233_) { if (p_296276_.getHealth() > 1.0F) { - p_296276_.hurt(p_296276_.damageSources().magic(), 1.0F); + // Neo: Replace DamageSources#magic() with neoforge:poison to allow differentiating poison damage. @@ -12,5 +12,5 @@ + var dType = dTypeReg.getHolder(net.neoforged.neoforge.common.NeoForgeMod.POISON_DAMAGE).orElse(dTypeReg.getHolderOrThrow(net.minecraft.world.damagesource.DamageTypes.MAGIC)); + p_296276_.hurt(new net.minecraft.world.damagesource.DamageSource(dType), 1.0F); } - } + return true; diff --git a/patches/net/minecraft/world/entity/Entity.java.patch b/patches/net/minecraft/world/entity/Entity.java.patch index b1643feb1e8..ea2e3eee018 100644 --- a/patches/net/minecraft/world/entity/Entity.java.patch +++ b/patches/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 -@@ -124,7 +_,7 @@ - import org.joml.Vector3f; +@@ -126,7 +_,7 @@ + import net.minecraft.world.scores.Team; import org.slf4j.Logger; --public abstract class Entity implements Nameable, EntityAccess, CommandSource, ScoreHolder { -+public abstract class Entity extends net.neoforged.neoforge.attachment.AttachmentHolder implements Nameable, EntityAccess, CommandSource, ScoreHolder, net.neoforged.neoforge.common.extensions.IEntityExtension { +-public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, CommandSource, ScoreHolder { ++public abstract class Entity extends net.neoforged.neoforge.attachment.AttachmentHolder implements SyncedDataHolder, Nameable, EntityAccess, CommandSource, ScoreHolder, net.neoforged.neoforge.common.extensions.IEntityExtension { private static final Logger LOGGER = LogUtils.getLogger(); public static final String ID_TAG = "id"; public static final String PASSENGERS_TAG = "Passengers"; -@@ -145,6 +_,7 @@ +@@ -147,6 +_,7 @@ private static final double LAVA_SLOW_FLOW_SCALE = 0.0023333333333333335; public static final String UUID_TAG = "UUID"; private static double viewScale = 1.0; @@ -17,7 +17,7 @@ private final EntityType type; private int id = ENTITY_COUNTER.incrementAndGet(); public boolean blocksBuilding; -@@ -191,8 +_,10 @@ +@@ -192,8 +_,10 @@ public int tickCount; private int remainingFireTicks = -this.getFireImmuneTicks(); protected boolean wasTouchingWater; @@ -28,19 +28,19 @@ private final Set> fluidOnEyes = new HashSet<>(); public int invulnerableTime; protected boolean firstTick = true; -@@ -260,7 +_,10 @@ - this.entityData.define(DATA_TICKS_FROZEN, 0); - this.defineSynchedData(); +@@ -262,7 +_,10 @@ + this.defineSynchedData(synchedentitydata$builder); + this.entityData = synchedentitydata$builder.build(); this.setPos(0.0, 0.0, 0.0); -- this.eyeHeight = this.getEyeHeight(Pose.STANDING, this.dimensions); -+ net.neoforged.neoforge.event.entity.EntityEvent.Size sizeEvent = net.neoforged.neoforge.event.EventHooks.getEntitySizeForge(this, Pose.STANDING, this.dimensions, this.getEyeHeight(Pose.STANDING, this.dimensions)); +- this.eyeHeight = this.dimensions.eyeHeight(); ++ net.neoforged.neoforge.event.entity.EntityEvent.Size sizeEvent = net.neoforged.neoforge.event.EventHooks.getEntitySizeForge(this, Pose.STANDING, this.dimensions, this.dimensions.eyeHeight()); + this.dimensions = sizeEvent.getNewSize(); + this.eyeHeight = sizeEvent.getNewEyeHeight(); + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.entity.EntityEvent.EntityConstructing(this)); } public boolean isColliding(BlockPos p_20040_, BlockState p_20041_) { -@@ -468,7 +_,7 @@ +@@ -466,7 +_,7 @@ if (this.isInLava()) { this.lavaHurt(); @@ -49,16 +49,16 @@ } this.checkBelowWorld(); -@@ -675,7 +_,7 @@ +@@ -672,7 +_,7 @@ double d1 = vec3.x; double d2 = vec3.y; double d3 = vec3.z; -- this.flyDist += (float)(vec3.length() * 0.6); +- this.flyDist = this.flyDist + (float)(vec3.length() * 0.6); + this.flyDist = (float)((double)this.flyDist + vec3.length() * 0.6D); BlockPos blockpos1 = this.getOnPos(); BlockState blockstate1 = this.level().getBlockState(blockpos1); boolean flag1 = this.isStateClimbable(blockstate1); -@@ -719,16 +_,16 @@ +@@ -716,16 +_,16 @@ this.setRemainingFireTicks(-this.getFireImmuneTicks()); } @@ -78,7 +78,7 @@ } } } -@@ -814,9 +_,7 @@ +@@ -811,9 +_,7 @@ return blockpos; } else { BlockState blockstate = this.level().getBlockState(blockpos); @@ -89,25 +89,7 @@ ? blockpos.atY(Mth.floor(this.position.y - (double)p_216987_)) : blockpos; } -@@ -889,12 +_,13 @@ - boolean flag1 = p_20273_.y != vec3.y; - boolean flag2 = p_20273_.z != vec3.z; - boolean flag3 = this.onGround() || flag1 && p_20273_.y < 0.0; -- if (this.maxUpStep() > 0.0F && flag3 && (flag || flag2)) { -- Vec3 vec31 = collideBoundingBox(this, new Vec3(p_20273_.x, (double)this.maxUpStep(), p_20273_.z), aabb, this.level(), list); -+ float stepHeight = getStepHeight(); -+ if (stepHeight > 0.0F && flag3 && (flag || flag2)) { -+ Vec3 vec31 = collideBoundingBox(this, new Vec3(p_20273_.x, (double)stepHeight, p_20273_.z), aabb, this.level(), list); - Vec3 vec32 = collideBoundingBox( -- this, new Vec3(0.0, (double)this.maxUpStep(), 0.0), aabb.expandTowards(p_20273_.x, 0.0, p_20273_.z), this.level(), list -+ this, new Vec3(0.0D, (double)stepHeight, 0.0D), aabb.expandTowards(p_20273_.x, 0.0D, p_20273_.z), this.level(), list - ); -- if (vec32.y < (double)this.maxUpStep()) { -+ if (vec32.y < (double)stepHeight) { - Vec3 vec33 = collideBoundingBox(this, new Vec3(p_20273_.x, 0.0, p_20273_.z), aabb.move(vec32), this.level(), list).add(vec32); - if (vec33.horizontalDistanceSqr() > vec31.horizontalDistanceSqr()) { - vec31 = vec33; -@@ -1042,19 +_,19 @@ +@@ -1039,19 +_,19 @@ return !blockstate.is(BlockTags.INSIDE_STEP_SOUND_BLOCKS) && !blockstate.is(BlockTags.COMBINATION_STEP_SOUND_BLOCKS) ? p_278049_ : blockpos; } @@ -133,7 +115,7 @@ this.playSound(soundtype.getStepSound(), soundtype.getVolume() * 0.15F, soundtype.getPitch()); } -@@ -1192,20 +_,23 @@ +@@ -1204,20 +_,23 @@ public void updateSwimming() { if (this.isSwimming()) { @@ -162,15 +144,15 @@ } void updateInWaterStateAndDoWaterCurrentPushing() { -@@ -1231,6 +_,7 @@ +@@ -1242,6 +_,7 @@ private void updateFluidOnEyes() { this.wasEyeInWater = this.isEyeInFluid(FluidTags.WATER); this.fluidOnEyes.clear(); + this.forgeFluidTypeOnEyes = net.neoforged.neoforge.common.NeoForgeMod.EMPTY_TYPE.value(); - double d0 = this.getEyeY() - 0.11111111F; - Entity entity = this.getVehicle(); - if (entity instanceof Boat boat && !boat.isUnderWater() && boat.getBoundingBox().maxY >= d0 && boat.getBoundingBox().minY <= d0) { -@@ -1241,7 +_,7 @@ + double d0 = this.getEyeY(); + if (this.getVehicle() instanceof Boat boat && !boat.isUnderWater() && boat.getBoundingBox().maxY >= d0 && boat.getBoundingBox().minY <= d0) { + return; +@@ -1251,7 +_,7 @@ FluidState fluidstate = this.level().getFluidState(blockpos); double d1 = (double)((float)blockpos.getY() + fluidstate.getHeight(this.level(), blockpos)); if (d1 > d0) { @@ -179,7 +161,7 @@ } } -@@ -1286,12 +_,13 @@ +@@ -1296,12 +_,13 @@ } public boolean canSpawnSprintParticle() { @@ -194,7 +176,7 @@ if (blockstate.getRenderShape() != RenderShape.INVISIBLE) { Vec3 vec3 = this.getDeltaMovement(); BlockPos blockpos1 = this.blockPosition(); -@@ -1305,16 +_,19 @@ +@@ -1315,16 +_,19 @@ d1 = Mth.clamp(d1, (double)blockpos.getZ(), (double)blockpos.getZ() + 1.0); } @@ -216,37 +198,27 @@ } public void moveRelative(float p_19921_, Vec3 p_19922_) { -@@ -1631,6 +_,8 @@ - p_20241_.putBoolean("HasVisualFire", this.hasVisualFire); - } - -+ p_20241_.putBoolean("CanUpdate", canUpdate); -+ - if (!this.tags.isEmpty()) { - ListTag listtag = new ListTag(); - -@@ -1641,6 +_,10 @@ +@@ -1655,6 +_,10 @@ p_20241_.put("Tags", listtag); } -+ CompoundTag attachments = serializeAttachments(); ++ CompoundTag attachments = serializeAttachments(registryAccess()); + if (attachments != null) p_20241_.put(ATTACHMENTS_NBT_KEY, attachments); + if (persistentData != null) p_20241_.put("NeoForgeData", persistentData.copy()); + this.addAdditionalSaveData(p_20241_); if (this.isVehicle()) { ListTag listtag1 = new ListTag(); -@@ -1721,6 +_,9 @@ +@@ -1735,6 +_,8 @@ this.setGlowingTag(p_20259_.getBoolean("Glowing")); this.setTicksFrozen(p_20259_.getInt("TicksFrozen")); this.hasVisualFire = p_20259_.getBoolean("HasVisualFire"); + if (p_20259_.contains("NeoForgeData", 10)) persistentData = p_20259_.getCompound("NeoForgeData"); -+ if (p_20259_.contains("CanUpdate", 99)) this.canUpdate(p_20259_.getBoolean("CanUpdate")); -+ if (p_20259_.contains(ATTACHMENTS_NBT_KEY, net.minecraft.nbt.Tag.TAG_COMPOUND)) deserializeAttachments(p_20259_.getCompound(ATTACHMENTS_NBT_KEY)); ++ if (p_20259_.contains(ATTACHMENTS_NBT_KEY, net.minecraft.nbt.Tag.TAG_COMPOUND)) deserializeAttachments(registryAccess(), p_20259_.getCompound(ATTACHMENTS_NBT_KEY)); if (p_20259_.contains("Tags", 9)) { this.tags.clear(); ListTag listtag3 = p_20259_.getList("Tags", 8); -@@ -1805,6 +_,8 @@ +@@ -1819,6 +_,8 @@ } else { ItemEntity itementity = new ItemEntity(this.level(), this.getX(), this.getY() + (double)p_19986_, this.getZ(), p_19985_); itementity.setDefaultPickUpDelay(); @@ -255,15 +227,19 @@ this.level().addFreshEntity(itementity); return itementity; } -@@ -1851,6 +_,7 @@ +@@ -1865,7 +_,10 @@ public void rideTick() { this.setDeltaMovement(Vec3.ZERO); -+ if (canUpdate()) - this.tick(); +- this.tick(); ++ // Neo: Permit cancellation of Entity#tick via EntityTickEvent.Pre ++ if (!net.neoforged.neoforge.event.EventHooks.fireEntityTickPre(this).isCanceled()) { ++ this.tick(); ++ } if (this.isPassenger()) { this.getVehicle().positionRider(this); -@@ -1908,6 +_,7 @@ + } +@@ -1923,6 +_,7 @@ } } @@ -271,7 +247,7 @@ if (p_19967_ || this.canRide(p_19966_) && p_19966_.canAddPassenger(this)) { if (this.isPassenger()) { this.stopRiding(); -@@ -1939,6 +_,7 @@ +@@ -1954,6 +_,7 @@ public void removeVehicle() { if (this.vehicle != null) { Entity entity = this.vehicle; @@ -279,7 +255,7 @@ this.vehicle = null; entity.removePassenger(this); } -@@ -1988,6 +_,8 @@ +@@ -2003,6 +_,8 @@ return this.passengers.isEmpty(); } @@ -288,7 +264,7 @@ protected boolean couldAcceptPassenger() { return true; } -@@ -2193,7 +_,7 @@ +@@ -2192,7 +_,7 @@ } public boolean isVisuallyCrawling() { @@ -297,8 +273,8 @@ } public void setSwimming(boolean p_20283_) { -@@ -2302,7 +_,7 @@ - this.setSecondsOnFire(8); +@@ -2301,7 +_,7 @@ + this.igniteForSeconds(8); } - this.hurt(this.damageSources().lightningBolt(), 5.0F); @@ -306,7 +282,7 @@ } public void onAboveBubbleCol(boolean p_20313_) { -@@ -2397,7 +_,7 @@ +@@ -2396,7 +_,7 @@ } protected Component getTypeName() { @@ -315,7 +291,7 @@ } public boolean is(Entity p_20356_) { -@@ -2480,14 +_,20 @@ +@@ -2479,14 +_,20 @@ @Nullable public Entity changeDimension(ServerLevel p_20118_) { @@ -337,7 +313,7 @@ this.level().getProfiler().popPush("reloading"); Entity entity = this.getType().create(p_20118_); if (entity != null) { -@@ -2495,17 +_,19 @@ +@@ -2494,17 +_,19 @@ entity.moveTo(portalinfo.pos.x, portalinfo.pos.y, portalinfo.pos.z, portalinfo.yRot, entity.getXRot()); entity.setDeltaMovement(portalinfo.speed); p_20118_.addDuringTeleport(entity); @@ -359,7 +335,7 @@ } } else { return null; -@@ -2641,6 +_,7 @@ +@@ -2639,6 +_,7 @@ return this.stringUUID; } @@ -367,31 +343,30 @@ public boolean isPushedByFluid() { return true; } -@@ -2764,8 +_,10 @@ +@@ -2764,6 +_,8 @@ EntityDimensions entitydimensions = this.dimensions; Pose pose = this.getPose(); EntityDimensions entitydimensions1 = this.getDimensions(pose); -+ net.neoforged.neoforge.event.entity.EntityEvent.Size sizeEvent = net.neoforged.neoforge.event.EventHooks.getEntitySizeForge(this, pose, entitydimensions, entitydimensions1, this.getEyeHeight(pose, entitydimensions1)); ++ net.neoforged.neoforge.event.entity.EntityEvent.Size sizeEvent = net.neoforged.neoforge.event.EventHooks.getEntitySizeForge(this, pose, entitydimensions, entitydimensions1, entitydimensions1.eyeHeight()); // Porting 1.20.5 check if this still works + entitydimensions1 = sizeEvent.getNewSize(); this.dimensions = entitydimensions1; -- this.eyeHeight = this.getEyeHeight(pose, entitydimensions1); -+ this.eyeHeight = sizeEvent.getNewEyeHeight(); + this.eyeHeight = entitydimensions1.eyeHeight(); this.reapplyPosition(); - boolean flag = (double)entitydimensions1.width <= 4.0 && (double)entitydimensions1.height <= 4.0; - if (!this.level().isClientSide -@@ -2778,9 +_,10 @@ - double d0 = (double)Math.max(0.0F, entitydimensions1.width - entitydimensions.width) + 1.0E-6; - double d1 = (double)Math.max(0.0F, entitydimensions1.height - entitydimensions.height) + 1.0E-6; +@@ -2778,11 +_,12 @@ + double d0 = (double)Math.max(0.0F, entitydimensions1.width() - entitydimensions.width()) + 1.0E-6; + double d1 = (double)Math.max(0.0F, entitydimensions1.height() - entitydimensions.height()) + 1.0E-6; VoxelShape voxelshape = Shapes.create(AABB.ofSize(vec3, d0, d1, d0)); + EntityDimensions finalEntitydimensions = entitydimensions1; this.level() - .findFreePosition(this, voxelshape, vec3, (double)entitydimensions1.width, (double)entitydimensions1.height, (double)entitydimensions1.width) -- .ifPresent(p_185956_ -> this.setPos(p_185956_.add(0.0, (double)(-entitydimensions1.height) / 2.0, 0.0))); -+ .ifPresent(p_185956_ -> this.setPos(p_185956_.add(0.0, (double)(-finalEntitydimensions.height) / 2.0, 0.0))); + .findFreePosition( + this, voxelshape, vec3, (double)entitydimensions1.width(), (double)entitydimensions1.height(), (double)entitydimensions1.width() + ) +- .ifPresent(p_315932_ -> this.setPos(p_315932_.add(0.0, (double)(-entitydimensions1.height()) / 2.0, 0.0))); ++ .ifPresent(p_315932_ -> this.setPos(p_315932_.add(0.0, (double)(-finalEntitydimensions.height()) / 2.0, 0.0))); } } -@@ -3076,9 +_,17 @@ +@@ -3084,9 +_,17 @@ this.yRotO = this.getYRot(); } @@ -410,7 +385,7 @@ } else { AABB aabb = this.getBoundingBox().deflate(0.001); int i = Mth.floor(aabb.minX); -@@ -3093,25 +_,36 @@ +@@ -3101,25 +_,36 @@ Vec3 vec3 = Vec3.ZERO; int k1 = 0; BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); @@ -421,9 +396,9 @@ + } + it.unimi.dsi.fastutil.objects.Object2ObjectMap interimCalcs = null; - for(int l1 = i; l1 < j; ++l1) { - for(int i2 = k; i2 < l; ++i2) { - for(int j2 = i1; j2 < j1; ++j2) { + for (int l1 = i; l1 < j; l1++) { + for (int i2 = k; i2 < l; i2++) { + for (int j2 = i1; j2 < j1; j2++) { blockpos$mutableblockpos.set(l1, i2, j2); FluidState fluidstate = this.level().getFluidState(blockpos$mutableblockpos); - if (fluidstate.is(p_204032_)) { @@ -448,13 +423,13 @@ } - vec3 = vec3.add(vec31); -- ++k1; +- k1++; + interim.flowVector = interim.flowVector.add(vec31); + interim.blockCount++; } } } -@@ -3119,27 +_,30 @@ +@@ -3127,27 +_,30 @@ } } @@ -495,7 +470,7 @@ } } -@@ -3152,7 +_,10 @@ +@@ -3160,7 +_,10 @@ return !this.level().hasChunksAt(i, k, j, l); } @@ -506,7 +481,7 @@ return this.fluidHeight.getDouble(p_204037_); } -@@ -3289,6 +_,7 @@ +@@ -3297,6 +_,7 @@ this.levelCallback.onMove(); } @@ -514,50 +489,13 @@ } public void checkDespawn() { -@@ -3360,10 +_,27 @@ - return false; - } - -+ /** -+ * Gets the value of the legacy {@link #maxUpStep} field. Only used by players when the modified value causes issues. -+ * @deprecated Use {@link net.neoforged.neoforge.common.extensions.IEntityExtension#getStepHeight()} to get the real step height value. -+ */ -+ @Deprecated - public float maxUpStep() { - return this.maxUpStep; - } - -+ /** -+ * Changes the legacy {@link #maxUpStep} field. Only used by vanilla entities to improve maintainability. -+ *

-+ * For your own entities, you should change the default value of {@linkplain net.neoforged.neoforge.common.NeoForgeMod#STEP_HEIGHT NeoForgeMod#STEP_HEIGHT} -+ * during attribute creation. -+ *

-+ * For modifying the step height of other entities, you should use {@link net.minecraft.world.entity.ai.attributes.AttributeModifier AttributeModifiers} for -+ * {@link net.neoforged.neoforge.common.NeoForgeMod#STEP_HEIGHT NeoForgeMod#STEP_HEIGHT}. -+ * -+ * @deprecated Use attribute modifiers for the {@link net.neoforged.neoforge.common.NeoForgeMod#STEP_HEIGHT NeoForgeMod#STEP_HEIGHT} attribute. -+ */ -+ @Deprecated - public void setMaxUpStep(float p_275672_) { - this.maxUpStep = p_275672_; - } -@@ -3419,6 +_,126 @@ +@@ -3424,6 +_,117 @@ public boolean mayInteract(Level p_146843_, BlockPos p_146844_) { return true; } + + /* ================================== Forge Start =====================================*/ + -+ private boolean canUpdate = true; -+ @Override -+ public void canUpdate(boolean value) { -+ this.canUpdate = value; -+ } -+ @Override -+ public boolean canUpdate() { -+ return this.canUpdate; -+ } + @Nullable + private java.util.Collection captureDrops = null; + @Override @@ -608,10 +546,10 @@ + + // no AT because of overrides + /** -+ * Accessor method for {@link #getEyeHeight(Pose, EntityDimensions)} ++ * Accessor method for {@link #getEyeHeight(Pose)} + */ -+ public float getEyeHeightAccess(Pose pose, EntityDimensions size) { -+ return this.getEyeHeight(pose, size); ++ public float getEyeHeightAccess(Pose pose) { ++ return this.getEyeHeight(pose); + } + + protected Object2DoubleMap forgeFluidTypeHeight = new Object2DoubleArrayMap<>(net.neoforged.neoforge.fluids.FluidType.SIZE.get()); diff --git a/patches/net/minecraft/world/entity/EntityType.java.patch b/patches/net/minecraft/world/entity/EntityType.java.patch index 60d081b8295..a1a2002bf80 100644 --- a/patches/net/minecraft/world/entity/EntityType.java.patch +++ b/patches/net/minecraft/world/entity/EntityType.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/entity/EntityType.java +++ b/net/minecraft/world/entity/EntityType.java -@@ -620,6 +_,10 @@ - private final EntityDimensions dimensions; +@@ -852,6 +_,10 @@ + private final float spawnDimensionsScale; private final FeatureFlagSet requiredFeatures; + private final java.util.function.Predicate> trackDeltasSupplier; @@ -11,12 +11,13 @@ private static EntityType register(String p_20635_, EntityType.Builder p_20636_) { return Registry.register(BuiltInRegistries.ENTITY_TYPE, p_20635_, p_20636_.build(p_20635_)); } -@@ -645,6 +_,24 @@ +@@ -878,6 +_,26 @@ int p_273451_, FeatureFlagSet p_273518_ ) { -+ this(p_273268_, p_272918_, p_273417_, p_273389_, p_273556_, p_272654_, p_273631_, p_272946_, p_272895_, p_273451_, p_273518_, EntityType::defaultTrackDeltasSupplier, EntityType::defaultTrackingRangeSupplier, EntityType::defaultUpdateIntervalSupplier); ++ this(p_273268_, p_272918_, p_273417_, p_273389_, p_273556_, p_272654_, p_273631_, p_272946_, p_338404_, p_272895_, p_273451_, p_273518_, EntityType::defaultTrackDeltasSupplier, EntityType::defaultTrackingRangeSupplier, EntityType::defaultUpdateIntervalSupplier); + } ++ + public EntityType( + EntityType.EntityFactory p_273268_, + MobCategory p_272918_, @@ -26,6 +27,7 @@ + boolean p_272654_, + ImmutableSet p_273631_, + EntityDimensions p_272946_, ++ float p_338404_, + int p_272895_, + int p_273451_, + FeatureFlagSet p_273518_, @@ -36,7 +38,7 @@ this.factory = p_273268_; this.category = p_272918_; this.canSpawnFarFromPlayer = p_272654_; -@@ -656,6 +_,9 @@ +@@ -890,6 +_,9 @@ this.clientTrackingRange = p_272895_; this.updateInterval = p_273451_; this.requiredFeatures = p_273518_; @@ -46,10 +48,10 @@ } @Nullable -@@ -760,6 +_,15 @@ +@@ -976,6 +_,15 @@ mob.yHeadRot = mob.getYRot(); mob.yBodyRot = mob.getYRot(); - mob.finalizeSpawn(p_262637_, p_262637_.getCurrentDifficultyAt(mob.blockPosition()), p_262666_, null, p_262687_); + mob.finalizeSpawn(p_262637_, p_262637_.getCurrentDifficultyAt(mob.blockPosition()), p_262666_, null); + + if (mob.isSpawnCancelled()) { + // Neo: Discard mob, spawn was cancelled @@ -62,7 +64,7 @@ mob.playAmbientSound(); } -@@ -958,14 +_,23 @@ +@@ -1167,14 +_,23 @@ } public int clientTrackingRange() { @@ -86,7 +88,7 @@ return this != PLAYER && this != LLAMA_SPIT && this != WITHER -@@ -1001,6 +_,8 @@ +@@ -1210,6 +_,8 @@ return this.builtInRegistryHolder; } @@ -95,8 +97,8 @@ public static class Builder { private final EntityType.EntityFactory factory; private final MobCategory category; -@@ -1014,6 +_,10 @@ - private EntityDimensions dimensions = EntityDimensions.scalable(0.6F, 1.8F); +@@ -1225,6 +_,10 @@ + private EntityAttachments.Builder attachments = EntityAttachments.builder(); private FeatureFlagSet requiredFeatures = FeatureFlags.VANILLA_SET; + private java.util.function.Predicate> velocityUpdateSupplier = EntityType::defaultTrackDeltasSupplier; @@ -106,7 +108,7 @@ private Builder(EntityType.EntityFactory p_20696_, MobCategory p_20697_) { this.factory = p_20696_; this.category = p_20697_; -@@ -1073,6 +_,21 @@ +@@ -1332,6 +_,21 @@ return this; } @@ -128,8 +130,8 @@ public EntityType build(String p_20713_) { if (this.serialize) { Util.fetchChoiceType(References.ENTITY_TREE, p_20713_); -@@ -1089,7 +_,10 @@ - this.dimensions, +@@ -1349,7 +_,10 @@ + this.spawnDimensionsScale, this.clientTrackingRange, this.updateInterval, - this.requiredFeatures diff --git a/patches/net/minecraft/world/entity/ExperienceOrb.java.patch b/patches/net/minecraft/world/entity/ExperienceOrb.java.patch index 2bc78b71040..009bd98510e 100644 --- a/patches/net/minecraft/world/entity/ExperienceOrb.java.patch +++ b/patches/net/minecraft/world/entity/ExperienceOrb.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ExperienceOrb.java +++ b/net/minecraft/world/entity/ExperienceOrb.java -@@ -103,7 +_,8 @@ +@@ -109,7 +_,8 @@ this.move(MoverType.SELF, this.getDeltaMovement()); float f = 0.98F; if (this.onGround()) { @@ -10,7 +10,7 @@ } this.setDeltaMovement(this.getDeltaMovement().multiply((double)f, 0.98, (double)f)); -@@ -219,6 +_,7 @@ +@@ -225,6 +_,7 @@ public void playerTouch(Player p_20792_) { if (!this.level().isClientSide) { if (p_20792_.takeXpDelay == 0) { @@ -18,7 +18,7 @@ p_20792_.takeXpDelay = 2; p_20792_.take(this, 1); int i = this.repairPlayerItems(p_20792_, this.value); -@@ -238,7 +_,7 @@ +@@ -244,7 +_,7 @@ Entry entry = EnchantmentHelper.getRandomItemWith(Enchantments.MENDING, p_147093_, ItemStack::isDamaged); if (entry != null) { ItemStack itemstack = entry.getValue(); diff --git a/patches/net/minecraft/world/entity/LightningBolt.java.patch b/patches/net/minecraft/world/entity/LightningBolt.java.patch index 56e8cc9bb68..f74497ef942 100644 --- a/patches/net/minecraft/world/entity/LightningBolt.java.patch +++ b/patches/net/minecraft/world/entity/LightningBolt.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/LightningBolt.java +++ b/net/minecraft/world/entity/LightningBolt.java -@@ -37,6 +_,7 @@ +@@ -38,6 +_,7 @@ private ServerPlayer cause; private final Set hitEntities = Sets.newHashSet(); private int blocksSetOnFire; @@ -8,7 +8,7 @@ public LightningBolt(EntityType p_20865_, Level p_20866_) { super(p_20865_, p_20866_); -@@ -72,6 +_,14 @@ +@@ -73,6 +_,14 @@ } } @@ -23,10 +23,10 @@ @Override public void tick() { super.tick(); -@@ -150,6 +_,7 @@ +@@ -151,6 +_,7 @@ ); - for(Entity entity : list1) { + for (Entity entity : list1) { + if (!net.neoforged.neoforge.event.EventHooks.onEntityStruckByLightning(entity, this)) entity.thunderHit((ServerLevel)this.level(), this); } diff --git a/patches/net/minecraft/world/entity/LivingEntity.java.patch b/patches/net/minecraft/world/entity/LivingEntity.java.patch index 05608ae5db6..e20f82d76a7 100644 --- a/patches/net/minecraft/world/entity/LivingEntity.java.patch +++ b/patches/net/minecraft/world/entity/LivingEntity.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -119,14 +_,16 @@ - import net.minecraft.world.scores.PlayerTeam; +@@ -126,7 +_,7 @@ + import net.minecraft.world.scores.Scoreboard; import org.slf4j.Logger; -public abstract class LivingEntity extends Entity implements Attackable { @@ -9,39 +9,28 @@ private static final Logger LOGGER = LogUtils.getLogger(); private static final String TAG_ACTIVE_EFFECTS = "active_effects"; private static final UUID SPEED_MODIFIER_SOUL_SPEED_UUID = UUID.fromString("87f46a96-686f-4796-b035-22e16ee9e038"); - private static final UUID SPEED_MODIFIER_POWDER_SNOW_UUID = UUID.fromString("1eaf83ff-7207-4596-b37a-d7a07b3ec4ce"); -+ private static final UUID SLOW_FALLING_ID = UUID.fromString("A5B6CF2A-2F7C-31EF-9022-7C3E7D5E6ABA"); - private static final AttributeModifier SPEED_MODIFIER_SPRINTING = new AttributeModifier( - UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"), "Sprinting speed boost", 0.3F, AttributeModifier.Operation.MULTIPLY_TOTAL - ); -+ private static final AttributeModifier SLOW_FALLING = new AttributeModifier(SLOW_FALLING_ID, "Slow falling acceleration reduction", -0.07, AttributeModifier.Operation.ADDITION); // Add -0.07 to 0.08 so we get the vanilla default of 0.01 - public static final int HAND_SLOTS = 2; - public static final int ARMOR_SLOTS = 4; - public static final int EQUIPMENT_SLOT_OFFSET = 98; -@@ -284,7 +_,11 @@ - .add(Attributes.MOVEMENT_SPEED) - .add(Attributes.ARMOR) - .add(Attributes.ARMOR_TOUGHNESS) -- .add(Attributes.MAX_ABSORPTION); -+ .add(Attributes.MAX_ABSORPTION) -+ .add(net.neoforged.neoforge.common.NeoForgeMod.SWIM_SPEED.value()) -+ .add(net.neoforged.neoforge.common.NeoForgeMod.NAMETAG_DISTANCE.value()) -+ .add(net.neoforged.neoforge.common.NeoForgeMod.ENTITY_GRAVITY.value()) -+ .add(net.neoforged.neoforge.common.NeoForgeMod.STEP_HEIGHT.value()); +@@ -302,7 +_,9 @@ + .add(Attributes.GRAVITY) + .add(Attributes.SAFE_FALL_DISTANCE) + .add(Attributes.FALL_DAMAGE_MULTIPLIER) +- .add(Attributes.JUMP_STRENGTH); ++ .add(Attributes.JUMP_STRENGTH) ++ .add(net.neoforged.neoforge.common.NeoForgeMod.SWIM_SPEED) ++ .add(net.neoforged.neoforge.common.NeoForgeMod.NAMETAG_DISTANCE); } @Override -@@ -314,7 +_,8 @@ - float f = (float)Mth.ceil(this.fallDistance - 3.0F); - double d4 = Math.min((double)(0.2F + f / 15.0F), 2.5); - int i = (int)(150.0 * d4); -- ((ServerLevel)this.level()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, p_20992_), d0, d1, d2, i, 0.0, 0.0, 0.0, 0.15F); -+ if (!p_20992_.addLandingEffects((ServerLevel) this.level(), p_20993_, p_20992_, this, i)) -+ ((ServerLevel)this.level()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, p_20992_).setPos(p_20993_), d0, d1, d2, i, 0.0D, 0.0D, 0.0D, (double)0.15F); +@@ -331,7 +_,8 @@ + float f = (float)Mth.ceil((double)this.fallDistance - d0); + double d5 = Math.min((double)(0.2F + f / 15.0F), 2.5); + int i = (int)(150.0 * d5); +- ((ServerLevel)this.level()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, p_20992_), d1, d2, d3, i, 0.0, 0.0, 0.0, 0.15F); ++ if (!p_20992_.addLandingEffects((ServerLevel) this.level(), p_20993_, p_20992_, this, i)) ++ ((ServerLevel)this.level()).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, p_20992_).setPos(p_20993_), d1, d2, d3, i, 0.0D, 0.0D, 0.0D, 0.15F); + } } - super.checkFallDamage(p_20990_, p_20991_, p_20992_, p_20993_); -@@ -323,6 +_,7 @@ +@@ -341,6 +_,7 @@ } } @@ -49,7 +38,7 @@ public final boolean canBreatheUnderwater() { return this.getType().is(EntityTypeTags.CAN_BREATHE_UNDER_WATER); } -@@ -364,6 +_,9 @@ +@@ -382,6 +_,9 @@ } } @@ -59,7 +48,7 @@ if (this.isEyeInFluid(FluidTags.WATER) && !this.level().getBlockState(BlockPos.containing(this.getX(), this.getEyeY(), this.getZ())).is(Blocks.BUBBLE_COLUMN)) { boolean flag1 = !this.canBreatheUnderwater() -@@ -402,7 +_,7 @@ +@@ -420,7 +_,7 @@ } } @@ -68,29 +57,24 @@ this.extinguishFire(); } -@@ -776,7 +_,7 @@ - MobEffect mobeffect = iterator.next(); - MobEffectInstance mobeffectinstance = this.activeEffects.get(mobeffect); +@@ -813,7 +_,7 @@ + Holder holder = iterator.next(); + MobEffectInstance mobeffectinstance = this.activeEffects.get(holder); if (!mobeffectinstance.tick(this, () -> this.onEffectUpdated(mobeffectinstance, true, null))) { - if (!this.level().isClientSide) { + if (!this.level().isClientSide && !net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.entity.living.MobEffectEvent.Expired(this, mobeffectinstance)).isCanceled()) { iterator.remove(); this.onEffectRemoved(mobeffectinstance); } -@@ -834,8 +_,10 @@ - this.setInvisible(false); - } else { - Collection collection = this.activeEffects.values(); -- this.entityData.set(DATA_EFFECT_AMBIENCE_ID, areAllEffectsAmbient(collection)); -- this.entityData.set(DATA_EFFECT_COLOR_ID, PotionUtils.getColor(collection)); -+ net.neoforged.neoforge.event.entity.living.PotionColorCalculationEvent event = new net.neoforged.neoforge.event.entity.living.PotionColorCalculationEvent(this, PotionUtils.getColor(collection), areAllEffectsAmbient(collection), collection); -+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(event); -+ this.entityData.set(DATA_EFFECT_AMBIENCE_ID, event.areParticlesHidden()); -+ this.entityData.set(DATA_EFFECT_COLOR_ID, event.getColor()); - this.setInvisible(this.hasEffect(MobEffects.INVISIBILITY)); - } +@@ -861,6 +_,7 @@ + .filter(MobEffectInstance::isVisible) + .map(MobEffectInstance::getParticleOptions) + .toList(); ++ // Porting 1.20.5 re-add or remove PotionColorCalculationEvent + this.entityData.set(DATA_EFFECT_PARTICLES, list); + this.entityData.set(DATA_EFFECT_AMBIENCE_ID, areAllEffectsAmbient(this.activeEffects.values())); } -@@ -874,6 +_,7 @@ +@@ -899,6 +_,7 @@ } } @@ -98,10 +82,10 @@ return d0; } -@@ -916,7 +_,9 @@ +@@ -940,7 +_,9 @@ boolean flag; - for(flag = false; iterator.hasNext(); flag = true) { + for (flag = false; iterator.hasNext(); flag = true) { - this.onEffectRemoved(iterator.next()); + MobEffectInstance effect = iterator.next(); + if(net.neoforged.neoforge.event.EventHooks.onEffectRemoved(this, effect, null)) continue; @@ -109,7 +93,7 @@ iterator.remove(); } -@@ -951,6 +_,7 @@ +@@ -975,6 +_,7 @@ } else { MobEffectInstance mobeffectinstance = this.activeEffects.get(p_147208_.getEffect()); boolean flag = false; @@ -117,25 +101,25 @@ if (mobeffectinstance == null) { this.activeEffects.put(p_147208_.getEffect(), p_147208_); this.onEffectAdded(p_147208_, p_147209_); -@@ -966,6 +_,9 @@ +@@ -991,6 +_,9 @@ } public boolean canBeAffected(MobEffectInstance p_21197_) { + net.neoforged.neoforge.event.entity.living.MobEffectEvent.Applicable event = new net.neoforged.neoforge.event.entity.living.MobEffectEvent.Applicable(this, p_21197_); + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(event); + if (event.getResult() != net.neoforged.bus.api.Event.Result.DEFAULT) return event.getResult() == net.neoforged.bus.api.Event.Result.ALLOW; - if (this.getMobType() == MobType.UNDEAD) { - MobEffect mobeffect = p_21197_.getEffect(); - if (mobeffect == MobEffects.REGENERATION || mobeffect == MobEffects.POISON) { -@@ -997,6 +_,7 @@ + if (this.getType().is(EntityTypeTags.IMMUNE_TO_INFESTED)) { + return !p_21197_.is(MobEffects.INFESTED); + } else if (this.getType().is(EntityTypeTags.IMMUNE_TO_OOZING)) { +@@ -1024,6 +_,7 @@ } - public boolean removeEffect(MobEffect p_21196_) { -+ if (net.neoforged.neoforge.event.EventHooks.onEffectRemoved(this, p_21196_, null)) return false; - MobEffectInstance mobeffectinstance = this.removeEffectNoUpdate(p_21196_); + public boolean removeEffect(Holder p_316570_) { ++ if (net.neoforged.neoforge.event.EventHooks.onEffectRemoved(this, p_316570_, null)) return false; + MobEffectInstance mobeffectinstance = this.removeEffectNoUpdate(p_316570_); if (mobeffectinstance != null) { this.onEffectRemoved(mobeffectinstance); -@@ -1071,6 +_,8 @@ +@@ -1098,6 +_,8 @@ } public void heal(float p_21116_) { @@ -144,7 +128,7 @@ float f = this.getHealth(); if (f > 0.0F) { this.setHealth(f + p_21116_); -@@ -1091,6 +_,7 @@ +@@ -1118,6 +_,7 @@ @Override public boolean hurt(DamageSource p_21016_, float p_21017_) { @@ -152,7 +136,7 @@ if (this.isInvulnerableTo(p_21016_)) { return false; } else if (this.level().isClientSide) { -@@ -1109,9 +_,11 @@ +@@ -1136,14 +_,17 @@ boolean flag = false; float f1 = 0.0F; if (p_21017_ > 0.0F && this.isDamageSourceBlocked(p_21016_)) { @@ -164,11 +148,8 @@ + if(ev.shieldTakesDamage()) this.hurtCurrentlyUsedShield(p_21017_); + f1 = ev.getBlockedDamage(); + p_21017_ -= ev.getBlockedDamage(); - if (!p_21016_.is(DamageTypeTags.IS_PROJECTILE)) { - Entity entity = p_21016_.getDirectEntity(); - if (entity instanceof LivingEntity livingentity) { -@@ -1119,7 +_,8 @@ - } + if (!p_21016_.is(DamageTypeTags.IS_PROJECTILE) && p_21016_.getDirectEntity() instanceof LivingEntity livingentity) { + this.blockUsingShield(livingentity); } - flag = true; @@ -177,19 +158,19 @@ } if (p_21016_.is(DamageTypeTags.IS_FREEZING) && this.getType().is(EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES)) { -@@ -1158,9 +_,9 @@ - if (entity1 instanceof Player player1) { +@@ -1184,9 +_,9 @@ + if (entity instanceof Player player1) { this.lastHurtByPlayerTime = 100; this.lastHurtByPlayer = player1; -- } else if (entity1 instanceof Wolf wolf && wolf.isTame()) { -+ } else if (entity1 instanceof TamableAnimal tamableAnimal && tamableAnimal.isTame()) { +- } else if (entity instanceof Wolf wolf && wolf.isTame()) { ++ } else if (entity instanceof TamableAnimal tamableAnimal && tamableAnimal.isTame()) { this.lastHurtByPlayerTime = 100; -- LivingEntity livingentity2 = wolf.getOwner(); -+ LivingEntity livingentity2 = tamableAnimal.getOwner(); - if (livingentity2 instanceof Player player) { +- if (wolf.getOwner() instanceof Player player) { ++ if (tamableAnimal.getOwner() instanceof Player player) { this.lastHurtByPlayer = player; } else { -@@ -1217,7 +_,7 @@ + this.lastHurtByPlayer = null; +@@ -1245,7 +_,7 @@ if (this instanceof ServerPlayer) { CriteriaTriggers.ENTITY_HURT_PLAYER.trigger((ServerPlayer)this, p_21016_, f, p_21017_, flag); if (f1 > 0.0F && f1 < 3.4028235E37F) { @@ -198,16 +179,16 @@ } } -@@ -1245,7 +_,7 @@ +@@ -1273,7 +_,7 @@ - for(InteractionHand interactionhand : InteractionHand.values()) { + for (InteractionHand interactionhand : InteractionHand.values()) { ItemStack itemstack1 = this.getItemInHand(interactionhand); - if (itemstack1.is(Items.TOTEM_OF_UNDYING)) { + if (itemstack1.is(Items.TOTEM_OF_UNDYING) && net.neoforged.neoforge.common.CommonHooks.onLivingUseTotem(this, p_21263_, itemstack1, interactionhand)) { itemstack = itemstack1.copy(); itemstack1.shrink(1); break; -@@ -1254,13 +_,13 @@ +@@ -1282,13 +_,13 @@ if (itemstack != null) { if (this instanceof ServerPlayer serverplayer) { @@ -223,7 +204,7 @@ this.addEffect(new MobEffectInstance(MobEffects.REGENERATION, 900, 1)); this.addEffect(new MobEffectInstance(MobEffects.ABSORPTION, 100, 1)); this.addEffect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 800, 0)); -@@ -1328,6 +_,7 @@ +@@ -1359,6 +_,7 @@ } public void die(DamageSource p_21014_) { @@ -231,7 +212,7 @@ if (!this.isRemoved() && !this.dead) { Entity entity = p_21014_.getEntity(); LivingEntity livingentity = this.getKillCredit(); -@@ -1364,7 +_,7 @@ +@@ -1394,7 +_,7 @@ if (!this.level().isClientSide) { boolean flag = false; if (p_21269_ instanceof WitherBoss) { @@ -240,7 +221,7 @@ BlockPos blockpos = this.blockPosition(); BlockState blockstate = Blocks.WITHER_ROSE.defaultBlockState(); if (this.level().getBlockState(blockpos).isAir() && blockstate.canSurvive(this.level(), blockpos)) { -@@ -1383,12 +_,9 @@ +@@ -1413,12 +_,9 @@ protected void dropAllDeathLoot(DamageSource p_21192_) { Entity entity = p_21192_.getEntity(); @@ -256,7 +237,7 @@ boolean flag = this.lastHurtByPlayerTime > 0; if (this.shouldDropLoot() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { -@@ -1398,6 +_,10 @@ +@@ -1428,6 +_,10 @@ this.dropEquipment(); this.dropExperience(); @@ -267,7 +248,7 @@ } protected void dropEquipment() { -@@ -1410,7 +_,8 @@ +@@ -1440,7 +_,8 @@ this.isAlwaysExperienceDropper() || this.lastHurtByPlayerTime > 0 && this.shouldDropExperience() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT) )) { @@ -277,7 +258,7 @@ } } -@@ -1444,6 +_,11 @@ +@@ -1474,6 +_,11 @@ } public void knockback(double p_147241_, double p_147242_, double p_147243_) { @@ -289,10 +270,10 @@ p_147241_ *= 1.0 - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE); if (!(p_147241_ <= 0.0)) { this.hasImpulse = true; -@@ -1515,15 +_,9 @@ +@@ -1545,15 +_,9 @@ } else { BlockPos blockpos = this.blockPosition(); - BlockState blockstate = this.getFeetBlockState(); + BlockState blockstate = this.getInBlockState(); - if (blockstate.is(BlockTags.CLIMBABLE)) { - this.lastClimbablePos = Optional.of(blockpos); - return true; @@ -308,7 +289,7 @@ } } -@@ -1545,6 +_,11 @@ +@@ -1584,6 +_,11 @@ @Override public boolean causeFallDamage(float p_147187_, float p_147188_, DamageSource p_147189_) { @@ -320,7 +301,7 @@ boolean flag = super.causeFallDamage(p_147187_, p_147188_, p_147189_); int i = this.calculateFallDamage(p_147187_, p_147188_); if (i > 0) { -@@ -1572,9 +_,10 @@ +@@ -1611,9 +_,10 @@ int i = Mth.floor(this.getX()); int j = Mth.floor(this.getY() - 0.2F); int k = Mth.floor(this.getZ()); @@ -333,7 +314,7 @@ this.playSound(soundtype.getFallSound(), soundtype.getVolume() * 0.5F, soundtype.getPitch() * 0.75F); } } -@@ -1621,9 +_,9 @@ +@@ -1675,9 +_,9 @@ float f2 = f1 - p_21194_; if (f2 > 0.0F && f2 < 3.4028235E37F) { if (this instanceof ServerPlayer) { @@ -345,7 +326,7 @@ } } } -@@ -1645,6 +_,8 @@ +@@ -1699,6 +_,8 @@ protected void actuallyHurt(DamageSource p_21240_, float p_21241_) { if (!this.isInvulnerableTo(p_21240_)) { @@ -354,15 +335,15 @@ p_21241_ = this.getDamageAfterArmorAbsorb(p_21240_, p_21241_); p_21241_ = this.getDamageAfterMagicAbsorb(p_21240_, p_21241_); float f1 = Math.max(p_21241_ - this.getAbsorptionAmount(), 0.0F); -@@ -1657,6 +_,7 @@ - } +@@ -1708,6 +_,7 @@ + serverplayer.awardStat(Stats.DAMAGE_DEALT_ABSORBED, Math.round(f * 10.0F)); } + f1 = net.neoforged.neoforge.common.CommonHooks.onLivingDamage(this, p_21240_, f1); if (f1 != 0.0F) { this.getCombatTracker().recordDamage(p_21240_, f1); this.setHealth(this.getHealth() - f1); -@@ -1716,6 +_,8 @@ +@@ -1767,6 +_,8 @@ } public void swing(InteractionHand p_21012_, boolean p_21013_) { @@ -371,7 +352,7 @@ if (!this.swinging || this.swingTime >= this.getCurrentSwingDuration() / 2 || this.swingTime < 0) { this.swingTime = -1; this.swinging = true; -@@ -1825,8 +_,10 @@ +@@ -1879,8 +_,10 @@ private void swapHandItems() { ItemStack itemstack = this.getItemBySlot(EquipmentSlot.OFFHAND); @@ -384,11 +365,12 @@ } @Override -@@ -2018,14 +_,17 @@ - } +@@ -2077,15 +_,18 @@ + } - this.hasImpulse = true; -+ net.neoforged.neoforge.common.CommonHooks.onLivingJump(this); + this.hasImpulse = true; ++ net.neoforged.neoforge.common.CommonHooks.onLivingJump(this); + } } + @Deprecated // FORGE: use sinkInFluid instead @@ -400,23 +382,12 @@ + @Deprecated // FORGE: use jumpInFluid instead protected void jumpInLiquid(TagKey p_204043_) { - this.setDeltaMovement(this.getDeltaMovement().add(0.0, 0.04F, 0.0)); -+ this.setDeltaMovement(this.getDeltaMovement().add(0.0D, (double)0.04F * this.getAttribute(net.neoforged.neoforge.common.NeoForgeMod.SWIM_SPEED.value()).getValue(), 0.0D)); ++ this.setDeltaMovement(this.getDeltaMovement().add(0.0D, (double)0.04F * this.getAttributeValue(net.neoforged.neoforge.common.NeoForgeMod.SWIM_SPEED), 0.0D)); } protected float getWaterSlowDown() { -@@ -2039,13 +_,18 @@ - public void travel(Vec3 p_21280_) { - if (this.isControlledByLocalInstance()) { - double d0 = 0.08; -+ AttributeInstance gravity = this.getAttribute(net.neoforged.neoforge.common.NeoForgeMod.ENTITY_GRAVITY.value()); - boolean flag = this.getDeltaMovement().y <= 0.0; - if (flag && this.hasEffect(MobEffects.SLOW_FALLING)) { -- d0 = 0.01; -+ if (!gravity.hasModifier(SLOW_FALLING)) gravity.addTransientModifier(SLOW_FALLING); -+ } else if (gravity.hasModifier(SLOW_FALLING)) { -+ gravity.removeModifier(SLOW_FALLING_ID); +@@ -2110,7 +_,8 @@ } -+ d0 = gravity.getValue(); FluidState fluidstate = this.level().getFluidState(this.blockPosition()); - if (this.isInWater() && this.isAffectedByFluids() && !this.canStandOnFluid(fluidstate)) { @@ -425,15 +396,15 @@ double d9 = this.getY(); float f4 = this.isSprinting() ? 0.9F : this.getWaterSlowDown(); float f5 = 0.02F; -@@ -2067,6 +_,7 @@ +@@ -2132,6 +_,7 @@ f4 = 0.96F; } -+ f5 *= (float)this.getAttribute(net.neoforged.neoforge.common.NeoForgeMod.SWIM_SPEED.value()).getValue(); ++ f5 *= (float)this.getAttributeValue(net.neoforged.neoforge.common.NeoForgeMod.SWIM_SPEED); this.moveRelative(f5, p_21280_); this.move(MoverType.SELF, this.getDeltaMovement()); Vec3 vec36 = this.getDeltaMovement(); -@@ -2080,6 +_,7 @@ +@@ -2145,6 +_,7 @@ if (this.horizontalCollision && this.isFree(vec32.x, vec32.y + 0.6F - this.getY() + d9, vec32.z)) { this.setDeltaMovement(vec32.x, 0.3F, vec32.z); } @@ -441,7 +412,7 @@ } else if (this.isInLava() && this.isAffectedByFluids() && !this.canStandOnFluid(fluidstate)) { double d8 = this.getY(); this.moveRelative(0.02F, p_21280_); -@@ -2142,7 +_,7 @@ +@@ -2207,7 +_,7 @@ } } else { BlockPos blockpos = this.getBlockPosBelowThatAffectsMyMovement(); @@ -450,32 +421,24 @@ float f3 = this.onGround() ? f2 * 0.91F : 0.91F; Vec3 vec35 = this.handleRelativeFrictionAndCalculateMovement(p_21280_, f2); double d2 = vec35.y; -@@ -2238,7 +_,7 @@ +@@ -2301,7 +_,7 @@ double d0 = Mth.clamp(p_21298_.x, -0.15F, 0.15F); double d1 = Mth.clamp(p_21298_.z, -0.15F, 0.15F); double d2 = Math.max(p_21298_.y, -0.15F); -- if (d2 < 0.0 && !this.getFeetBlockState().is(Blocks.SCAFFOLDING) && this.isSuppressingSlidingDownLadder() && this instanceof Player) { -+ if (d2 < 0.0D && !this.getFeetBlockState().isScaffolding(this) && this.isSuppressingSlidingDownLadder() && this instanceof Player) { +- if (d2 < 0.0 && !this.getInBlockState().is(Blocks.SCAFFOLDING) && this.isSuppressingSlidingDownLadder() && this instanceof Player) { ++ if (d2 < 0.0D && !this.getInBlockState().isScaffolding(this) && this.isSuppressingSlidingDownLadder() && this instanceof Player) { d2 = 0.0; } -@@ -2271,6 +_,7 @@ - - @Override - public void tick() { -+ if (net.neoforged.neoforge.common.CommonHooks.onLivingTick(this)) return; - super.tick(); - this.updatingUsingItem(); - this.updateSwimAmount(); -@@ -2422,6 +_,7 @@ - +@@ -2483,6 +_,7 @@ + }; ItemStack itemstack1 = this.getItemBySlot(equipmentslot); if (this.equipmentHasChanged(itemstack, itemstack1)) { + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.entity.living.LivingEquipmentChangeEvent(this, equipmentslot, itemstack, itemstack1)); if (map == null) { map = Maps.newEnumMap(EquipmentSlot.class); } -@@ -2566,6 +_,9 @@ +@@ -2642,6 +_,9 @@ this.level().getProfiler().push("jump"); if (this.jumping && this.isAffectedByFluids()) { double d3; @@ -485,7 +448,7 @@ if (this.isInLava()) { d3 = this.getFluidHeight(FluidTags.LAVA); } else { -@@ -2576,15 +_,17 @@ +@@ -2652,15 +_,17 @@ double d4 = this.getFluidJumpThreshold(); if (!flag || this.onGround() && !(d3 > d4)) { if (!this.isInLava() || this.onGround() && !(d3 > d4)) { @@ -505,16 +468,16 @@ } } else { this.noJumpDelay = 0; -@@ -2650,6 +_,8 @@ +@@ -2725,6 +_,8 @@ boolean flag = this.getSharedFlag(7); if (flag && !this.onGround() && !this.isPassenger() && !this.hasEffect(MobEffects.LEVITATION)) { ItemStack itemstack = this.getItemBySlot(EquipmentSlot.CHEST); + flag = itemstack.canElytraFly(this) && itemstack.elytraFlightTick(this, this.fallFlyTicks); -+ if (false) //Forge: Moved to ElytraItem ++ if (false) //Neo: Moved to ElytraItem if (itemstack.is(Items.ELYTRA) && ElytraItem.isFlyEnabled(itemstack)) { flag = true; int i = this.fallFlyTicks + 1; -@@ -2910,8 +_,11 @@ +@@ -2982,8 +_,11 @@ private void updatingUsingItem() { if (this.isUsingItem()) { @@ -528,12 +491,12 @@ this.updateUsingItem(this.useItem); } else { this.stopUsingItem(); -@@ -2920,19 +_,22 @@ +@@ -2992,12 +_,15 @@ } protected void updateUsingItem(ItemStack p_147201_) { + if (!p_147201_.isEmpty()) -+ this.useItemRemaining = net.neoforged.neoforge.event.EventHooks.onItemUseTick(this, p_147201_, this.getUseItemRemainingTicks()); ++ this.useItemRemaining = net.neoforged.neoforge.event.EventHooks.onItemUseTick(this, p_147201_, this.getUseItemRemainingTicks()); + if (this.getUseItemRemainingTicks() > 0) p_147201_.onUseTick(this.level(), this, this.getUseItemRemainingTicks()); if (this.shouldTriggerItemUseEffects()) { @@ -545,15 +508,7 @@ this.completeUsingItem(); } } - - private boolean shouldTriggerItemUseEffects() { - int i = this.getUseItemRemainingTicks(); -- FoodProperties foodproperties = this.useItem.getItem().getFoodProperties(); -+ FoodProperties foodproperties = this.useItem.getFoodProperties(this); - boolean flag = foodproperties != null && foodproperties.isFastFood(); - flag |= i <= this.useItem.getUseDuration() - 7; - return flag && i % 4 == 0; -@@ -2961,8 +_,10 @@ +@@ -3032,8 +_,10 @@ public void startUsingItem(InteractionHand p_21159_) { ItemStack itemstack = this.getItemInHand(p_21159_); if (!itemstack.isEmpty() && !this.isUsingItem()) { @@ -565,7 +520,7 @@ if (!this.level().isClientSide) { this.setLivingEntityFlag(1, true); this.setLivingEntityFlag(2, p_21159_ == InteractionHand.OFF_HAND); -@@ -3038,7 +_,8 @@ +@@ -3109,7 +_,8 @@ } else { if (!this.useItem.isEmpty() && this.isUsingItem()) { this.triggerItemUseEffects(this.useItem, 16); @@ -575,7 +530,7 @@ if (itemstack != this.useItem) { this.setItemInHand(interactionhand, itemstack); } -@@ -3063,7 +_,11 @@ +@@ -3134,7 +_,11 @@ public void releaseUsingItem() { if (!this.useItem.isEmpty()) { @@ -587,7 +542,7 @@ if (this.useItem.useOnRelease()) { this.updatingUsingItem(); } -@@ -3073,6 +_,7 @@ +@@ -3144,6 +_,7 @@ } public void stopUsingItem() { @@ -595,16 +550,16 @@ if (!this.level().isClientSide) { boolean flag = this.isUsingItem(); this.setLivingEntityFlag(1, false); -@@ -3088,7 +_,7 @@ +@@ -3159,7 +_,7 @@ public boolean isBlocking() { if (this.isUsingItem() && !this.useItem.isEmpty()) { Item item = this.useItem.getItem(); -- if (item.getUseAnimation(this.useItem) != UseAnim.BLOCK) { -+ if (!this.useItem.canPerformAction(net.neoforged.neoforge.common.ToolActions.SHIELD_BLOCK)) { - return false; - } else { - return item.getUseDuration(this.useItem) - this.useItemRemaining >= 5; -@@ -3229,8 +_,8 @@ +- return item.getUseAnimation(this.useItem) != UseAnim.BLOCK ? false : item.getUseDuration(this.useItem) - this.useItemRemaining >= 5; ++ return !this.useItem.canPerformAction(net.neoforged.neoforge.common.ToolActions.SHIELD_BLOCK) ? false : item.getUseDuration(this.useItem) - this.useItemRemaining >= 5; + } else { + return false; + } +@@ -3300,8 +_,8 @@ } BlockState blockstate = this.level().getBlockState(p_21141_); @@ -615,11 +570,11 @@ } this.setPose(Pose.SLEEPING); -@@ -3245,15 +_,17 @@ +@@ -3316,15 +_,17 @@ } private boolean checkBedExists() { -- return this.getSleepingPos().map(p_311581_ -> this.level().getBlockState(p_311581_).getBlock() instanceof BedBlock).orElse(false); +- return this.getSleepingPos().map(p_337701_ -> this.level().getBlockState(p_337701_).getBlock() instanceof BedBlock).orElse(false); + return this.getSleepingPos().map((p_289310_) -> { + return net.neoforged.neoforge.event.EventHooks.fireSleepingLocationCheck(this, p_289310_); + }).orElse(false); @@ -636,7 +591,7 @@ Vec3 vec31 = BedBlock.findStandUpPosition(this.getType(), this.level(), p_261435_, direction, this.getYRot()).orElseGet(() -> { BlockPos blockpos = p_261435_.above(); return new Vec3((double)blockpos.getX() + 0.5, (double)blockpos.getY() + 0.1, (double)blockpos.getZ() + 0.5); -@@ -3274,7 +_,9 @@ +@@ -3345,7 +_,9 @@ @Nullable public Direction getBedOrientation() { BlockPos blockpos = this.getSleepingPos().orElse(null); @@ -647,7 +602,7 @@ } @Override -@@ -3292,7 +_,7 @@ +@@ -3354,11 +_,11 @@ } public ItemStack getProjectile(ItemStack p_21272_) { @@ -656,17 +611,13 @@ } public ItemStack eat(Level p_21067_, ItemStack p_21068_) { -@@ -3321,7 +_,7 @@ - private void addEatEffect(ItemStack p_21064_, Level p_21065_, LivingEntity p_21066_) { - Item item = p_21064_.getItem(); - if (item.isEdible()) { -- for(Pair pair : item.getFoodProperties().getEffects()) { -+ for(Pair pair : p_21064_.getFoodProperties(this).getEffects()) { - if (!p_21065_.isClientSide && pair.getFirst() != null && p_21065_.random.nextFloat() < pair.getSecond()) { - p_21066_.addEffect(new MobEffectInstance(pair.getFirst())); - } -@@ -3356,6 +_,39 @@ - this.broadcastBreakEvent(p_21191_ == InteractionHand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND); +- FoodProperties foodproperties = p_21068_.get(DataComponents.FOOD); ++ FoodProperties foodproperties = p_21068_.getFoodProperties(this); + if (foodproperties != null) { + p_21067_.playSound( + null, +@@ -3408,6 +_,39 @@ + return p_320526_ == InteractionHand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND; } + /* ==== FORGE START ==== */ @@ -705,7 +656,7 @@ @Override public AABB getBoundingBoxForCulling() { if (this.getItemBySlot(EquipmentSlot.HEAD).is(Items.DRAGON_HEAD)) { -@@ -3367,6 +_,8 @@ +@@ -3419,6 +_,8 @@ } public static EquipmentSlot getEquipmentSlotForItem(ItemStack p_147234_) { @@ -714,7 +665,7 @@ Equipable equipable = Equipable.get(p_147234_); return equipable != null ? equipable.getEquipmentSlot() : EquipmentSlot.MAINHAND; } -@@ -3442,9 +_,14 @@ +@@ -3497,7 +_,7 @@ } public boolean canDisableShield() { @@ -722,11 +673,4 @@ + return this.getMainHandItem().canDisableShield(this.useItem, this, this); } -+ /** -+ * Gets the value of the legacy {@link #maxUpStep} field. -+ * @deprecated Use {@link #getStepHeight()} to get the real step height value. -+ */ -+ @Deprecated @Override - public float maxUpStep() { - float f = super.maxUpStep(); diff --git a/patches/net/minecraft/world/entity/Mob.java.patch b/patches/net/minecraft/world/entity/Mob.java.patch index d8af2cb3cad..5017452ac68 100644 --- a/patches/net/minecraft/world/entity/Mob.java.patch +++ b/patches/net/minecraft/world/entity/Mob.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java -@@ -118,6 +_,9 @@ - private CompoundTag leashInfoTag; +@@ -133,6 +_,9 @@ + private Either delayedLeashInfo; private BlockPos restrictCenter = BlockPos.ZERO; private float restrictRadius = -1.0F; + @Nullable @@ -10,7 +10,7 @@ protected Mob(EntityType p_21368_, Level p_21369_) { super(p_21368_, p_21369_); -@@ -221,7 +_,10 @@ +@@ -239,7 +_,10 @@ } public void setTarget(@Nullable LivingEntity p_21544_) { @@ -22,7 +22,20 @@ } @Override -@@ -424,6 +_,9 @@ +@@ -351,6 +_,12 @@ + this.updateControlFlags(); + } + } ++ ++ // Neo: Animal armor tick patch ++ if (this.canWearBodyArmor()) { ++ ItemStack stack = this.getBodyArmorItem(); ++ if (isBodyArmorItem(stack)) stack.onAnimalArmorTick(level(), this); ++ } + } + + protected void updateControlFlags() { +@@ -444,6 +_,9 @@ if (this.isNoAi()) { p_21484_.putBoolean("NoAI", this.isNoAi()); } @@ -32,7 +45,7 @@ } @Override -@@ -477,6 +_,14 @@ +@@ -510,6 +_,14 @@ } this.setNoAi(p_21450_.getBoolean("NoAI")); @@ -47,7 +60,7 @@ } @Override -@@ -525,7 +_,7 @@ +@@ -565,7 +_,7 @@ && this.canPickUpLoot() && this.isAlive() && !this.dead @@ -55,8 +68,8 @@ + && net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(this.level(), this)) { Vec3i vec3i = this.getPickupReach(); - for(ItemEntity itementity : this.level() -@@ -698,6 +_,14 @@ + for (ItemEntity itementity : this.level() +@@ -736,6 +_,14 @@ this.discard(); } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) { Entity entity = this.level().getNearestPlayer(this, -1.0); @@ -71,7 +84,7 @@ if (entity != null) { double d0 = entity.distanceToSqr(this); int i = this.getType().getCategory().getDespawnDistance(); -@@ -1031,6 +_,16 @@ +@@ -1135,6 +_,14 @@ } } @@ -80,23 +93,21 @@ + * Overrides are allowed. Do not wrap super calls within override (as that will cause stack overflows).
+ * Vanilla calls are replaced with a transformer, and are not visible in source.
+ *

-+ * Be certain to either call super.finalizeSpawn or set the {@link #spawnType} field from within your override. -+ * @see {@link net.neoforged.neoforge.event.EventHooks#onFinalizeSpawn onFinalizeSpawn} for additional documentation. + */ + @Deprecated + @org.jetbrains.annotations.ApiStatus.OverrideOnly @Nullable - public SpawnGroupData finalizeSpawn( - ServerLevelAccessor p_21434_, DifficultyInstance p_21435_, MobSpawnType p_21436_, @Nullable SpawnGroupData p_21437_, @Nullable CompoundTag p_21438_ -@@ -1046,6 +_,7 @@ - this.setLeftHanded(false); - } - + public SpawnGroupData finalizeSpawn(ServerLevelAccessor p_21434_, DifficultyInstance p_21435_, MobSpawnType p_21436_, @Nullable SpawnGroupData p_21437_) { + RandomSource randomsource = p_21434_.getRandom(); +@@ -1143,6 +_,7 @@ + new AttributeModifier("Random spawn bonus", randomsource.triangle(0.0, 0.11485000000000001), AttributeModifier.Operation.ADD_MULTIPLIED_BASE) + ); + this.setLeftHanded(randomsource.nextFloat() < 0.05F); + this.spawnType = p_21436_; return p_21437_; } -@@ -1442,14 +_,24 @@ +@@ -1530,14 +_,24 @@ } @Override @@ -122,7 +133,7 @@ @VisibleForTesting public void removeFreeWill() { this.removeAllGoals(p_262562_ -> true); -@@ -1476,5 +_,40 @@ +@@ -1564,5 +_,40 @@ public ItemStack getPickResult() { SpawnEggItem spawneggitem = SpawnEggItem.byId(this.getType()); return spawneggitem == null ? null : new ItemStack(spawneggitem); diff --git a/patches/net/minecraft/world/entity/SpawnPlacements.java.patch b/patches/net/minecraft/world/entity/SpawnPlacements.java.patch index afb0d27ae9c..95abc9f52c9 100644 --- a/patches/net/minecraft/world/entity/SpawnPlacements.java.patch +++ b/patches/net/minecraft/world/entity/SpawnPlacements.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/entity/SpawnPlacements.java +++ b/net/minecraft/world/entity/SpawnPlacements.java -@@ -45,6 +_,7 @@ +@@ -47,6 +_,7 @@ private static final Map, SpawnPlacements.Data> DATA_BY_TYPE = Maps.newHashMap(); - public static void register( + private static void register( + @Deprecated // FORGE: use SpawnPlacementRegisterEvent to register and modify spawn placements - EntityType p_21755_, SpawnPlacements.Type p_21756_, Heightmap.Types p_21757_, SpawnPlacements.SpawnPredicate p_21758_ + EntityType p_21755_, SpawnPlacementType p_321847_, Heightmap.Types p_21757_, SpawnPlacements.SpawnPredicate p_21758_ ) { - SpawnPlacements.Data spawnplacements$data = DATA_BY_TYPE.put(p_21755_, new SpawnPlacements.Data(p_21757_, p_21756_, p_21758_)); -@@ -67,7 +_,8 @@ + SpawnPlacements.Data spawnplacements$data = DATA_BY_TYPE.put(p_21755_, new SpawnPlacements.Data(p_21757_, p_321847_, p_21758_)); +@@ -73,7 +_,8 @@ EntityType p_217075_, ServerLevelAccessor p_217076_, MobSpawnType p_217077_, BlockPos p_217078_, RandomSource p_217079_ ) { SpawnPlacements.Data spawnplacements$data = DATA_BY_TYPE.get(p_217075_); @@ -18,32 +18,10 @@ } static { -@@ -173,10 +_,35 @@ +@@ -168,5 +_,14 @@ + @FunctionalInterface + public interface SpawnPredicate { boolean test(EntityType p_217081_, ServerLevelAccessor p_217082_, MobSpawnType p_217083_, BlockPos p_217084_, RandomSource p_217085_); - } - -- public static enum Type { -+ public static enum Type implements net.neoforged.neoforge.common.IExtensibleEnum { - ON_GROUND, - IN_WATER, - NO_RESTRICTIONS, - IN_LAVA; -+ -+ public static Type create(String name, net.neoforged.neoforge.common.util.TriPredicate> predicate) { -+ throw new IllegalStateException("Enum not extended"); -+ } -+ -+ private net.neoforged.neoforge.common.util.TriPredicate> predicate; -+ private Type() { this(null); } -+ private Type(net.neoforged.neoforge.common.util.TriPredicate> predicate) { -+ this.predicate = predicate; -+ } -+ -+ public boolean canSpawnAt(net.minecraft.world.level.LevelReader world, BlockPos pos, EntityType type) { -+ if (this == NO_RESTRICTIONS) return true; -+ if (predicate == null) return net.minecraft.world.level.NaturalSpawner.canSpawnAtBody(this, world, pos, type); -+ return predicate.test(world, pos, type); -+ } + } + + // ******* FORGE START. INTERNAL USE ONLY! ****** // @@ -51,7 +29,7 @@ + { + Map, net.neoforged.neoforge.event.entity.SpawnPlacementRegisterEvent.MergedSpawnPredicate> map = Maps.newHashMap(); + DATA_BY_TYPE.forEach((type, data) -> map.put(type, new net.neoforged.neoforge.event.entity.SpawnPlacementRegisterEvent.MergedSpawnPredicate<>(data.predicate, data.placement, data.heightMap))); -+ net.neoforged.fml.ModLoader.get().postEvent(new net.neoforged.neoforge.event.entity.SpawnPlacementRegisterEvent(map)); ++ net.neoforged.fml.ModLoader.postEvent(new net.neoforged.neoforge.event.entity.SpawnPlacementRegisterEvent(map)); + map.forEach(((entityType, merged) -> DATA_BY_TYPE.put(entityType, new SpawnPlacements.Data(merged.getHeightmapType(), merged.getSpawnType(), merged.build())))); } } diff --git a/patches/net/minecraft/world/entity/TamableAnimal.java.patch b/patches/net/minecraft/world/entity/TamableAnimal.java.patch index b7554d2bd2c..bb25362bc18 100644 --- a/patches/net/minecraft/world/entity/TamableAnimal.java.patch +++ b/patches/net/minecraft/world/entity/TamableAnimal.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/TamableAnimal.java +++ b/net/minecraft/world/entity/TamableAnimal.java -@@ -194,11 +_,15 @@ +@@ -195,11 +_,15 @@ @Override public void die(DamageSource p_21809_) { diff --git a/patches/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java.patch b/patches/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java.patch index 752fc797501..f60c40d4622 100644 --- a/patches/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java.patch +++ b/patches/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java.patch @@ -1,8 +1,11 @@ --- a/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java +++ b/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java -@@ -69,6 +_,22 @@ +@@ -66,8 +_,24 @@ + } + public static class Builder { - private final Map builder = Maps.newHashMap(); +- private final ImmutableMap.Builder, AttributeInstance> builder = ImmutableMap.builder(); ++ private final Map, AttributeInstance> builder = new java.util.HashMap<>(); private boolean instanceFrozen; + private final java.util.List others = new java.util.ArrayList<>(); + @@ -17,17 +20,19 @@ + others.add(other); + } + -+ public boolean hasAttribute(Attribute attribute) { ++ public boolean hasAttribute(Holder attribute) { + return this.builder.containsKey(attribute); + } - private AttributeInstance create(Attribute p_22275_) { - AttributeInstance attributeinstance = new AttributeInstance( -@@ -98,6 +_,7 @@ + private AttributeInstance create(Holder p_316369_) { + AttributeInstance attributeinstance = new AttributeInstance(p_316369_, p_315942_ -> { +@@ -92,7 +_,8 @@ public AttributeSupplier build() { this.instanceFrozen = true; +- return new AttributeSupplier(this.builder.buildKeepingLast()); + others.forEach(b -> b.instanceFrozen = true); - return new AttributeSupplier(this.builder); ++ return new AttributeSupplier(ImmutableMap.copyOf(this.builder)); } } + } diff --git a/patches/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch b/patches/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch index 27fcb34f03a..6497c6493e5 100644 --- a/patches/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch +++ b/patches/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java +++ b/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java -@@ -170,11 +_,12 @@ +@@ -174,11 +_,12 @@ .build(); public static AttributeSupplier getSupplier(EntityType p_22298_) { diff --git a/patches/net/minecraft/world/entity/ai/behavior/CrossbowAttack.java.patch b/patches/net/minecraft/world/entity/ai/behavior/CrossbowAttack.java.patch index dd1c5af6a47..a42fc22694e 100644 --- a/patches/net/minecraft/world/entity/ai/behavior/CrossbowAttack.java.patch +++ b/patches/net/minecraft/world/entity/ai/behavior/CrossbowAttack.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/behavior/CrossbowAttack.java +++ b/net/minecraft/world/entity/ai/behavior/CrossbowAttack.java -@@ -23,7 +_,7 @@ +@@ -25,7 +_,7 @@ protected boolean checkExtraStartConditions(ServerLevel p_22778_, E p_22779_) { LivingEntity livingentity = getAttackTarget(p_22779_); @@ -9,16 +9,16 @@ && BehaviorUtils.canSee(p_22779_, livingentity) && BehaviorUtils.isWithinAttackRange(p_22779_, livingentity, 0); } -@@ -43,7 +_,7 @@ +@@ -45,7 +_,7 @@ p_22806_.stopUsingItem(); } - if (p_22806_.isHolding(Items.CROSSBOW)) { + if (p_22806_.isHolding(is -> is.getItem() instanceof CrossbowItem)) { p_22806_.setChargingCrossbow(false); - CrossbowItem.setCharged(p_22806_.getUseItem(), false); + p_22806_.getUseItem().set(DataComponents.CHARGED_PROJECTILES, ChargedProjectiles.EMPTY); } -@@ -51,7 +_,7 @@ +@@ -53,7 +_,7 @@ private void crossbowAttack(E p_22787_, LivingEntity p_22788_) { if (this.crossbowState == CrossbowAttack.CrossbowState.UNCHARGED) { @@ -27,12 +27,3 @@ this.crossbowState = CrossbowAttack.CrossbowState.CHARGING; p_22787_.setChargingCrossbow(true); } else if (this.crossbowState == CrossbowAttack.CrossbowState.CHARGING) { -@@ -74,7 +_,7 @@ - } - } else if (this.crossbowState == CrossbowAttack.CrossbowState.READY_TO_ATTACK) { - p_22787_.performRangedAttack(p_22788_, 1.0F); -- ItemStack itemstack1 = p_22787_.getItemInHand(ProjectileUtil.getWeaponHoldingHand(p_22787_, Items.CROSSBOW)); -+ ItemStack itemstack1 = p_22787_.getItemInHand(ProjectileUtil.getWeaponHoldingHand(p_22787_, item -> item instanceof CrossbowItem)); - CrossbowItem.setCharged(itemstack1, false); - this.crossbowState = CrossbowAttack.CrossbowState.UNCHARGED; - } diff --git a/patches/net/minecraft/world/entity/ai/behavior/GiveGiftToHero.java.patch b/patches/net/minecraft/world/entity/ai/behavior/GiveGiftToHero.java.patch index 13bf8f819e7..dfe2740ab3a 100644 --- a/patches/net/minecraft/world/entity/ai/behavior/GiveGiftToHero.java.patch +++ b/patches/net/minecraft/world/entity/ai/behavior/GiveGiftToHero.java.patch @@ -1,25 +1,24 @@ --- a/net/minecraft/world/entity/ai/behavior/GiveGiftToHero.java +++ b/net/minecraft/world/entity/ai/behavior/GiveGiftToHero.java -@@ -31,6 +_,7 @@ +@@ -31,6 +_,8 @@ private static final int MIN_TIME_BETWEEN_GIFTS = 600; private static final int MAX_TIME_BETWEEN_GIFTS = 6600; private static final int TIME_TO_DELAY_FOR_HEAD_TO_FINISH_TURNING = 20; + /** @deprecated Neo: use the {@link net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps#RAID_HERO_GIFTS data map} instead */ - private static final Map GIFTS = Util.make(Maps.newHashMap(), p_23020_ -> { ++ @Deprecated + private static final Map> GIFTS = Util.make(Maps.newHashMap(), p_23020_ -> { p_23020_.put(VillagerProfession.ARMORER, BuiltInLootTables.ARMORER_GIFT); p_23020_.put(VillagerProfession.BUTCHER, BuiltInLootTables.BUTCHER_GIFT); -@@ -121,8 +_,14 @@ +@@ -121,8 +_,12 @@ return ImmutableList.of(new ItemStack(Items.POPPY)); } else { VillagerProfession villagerprofession = p_23010_.getVillagerData().getProfession(); - if (GIFTS.containsKey(villagerprofession)) { -- LootTable loottable = p_23010_.level().getServer().getLootData().getLootTable(GIFTS.get(villagerprofession)); +- LootTable loottable = p_23010_.level().getServer().reloadableRegistries().getLootTable(GIFTS.get(villagerprofession)); + LootTable loottable = null; + var gift = net.minecraft.core.registries.BuiltInRegistries.VILLAGER_PROFESSION.wrapAsHolder(villagerprofession).getData(net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps.RAID_HERO_GIFTS); + if (gift != null) { -+ loottable = p_23010_.level().getServer().getLootData().getLootTable(gift.lootTable()); -+ } else if (GIFTS.containsKey(villagerprofession)) { -+ loottable = p_23010_.level().getServer().getLootData().getLootTable(GIFTS.get(villagerprofession)); ++ loottable = p_23010_.level().getServer().reloadableRegistries().getLootTable(gift.lootTable()); + } + if (loottable != null) { LootParams lootparams = new LootParams.Builder((ServerLevel)p_23010_.level()) diff --git a/patches/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch b/patches/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch index ceeb6019714..9a34ee81b6e 100644 --- a/patches/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch +++ b/patches/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java +++ b/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java -@@ -48,7 +_,7 @@ +@@ -47,7 +_,7 @@ } protected boolean checkExtraStartConditions(ServerLevel p_23174_, Villager p_23175_) { @@ -9,15 +9,15 @@ return false; } else if (p_23175_.getVillagerData().getProfession() != VillagerProfession.FARMER) { return false; -@@ -123,6 +_,11 @@ - p_23196_.setBlockAndUpdate(this.aboveFarmlandPos, blockstate1); - p_23196_.gameEvent(GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.Context.of(p_23197_, blockstate1)); - flag = true; -+ } else if (itemstack.getItem() instanceof net.neoforged.neoforge.common.IPlantable) { -+ if (((net.neoforged.neoforge.common.IPlantable)itemstack.getItem()).getPlantType(p_23196_, aboveFarmlandPos) == net.neoforged.neoforge.common.PlantType.CROP) { -+ p_23196_.setBlock(aboveFarmlandPos, ((net.neoforged.neoforge.common.IPlantable)itemstack.getItem()).getPlant(p_23196_, aboveFarmlandPos), 3); -+ flag = true; -+ } - } +@@ -120,6 +_,11 @@ + p_23196_.setBlockAndUpdate(this.aboveFarmlandPos, blockstate1); + p_23196_.gameEvent(GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.Context.of(p_23197_, blockstate1)); + flag = true; ++ } else if (itemstack.getItem() instanceof net.neoforged.neoforge.common.IPlantable) { ++ if (((net.neoforged.neoforge.common.IPlantable)itemstack.getItem()).getPlantType(p_23196_, aboveFarmlandPos) == net.neoforged.neoforge.common.PlantType.CROP) { ++ p_23196_.setBlock(aboveFarmlandPos, ((net.neoforged.neoforge.common.IPlantable)itemstack.getItem()).getPlant(p_23196_, aboveFarmlandPos), 3); ++ flag = true; ++ } } + if (flag) { diff --git a/patches/net/minecraft/world/entity/ai/behavior/StartAttacking.java.patch b/patches/net/minecraft/world/entity/ai/behavior/StartAttacking.java.patch index b5b51a46bce..abe3c40c8de 100644 --- a/patches/net/minecraft/world/entity/ai/behavior/StartAttacking.java.patch +++ b/patches/net/minecraft/world/entity/ai/behavior/StartAttacking.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/behavior/StartAttacking.java +++ b/net/minecraft/world/entity/ai/behavior/StartAttacking.java -@@ -32,7 +_,11 @@ +@@ -30,7 +_,11 @@ if (!p_258774_.canAttack(livingentity)) { return false; } else { diff --git a/patches/net/minecraft/world/entity/ai/behavior/Swim.java.patch b/patches/net/minecraft/world/entity/ai/behavior/Swim.java.patch index 6992d43d47b..b9fd7fcb35a 100644 --- a/patches/net/minecraft/world/entity/ai/behavior/Swim.java.patch +++ b/patches/net/minecraft/world/entity/ai/behavior/Swim.java.patch @@ -3,9 +3,9 @@ @@ -14,7 +_,7 @@ } - protected boolean checkExtraStartConditions(ServerLevel p_24388_, Mob p_24389_) { -- return p_24389_.isInWater() && p_24389_.getFluidHeight(FluidTags.WATER) > p_24389_.getFluidJumpThreshold() || p_24389_.isInLava(); -+ return p_24389_.isInWater() && p_24389_.getFluidHeight(FluidTags.WATER) > p_24389_.getFluidJumpThreshold() || p_24389_.isInLava() || p_24389_.isInFluidType((fluidType, height) -> p_24389_.canSwimInFluidType(fluidType) && height > p_24389_.getFluidJumpThreshold()); + public static boolean shouldSwim(Mob p_316787_) { +- return p_316787_.isInWater() && p_316787_.getFluidHeight(FluidTags.WATER) > p_316787_.getFluidJumpThreshold() || p_316787_.isInLava(); ++ return p_316787_.isInWater() && p_316787_.getFluidHeight(FluidTags.WATER) > p_316787_.getFluidJumpThreshold() || p_316787_.isInLava() || p_316787_.isInFluidType((fluidType, height) -> p_316787_.canSwimInFluidType(fluidType) && height > p_316787_.getFluidJumpThreshold()); } - protected boolean canStillUse(ServerLevel p_24391_, Mob p_24392_, long p_24393_) { + protected boolean checkExtraStartConditions(ServerLevel p_24388_, Mob p_24389_) { diff --git a/patches/net/minecraft/world/entity/ai/control/MoveControl.java.patch b/patches/net/minecraft/world/entity/ai/control/MoveControl.java.patch deleted file mode 100644 index f24b14bd34f..00000000000 --- a/patches/net/minecraft/world/entity/ai/control/MoveControl.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/entity/ai/control/MoveControl.java -+++ b/net/minecraft/world/entity/ai/control/MoveControl.java -@@ -98,7 +_,7 @@ - BlockPos blockpos = this.mob.blockPosition(); - BlockState blockstate = this.mob.level().getBlockState(blockpos); - VoxelShape voxelshape = blockstate.getCollisionShape(this.mob.level(), blockpos); -- if (d2 > (double)this.mob.maxUpStep() && d0 * d0 + d1 * d1 < (double)Math.max(1.0F, this.mob.getBbWidth()) -+ if (d2 > (double)this.mob.getStepHeight() && d0 * d0 + d1 * d1 < (double)Math.max(1.0F, this.mob.getBbWidth()) - || !voxelshape.isEmpty() - && this.mob.getY() < voxelshape.max(Direction.Axis.Y) + (double)blockpos.getY() - && !blockstate.is(BlockTags.DOORS) diff --git a/patches/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java.patch b/patches/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java.patch index 8a6f6deb0a6..a0d2d9d38fb 100644 --- a/patches/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java.patch +++ b/patches/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java +++ b/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java -@@ -31,7 +_,7 @@ - public boolean canUse() { +@@ -32,7 +_,7 @@ if (!super.canUse()) { return false; -- } else if (!this.mob.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { -+ } else if (!net.neoforged.neoforge.common.CommonHooks.canEntityDestroy(this.mob.level(), this.doorPos, this.mob)) { - return false; } else { - return this.isValidDifficulty(this.mob.level().getDifficulty()) && !this.isOpen(); +- return !this.mob.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ++ return !net.neoforged.neoforge.common.CommonHooks.canEntityDestroy(this.mob.level(), this.doorPos, this.mob) + ? false + : this.isValidDifficulty(this.mob.level().getDifficulty()) && !this.isOpen(); + } diff --git a/patches/net/minecraft/world/entity/ai/goal/EatBlockGoal.java.patch b/patches/net/minecraft/world/entity/ai/goal/EatBlockGoal.java.patch index 8cc3ffb6274..2d2ca4cab18 100644 --- a/patches/net/minecraft/world/entity/ai/goal/EatBlockGoal.java.patch +++ b/patches/net/minecraft/world/entity/ai/goal/EatBlockGoal.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/goal/EatBlockGoal.java +++ b/net/minecraft/world/entity/ai/goal/EatBlockGoal.java -@@ -65,7 +_,7 @@ +@@ -61,7 +_,7 @@ if (this.eatAnimationTick == this.adjustedTickDelay(4)) { BlockPos blockpos = this.mob.blockPosition(); if (IS_TALL_GRASS.test(this.level.getBlockState(blockpos))) { @@ -9,7 +9,7 @@ this.level.destroyBlock(blockpos, false); } -@@ -73,7 +_,7 @@ +@@ -69,7 +_,7 @@ } else { BlockPos blockpos1 = blockpos.below(); if (this.level.getBlockState(blockpos1).is(Blocks.GRASS_BLOCK)) { diff --git a/patches/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch b/patches/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch index 06193a16f9e..d8b844bdfe5 100644 --- a/patches/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch +++ b/patches/net/minecraft/world/entity/ai/goal/MeleeAttackGoal.java.patch @@ -23,9 +23,9 @@ + } + } this.path = this.mob.getNavigation().createPath(livingentity, 0); - if (this.path != null) { - return true; -@@ -110,6 +_,18 @@ + return this.path != null ? true : this.mob.isWithinMeleeAttackRange(livingentity); + } +@@ -106,6 +_,18 @@ this.pathedTargetZ = livingentity.getZ(); this.ticksUntilNextPathRecalculation = 4 + this.mob.getRandom().nextInt(7); double d0 = this.mob.distanceToSqr(livingentity); diff --git a/patches/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java.patch b/patches/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java.patch index 2d7c5136e54..d594680f757 100644 --- a/patches/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java.patch +++ b/patches/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java +++ b/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java -@@ -10,7 +_,7 @@ +@@ -9,7 +_,7 @@ import net.minecraft.world.item.BowItem; import net.minecraft.world.item.Items; @@ -9,7 +9,7 @@ private final T mob; private final double speedModifier; private int attackIntervalMin; -@@ -21,6 +_,10 @@ +@@ -20,6 +_,10 @@ private boolean strafingBackwards; private int strafingTime = -1; @@ -20,7 +20,7 @@ public RangedBowAttackGoal(T p_25792_, double p_25793_, int p_25794_, float p_25795_) { this.mob = p_25792_; this.speedModifier = p_25793_; -@@ -39,7 +_,7 @@ +@@ -38,7 +_,7 @@ } protected boolean isHoldingBow() { @@ -29,7 +29,7 @@ } @Override -@@ -134,7 +_,7 @@ +@@ -132,7 +_,7 @@ } } } else if (--this.attackTime <= 0 && this.seeTime >= -60) { diff --git a/patches/net/minecraft/world/entity/ai/goal/RangedCrossbowAttackGoal.java.patch b/patches/net/minecraft/world/entity/ai/goal/RangedCrossbowAttackGoal.java.patch index adabc953d25..13c3f325efd 100644 --- a/patches/net/minecraft/world/entity/ai/goal/RangedCrossbowAttackGoal.java.patch +++ b/patches/net/minecraft/world/entity/ai/goal/RangedCrossbowAttackGoal.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/entity/ai/goal/RangedCrossbowAttackGoal.java +++ b/net/minecraft/world/entity/ai/goal/RangedCrossbowAttackGoal.java -@@ -12,7 +_,7 @@ - import net.minecraft.world.item.ItemStack; +@@ -14,7 +_,7 @@ import net.minecraft.world.item.Items; + import net.minecraft.world.item.component.ChargedProjectiles; -public class RangedCrossbowAttackGoal extends Goal { +public class RangedCrossbowAttackGoal extends Goal { public static final UniformInt PATHFINDING_DELAY_RANGE = TimeUtil.rangeOfSeconds(1, 2); private final T mob; private RangedCrossbowAttackGoal.CrossbowState crossbowState = RangedCrossbowAttackGoal.CrossbowState.UNCHARGED; -@@ -22,6 +_,10 @@ +@@ -24,6 +_,10 @@ private int attackDelay; private int updatePathDelay; @@ -20,7 +20,7 @@ public RangedCrossbowAttackGoal(T p_25814_, double p_25815_, float p_25816_) { this.mob = p_25814_; this.speedModifier = p_25815_; -@@ -35,7 +_,7 @@ +@@ -37,7 +_,7 @@ } private boolean isHoldingCrossbow() { @@ -29,7 +29,7 @@ } @Override -@@ -97,7 +_,7 @@ +@@ -99,7 +_,7 @@ this.mob.getLookControl().setLookAt(livingentity, 30.0F, 30.0F); if (this.crossbowState == RangedCrossbowAttackGoal.CrossbowState.UNCHARGED) { if (!flag2) { @@ -38,12 +38,3 @@ this.crossbowState = RangedCrossbowAttackGoal.CrossbowState.CHARGING; this.mob.setChargingCrossbow(true); } -@@ -121,7 +_,7 @@ - } - } else if (this.crossbowState == RangedCrossbowAttackGoal.CrossbowState.READY_TO_ATTACK && flag) { - this.mob.performRangedAttack(livingentity, 1.0F); -- ItemStack itemstack1 = this.mob.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this.mob, Items.CROSSBOW)); -+ ItemStack itemstack1 = this.mob.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this.mob, item -> item instanceof CrossbowItem)); - CrossbowItem.setCharged(itemstack1, false); - this.crossbowState = RangedCrossbowAttackGoal.CrossbowState.UNCHARGED; - } diff --git a/patches/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java.patch b/patches/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java.patch index 165a3ee8954..e5945226c93 100644 --- a/patches/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java.patch +++ b/patches/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java.patch @@ -8,12 +8,14 @@ + if (!net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(this.removerMob.level(), this.removerMob)) { return false; } else if (this.nextStartTick > 0) { - --this.nextStartTick; -@@ -159,6 +_,7 @@ - if (chunkaccess == null) { - return false; - } else { -+ if (!chunkaccess.getBlockState(p_25851_).canEntityDestroy(p_25850_, p_25851_, this.removerMob)) return false; - return chunkaccess.getBlockState(p_25851_).is(this.blockToRemove) + this.nextStartTick--; +@@ -158,7 +_,8 @@ + ); + return chunkaccess == null + ? false +- : chunkaccess.getBlockState(p_25851_).is(this.blockToRemove) ++ : chunkaccess.getBlockState(p_25851_).canEntityDestroy(p_25850_, p_25851_, this.removerMob) ++ && chunkaccess.getBlockState(p_25851_).is(this.blockToRemove) && chunkaccess.getBlockState(p_25851_.above()).isAir() && chunkaccess.getBlockState(p_25851_.above(2)).isAir(); + } diff --git a/patches/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch b/patches/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch index 4d9aa2849fd..75309fc078b 100644 --- a/patches/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch +++ b/patches/net/minecraft/world/entity/ai/navigation/PathNavigation.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -228,10 +_,10 @@ +@@ -232,10 +_,10 @@ Vec3 vec3 = this.getTempMobPos(); this.maxDistanceToWaypoint = this.mob.getBbWidth() > 0.75F ? this.mob.getBbWidth() / 2.0F : 0.75F - this.mob.getBbWidth() / 2.0F; Vec3i vec3i = this.path.getNextNodePos(); diff --git a/patches/net/minecraft/world/entity/ai/village/VillageSiege.java.patch b/patches/net/minecraft/world/entity/ai/village/VillageSiege.java.patch index e3acda4a8b6..075cd89a917 100644 --- a/patches/net/minecraft/world/entity/ai/village/VillageSiege.java.patch +++ b/patches/net/minecraft/world/entity/ai/village/VillageSiege.java.patch @@ -17,6 +17,6 @@ try { - zombie = new Zombie(p_27017_); + zombie = EntityType.ZOMBIE.create(p_27017_); //Forge: Direct Initialization is deprecated, use EntityType. - zombie.finalizeSpawn(p_27017_, p_27017_.getCurrentDifficultyAt(zombie.blockPosition()), MobSpawnType.EVENT, null, null); + zombie.finalizeSpawn(p_27017_, p_27017_.getCurrentDifficultyAt(zombie.blockPosition()), MobSpawnType.EVENT, null); } catch (Exception exception) { LOGGER.warn("Failed to create zombie for village siege at {}", vec3, exception); diff --git a/patches/net/minecraft/world/entity/animal/Animal.java.patch b/patches/net/minecraft/world/entity/animal/Animal.java.patch index f7ba2b902bd..38850749707 100644 --- a/patches/net/minecraft/world/entity/animal/Animal.java.patch +++ b/patches/net/minecraft/world/entity/animal/Animal.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Animal.java +++ b/net/minecraft/world/entity/animal/Animal.java -@@ -212,6 +_,17 @@ +@@ -201,6 +_,17 @@ public void spawnChildFromBreeding(ServerLevel p_27564_, Animal p_27565_) { AgeableMob ageablemob = this.getBreedOffspring(p_27564_, p_27565_); diff --git a/patches/net/minecraft/world/entity/animal/Bee.java.patch b/patches/net/minecraft/world/entity/animal/Bee.java.patch index 6181e8634f2..83f78c1437d 100644 --- a/patches/net/minecraft/world/entity/animal/Bee.java.patch +++ b/patches/net/minecraft/world/entity/animal/Bee.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Bee.java +++ b/net/minecraft/world/entity/animal/Bee.java -@@ -498,7 +_,7 @@ +@@ -482,7 +_,7 @@ return false; } else { BlockEntity blockentity = this.level().getBlockEntity(this.hivePos); @@ -9,7 +9,7 @@ } } -@@ -657,8 +_,18 @@ +@@ -631,8 +_,18 @@ } @Override diff --git a/patches/net/minecraft/world/entity/animal/Cat.java.patch b/patches/net/minecraft/world/entity/animal/Cat.java.patch index b47fa892ba4..dcdb70386ea 100644 --- a/patches/net/minecraft/world/entity/animal/Cat.java.patch +++ b/patches/net/minecraft/world/entity/animal/Cat.java.patch @@ -1,21 +1,23 @@ --- a/net/minecraft/world/entity/animal/Cat.java +++ b/net/minecraft/world/entity/animal/Cat.java -@@ -382,8 +_,8 @@ - if (this.isOwnedBy(p_28153_)) { - if (!(item instanceof DyeItem)) { - if (item.isEdible() && this.isFood(itemstack) && this.getHealth() < this.getMaxHealth()) { -+ this.heal((float)itemstack.getFoodProperties(this).getNutrition()); - this.usePlayerItem(p_28153_, p_28154_, itemstack); -- this.heal((float)item.getFoodProperties().getNutrition()); - return InteractionResult.CONSUME; - } +@@ -379,9 +_,9 @@ + } + } else if (this.isFood(itemstack) && this.getHealth() < this.getMaxHealth()) { + if (!this.level().isClientSide()) { +- this.usePlayerItem(p_28153_, p_28154_, itemstack); +- FoodProperties foodproperties = itemstack.get(DataComponents.FOOD); ++ FoodProperties foodproperties = itemstack.getFoodProperties(this); + this.heal(foodproperties != null ? (float)foodproperties.nutrition() : 1.0F); ++ this.usePlayerItem(p_28153_, p_28154_, itemstack); + } -@@ -408,7 +_,7 @@ - } - } else if (this.isFood(itemstack)) { - this.usePlayerItem(p_28153_, p_28154_, itemstack); -- if (this.random.nextInt(3) == 0) { -+ if (this.random.nextInt(3) == 0 && !net.neoforged.neoforge.event.EventHooks.onAnimalTame(this, p_28153_)) { - this.tame(p_28153_); - this.setOrderedToSit(true); - this.level().broadcastEntityEvent(this, (byte)7); + return InteractionResult.sidedSuccess(this.level().isClientSide()); +@@ -441,7 +_,7 @@ + } + + private void tryToTame(Player p_333858_) { +- if (this.random.nextInt(3) == 0) { ++ if (this.random.nextInt(3) == 0 && !net.neoforged.neoforge.event.EventHooks.onAnimalTame(this, p_333858_)) { + this.tame(p_333858_); + this.setOrderedToSit(true); + this.level().broadcastEntityEvent(this, (byte)7); diff --git a/patches/net/minecraft/world/entity/animal/Fox.java.patch b/patches/net/minecraft/world/entity/animal/Fox.java.patch index 1b3f772f864..82eb17b1f9f 100644 --- a/patches/net/minecraft/world/entity/animal/Fox.java.patch +++ b/patches/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 -@@ -693,13 +_,16 @@ +@@ -677,13 +_,16 @@ @Override protected void dropAllDeathLoot(DamageSource p_28536_) { @@ -17,8 +17,8 @@ - super.dropAllDeathLoot(p_28536_); } - @Override -@@ -868,6 +_,17 @@ + public static boolean isPathClear(Fox p_28472_, LivingEntity p_28473_) { +@@ -842,6 +_,17 @@ protected void breed() { ServerLevel serverlevel = (ServerLevel)this.level; Fox fox = (Fox)this.animal.getBreedOffspring(serverlevel, this.partner); @@ -36,7 +36,7 @@ if (fox != null) { ServerPlayer serverplayer = this.animal.getLoveCause(); ServerPlayer serverplayer1 = this.partner.getLoveCause(); -@@ -945,7 +_,7 @@ +@@ -919,7 +_,7 @@ } protected void onReachedTarget() { @@ -45,7 +45,7 @@ BlockState blockstate = Fox.this.level().getBlockState(this.blockPos); if (blockstate.is(Blocks.SWEET_BERRY_BUSH)) { this.pickSweetBerries(blockstate); -@@ -1004,7 +_,7 @@ +@@ -978,7 +_,7 @@ @Override public boolean canUse() { diff --git a/patches/net/minecraft/world/entity/animal/MushroomCow.java.patch b/patches/net/minecraft/world/entity/animal/MushroomCow.java.patch index af856f60c42..4618aab0727 100644 --- a/patches/net/minecraft/world/entity/animal/MushroomCow.java.patch +++ b/patches/net/minecraft/world/entity/animal/MushroomCow.java.patch @@ -9,7 +9,7 @@ this.shear(SoundSource.PLAYERS); this.gameEvent(GameEvent.SHEAR, p_28941_); if (!this.level().isClientSide) { -@@ -167,8 +_,10 @@ +@@ -165,8 +_,10 @@ public void shear(SoundSource p_28924_) { this.level().playSound(null, this, SoundEvents.MOOSHROOM_SHEAR, p_28924_, 1.0F, 1.0F); if (!this.level().isClientSide()) { @@ -20,10 +20,10 @@ ((ServerLevel)this.level()).sendParticles(ParticleTypes.EXPLOSION, this.getX(), this.getY(0.5), this.getZ(), 1, 0.0, 0.0, 0.0, 0.0); this.discard(); cow.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); -@@ -187,10 +_,9 @@ +@@ -185,10 +_,9 @@ this.level().addFreshEntity(cow); - for(int i = 0; i < 5; ++i) { + for (int i = 0; i < 5; i++) { - this.level() - .addFreshEntity( - new ItemEntity(this.level(), this.getX(), this.getY(1.0), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock())) diff --git a/patches/net/minecraft/world/entity/animal/Ocelot.java.patch b/patches/net/minecraft/world/entity/animal/Ocelot.java.patch index 3722dc4ce7e..da7e37316a2 100644 --- a/patches/net/minecraft/world/entity/animal/Ocelot.java.patch +++ b/patches/net/minecraft/world/entity/animal/Ocelot.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Ocelot.java +++ b/net/minecraft/world/entity/animal/Ocelot.java -@@ -173,7 +_,7 @@ +@@ -170,7 +_,7 @@ if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemstack) && p_29021_.distanceToSqr(this) < 9.0) { this.usePlayerItem(p_29021_, p_29022_, itemstack); if (!this.level().isClientSide) { diff --git a/patches/net/minecraft/world/entity/animal/Parrot.java.patch b/patches/net/minecraft/world/entity/animal/Parrot.java.patch index 7edfe74e570..9cbc9c4deb2 100644 --- a/patches/net/minecraft/world/entity/animal/Parrot.java.patch +++ b/patches/net/minecraft/world/entity/animal/Parrot.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Parrot.java +++ b/net/minecraft/world/entity/animal/Parrot.java -@@ -76,13 +_,15 @@ +@@ -70,9 +_,11 @@ private static final EntityDataAccessor DATA_VARIANT_ID = SynchedEntityData.defineId(Parrot.class, EntityDataSerializers.INT); private static final Predicate NOT_PARROT_PREDICATE = new Predicate() { public boolean test(@Nullable Mob p_29453_) { @@ -8,16 +8,12 @@ + return p_29453_ != null && (Parrot.MOB_SOUND_MAP.containsKey(p_29453_.getType()) || p_29453_.getType().builtInRegistryHolder().getData(net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps.PARROT_IMITATIONS) != null); } }; - private static final Item POISONOUS_FOOD = Items.COOKIE; - private static final Set TAME_FOOD = Sets.newHashSet( - Items.WHEAT_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS, Items.BEETROOT_SEEDS, Items.TORCHFLOWER_SEEDS, Items.PITCHER_POD - ); + /** @deprecated Neo: use the {@link net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps#PARROT_IMITATIONS data map} instead */ + @Deprecated - static final Map, SoundEvent> MOB_SOUND_MAP = Util.make(Maps.newHashMap(), p_311670_ -> { - p_311670_.put(EntityType.BLAZE, SoundEvents.PARROT_IMITATE_BLAZE); - p_311670_.put(EntityType.BREEZE, SoundEvents.PARROT_IMITATE_BREEZE); -@@ -272,7 +_,7 @@ + static final Map, SoundEvent> MOB_SOUND_MAP = Util.make(Maps.newHashMap(), p_326764_ -> { + p_326764_.put(EntityType.BLAZE, SoundEvents.PARROT_IMITATE_BLAZE); + p_326764_.put(EntityType.BOGGED, SoundEvents.PARROT_IMITATE_BOGGED); +@@ -253,7 +_,7 @@ } if (!this.level().isClientSide) { @@ -26,7 +22,7 @@ this.tame(p_29414_); this.level().broadcastEntityEvent(this, (byte)7); } else { -@@ -342,7 +_,10 @@ +@@ -322,7 +_,10 @@ public static SoundEvent getAmbient(Level p_218239_, RandomSource p_218240_) { if (p_218239_.getDifficulty() != Difficulty.PEACEFUL && p_218240_.nextInt(1000) == 0) { @@ -38,7 +34,7 @@ return getImitatedSound(list.get(p_218240_.nextInt(list.size()))); } else { return SoundEvents.PARROT_AMBIENT; -@@ -350,6 +_,8 @@ +@@ -330,6 +_,8 @@ } private static SoundEvent getImitatedSound(EntityType p_29409_) { diff --git a/patches/net/minecraft/world/entity/animal/Pig.java.patch b/patches/net/minecraft/world/entity/animal/Pig.java.patch index 45321d45467..63461513466 100644 --- a/patches/net/minecraft/world/entity/animal/Pig.java.patch +++ b/patches/net/minecraft/world/entity/animal/Pig.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Pig.java +++ b/net/minecraft/world/entity/animal/Pig.java -@@ -215,7 +_,7 @@ +@@ -206,7 +_,7 @@ @Override public void thunderHit(ServerLevel p_29473_, LightningBolt p_29474_) { @@ -9,7 +9,7 @@ ZombifiedPiglin zombifiedpiglin = EntityType.ZOMBIFIED_PIGLIN.create(p_29473_); if (zombifiedpiglin != null) { zombifiedpiglin.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(Items.GOLDEN_SWORD)); -@@ -228,6 +_,7 @@ +@@ -219,6 +_,7 @@ } zombifiedpiglin.setPersistenceRequired(); diff --git a/patches/net/minecraft/world/entity/animal/Rabbit.java.patch b/patches/net/minecraft/world/entity/animal/Rabbit.java.patch index 93d9d625c47..b71d6d55bdc 100644 --- a/patches/net/minecraft/world/entity/animal/Rabbit.java.patch +++ b/patches/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 -@@ -534,7 +_,7 @@ +@@ -527,7 +_,7 @@ @Override public boolean canUse() { if (this.nextStartTick <= 0) { diff --git a/patches/net/minecraft/world/entity/animal/Sheep.java.patch b/patches/net/minecraft/world/entity/animal/Sheep.java.patch index c689463a809..5211a4e962e 100644 --- a/patches/net/minecraft/world/entity/animal/Sheep.java.patch +++ b/patches/net/minecraft/world/entity/animal/Sheep.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Sheep.java +++ b/net/minecraft/world/entity/animal/Sheep.java -@@ -206,7 +_,7 @@ +@@ -208,7 +_,7 @@ @Override public InteractionResult mobInteract(Player p_29853_, InteractionHand p_29854_) { ItemStack itemstack = p_29853_.getItemInHand(p_29854_); diff --git a/patches/net/minecraft/world/entity/animal/SnowGolem.java.patch b/patches/net/minecraft/world/entity/animal/SnowGolem.java.patch index a700a407ead..907cd15285b 100644 --- a/patches/net/minecraft/world/entity/animal/SnowGolem.java.patch +++ b/patches/net/minecraft/world/entity/animal/SnowGolem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/SnowGolem.java +++ b/net/minecraft/world/entity/animal/SnowGolem.java -@@ -95,7 +_,7 @@ +@@ -92,7 +_,7 @@ this.hurt(this.damageSources().onFire(), 1.0F); } @@ -9,7 +9,7 @@ return; } -@@ -135,7 +_,7 @@ +@@ -127,7 +_,7 @@ @Override protected InteractionResult mobInteract(Player p_29920_, InteractionHand p_29921_) { ItemStack itemstack = p_29920_.getItemInHand(p_29921_); diff --git a/patches/net/minecraft/world/entity/animal/Wolf.java.patch b/patches/net/minecraft/world/entity/animal/Wolf.java.patch index c9bd0f19663..02d705a49eb 100644 --- a/patches/net/minecraft/world/entity/animal/Wolf.java.patch +++ b/patches/net/minecraft/world/entity/animal/Wolf.java.patch @@ -1,34 +1,25 @@ --- a/net/minecraft/world/entity/animal/Wolf.java +++ b/net/minecraft/world/entity/animal/Wolf.java -@@ -342,11 +_,12 @@ - return flag ? InteractionResult.CONSUME : InteractionResult.PASS; - } else if (this.isTame()) { - if (this.isFood(itemstack) && this.getHealth() < this.getMaxHealth()) { -+ this.heal((float)itemstack.getFoodProperties(this).getNutrition()); - if (!p_30412_.getAbilities().instabuild) { - itemstack.shrink(1); - } - -- this.heal((float)item.getFoodProperties().getNutrition()); -+ this.gameEvent(GameEvent.EAT, this); - return InteractionResult.SUCCESS; - } else { - if (item instanceof DyeItem dyeitem && this.isOwnedBy(p_30412_)) { -@@ -379,7 +_,7 @@ - itemstack.shrink(1); - } - -- if (this.random.nextInt(3) == 0) { -+ if (this.random.nextInt(3) == 0 && !net.neoforged.neoforge.event.EventHooks.onAnimalTame(this, p_30412_)) { - this.tame(p_30412_); - this.navigation.stop(); - this.setTarget(null); -@@ -419,7 +_,7 @@ - @Override - public boolean isFood(ItemStack p_30440_) { - Item item = p_30440_.getItem(); -- return item.isEdible() && item.getFoodProperties().isMeat(); -+ return item.isEdible() && p_30440_.getFoodProperties(this).isMeat(); +@@ -421,10 +_,11 @@ + if (!this.level().isClientSide || this.isBaby() && this.isFood(itemstack)) { + if (this.isTame()) { + if (this.isFood(itemstack) && this.getHealth() < this.getMaxHealth()) { +- itemstack.consume(1, p_30412_); +- FoodProperties foodproperties = itemstack.get(DataComponents.FOOD); ++ FoodProperties foodproperties = itemstack.getFoodProperties(this); + float f = foodproperties != null ? (float)foodproperties.nutrition() : 1.0F; + this.heal(2.0F * f); ++ itemstack.consume(1, p_30412_); ++ this.gameEvent(GameEvent.EAT); // Neo: add EAT game event + return InteractionResult.sidedSuccess(this.level().isClientSide()); + } else { + if (item instanceof DyeItem dyeitem && this.isOwnedBy(p_30412_)) { +@@ -490,7 +_,7 @@ } - @Override + private void tryToTame(Player p_333736_) { +- if (this.random.nextInt(3) == 0) { ++ if (this.random.nextInt(3) == 0 && !net.neoforged.neoforge.event.EventHooks.onAnimalTame(this, p_333736_)) { + this.tame(p_333736_); + this.navigation.stop(); + this.setTarget(null); diff --git a/patches/net/minecraft/world/entity/animal/allay/Allay.java.patch b/patches/net/minecraft/world/entity/animal/allay/Allay.java.patch index a5b22c00b5b..c11160e1b81 100644 --- a/patches/net/minecraft/world/entity/animal/allay/Allay.java.patch +++ b/patches/net/minecraft/world/entity/animal/allay/Allay.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/allay/Allay.java +++ b/net/minecraft/world/entity/animal/allay/Allay.java -@@ -370,9 +_,9 @@ +@@ -366,9 +_,9 @@ public boolean wantsToPickUp(ItemStack p_218387_) { ItemStack itemstack = this.getItemInHand(InteractionHand.MAIN_HAND); return !itemstack.isEmpty() diff --git a/patches/net/minecraft/world/entity/animal/frog/Tadpole.java.patch b/patches/net/minecraft/world/entity/animal/frog/Tadpole.java.patch index e85711b7f10..637cf5cae45 100644 --- a/patches/net/minecraft/world/entity/animal/frog/Tadpole.java.patch +++ b/patches/net/minecraft/world/entity/animal/frog/Tadpole.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/world/entity/animal/frog/Tadpole.java +++ b/net/minecraft/world/entity/animal/frog/Tadpole.java -@@ -226,8 +_,10 @@ +@@ -225,8 +_,10 @@ + private void ageUp() { - Level $$1 = this.level(); - if ($$1 instanceof ServerLevel serverlevel) { + if (this.level() instanceof ServerLevel serverlevel) { + if (!net.neoforged.neoforge.event.EventHooks.canLivingConvert(this, EntityType.FROG, (timer) -> {})) return; Frog frog = EntityType.FROG.create(this.level()); if (frog != null) { + net.neoforged.neoforge.event.EventHooks.onLivingConvert(this, frog); frog.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); - frog.finalizeSpawn(serverlevel, this.level().getCurrentDifficultyAt(frog.blockPosition()), MobSpawnType.CONVERSION, null, null); + frog.finalizeSpawn(serverlevel, this.level().getCurrentDifficultyAt(frog.blockPosition()), MobSpawnType.CONVERSION, null); frog.setNoAi(this.isNoAi()); diff --git a/patches/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch b/patches/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch index ec57d9585b7..a2ad5869ff9 100644 --- a/patches/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch +++ b/patches/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/horse/AbstractHorse.java +++ b/net/minecraft/world/entity/animal/horse/AbstractHorse.java -@@ -384,9 +_,9 @@ +@@ -388,9 +_,9 @@ protected void playStepSound(BlockPos p_30584_, BlockState p_30585_) { if (!p_30585_.liquid()) { BlockState blockstate = this.level().getBlockState(p_30584_.above()); @@ -12,31 +12,18 @@ } if (this.isVehicle() && this.canGallop) { -@@ -669,6 +_,12 @@ - this.mouthAnim = 0.0F; - } - } -+ -+ // Neo: Horse armor tick patch -+ if (this.canWearArmor()) { -+ ItemStack stack = this.inventory.getItem(1); -+ if (isArmor(stack)) stack.onHorseArmorTick(level(), this); -+ } - } - - @Override -@@ -802,6 +_,7 @@ - this.setDeltaMovement(vec3.x, d1, vec3.z); +@@ -808,6 +_,7 @@ + this.setDeltaMovement(vec3.x, d0, vec3.z); this.setIsJumping(true); this.hasImpulse = true; + net.neoforged.neoforge.common.CommonHooks.onLivingJump(this); if (p_275435_.z > 0.0) { float f = Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)); float f1 = Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)); -@@ -1137,6 +_,11 @@ +@@ -1110,6 +_,11 @@ this.randomizeAttributes(p_30555_.getRandom()); - return super.finalizeSpawn(p_30555_, p_30556_, p_30557_, p_30558_, p_30559_); + return super.finalizeSpawn(p_30555_, p_30556_, p_30557_, p_30558_); + } + + // Neo: Inventory getter diff --git a/patches/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch b/patches/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch index c025729dc74..e3a7684a927 100644 --- a/patches/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch +++ b/patches/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java +++ b/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java -@@ -28,6 +_,10 @@ +@@ -31,6 +_,10 @@ @Override public void tick() { ServerLevel serverlevel = (ServerLevel)this.horse.level(); @@ -11,7 +11,7 @@ DifficultyInstance difficultyinstance = serverlevel.getCurrentDifficultyAt(this.horse.blockPosition()); this.horse.setTrap(false); this.horse.setTamed(true); -@@ -55,6 +_,7 @@ +@@ -58,6 +_,7 @@ } } } diff --git a/patches/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch b/patches/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch index 02c0676e3ea..cfa11ac57e0 100644 --- a/patches/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch +++ b/patches/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java +++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java -@@ -295,7 +_,7 @@ +@@ -299,7 +_,7 @@ if (this.tickCount % 10 == 0) { this.level() .playLocalSound( diff --git a/patches/net/minecraft/world/entity/boss/EnderDragonPart.java.patch b/patches/net/minecraft/world/entity/boss/EnderDragonPart.java.patch index d31569dbe8f..935ae3aceb4 100644 --- a/patches/net/minecraft/world/entity/boss/EnderDragonPart.java.patch +++ b/patches/net/minecraft/world/entity/boss/EnderDragonPart.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/boss/EnderDragonPart.java +++ b/net/minecraft/world/entity/boss/EnderDragonPart.java -@@ -11,13 +_,13 @@ +@@ -12,13 +_,13 @@ import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.item.ItemStack; diff --git a/patches/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch b/patches/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch index 3a2fd0eef2e..edc0e0d4509 100644 --- a/patches/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch +++ b/patches/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -@@ -104,6 +_,14 @@ +@@ -102,6 +_,14 @@ this.noPhysics = true; this.noCulling = true; this.phaseManager = new EnderDragonPhaseManager(this); @@ -15,7 +15,7 @@ } public void setDragonFight(EndDragonFight p_287736_) { -@@ -171,8 +_,12 @@ +@@ -169,8 +_,12 @@ return adouble; } @@ -28,7 +28,7 @@ this.processFlappingMovement(); if (this.level().isClientSide) { this.setHealth(this.getHealth()); -@@ -470,7 +_,7 @@ +@@ -465,7 +_,7 @@ BlockPos blockpos = new BlockPos(k1, l1, i2); BlockState blockstate = this.level().getBlockState(blockpos); if (!blockstate.isAir() && !blockstate.is(BlockTags.DRAGON_TRANSPARENT)) { @@ -37,7 +37,7 @@ flag1 = this.level().removeBlock(blockpos, false) || flag1; } else { flag = true; -@@ -564,7 +_,8 @@ +@@ -559,7 +_,8 @@ if (this.level() instanceof ServerLevel) { if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && flag) { @@ -47,7 +47,7 @@ } if (this.dragonDeathTime == 1 && !this.isSilent()) { -@@ -575,7 +_,8 @@ +@@ -570,7 +_,8 @@ this.move(MoverType.SELF, new Vec3(0.0, 0.1F, 0.0)); if (this.dragonDeathTime == 200 && this.level() instanceof ServerLevel) { if (flag) { @@ -57,7 +57,7 @@ } if (this.dragonFight != null) { -@@ -907,8 +_,19 @@ +@@ -902,8 +_,19 @@ } @Override @@ -76,4 +76,4 @@ + if (true) return; // Forge: Fix MC-158205: Moved into setId() EnderDragonPart[] aenderdragonpart = this.getSubEntities(); - for(int i = 0; i < aenderdragonpart.length; ++i) { + for (int i = 0; i < aenderdragonpart.length; i++) { diff --git a/patches/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch b/patches/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch index 9241c282de6..3ac2613fb4b 100644 --- a/patches/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch +++ b/patches/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch @@ -1,24 +1,24 @@ --- a/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/net/minecraft/world/entity/boss/wither/WitherBoss.java -@@ -315,7 +_,7 @@ +@@ -321,7 +_,7 @@ if (this.destroyBlocksTick > 0) { - --this.destroyBlocksTick; + this.destroyBlocksTick--; - if (this.destroyBlocksTick == 0 && this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (this.destroyBlocksTick == 0 && net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(this.level(), this)) { - int j1 = Mth.floor(this.getY()); - int i2 = Mth.floor(this.getX()); - int j2 = Mth.floor(this.getZ()); -@@ -329,7 +_,7 @@ - int i1 = j2 + k2; - BlockPos blockpos = new BlockPos(l2, l, i1); - BlockState blockstate = this.level().getBlockState(blockpos); -- if (canDestroy(blockstate)) { -+ if (blockstate.canEntityDestroy(this.level(), blockpos, this) && net.neoforged.neoforge.event.EventHooks.onEntityDestroyBlock(this, blockpos, blockstate)) { - flag = this.level().destroyBlock(blockpos, true, this) || flag; - } - } -@@ -350,6 +_,10 @@ + boolean flag = false; + int l = Mth.floor(this.getBbWidth() / 2.0F + 1.0F); + int i1 = Mth.floor(this.getBbHeight()); +@@ -330,7 +_,7 @@ + this.getBlockX() - l, this.getBlockY(), this.getBlockZ() - l, this.getBlockX() + l, this.getBlockY() + i1, this.getBlockZ() + l + )) { + BlockState blockstate = this.level().getBlockState(blockpos); +- if (canDestroy(blockstate)) { ++ if (blockstate.canEntityDestroy(this.level(), blockpos, this) && net.neoforged.neoforge.event.EventHooks.onEntityDestroyBlock(this, blockpos, blockstate)) { + flag = this.level().destroyBlock(blockpos, true, this) || flag; + } + } +@@ -349,6 +_,10 @@ } } diff --git a/patches/net/minecraft/world/entity/decoration/ArmorStand.java.patch b/patches/net/minecraft/world/entity/decoration/ArmorStand.java.patch index 23c3ae3cf94..5bc9fd973b6 100644 --- a/patches/net/minecraft/world/entity/decoration/ArmorStand.java.patch +++ b/patches/net/minecraft/world/entity/decoration/ArmorStand.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/net/minecraft/world/entity/decoration/ArmorStand.java -@@ -71,7 +_,7 @@ +@@ -74,7 +_,7 @@ public static final EntityDataAccessor DATA_LEFT_LEG_POSE = SynchedEntityData.defineId(ArmorStand.class, EntityDataSerializers.ROTATIONS); public static final EntityDataAccessor DATA_RIGHT_LEG_POSE = SynchedEntityData.defineId(ArmorStand.class, EntityDataSerializers.ROTATIONS); private static final Predicate RIDABLE_MINECARTS = p_31582_ -> p_31582_ instanceof AbstractMinecart diff --git a/patches/net/minecraft/world/entity/decoration/HangingEntity.java.patch b/patches/net/minecraft/world/entity/decoration/HangingEntity.java.patch index b533f4f73be..76faef3e12f 100644 --- a/patches/net/minecraft/world/entity/decoration/HangingEntity.java.patch +++ b/patches/net/minecraft/world/entity/decoration/HangingEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/decoration/HangingEntity.java +++ b/net/minecraft/world/entity/decoration/HangingEntity.java -@@ -120,6 +_,8 @@ +@@ -121,6 +_,8 @@ int j1 = (j - 1) / -2; blockpos$mutableblockpos.set(blockpos).move(direction, k + i1).move(Direction.UP, l + j1); BlockState blockstate = this.level().getBlockState(blockpos$mutableblockpos); diff --git a/patches/net/minecraft/world/entity/item/FallingBlockEntity.java.patch b/patches/net/minecraft/world/entity/item/FallingBlockEntity.java.patch index 99b9f3d3f5e..be3b00816d3 100644 --- a/patches/net/minecraft/world/entity/item/FallingBlockEntity.java.patch +++ b/patches/net/minecraft/world/entity/item/FallingBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -131,7 +_,7 @@ +@@ -133,7 +_,7 @@ if (!this.level().isClientSide) { BlockPos blockpos = this.blockPosition(); boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock; @@ -9,7 +9,7 @@ double d0 = this.getDeltaMovement().lengthSqr(); if (flag && d0 > 1.0) { BlockHitResult blockhitresult = this.level() -@@ -140,7 +_,7 @@ +@@ -142,7 +_,7 @@ new Vec3(this.xo, this.yo, this.zo), this.position(), ClipContext.Block.COLLIDER, ClipContext.Fluid.SOURCE_ONLY, this ) ); diff --git a/patches/net/minecraft/world/entity/item/ItemEntity.java.patch b/patches/net/minecraft/world/entity/item/ItemEntity.java.patch index 74b76796d50..ef93c503974 100644 --- a/patches/net/minecraft/world/entity/item/ItemEntity.java.patch +++ b/patches/net/minecraft/world/entity/item/ItemEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/item/ItemEntity.java +++ b/net/minecraft/world/entity/item/ItemEntity.java -@@ -44,6 +_,10 @@ +@@ -48,6 +_,10 @@ @Nullable private UUID target; public final float bobOffs; @@ -11,7 +11,7 @@ public ItemEntity(EntityType p_31991_, Level p_31992_) { super(p_31991_, p_31992_); -@@ -62,6 +_,7 @@ +@@ -66,6 +_,7 @@ this.setPos(p_149664_, p_149665_, p_149666_); this.setDeltaMovement(p_149668_, p_149669_, p_149670_); this.setItem(p_149667_); @@ -19,7 +19,7 @@ } private ItemEntity(ItemEntity p_31994_) { -@@ -70,6 +_,7 @@ +@@ -74,6 +_,7 @@ this.copyPosition(p_31994_); this.age = p_31994_.age; this.bobOffs = p_31994_.bobOffs; @@ -27,7 +27,7 @@ } @Override -@@ -115,6 +_,7 @@ +@@ -119,6 +_,7 @@ @Override public void tick() { @@ -35,27 +35,27 @@ if (this.getItem().isEmpty()) { this.discard(); } else { -@@ -128,6 +_,9 @@ +@@ -131,6 +_,9 @@ + this.yo = this.getY(); this.zo = this.getZ(); Vec3 vec3 = this.getDeltaMovement(); - float f = this.getEyeHeight() - 0.11111111F; + net.neoforged.neoforge.fluids.FluidType fluidType = this.getMaxHeightFluidType(); -+ if (!fluidType.isAir() && !fluidType.isVanilla() && this.getFluidTypeHeight(fluidType) > (double)f) fluidType.setItemMovement(this); ++ if (!fluidType.isAir() && !fluidType.isVanilla() && this.getFluidTypeHeight(fluidType) > 0.1F) fluidType.setItemMovement(this); + else - if (this.isInWater() && this.getFluidHeight(FluidTags.WATER) > (double)f) { + if (this.isInWater() && this.getFluidHeight(FluidTags.WATER) > 0.1F) { this.setUnderwaterMovement(); - } else if (this.isInLava() && this.getFluidHeight(FluidTags.LAVA) > (double)f) { -@@ -149,7 +_,8 @@ + } else if (this.isInLava() && this.getFluidHeight(FluidTags.LAVA) > 0.1F) { +@@ -152,7 +_,8 @@ this.move(MoverType.SELF, this.getDeltaMovement()); - float f1 = 0.98F; + float f = 0.98F; if (this.onGround()) { -- f1 = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F; +- f = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F; + BlockPos groundPos = getBlockPosBelowThatAffectsMyMovement(); -+ f1 = this.level().getBlockState(groundPos).getFriction(level(), groundPos, this) * 0.98F; ++ f = this.level().getBlockState(groundPos).getFriction(level(), groundPos, this) * 0.98F; } - this.setDeltaMovement(this.getDeltaMovement().multiply((double)f1, 0.98, (double)f1)); -@@ -181,7 +_,16 @@ + this.setDeltaMovement(this.getDeltaMovement().multiply((double)f, 0.98, (double)f)); +@@ -184,7 +_,16 @@ } } @@ -73,16 +73,7 @@ this.discard(); } } -@@ -240,6 +_,8 @@ - return false; - } else if (p_32028_.hasTag() ^ p_32027_.hasTag()) { - return false; -+ } else if (!p_32027_.areAttachmentsCompatible(p_32028_)) { -+ return false; - } else { - return !p_32028_.hasTag() || p_32028_.getTag().equals(p_32027_.getTag()); - } -@@ -286,7 +_,7 @@ +@@ -281,7 +_,7 @@ this.health = (int)((float)this.health - p_32014_); this.gameEvent(GameEvent.ENTITY_DAMAGE, p_32013_.getEntity()); if (this.health <= 0) { @@ -91,7 +82,7 @@ this.discard(); } -@@ -299,6 +_,7 @@ +@@ -294,6 +_,7 @@ p_32050_.putShort("Health", (short)this.health); p_32050_.putShort("Age", (short)this.age); p_32050_.putShort("PickupDelay", (short)this.pickupDelay); @@ -99,7 +90,7 @@ if (this.thrower != null) { p_32050_.putUUID("Thrower", this.thrower); } -@@ -319,6 +_,9 @@ +@@ -314,6 +_,9 @@ if (p_32034_.contains("PickupDelay")) { this.pickupDelay = p_32034_.getShort("PickupDelay"); } diff --git a/patches/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch b/patches/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch index 6f600f2dc13..1faf9101653 100644 --- a/patches/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch +++ b/patches/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch @@ -1,23 +1,24 @@ --- a/net/minecraft/world/entity/monster/AbstractSkeleton.java +++ b/net/minecraft/world/entity/monster/AbstractSkeleton.java -@@ -165,7 +_,7 @@ +@@ -155,7 +_,7 @@ if (this.level() != null && !this.level().isClientSide) { this.goalSelector.removeGoal(this.meleeGoal); this.goalSelector.removeGoal(this.bowGoal); - ItemStack itemstack = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW)); + ItemStack itemstack = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.world.item.BowItem)); if (itemstack.is(Items.BOW)) { - int i = 20; + int i = this.getHardAttackInterval(); if (this.level().getDifficulty() != Difficulty.HARD) { -@@ -182,8 +_,10 @@ +@@ -180,8 +_,11 @@ @Override public void performRangedAttack(LivingEntity p_32141_, float p_32142_) { - ItemStack itemstack = this.getProjectile(this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW))); -+ ItemStack itemstack = this.getProjectile(this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.world.item.BowItem))); ++ ItemStack weapon = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.world.item.BowItem)); ++ ItemStack itemstack = this.getProjectile(weapon); AbstractArrow abstractarrow = this.getArrow(itemstack, p_32142_); -+ if (this.getMainHandItem().getItem() instanceof net.minecraft.world.item.BowItem) -+ abstractarrow = ((net.minecraft.world.item.BowItem)this.getMainHandItem().getItem()).customArrow(abstractarrow, itemstack); ++ if (weapon.getItem() instanceof net.minecraft.world.item.ProjectileWeaponItem weaponItem) ++ abstractarrow = weaponItem.customArrow(abstractarrow, itemstack); double d0 = p_32141_.getX() - this.getX(); double d1 = p_32141_.getY(0.3333333333333333) - abstractarrow.getY(); double d2 = p_32141_.getZ() - this.getZ(); diff --git a/patches/net/minecraft/world/entity/monster/CrossbowAttackMob.java.patch b/patches/net/minecraft/world/entity/monster/CrossbowAttackMob.java.patch index 7c9026445f5..e9348deb1be 100644 --- a/patches/net/minecraft/world/entity/monster/CrossbowAttackMob.java.patch +++ b/patches/net/minecraft/world/entity/monster/CrossbowAttackMob.java.patch @@ -1,14 +1,11 @@ --- a/net/minecraft/world/entity/monster/CrossbowAttackMob.java +++ b/net/minecraft/world/entity/monster/CrossbowAttackMob.java -@@ -23,9 +_,9 @@ +@@ -17,7 +_,7 @@ void onCrossbowAttackPerformed(); default void performCrossbowAttack(LivingEntity p_32337_, float p_32338_) { - InteractionHand interactionhand = ProjectileUtil.getWeaponHoldingHand(p_32337_, Items.CROSSBOW); + InteractionHand interactionhand = ProjectileUtil.getWeaponHoldingHand(p_32337_, item -> item instanceof CrossbowItem); ItemStack itemstack = p_32337_.getItemInHand(interactionhand); -- if (p_32337_.isHolding(Items.CROSSBOW)) { -+ if (p_32337_.isHolding(is -> is.getItem() instanceof CrossbowItem)) { - CrossbowItem.performShooting( - p_32337_.level(), p_32337_, interactionhand, itemstack, p_32338_, (float)(14 - p_32337_.level().getDifficulty().getId() * 4) - ); + if (itemstack.getItem() instanceof CrossbowItem crossbowitem) { + crossbowitem.performShooting( diff --git a/patches/net/minecraft/world/entity/monster/EnderMan.java.patch b/patches/net/minecraft/world/entity/monster/EnderMan.java.patch index 0da394e3240..425799d7ab3 100644 --- a/patches/net/minecraft/world/entity/monster/EnderMan.java.patch +++ b/patches/net/minecraft/world/entity/monster/EnderMan.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/EnderMan.java +++ b/net/minecraft/world/entity/monster/EnderMan.java -@@ -121,7 +_,6 @@ +@@ -116,7 +_,6 @@ @Override public void setTarget(@Nullable LivingEntity p_32537_) { @@ -8,7 +8,7 @@ AttributeInstance attributeinstance = this.getAttribute(Attributes.MOVEMENT_SPEED); if (p_32537_ == null) { this.targetChangeTime = 0; -@@ -135,6 +_,7 @@ +@@ -130,6 +_,7 @@ attributeinstance.addTransientModifier(SPEED_MODIFIER_ATTACKING); } } @@ -16,7 +16,7 @@ } @Override -@@ -217,7 +_,7 @@ +@@ -212,7 +_,7 @@ boolean isLookingAtMe(Player p_32535_) { ItemStack itemstack = p_32535_.getInventory().armor.get(3); @@ -25,7 +25,7 @@ return false; } else { Vec3 vec3 = p_32535_.getViewVector(1.0F).normalize(); -@@ -314,8 +_,10 @@ +@@ -299,8 +_,10 @@ boolean flag = blockstate.blocksMotion(); boolean flag1 = blockstate.getFluidState().is(FluidTags.WATER); if (flag && !flag1) { @@ -37,16 +37,16 @@ if (flag2) { this.level().gameEvent(GameEvent.TELEPORT, vec3, GameEvent.Context.of(this)); if (!this.isSilent()) { -@@ -467,7 +_,7 @@ - public boolean canUse() { +@@ -451,7 +_,7 @@ if (this.enderman.getCarriedBlock() == null) { return false; -- } else if (!this.enderman.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { -+ } else if (!net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(this.enderman.level(), this.enderman)) { - return false; } else { - return this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0; -@@ -488,7 +_,7 @@ +- return !this.enderman.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ++ return !net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(this.enderman.level(), this.enderman) + ? false + : this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0; + } +@@ -471,7 +_,7 @@ BlockState blockstate2 = this.enderman.getCarriedBlock(); if (blockstate2 != null) { blockstate2 = Block.updateFromNeighbourShapes(blockstate2, this.enderman.level(), blockpos); @@ -55,7 +55,7 @@ level.setBlock(blockpos, blockstate2, 3); level.gameEvent(GameEvent.BLOCK_PLACE, blockpos, GameEvent.Context.of(this.enderman, blockstate2)); this.enderman.setCarriedBlock(null); -@@ -500,6 +_,7 @@ +@@ -483,6 +_,7 @@ return p_32562_.isAir() && !p_32563_.isAir() && !p_32563_.is(Blocks.BEDROCK) @@ -63,12 +63,12 @@ && p_32563_.isCollisionShapeFullBlock(p_32559_, p_32564_) && p_32561_.canSurvive(p_32559_, p_32560_) && p_32559_.getEntities(this.enderman, AABB.unitCubeFromLowerCorner(Vec3.atLowerCornerOf(p_32560_))).isEmpty(); -@@ -610,7 +_,7 @@ - public boolean canUse() { +@@ -594,7 +_,7 @@ if (this.enderman.getCarriedBlock() != null) { return false; -- } else if (!this.enderman.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { -+ } else if (!net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(this.enderman.level(), this.enderman)) { - return false; } else { - return this.enderman.getRandom().nextInt(reducedTickDelay(20)) == 0; +- return !this.enderman.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ++ return !net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(this.enderman.level(), this.enderman) + ? false + : this.enderman.getRandom().nextInt(reducedTickDelay(20)) == 0; + } diff --git a/patches/net/minecraft/world/entity/monster/Evoker.java.patch b/patches/net/minecraft/world/entity/monster/Evoker.java.patch index 19444669cdf..a7549041ac0 100644 --- a/patches/net/minecraft/world/entity/monster/Evoker.java.patch +++ b/patches/net/minecraft/world/entity/monster/Evoker.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Evoker.java +++ b/net/minecraft/world/entity/monster/Evoker.java -@@ -309,7 +_,7 @@ +@@ -305,7 +_,7 @@ return false; } else if (Evoker.this.tickCount < this.nextAttackTickCount) { return false; diff --git a/patches/net/minecraft/world/entity/monster/Husk.java.patch b/patches/net/minecraft/world/entity/monster/Husk.java.patch index 623afcfb795..f36b13b0105 100644 --- a/patches/net/minecraft/world/entity/monster/Husk.java.patch +++ b/patches/net/minecraft/world/entity/monster/Husk.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Husk.java +++ b/net/minecraft/world/entity/monster/Husk.java -@@ -72,6 +_,7 @@ +@@ -70,6 +_,7 @@ @Override protected void doUnderWaterConversion() { diff --git a/patches/net/minecraft/world/entity/monster/Illusioner.java.patch b/patches/net/minecraft/world/entity/monster/Illusioner.java.patch index e12536ba6f6..d6089e1d581 100644 --- a/patches/net/minecraft/world/entity/monster/Illusioner.java.patch +++ b/patches/net/minecraft/world/entity/monster/Illusioner.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Illusioner.java +++ b/net/minecraft/world/entity/monster/Illusioner.java -@@ -194,8 +_,10 @@ +@@ -173,8 +_,10 @@ @Override public void performRangedAttack(LivingEntity p_32918_, float p_32919_) { diff --git a/patches/net/minecraft/world/entity/monster/MagmaCube.java.patch b/patches/net/minecraft/world/entity/monster/MagmaCube.java.patch index e37c3d678d7..06e5ea98f45 100644 --- a/patches/net/minecraft/world/entity/monster/MagmaCube.java.patch +++ b/patches/net/minecraft/world/entity/monster/MagmaCube.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/MagmaCube.java +++ b/net/minecraft/world/entity/monster/MagmaCube.java -@@ -77,17 +_,28 @@ +@@ -71,17 +_,28 @@ float f = (float)this.getSize() * 0.1F; this.setDeltaMovement(vec3.x, (double)(this.getJumpPower() + f), vec3.z); this.hasImpulse = true; diff --git a/patches/net/minecraft/world/entity/monster/Pillager.java.patch b/patches/net/minecraft/world/entity/monster/Pillager.java.patch index 8937d159fb4..0ecf222c123 100644 --- a/patches/net/minecraft/world/entity/monster/Pillager.java.patch +++ b/patches/net/minecraft/world/entity/monster/Pillager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Pillager.java +++ b/net/minecraft/world/entity/monster/Pillager.java -@@ -120,7 +_,7 @@ +@@ -112,7 +_,7 @@ public AbstractIllager.IllagerArmPose getArmPose() { if (this.isChargingCrossbow()) { return AbstractIllager.IllagerArmPose.CROSSBOW_CHARGE; diff --git a/patches/net/minecraft/world/entity/monster/Ravager.java.patch b/patches/net/minecraft/world/entity/monster/Ravager.java.patch index d27c87c1e08..50f6d928316 100644 --- a/patches/net/minecraft/world/entity/monster/Ravager.java.patch +++ b/patches/net/minecraft/world/entity/monster/Ravager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Ravager.java +++ b/net/minecraft/world/entity/monster/Ravager.java -@@ -139,7 +_,7 @@ +@@ -133,7 +_,7 @@ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Mth.lerp(0.1, d1, d0)); } diff --git a/patches/net/minecraft/world/entity/monster/Shulker.java.patch b/patches/net/minecraft/world/entity/monster/Shulker.java.patch index de027e3882f..f7260e87d4a 100644 --- a/patches/net/minecraft/world/entity/monster/Shulker.java.patch +++ b/patches/net/minecraft/world/entity/monster/Shulker.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Shulker.java +++ b/net/minecraft/world/entity/monster/Shulker.java -@@ -391,6 +_,12 @@ +@@ -392,6 +_,12 @@ && this.level().noCollision(this, new AABB(blockpos1).deflate(1.0E-6))) { Direction direction = this.findAttachableSurface(blockpos1); if (direction != null) { diff --git a/patches/net/minecraft/world/entity/monster/Silverfish.java.patch b/patches/net/minecraft/world/entity/monster/Silverfish.java.patch index d1bef172de3..7e73ef502a3 100644 --- a/patches/net/minecraft/world/entity/monster/Silverfish.java.patch +++ b/patches/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 -@@ -159,7 +_,7 @@ +@@ -140,7 +_,7 @@ return false; } else { RandomSource randomsource = this.mob.getRandom(); @@ -9,7 +9,7 @@ this.selectedDirection = Direction.getRandom(randomsource); BlockPos blockpos = BlockPos.containing(this.mob.getX(), this.mob.getY() + 0.5, this.mob.getZ()).relative(this.selectedDirection); BlockState blockstate = this.mob.level().getBlockState(blockpos); -@@ -230,7 +_,7 @@ +@@ -211,7 +_,7 @@ BlockState blockstate = level.getBlockState(blockpos1); Block block = blockstate.getBlock(); if (block instanceof InfestedBlock) { diff --git a/patches/net/minecraft/world/entity/monster/Skeleton.java.patch b/patches/net/minecraft/world/entity/monster/Skeleton.java.patch index 499e41ec198..f9a48f3b1fb 100644 --- a/patches/net/minecraft/world/entity/monster/Skeleton.java.patch +++ b/patches/net/minecraft/world/entity/monster/Skeleton.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Skeleton.java +++ b/net/minecraft/world/entity/monster/Skeleton.java -@@ -86,7 +_,9 @@ +@@ -85,7 +_,9 @@ } protected void doFreezeConversion() { diff --git a/patches/net/minecraft/world/entity/monster/Slime.java.patch b/patches/net/minecraft/world/entity/monster/Slime.java.patch index bb40934c1b0..d006918b006 100644 --- a/patches/net/minecraft/world/entity/monster/Slime.java.patch +++ b/patches/net/minecraft/world/entity/monster/Slime.java.patch @@ -1,27 +1,27 @@ --- a/net/minecraft/world/entity/monster/Slime.java +++ b/net/minecraft/world/entity/monster/Slime.java -@@ -136,6 +_,8 @@ - if (this.onGround() && !this.wasOnGround) { - int i = this.getSize(); +@@ -137,6 +_,8 @@ + float f = this.getDimensions(this.getPose()).width() * 2.0F; + float f1 = f / 2.0F; + // Forge: Don't spawn particles if it's handled by the implementation itself + if (!spawnCustomParticles()) - for(int j = 0; j < i * 8; ++j) { - float f = this.random.nextFloat() * (float) (Math.PI * 2); - float f1 = this.random.nextFloat() * 0.5F + 0.5F; -@@ -200,6 +_,8 @@ + for (int i = 0; (float)i < f * 16.0F; i++) { + float f2 = this.random.nextFloat() * (float) (Math.PI * 2); + float f3 = this.random.nextFloat() * 0.5F + 0.5F; +@@ -202,6 +_,8 @@ int j = i / 2; int k = 2 + this.random.nextInt(3); + var children = new java.util.ArrayList(); // Neo: Children list for MobSplitEvent. + - for(int l = 0; l < k; ++l) { - float f1 = ((float)(l % 2) - 0.5F) * f; - float f2 = ((float)(l / 2) - 0.5F) * f; -@@ -214,8 +_,13 @@ + for (int l = 0; l < k; l++) { + float f2 = ((float)(l % 2) - 0.5F) * f1; + float f3 = ((float)(l / 2) - 0.5F) * f1; +@@ -216,8 +_,13 @@ slime.setInvulnerable(this.isInvulnerable()); slime.setSize(j, true); - slime.moveTo(this.getX() + (double)f1, this.getY() + 0.5, this.getZ() + (double)f2, this.random.nextFloat() * 360.0F, 0.0F); + slime.moveTo(this.getX() + (double)f2, this.getY() + 0.5, this.getZ() + (double)f3, this.random.nextFloat() * 360.0F, 0.0F); - this.level().addFreshEntity(slime); + + children.add(slime); // Neo: Record the slime until after event firing. @@ -33,9 +33,9 @@ } } -@@ -366,6 +_,12 @@ - public EntityDimensions getDimensions(Pose p_33597_) { - return super.getDimensions(p_33597_).scale(0.255F * (float)this.getSize()); +@@ -361,6 +_,12 @@ + public EntityDimensions getDefaultDimensions(Pose p_316359_) { + return super.getDefaultDimensions(p_316359_).scale((float)this.getSize()); } + + /** diff --git a/patches/net/minecraft/world/entity/monster/Spider.java.patch b/patches/net/minecraft/world/entity/monster/Spider.java.patch index 10da6d89dd4..e6368793de1 100644 --- a/patches/net/minecraft/world/entity/monster/Spider.java.patch +++ b/patches/net/minecraft/world/entity/monster/Spider.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/entity/monster/Spider.java +++ b/net/minecraft/world/entity/monster/Spider.java -@@ -132,7 +_,12 @@ +@@ -121,7 +_,12 @@ @Override public boolean canBeAffected(MobEffectInstance p_33809_) { -- return p_33809_.getEffect() == MobEffects.POISON ? false : super.canBeAffected(p_33809_); +- return p_33809_.is(MobEffects.POISON) ? false : super.canBeAffected(p_33809_); + if (p_33809_.getEffect() == MobEffects.POISON) { + net.neoforged.neoforge.event.entity.living.MobEffectEvent.Applicable event = new net.neoforged.neoforge.event.entity.living.MobEffectEvent.Applicable(this, p_33809_); + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(event); diff --git a/patches/net/minecraft/world/entity/monster/Zombie.java.patch b/patches/net/minecraft/world/entity/monster/Zombie.java.patch index f76a8cb274d..49e8c23de4c 100644 --- a/patches/net/minecraft/world/entity/monster/Zombie.java.patch +++ b/patches/net/minecraft/world/entity/monster/Zombie.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Zombie.java +++ b/net/minecraft/world/entity/monster/Zombie.java -@@ -254,6 +_,7 @@ +@@ -251,6 +_,7 @@ } protected void doUnderWaterConversion() { @@ -8,7 +8,7 @@ this.convertToZombieType(EntityType.DROWNED); if (!this.isSilent()) { this.level().levelEvent(null, 1040, this.blockPosition(), 0); -@@ -265,6 +_,7 @@ +@@ -262,6 +_,7 @@ if (zombie != null) { zombie.handleAttributes(zombie.level().getCurrentDifficultyAt(zombie.blockPosition()).getSpecialMultiplier()); zombie.setCanBreakDoors(zombie.supportsBreakDoorGoal() && this.canBreakDoors()); @@ -16,7 +16,7 @@ } } -@@ -285,14 +_,19 @@ +@@ -282,14 +_,19 @@ livingentity = (LivingEntity)p_34288_.getEntity(); } @@ -42,9 +42,9 @@ + + Zombie zombie = event.getCustomSummonedAid() != null && event.getResult() == net.neoforged.bus.api.Event.Result.ALLOW ? event.getCustomSummonedAid() : EntityType.ZOMBIE.create(this.level()); - for(int l = 0; l < 50; ++l) { + for (int l = 0; l < 50; l++) { int i1 = i + Mth.nextInt(this.random, 7, 40) * Mth.nextInt(this.random, -1, 1); -@@ -308,7 +_,9 @@ +@@ -304,7 +_,9 @@ && this.level().isUnobstructed(zombie) && this.level().noCollision(zombie) && !this.level().containsAnyLiquid(zombie.getBoundingBox())) { @@ -52,10 +52,10 @@ + if (livingentity != null) { + zombie.setTarget(livingentity); + } - zombie.finalizeSpawn( - serverlevel, this.level().getCurrentDifficultyAt(zombie.blockPosition()), MobSpawnType.REINFORCEMENT, null, null - ); -@@ -405,7 +_,7 @@ + zombie.finalizeSpawn(serverlevel, this.level().getCurrentDifficultyAt(zombie.blockPosition()), MobSpawnType.REINFORCEMENT, null); + serverlevel.addFreshEntityWithPassengers(zombie); + this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE) +@@ -398,7 +_,7 @@ @Override public boolean killedEntity(ServerLevel p_219160_, LivingEntity p_219161_) { boolean flag = super.killedEntity(p_219160_, p_219161_); @@ -64,9 +64,9 @@ if (p_219160_.getDifficulty() != Difficulty.HARD && this.random.nextBoolean()) { return flag; } -@@ -423,6 +_,7 @@ +@@ -415,6 +_,7 @@ zombievillager.setGossips(villager.getGossips().store(NbtOps.INSTANCE)); - zombievillager.setTradeOffers(villager.getOffers().createTag()); + zombievillager.setTradeOffers(villager.getOffers().copy()); zombievillager.setVillagerXp(villager.getVillagerXp()); + net.neoforged.neoforge.event.EventHooks.onLivingConvert(p_219161_, zombievillager); if (!this.isSilent()) { diff --git a/patches/net/minecraft/world/entity/monster/ZombieVillager.java.patch b/patches/net/minecraft/world/entity/monster/ZombieVillager.java.patch index 0ea4f20d507..6f9a1242b8e 100644 --- a/patches/net/minecraft/world/entity/monster/ZombieVillager.java.patch +++ b/patches/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 -@@ -136,7 +_,7 @@ +@@ -139,7 +_,7 @@ if (!this.level().isClientSide && this.isAlive() && this.isConverting()) { int i = this.getConversionProgress(); this.villagerConversionTime -= i; diff --git a/patches/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch b/patches/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch index bb0f6ecf5c5..14a4f5a41de 100644 --- a/patches/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch +++ b/patches/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java -@@ -163,7 +_,7 @@ +@@ -161,7 +_,7 @@ HoglinAi.updateActivity(this); if (this.isConverting()) { - ++this.timeInOverworld; + this.timeInOverworld++; - if (this.timeInOverworld > 300) { + if (this.timeInOverworld > 300 && net.neoforged.neoforge.event.EventHooks.canLivingConvert(this, EntityType.ZOGLIN, (timer) -> this.timeInOverworld = timer)) { - this.playSoundEvent(SoundEvents.HOGLIN_CONVERTED_TO_ZOMBIFIED); + this.makeSound(SoundEvents.HOGLIN_CONVERTED_TO_ZOMBIFIED); this.finishConversion((ServerLevel)this.level()); } -@@ -268,6 +_,7 @@ +@@ -259,6 +_,7 @@ Zoglin zoglin = this.convertTo(EntityType.ZOGLIN, true); if (zoglin != null) { zoglin.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0)); diff --git a/patches/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch b/patches/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch index 519798d0894..36ab4f9ccdc 100644 --- a/patches/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch +++ b/patches/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch @@ -1,10 +1,7 @@ --- a/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java +++ b/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java -@@ -101,9 +_,10 @@ - ++this.timeInOverworld; - } else { +@@ -82,7 +_,7 @@ this.timeInOverworld = 0; -+ this.timeInOverworld = 0; } - if (this.timeInOverworld > 300) { @@ -12,7 +9,7 @@ this.playConvertedSound(); this.finishConversion((ServerLevel)this.level()); } -@@ -117,6 +_,7 @@ +@@ -96,6 +_,7 @@ ZombifiedPiglin zombifiedpiglin = this.convertTo(EntityType.ZOMBIFIED_PIGLIN, true); if (zombifiedpiglin != null) { zombifiedpiglin.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0)); diff --git a/patches/net/minecraft/world/entity/monster/piglin/Piglin.java.patch b/patches/net/minecraft/world/entity/monster/piglin/Piglin.java.patch index 5d00b21d025..7177a802227 100644 --- a/patches/net/minecraft/world/entity/monster/piglin/Piglin.java.patch +++ b/patches/net/minecraft/world/entity/monster/piglin/Piglin.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/net/minecraft/world/entity/monster/piglin/Piglin.java -@@ -355,7 +_,7 @@ +@@ -349,7 +_,7 @@ } else if (this.isChargingCrossbow()) { return PiglinArmPose.CROSSBOW_CHARGE; } else { @@ -9,7 +9,7 @@ } } -@@ -401,7 +_,7 @@ +@@ -390,7 +_,7 @@ } protected void holdInOffHand(ItemStack p_34786_) { @@ -18,7 +18,7 @@ this.setItemSlot(EquipmentSlot.OFFHAND, p_34786_); this.setGuaranteedDrop(EquipmentSlot.OFFHAND); } else { -@@ -411,7 +_,7 @@ +@@ -400,7 +_,7 @@ @Override public boolean wantsToPickUp(ItemStack p_34777_) { diff --git a/patches/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch b/patches/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch index 640aa843011..3aa8dcc2a53 100644 --- a/patches/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch +++ b/patches/net/minecraft/world/entity/monster/piglin/PiglinAi.java.patch @@ -9,7 +9,7 @@ if (p_34869_ && flag) { throwItems(p_34868_, getBarterResponseItems(p_34868_)); } else if (!flag) { -@@ -465,7 +_,7 @@ +@@ -461,7 +_,7 @@ return false; } else if (isAdmiringDisabled(p_34858_) && p_34858_.getBrain().hasMemoryValue(MemoryModuleType.ATTACK_TARGET)) { return false; @@ -18,7 +18,7 @@ return isNotHoldingLovedItemInOffHand(p_34858_); } else { boolean flag = p_34858_.canAddToInventory(p_34859_); -@@ -560,7 +_,7 @@ +@@ -551,7 +_,7 @@ } protected static boolean canAdmire(Piglin p_34910_, ItemStack p_34911_) { @@ -27,16 +27,16 @@ } protected static void wasHurtBy(Piglin p_34838_, LivingEntity p_34839_) { -@@ -650,7 +_,7 @@ +@@ -641,7 +_,7 @@ public static boolean isWearingGold(LivingEntity p_34809_) { - for(ItemStack itemstack : p_34809_.getArmorSlots()) { + for (ItemStack itemstack : p_34809_.getArmorAndBodyArmorSlots()) { Item item = itemstack.getItem(); -- if (item instanceof ArmorItem && ((ArmorItem)item).getMaterial() == ArmorMaterials.GOLD) { +- if (item instanceof ArmorItem && ((ArmorItem)item).getMaterial().is(ArmorMaterials.GOLD)) { + if (itemstack.makesPiglinsNeutral(p_34809_)) { return true; } } -@@ -803,7 +_,7 @@ +@@ -792,7 +_,7 @@ } private static boolean hasCrossbow(LivingEntity p_34919_) { diff --git a/patches/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java.patch b/patches/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java.patch index 769308e5973..25f0fb13370 100644 --- a/patches/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java.patch +++ b/patches/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java +++ b/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java -@@ -12,7 +_,7 @@ +@@ -11,7 +_,7 @@ + public static BehaviorControl create() { return BehaviorBuilder.create( - p_259197_ -> p_259197_.group(p_259197_.absent(MemoryModuleType.ADMIRING_ITEM)) - .apply(p_259197_, p_259512_ -> (p_311695_, p_311696_, p_311697_) -> { -- if (!p_311696_.getOffhandItem().isEmpty() && !p_311696_.getOffhandItem().is(Items.SHIELD)) { -+ if (!p_311696_.getOffhandItem().isEmpty() && !p_311696_.getOffhandItem().canPerformAction(net.neoforged.neoforge.common.ToolActions.SHIELD_BLOCK)) { - PiglinAi.stopHoldingOffHandItem(p_311696_, true); - return true; - } else { + p_259197_ -> p_259197_.group(p_259197_.absent(MemoryModuleType.ADMIRING_ITEM)).apply(p_259197_, p_259512_ -> (p_337869_, p_337870_, p_337871_) -> { +- if (!p_337870_.getOffhandItem().isEmpty() && !p_337870_.getOffhandItem().is(Items.SHIELD)) { ++ if (!p_337870_.getOffhandItem().isEmpty() && !p_337870_.getOffhandItem().canPerformAction(net.neoforged.neoforge.common.ToolActions.SHIELD_BLOCK)) { + PiglinAi.stopHoldingOffHandItem(p_337870_, true); + return true; + } else { diff --git a/patches/net/minecraft/world/entity/npc/AbstractVillager.java.patch b/patches/net/minecraft/world/entity/npc/AbstractVillager.java.patch index 851fe96f822..5afd75101ba 100644 --- a/patches/net/minecraft/world/entity/npc/AbstractVillager.java.patch +++ b/patches/net/minecraft/world/entity/npc/AbstractVillager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/npc/AbstractVillager.java +++ b/net/minecraft/world/entity/npc/AbstractVillager.java -@@ -127,6 +_,7 @@ +@@ -123,6 +_,7 @@ if (this.tradingPlayer instanceof ServerPlayer) { CriteriaTriggers.TRADE.trigger((ServerPlayer)this.tradingPlayer, this, p_35274_.getResult()); } @@ -8,7 +8,7 @@ } protected abstract void rewardTradeXp(MerchantOffer p_35299_); -@@ -180,9 +_,9 @@ +@@ -181,9 +_,9 @@ @Nullable @Override diff --git a/patches/net/minecraft/world/entity/npc/CatSpawner.java.patch b/patches/net/minecraft/world/entity/npc/CatSpawner.java.patch index e9bd6dd1c83..c0cbf518d6b 100644 --- a/patches/net/minecraft/world/entity/npc/CatSpawner.java.patch +++ b/patches/net/minecraft/world/entity/npc/CatSpawner.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/npc/CatSpawner.java +++ b/net/minecraft/world/entity/npc/CatSpawner.java -@@ -84,8 +_,8 @@ +@@ -83,8 +_,8 @@ if (cat == null) { return 0; } else { + cat.moveTo(p_35334_, 0.0F, 0.0F); // Fix MC-147659: Some witch huts spawn the incorrect cat - cat.finalizeSpawn(p_35335_, p_35335_.getCurrentDifficultyAt(p_35334_), MobSpawnType.NATURAL, null, null); + cat.finalizeSpawn(p_35335_, p_35335_.getCurrentDifficultyAt(p_35334_), MobSpawnType.NATURAL, null); - cat.moveTo(p_35334_, 0.0F, 0.0F); p_35335_.addFreshEntityWithPassengers(cat); return 1; diff --git a/patches/net/minecraft/world/entity/npc/Villager.java.patch b/patches/net/minecraft/world/entity/npc/Villager.java.patch index ffdd057be75..f2042d3216b 100644 --- a/patches/net/minecraft/world/entity/npc/Villager.java.patch +++ b/patches/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 -@@ -323,7 +_,7 @@ +@@ -322,7 +_,7 @@ @Override public InteractionResult mobInteract(Player p_35472_, InteractionHand p_35473_) { ItemStack itemstack = p_35472_.getItemInHand(p_35473_); @@ -9,7 +9,7 @@ return super.mobInteract(p_35472_, p_35473_); } else if (this.isBaby()) { this.setUnhappy(); -@@ -747,8 +_,9 @@ +@@ -740,8 +_,9 @@ @Override protected Component getTypeName() { @@ -20,7 +20,7 @@ ); } -@@ -806,7 +_,7 @@ +@@ -797,7 +_,7 @@ @Override public void thunderHit(ServerLevel p_35409_, LightningBolt p_35410_) { @@ -29,7 +29,7 @@ LOGGER.info("Villager {} was struck by lightning {}.", this, p_35410_); Witch witch = EntityType.WITCH.create(p_35409_); if (witch != null) { -@@ -819,6 +_,7 @@ +@@ -810,6 +_,7 @@ } witch.setPersistenceRequired(); diff --git a/patches/net/minecraft/world/entity/player/Inventory.java.patch b/patches/net/minecraft/world/entity/player/Inventory.java.patch index aa02ede9073..839ed703058 100644 --- a/patches/net/minecraft/world/entity/player/Inventory.java.patch +++ b/patches/net/minecraft/world/entity/player/Inventory.java.patch @@ -1,31 +1,21 @@ --- a/net/minecraft/world/entity/player/Inventory.java +++ b/net/minecraft/world/entity/player/Inventory.java -@@ -137,7 +_,7 @@ +@@ -133,7 +_,7 @@ - for(int k = 0; k < 9; ++k) { + for (int k = 0; k < 9; k++) { int l = (this.selected + k) % 9; - if (!this.items.get(l).isEnchanted()) { + if (!this.items.get(l).isNotReplaceableByPickAction(this.player, l)) { return l; } } -@@ -186,7 +_,8 @@ - int i = p_36049_.getCount(); - ItemStack itemstack = this.getItem(p_36048_); - if (itemstack.isEmpty()) { -- itemstack = new ItemStack(item, 0); -+ itemstack = p_36049_.copy(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up. -+ itemstack.setCount(0); - if (p_36049_.hasTag()) { - itemstack.setTag(p_36049_.getTag().copy()); - } -@@ -230,13 +_,18 @@ +@@ -214,13 +_,18 @@ } public void tick() { + int slot = 0; - for(NonNullList nonnulllist : this.compartments) { - for(int i = 0; i < nonnulllist.size(); ++i) { + for (NonNullList nonnulllist : this.compartments) { + for (int i = 0; i < nonnulllist.size(); i++) { if (!nonnulllist.get(i).isEmpty()) { - nonnulllist.get(i).inventoryTick(this.player.level(), this.player, i, this.selected == i); + // Neo: Fix the slot param to be the global index instead of the per-compartment index. @@ -39,7 +29,7 @@ } public boolean add(ItemStack p_36055_) { -@@ -284,6 +_,8 @@ +@@ -268,6 +_,8 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Adding item to inventory"); CrashReportCategory crashreportcategory = crashreport.addCategory("Item being added"); diff --git a/patches/net/minecraft/world/entity/player/Player.java.patch b/patches/net/minecraft/world/entity/player/Player.java.patch index d410d2472b5..530f8ebdf79 100644 --- a/patches/net/minecraft/world/entity/player/Player.java.patch +++ b/patches/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 -@@ -112,7 +_,8 @@ +@@ -114,7 +_,8 @@ import net.minecraft.world.scores.Team; import org.slf4j.Logger; @@ -8,40 +8,38 @@ +public abstract class Player extends LivingEntity implements net.neoforged.neoforge.common.extensions.IPlayerExtension { + public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; private static final Logger LOGGER = LogUtils.getLogger(); - public static final int MAX_NAME_LENGTH = 16; public static final HumanoidArm DEFAULT_MAIN_HAND = HumanoidArm.RIGHT; -@@ -174,6 +_,9 @@ + public static final int DEFAULT_MODEL_CUSTOMIZATION = 0; +@@ -192,6 +_,9 @@ @Nullable - public FishingHook fishing; - protected float hurtDir; + public Entity currentExplosionCause; + public boolean ignoreFallDamageFromCurrentImpulse; + private final java.util.Collection prefixes = new java.util.LinkedList<>(); + private final java.util.Collection suffixes = new java.util.LinkedList<>(); + @Nullable private Pose forcedPose; public Player(Level p_250508_, BlockPos p_250289_, float p_251702_, GameProfile p_252153_) { super(EntityType.PLAYER, p_250508_); -@@ -206,7 +_,11 @@ - .add(Attributes.ATTACK_DAMAGE, 1.0) - .add(Attributes.MOVEMENT_SPEED, 0.1F) - .add(Attributes.ATTACK_SPEED) -- .add(Attributes.LUCK); -+ .add(Attributes.LUCK) -+ .add(net.neoforged.neoforge.common.NeoForgeMod.BLOCK_REACH.value()) +@@ -224,7 +_,9 @@ + .add(Attributes.LUCK) + .add(Attributes.BLOCK_INTERACTION_RANGE, 4.5) + .add(Attributes.ENTITY_INTERACTION_RANGE, 3.0) +- .add(Attributes.BLOCK_BREAK_SPEED); ++ .add(Attributes.BLOCK_BREAK_SPEED) + .add(Attributes.ATTACK_KNOCKBACK) -+ .add(net.neoforged.neoforge.common.NeoForgeMod.ENTITY_REACH.value()) -+ .add(net.neoforged.neoforge.common.NeoForgeMod.CREATIVE_FLIGHT.value()); ++ .add(net.neoforged.neoforge.common.NeoForgeMod.CREATIVE_FLIGHT); } @Override -@@ -222,6 +_,7 @@ +@@ -240,6 +_,7 @@ @Override public void tick() { -+ net.neoforged.neoforge.event.EventHooks.onPlayerPreTick(this); ++ net.neoforged.neoforge.event.EventHooks.firePlayerTickPre(this); this.noPhysics = this.isSpectator(); if (this.isSpectator()) { this.setOnGround(false); -@@ -237,7 +_,7 @@ +@@ -255,7 +_,7 @@ this.sleepCounter = 100; } @@ -50,15 +48,15 @@ this.stopSleepInBed(false, true); } } else if (this.sleepCounter > 0) { -@@ -292,6 +_,7 @@ +@@ -310,6 +_,7 @@ this.turtleHelmetTick(); this.cooldowns.tick(); this.updatePlayerPose(); -+ net.neoforged.neoforge.event.EventHooks.onPlayerPostTick(this); ++ net.neoforged.neoforge.event.EventHooks.firePlayerTickPost(this); } @Override -@@ -371,6 +_,10 @@ +@@ -389,6 +_,10 @@ } protected void updatePlayerPose() { @@ -69,7 +67,7 @@ if (this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.SWIMMING)) { Pose pose; if (this.isFallFlying()) { -@@ -613,6 +_,7 @@ +@@ -620,6 +_,7 @@ @Override public void die(DamageSource p_36152_) { @@ -77,7 +75,7 @@ super.die(p_36152_); this.reapplyPosition(); if (!this.isSpectator()) { -@@ -667,7 +_,7 @@ +@@ -674,7 +_,7 @@ @Nullable public ItemEntity drop(ItemStack p_36177_, boolean p_36178_) { @@ -86,7 +84,7 @@ } @Nullable -@@ -709,7 +_,12 @@ +@@ -716,7 +_,12 @@ } } @@ -99,7 +97,7 @@ float f = this.inventory.getDestroySpeed(p_36282_); if (f > 1.0F) { int i = EnchantmentHelper.getBlockEfficiency(this); -@@ -740,11 +_,12 @@ +@@ -748,11 +_,12 @@ f /= 5.0F; } @@ -113,7 +111,7 @@ } @Override -@@ -831,6 +_,7 @@ +@@ -851,6 +_,7 @@ @Override public boolean hurt(DamageSource p_36154_, float p_36155_) { @@ -121,7 +119,7 @@ if (this.isInvulnerableTo(p_36154_)) { return false; } else if (this.abilities.invulnerable && !p_36154_.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { -@@ -844,7 +_,9 @@ +@@ -864,7 +_,9 @@ this.removeEntitiesOnShoulder(); } @@ -132,7 +130,7 @@ if (this.level().getDifficulty() == Difficulty.PEACEFUL) { p_36155_ = 0.0F; } -@@ -898,7 +_,7 @@ +@@ -918,7 +_,7 @@ @Override protected void hurtCurrentlyUsedShield(float p_36383_) { @@ -141,20 +139,22 @@ if (!this.level().isClientSide) { this.awardStat(Stats.ITEM_USED.get(this.useItem.getItem())); } -@@ -906,7 +_,11 @@ +@@ -926,7 +_,13 @@ if (p_36383_ >= 3.0F) { int i = 1 + Mth.floor(p_36383_); InteractionHand interactionhand = this.getUsedItemHand(); -- this.useItem.hurtAndBreak(i, this, p_219739_ -> p_219739_.broadcastBreakEvent(interactionhand)); -+ this.useItem.hurtAndBreak(i, this, p_219739_ -> { -+ p_219739_.broadcastBreakEvent(interactionhand); -+ net.neoforged.neoforge.event.EventHooks.onPlayerDestroyItem(this, this.useItem, interactionhand); -+ stopUsingItem(); // Neo: Fix MC-168573 ("After breaking a shield, the player's off-hand can't finish using some items") -+ }); +- this.useItem.hurtAndBreak(i, this, getSlotForHand(interactionhand)); ++ if (!level().isClientSide && !hasInfiniteMaterials()) { ++ this.useItem.hurtAndBreak(i, getRandom(), this, () -> { ++ broadcastBreakEvent(getSlotForHand(interactionhand)); ++ net.neoforged.neoforge.event.EventHooks.onPlayerDestroyItem(this, this.useItem, interactionhand); ++ stopUsingItem(); // Neo: Fix MC-168573 ("After breaking a shield, the player's off-hand can't finish using some items") ++ }); ++ } if (this.useItem.isEmpty()) { if (interactionhand == InteractionHand.MAIN_HAND) { this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY); -@@ -924,10 +_,13 @@ +@@ -944,10 +_,13 @@ @Override protected void actuallyHurt(DamageSource p_36312_, float p_36313_) { if (!this.isInvulnerableTo(p_36312_)) { @@ -168,7 +168,7 @@ float f = p_36313_ - f1; if (f > 0.0F && f < 3.4028235E37F) { this.awardStat(Stats.DAMAGE_ABSORBED, Math.round(f * 10.0F)); -@@ -991,6 +_,8 @@ +@@ -1011,6 +_,8 @@ return InteractionResult.PASS; } else { @@ -177,7 +177,7 @@ ItemStack itemstack = this.getItemInHand(p_36159_); ItemStack itemstack1 = itemstack.copy(); InteractionResult interactionresult = p_36158_.interact(this, p_36159_); -@@ -999,6 +_,9 @@ +@@ -1019,6 +_,9 @@ itemstack.setCount(itemstack1.getCount()); } @@ -187,7 +187,7 @@ return interactionresult; } else { if (!itemstack.isEmpty() && p_36158_ instanceof LivingEntity) { -@@ -1010,6 +_,7 @@ +@@ -1030,6 +_,7 @@ if (interactionresult1.consumesAction()) { this.level().gameEvent(GameEvent.ENTITY_INTERACT, p_36158_.position(), GameEvent.Context.of(this)); if (itemstack.isEmpty() && !this.abilities.instabuild) { @@ -195,23 +195,23 @@ this.setItemInHand(p_36159_, ItemStack.EMPTY); } -@@ -1044,6 +_,7 @@ +@@ -1059,6 +_,7 @@ } @Override + // Forge: Don't update this method to use IForgeEntity#getStepHeight() - https://github.com/MinecraftForge/MinecraftForge/issues/8922 protected Vec3 maybeBackOffFromEdge(Vec3 p_36201_, MoverType p_36202_) { + float f = this.maxUpStep(); if (!this.abilities.flying - && p_36201_.y <= 0.0 -@@ -1098,6 +_,7 @@ - return p_36201_; +@@ -1108,6 +_,7 @@ + } } + // Forge: Don't update this method to use IForgeEntity#getStepHeight() - https://github.com/MinecraftForge/MinecraftForge/issues/9376 - private boolean isAboveGround() { - return this.onGround() - || this.fallDistance < this.maxUpStep() -@@ -1105,6 +_,7 @@ + private boolean isAboveGround(float p_341626_) { + return this.onGround() || this.fallDistance < p_341626_ && !this.canFallAtLeast(0.0, 0.0, p_341626_ - this.fallDistance); + } +@@ -1129,6 +_,7 @@ } public void attack(Entity p_36347_) { @@ -219,75 +219,78 @@ if (p_36347_.isAttackable()) { if (!p_36347_.skipAttackInteraction(this)) { float f = (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE); -@@ -1118,11 +_,10 @@ +@@ -1136,14 +_,13 @@ float f2 = this.getAttackStrengthScale(0.5F); f *= 0.2F + f2 * f2 * 0.8F; f1 *= f2; - this.resetAttackStrengthTicker(); - if (f > 0.0F || f1 > 0.0F) { - boolean flag = f2 > 0.9F; - boolean flag1 = false; -- int i = 0; -+ float i = (float)this.getAttributeValue(Attributes.ATTACK_KNOCKBACK); // Forge: Initialize this value to the attack knockback attribute of the player, which is by default 0 - i += EnchantmentHelper.getKnockbackBonus(this); - if (this.isSprinting() && flag) { - this.level() -@@ -1140,8 +_,10 @@ - && !this.isPassenger() - && p_36347_ instanceof LivingEntity; - flag2 = flag2 && !this.isSprinting(); -+ net.neoforged.neoforge.event.entity.player.CriticalHitEvent hitResult = net.neoforged.neoforge.common.CommonHooks.getCriticalHit(this, p_36347_, flag2, flag2 ? 1.5F : 1.0F); -+ flag2 = hitResult != null; - if (flag2) { -- f *= 1.5F; -+ f *= hitResult.getDamageModifier(); - } - - f += f1; -@@ -1149,9 +_,7 @@ - double d0 = (double)(this.walkDist - this.walkDistO); - if (flag && !flag2 && !flag1 && this.onGround() && d0 < (double)this.getSpeed()) { - ItemStack itemstack = this.getItemInHand(InteractionHand.MAIN_HAND); -- if (itemstack.getItem() instanceof SwordItem) { -- flag3 = true; -- } -+ flag3 = itemstack.canPerformAction(net.neoforged.neoforge.common.ToolActions.SWORD_SWEEP); - } + if (p_36347_.getType().is(EntityTypeTags.REDIRECTABLE_PROJECTILE) && p_36347_ instanceof Projectile projectile) { + projectile.deflect(ProjectileDeflection.AIM_DEFLECT, this, this, true); + } else { + if (f > 0.0F || f1 > 0.0F) { + boolean flag = f2 > 0.9F; + boolean flag1 = false; +- int i = 0; ++ float i = (float)this.getAttributeValue(Attributes.ATTACK_KNOCKBACK); // Forge: Initialize this value to the attack knockback attribute of the player, which is by default 0 + i += EnchantmentHelper.getKnockbackBonus(this); + if (this.isSprinting() && flag) { + this.level() +@@ -1162,8 +_,10 @@ + && !this.isPassenger() + && p_36347_ instanceof LivingEntity + && !this.isSprinting(); ++ net.neoforged.neoforge.event.entity.player.CriticalHitEvent hitResult = net.neoforged.neoforge.common.CommonHooks.getCriticalHit(this, p_36347_, flag2, flag2 ? 1.5F : 1.0F); ++ flag2 = hitResult != null; + if (flag2) { +- f *= 1.5F; ++ f *= hitResult.getDamageModifier(); + } - float f4 = 0.0F; -@@ -1193,11 +_,12 @@ - - for(LivingEntity livingentity : this.level() - .getEntitiesOfClass(LivingEntity.class, p_36347_.getBoundingBox().inflate(1.0, 0.25, 1.0))) { -+ double entityReachSq = Mth.square(this.getEntityReach()); // Use entity reach instead of constant 9.0. Vanilla uses bottom center-to-center checks here, so don't update this to use canReach, since it uses closest-corner checks. - if (livingentity != this - && livingentity != p_36347_ - && !this.isAlliedTo(livingentity) - && (!(livingentity instanceof ArmorStand) || !((ArmorStand)livingentity).isMarker()) -- && this.distanceToSqr(livingentity) < 9.0) { -+ && this.distanceToSqr(livingentity) < entityReachSq) { - livingentity.knockback( - 0.4F, - (double)Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), -@@ -1246,13 +_,15 @@ - EnchantmentHelper.doPostDamageEffects(this, p_36347_); - ItemStack itemstack1 = this.getMainHandItem(); - Entity entity = p_36347_; -- if (p_36347_ instanceof EnderDragonPart) { -- entity = ((EnderDragonPart)p_36347_).parentMob; -+ if (p_36347_ instanceof net.neoforged.neoforge.entity.PartEntity) { -+ entity = ((net.neoforged.neoforge.entity.PartEntity) p_36347_).getParent(); + f += f1; +@@ -1171,9 +_,7 @@ + double d0 = (double)(this.walkDist - this.walkDistO); + if (flag && !flag2 && !flag1 && this.onGround() && d0 < (double)this.getSpeed()) { + ItemStack itemstack = this.getItemInHand(InteractionHand.MAIN_HAND); +- if (itemstack.getItem() instanceof SwordItem) { +- flag3 = true; +- } ++ flag3 = itemstack.canPerformAction(net.neoforged.neoforge.common.ToolActions.SWORD_SWEEP); } - if (!this.level().isClientSide && !itemstack1.isEmpty() && entity instanceof LivingEntity) { -+ ItemStack copy = itemstack1.copy(); - itemstack1.hurtEnemy((LivingEntity)entity, this); - if (itemstack1.isEmpty()) { -+ net.neoforged.neoforge.event.EventHooks.onPlayerDestroyItem(this, copy, InteractionHand.MAIN_HAND); - this.setItemInHand(InteractionHand.MAIN_HAND, ItemStack.EMPTY); + float f4 = 0.0F; +@@ -1215,11 +_,12 @@ + + for (LivingEntity livingentity : this.level() + .getEntitiesOfClass(LivingEntity.class, p_36347_.getBoundingBox().inflate(1.0, 0.25, 1.0))) { ++ double entityReachSq = Mth.square(this.entityInteractionRange()); // Use entity reach instead of constant 9.0. Vanilla uses bottom center-to-center checks here, so don't update this to use canReach, since it uses closest-corner checks. + if (livingentity != this + && livingentity != p_36347_ + && !this.isAlliedTo(livingentity) + && (!(livingentity instanceof ArmorStand) || !((ArmorStand)livingentity).isMarker()) +- && this.distanceToSqr(livingentity) < 9.0) { ++ && this.distanceToSqr(livingentity) < entityReachSq) { + livingentity.knockback( + 0.4F, + (double)Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), +@@ -1272,13 +_,15 @@ + EnchantmentHelper.doPostDamageEffects(this, p_36347_); + ItemStack itemstack1 = this.getMainHandItem(); + Entity entity = p_36347_; +- if (p_36347_ instanceof EnderDragonPart) { +- entity = ((EnderDragonPart)p_36347_).parentMob; ++ if (p_36347_ instanceof net.neoforged.neoforge.entity.PartEntity) { ++ entity = ((net.neoforged.neoforge.entity.PartEntity) p_36347_).getParent(); } - } -@@ -1280,6 +_,7 @@ + + if (!this.level().isClientSide && !itemstack1.isEmpty() && entity instanceof LivingEntity) { ++ ItemStack copy = itemstack1.copy(); + itemstack1.hurtEnemy((LivingEntity)entity, this); + if (itemstack1.isEmpty()) { ++ net.neoforged.neoforge.event.EventHooks.onPlayerDestroyItem(this, copy, InteractionHand.MAIN_HAND); + this.setItemInHand(InteractionHand.MAIN_HAND, ItemStack.EMPTY); + } + } +@@ -1309,6 +_,7 @@ } } } @@ -295,16 +298,16 @@ } } } -@@ -1296,7 +_,7 @@ - } +@@ -1319,7 +_,7 @@ + } - if (this.random.nextFloat() < f) { -- this.getCooldowns().addCooldown(Items.SHIELD, 100); -+ this.getCooldowns().addCooldown(this.getUseItem().getItem(), 100); - this.stopUsingItem(); - this.level().broadcastEntityEvent(this, (byte)30); - } -@@ -1358,6 +_,7 @@ + public void disableShield() { +- this.getCooldowns().addCooldown(Items.SHIELD, 100); ++ this.getCooldowns().addCooldown(this.getUseItem().getItem(), 100); + this.stopUsingItem(); + this.level().broadcastEntityEvent(this, (byte)30); + } +@@ -1385,6 +_,7 @@ } public void stopSleepInBed(boolean p_36226_, boolean p_36227_) { @@ -312,7 +315,7 @@ super.stopSleeping(); if (this.level() instanceof ServerLevel && p_36227_) { ((ServerLevel)this.level()).updateSleepingPlayerList(); -@@ -1390,7 +_,7 @@ +@@ -1417,7 +_,7 @@ } else if (block instanceof BedBlock && BedBlock.canSetSpawn(p_36131_)) { return BedBlock.findStandUpPosition(EntityType.PLAYER, p_36131_, p_36132_, blockstate.getValue(BedBlock.FACING), p_36133_); } else if (!p_36134_) { @@ -321,7 +324,7 @@ } else { boolean flag = block.isPossibleToRespawnInThis(blockstate); BlockState blockstate1 = p_36131_.getBlockState(p_36132_.above()); -@@ -1500,7 +_,8 @@ +@@ -1527,7 +_,8 @@ @Override public boolean causeFallDamage(float p_150093_, float p_150094_, DamageSource p_150095_) { @@ -331,7 +334,7 @@ return false; } else { if (p_150093_ >= 2.0F) { -@@ -1514,7 +_,7 @@ +@@ -1547,7 +_,7 @@ public boolean tryToStartFallFlying() { if (!this.onGround() && !this.isFallFlying() && !this.isInWater() && !this.hasEffect(MobEffects.LEVITATION)) { ItemStack itemstack = this.getItemBySlot(EquipmentSlot.CHEST); @@ -340,7 +343,7 @@ this.startFallFlying(); return true; } -@@ -1543,13 +_,13 @@ +@@ -1576,13 +_,13 @@ protected void playStepSound(BlockPos p_282121_, BlockState p_282194_) { if (this.isInWater()) { this.waterSwimSound(); @@ -356,7 +359,7 @@ } else { super.playStepSound(blockpos, blockstate); } -@@ -1578,6 +_,10 @@ +@@ -1613,6 +_,10 @@ } public void giveExperiencePoints(int p_36291_) { @@ -365,9 +368,9 @@ + p_36291_ = event.getAmount(); + this.increaseScore(p_36291_); - this.experienceProgress += (float)p_36291_ / (float)this.getXpNeededForNextLevel(); + this.experienceProgress = this.experienceProgress + (float)p_36291_ / (float)this.getXpNeededForNextLevel(); this.totalExperience = Mth.clamp(this.totalExperience + p_36291_, 0, Integer.MAX_VALUE); -@@ -1605,7 +_,7 @@ +@@ -1640,7 +_,7 @@ } public void onEnchantmentPerformed(ItemStack p_36172_, int p_36173_) { @@ -376,7 +379,7 @@ if (this.experienceLevel < 0) { this.experienceLevel = 0; this.experienceProgress = 0.0F; -@@ -1616,6 +_,10 @@ +@@ -1651,6 +_,10 @@ } public void giveExperienceLevels(int p_36276_) { @@ -387,7 +390,7 @@ this.experienceLevel += p_36276_; if (this.experienceLevel < 0) { this.experienceLevel = 0; -@@ -1819,7 +_,11 @@ +@@ -1859,7 +_,11 @@ @Override public Component getDisplayName() { @@ -400,7 +403,7 @@ return this.decorateDisplayNameComponent(mutablecomponent); } -@@ -1966,25 +_,25 @@ +@@ -2024,25 +_,25 @@ Predicate predicate = ((ProjectileWeaponItem)p_36349_.getItem()).getSupportedHeldProjectiles(); ItemStack itemstack = ProjectileWeaponItem.getHeldProjectile(this, predicate); if (!itemstack.isEmpty()) { @@ -409,7 +412,7 @@ } else { predicate = ((ProjectileWeaponItem)p_36349_.getItem()).getAllSupportedProjectiles(); - for(int i = 0; i < this.inventory.getContainerSize(); ++i) { + for (int i = 0; i < this.inventory.getContainerSize(); i++) { ItemStack itemstack1 = this.inventory.getItem(i); if (predicate.test(itemstack1)) { - return itemstack1; @@ -425,12 +428,12 @@ @Override public ItemStack eat(Level p_36185_, ItemStack p_36186_) { -- this.getFoodData().eat(p_36186_.getItem(), p_36186_); -+ this.getFoodData().eat(p_36186_.getItem(), p_36186_, this); +- this.getFoodData().eat(p_36186_); ++ this.getFoodData().eat(p_36186_, this); this.awardStat(Stats.ITEM_USED.get(p_36186_.getItem())); p_36185_.playSound( null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 0.5F, p_36185_.random.nextFloat() * 0.1F + 0.9F -@@ -2108,5 +_,39 @@ +@@ -2186,5 +_,39 @@ public Component getMessage() { return this.message; } diff --git a/patches/net/minecraft/world/entity/projectile/AbstractArrow.java.patch b/patches/net/minecraft/world/entity/projectile/AbstractArrow.java.patch index 725bcd13890..2f62b2cf0fb 100644 --- a/patches/net/minecraft/world/entity/projectile/AbstractArrow.java.patch +++ b/patches/net/minecraft/world/entity/projectile/AbstractArrow.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/net/minecraft/world/entity/projectile/AbstractArrow.java -@@ -163,7 +_,7 @@ - --this.shakeTime; +@@ -167,7 +_,7 @@ + this.shakeTime--; } - if (this.isInWaterOrRain() || blockstate.is(Blocks.POWDER_SNOW)) { @@ -9,7 +9,7 @@ this.clearFire(); } -@@ -199,7 +_,9 @@ +@@ -203,7 +_,9 @@ } } @@ -17,6 +17,6 @@ + if (hitresult != null && hitresult.getType() != HitResult.Type.MISS && !flag) { + if (net.neoforged.neoforge.event.EventHooks.onProjectileImpact(this, hitresult)) + break; - this.onHit(hitresult); + ProjectileDeflection projectiledeflection = this.hitTargetOrDeflectSelf(hitresult); this.hasImpulse = true; - } + if (projectiledeflection != ProjectileDeflection.NONE) { diff --git a/patches/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch b/patches/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch index 2f4a7d07d09..afb5659130b 100644 --- a/patches/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch +++ b/patches/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java +++ b/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java -@@ -91,7 +_,7 @@ +@@ -89,7 +_,7 @@ } HitResult hitresult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType()); - if (hitresult.getType() != HitResult.Type.MISS) { + if (hitresult.getType() != HitResult.Type.MISS && !net.neoforged.neoforge.event.EventHooks.onProjectileImpact(this, hitresult)) { - this.onHit(hitresult); + this.hitTargetOrDeflectSelf(hitresult); } diff --git a/patches/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch b/patches/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch index 3cb9bb6bfd3..61b9073b359 100644 --- a/patches/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch +++ b/patches/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 -@@ -171,6 +_,13 @@ +@@ -175,6 +_,13 @@ } } diff --git a/patches/net/minecraft/world/entity/projectile/FishingHook.java.patch b/patches/net/minecraft/world/entity/projectile/FishingHook.java.patch index 7f94247ddde..d3f5be43df6 100644 --- a/patches/net/minecraft/world/entity/projectile/FishingHook.java.patch +++ b/patches/net/minecraft/world/entity/projectile/FishingHook.java.patch @@ -15,12 +15,12 @@ private void checkCollision() { HitResult hitresult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); -- this.onHit(hitresult); +- this.hitTargetOrDeflectSelf(hitresult); + if (hitresult.getType() == HitResult.Type.MISS || !net.neoforged.neoforge.event.EventHooks.onProjectileImpact(this, hitresult)) this.onHit(hitresult); } @Override -@@ -439,6 +_,7 @@ +@@ -440,6 +_,7 @@ Player player = this.getPlayerOwner(); if (!this.level().isClientSide && player != null && !this.shouldStopFishing(player)) { int i = 0; @@ -28,14 +28,14 @@ if (this.hookedIn != null) { this.pullEntity(this.hookedIn); CriteriaTriggers.FISHING_ROD_HOOKED.trigger((ServerPlayer)player, p_37157_, this, Collections.emptyList()); -@@ -449,10 +_,17 @@ +@@ -450,10 +_,17 @@ .withParameter(LootContextParams.ORIGIN, this.position()) .withParameter(LootContextParams.TOOL, p_37157_) .withParameter(LootContextParams.THIS_ENTITY, this) + .withParameter(LootContextParams.KILLER_ENTITY, this.getOwner()) .withLuck((float)this.luck + player.getLuck()) .create(LootContextParamSets.FISHING); - LootTable loottable = this.level().getServer().getLootData().getLootTable(BuiltInLootTables.FISHING); + LootTable loottable = this.level().getServer().reloadableRegistries().getLootTable(BuiltInLootTables.FISHING); List list = loottable.getRandomItems(lootparams); + event = new net.neoforged.neoforge.event.entity.player.ItemFishedEvent(list, this.onGround() ? 2 : 1, this); + net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(event); @@ -45,8 +45,8 @@ + } CriteriaTriggers.FISHING_ROD_HOOKED.trigger((ServerPlayer)player, p_37157_, this, list); - for(ItemStack itemstack : list) { -@@ -478,6 +_,7 @@ + for (ItemStack itemstack : list) { +@@ -479,6 +_,7 @@ } this.discard(); diff --git a/patches/net/minecraft/world/entity/projectile/LlamaSpit.java.patch b/patches/net/minecraft/world/entity/projectile/LlamaSpit.java.patch index 0681913e1ff..013726ff411 100644 --- a/patches/net/minecraft/world/entity/projectile/LlamaSpit.java.patch +++ b/patches/net/minecraft/world/entity/projectile/LlamaSpit.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/entity/projectile/LlamaSpit.java +++ b/net/minecraft/world/entity/projectile/LlamaSpit.java -@@ -34,6 +_,7 @@ +@@ -39,6 +_,7 @@ super.tick(); Vec3 vec3 = this.getDeltaMovement(); HitResult hitresult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); + if (hitresult.getType() != HitResult.Type.MISS && !net.neoforged.neoforge.event.EventHooks.onProjectileImpact(this, hitresult)) - this.onHit(hitresult); + this.hitTargetOrDeflectSelf(hitresult); double d0 = this.getX() + vec3.x; double d1 = this.getY() + vec3.y; diff --git a/patches/net/minecraft/world/entity/projectile/Projectile.java.patch b/patches/net/minecraft/world/entity/projectile/Projectile.java.patch index ed0b94262c0..beda4d0988c 100644 --- a/patches/net/minecraft/world/entity/projectile/Projectile.java.patch +++ b/patches/net/minecraft/world/entity/projectile/Projectile.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/projectile/Projectile.java +++ b/net/minecraft/world/entity/projectile/Projectile.java -@@ -242,7 +_,7 @@ - if (entity instanceof Player) { - return entity.mayInteract(p_150167_, p_150168_); - } else { -- return entity == null || p_150167_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); -+ return entity == null || net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(p_150167_, entity); - } +@@ -271,7 +_,7 @@ + Entity entity = this.getOwner(); + return entity instanceof Player + ? entity.mayInteract(p_150167_, p_150168_) +- : entity == null || p_150167_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); ++ : entity == null || net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(p_150167_, entity); } + public boolean mayBreak(Level p_307481_) { diff --git a/patches/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch b/patches/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch index fa05a79c3ce..ce21a8dd5ea 100644 --- a/patches/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch +++ b/patches/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/projectile/ShulkerBullet.java +++ b/net/minecraft/world/entity/projectile/ShulkerBullet.java -@@ -216,7 +_,7 @@ +@@ -217,7 +_,7 @@ } HitResult hitresult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); - if (hitresult.getType() != HitResult.Type.MISS) { + if (hitresult.getType() != HitResult.Type.MISS && !net.neoforged.neoforge.event.EventHooks.onProjectileImpact(this, hitresult)) { - this.onHit(hitresult); + this.hitTargetOrDeflectSelf(hitresult); } } diff --git a/patches/net/minecraft/world/entity/projectile/ThrowableProjectile.java.patch b/patches/net/minecraft/world/entity/projectile/ThrowableProjectile.java.patch index 169617f5b89..da91c66d960 100644 --- a/patches/net/minecraft/world/entity/projectile/ThrowableProjectile.java.patch +++ b/patches/net/minecraft/world/entity/projectile/ThrowableProjectile.java.patch @@ -6,6 +6,6 @@ - if (hitresult.getType() != HitResult.Type.MISS && !flag) { + if (hitresult.getType() != HitResult.Type.MISS && !flag && !net.neoforged.neoforge.event.EventHooks.onProjectileImpact(this, hitresult)) { - this.onHit(hitresult); + this.hitTargetOrDeflectSelf(hitresult); } diff --git a/patches/net/minecraft/world/entity/raid/Raid.java.patch b/patches/net/minecraft/world/entity/raid/Raid.java.patch index 3dc76ea005f..020998b2293 100644 --- a/patches/net/minecraft/world/entity/raid/Raid.java.patch +++ b/patches/net/minecraft/world/entity/raid/Raid.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/raid/Raid.java +++ b/net/minecraft/world/entity/raid/Raid.java -@@ -825,7 +_,7 @@ +@@ -837,7 +_,7 @@ } } @@ -9,7 +9,7 @@ VINDICATOR(EntityType.VINDICATOR, new int[]{0, 0, 2, 0, 1, 4, 2, 5}), EVOKER(EntityType.EVOKER, new int[]{0, 0, 0, 0, 0, 1, 1, 2}), PILLAGER(EntityType.PILLAGER, new int[]{0, 4, 3, 3, 4, 4, 4, 2}), -@@ -839,6 +_,20 @@ +@@ -851,6 +_,20 @@ private RaiderType(EntityType p_37821_, int[] p_37822_) { this.entityType = p_37821_; this.spawnsPerWaveBeforeBonus = p_37822_; diff --git a/patches/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch b/patches/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch index cb8c4f93cac..94468fab356 100644 --- a/patches/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch +++ b/patches/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/entity/vehicle/AbstractMinecart.java +++ b/net/minecraft/world/entity/vehicle/AbstractMinecart.java -@@ -46,7 +_,7 @@ +@@ -45,7 +_,7 @@ + import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; - import org.joml.Vector3f; -public abstract class AbstractMinecart extends VehicleEntity { +public abstract class AbstractMinecart extends VehicleEntity implements net.neoforged.neoforge.common.extensions.IAbstractMinecartExtension { - private static final float LOWERED_PASSENGER_ATTACHMENT_Y = 0.0F; - private static final float PASSENGER_ATTACHMENT_Y = 0.1875F; + private static final Vec3 LOWERED_PASSENGER_ATTACHMENT = new Vec3(0.0, 0.0, 0.0); private static final EntityDataAccessor DATA_ID_DISPLAY_BLOCK = SynchedEntityData.defineId(AbstractMinecart.class, EntityDataSerializers.INT); -@@ -65,6 +_,7 @@ + private static final EntityDataAccessor DATA_ID_DISPLAY_OFFSET = SynchedEntityData.defineId(AbstractMinecart.class, EntityDataSerializers.INT); +@@ -63,6 +_,7 @@ private double lerpYRot; private double lerpXRot; private Vec3 targetDeltaMovement = Vec3.ZERO; @@ -17,7 +17,7 @@ private static final Map> EXITS = Util.make(Maps.newEnumMap(RailShape.class), p_38135_ -> { Vec3i vec3i = Direction.WEST.getNormal(); Vec3i vec3i1 = Direction.EAST.getNormal(); -@@ -85,6 +_,7 @@ +@@ -83,6 +_,7 @@ p_38135_.put(RailShape.NORTH_WEST, Pair.of(vec3i2, vec3i)); p_38135_.put(RailShape.NORTH_EAST, Pair.of(vec3i2, vec3i1)); }); @@ -25,7 +25,7 @@ protected AbstractMinecart(EntityType p_38087_, Level p_38088_) { super(p_38087_, p_38088_); -@@ -99,6 +_,14 @@ +@@ -97,6 +_,14 @@ this.zo = p_38094_; } @@ -40,7 +40,7 @@ public static AbstractMinecart createMinecart( ServerLevel p_305794_, double p_38121_, -@@ -141,7 +_,7 @@ +@@ -139,7 +_,7 @@ @Override public boolean isPushable() { @@ -49,8 +49,8 @@ } @Override -@@ -272,9 +_,9 @@ - BlockPos blockpos = new BlockPos(k, i, j); +@@ -271,9 +_,9 @@ + BlockPos blockpos = new BlockPos(i, j, k); BlockState blockstate = this.level().getBlockState(blockpos); this.onRails = BaseRailBlock.isRail(blockstate); - if (this.onRails) { @@ -58,10 +58,10 @@ this.moveAlongTrack(blockpos, blockstate); - if (blockstate.is(Blocks.ACTIVATOR_RAIL)) { + if (blockstate.getBlock() instanceof PoweredRailBlock && ((PoweredRailBlock) blockstate.getBlock()).isActivatorRail()) { - this.activateMinecart(k, i, j, blockstate.getValue(PoweredRailBlock.POWERED)); + this.activateMinecart(i, j, k, blockstate.getValue(PoweredRailBlock.POWERED)); } } else { -@@ -299,8 +_,11 @@ +@@ -298,8 +_,11 @@ } this.setRot(this.getYRot(), this.getXRot()); @@ -73,18 +73,18 @@ + if (canBeRidden() && this.getDeltaMovement().horizontalDistanceSqr() > 0.01D) { + List list = this.level().getEntities(this, box, EntitySelector.pushableBy(this)); if (!list.isEmpty()) { - for(Entity entity1 : list) { + for (Entity entity1 : list) { if (!(entity1 instanceof Player) -@@ -315,7 +_,7 @@ +@@ -314,7 +_,7 @@ } } } else { -- for(Entity entity : this.level().getEntities(this, this.getBoundingBox().inflate(0.2F, 0.0, 0.2F))) { +- for (Entity entity : this.level().getEntities(this, this.getBoundingBox().inflate(0.2F, 0.0, 0.2F))) { + for(Entity entity : this.level().getEntities(this, box)) { if (!this.hasPassenger(entity) && entity.isPushable() && entity instanceof AbstractMinecart) { entity.push(this); } -@@ -340,16 +_,23 @@ +@@ -339,16 +_,23 @@ } protected void comeOffTrack() { @@ -110,7 +110,7 @@ } } -@@ -362,18 +_,19 @@ +@@ -361,18 +_,19 @@ d1 = (double)p_38156_.getY(); boolean flag = false; boolean flag1 = false; @@ -130,10 +130,10 @@ Vec3 vec31 = this.getDeltaMovement(); - RailShape railshape = p_38157_.getValue(((BaseRailBlock)p_38157_.getBlock()).getShapeProperty()); + RailShape railshape = ((BaseRailBlock)p_38157_.getBlock()).getRailDirection(p_38157_, this.level(), p_38156_, this); - switch(railshape) { + switch (railshape) { case ASCENDING_EAST: this.setDeltaMovement(vec31.add(-d3, 0.0, 0.0)); -@@ -419,7 +_,7 @@ +@@ -418,7 +_,7 @@ } } @@ -142,7 +142,7 @@ double d22 = this.getDeltaMovement().horizontalDistance(); if (d22 < 0.03) { this.setDeltaMovement(Vec3.ZERO); -@@ -448,10 +_,7 @@ +@@ -447,10 +_,7 @@ d0 = d23 + d4 * d14; d2 = d10 + d5 * d14; this.setPos(d0, d1, d2); @@ -154,7 +154,7 @@ if (vec3i.getY() != 0 && Mth.floor(this.getX()) - p_38156_.getX() == vec3i.getX() && Mth.floor(this.getZ()) - p_38156_.getZ() == vec3i.getZ()) { this.setPos(this.getX(), this.getY() + (double)vec3i.getY(), this.getZ()); } else if (vec3i1.getY() != 0 && Mth.floor(this.getX()) - p_38156_.getX() == vec3i1.getX() && Mth.floor(this.getZ()) - p_38156_.getZ() == vec3i1.getZ() -@@ -481,7 +_,10 @@ +@@ -480,7 +_,10 @@ this.setDeltaMovement(d26 * (double)(j - p_38156_.getX()), vec35.y, d26 * (double)(i - p_38156_.getZ())); } @@ -166,7 +166,7 @@ Vec3 vec36 = this.getDeltaMovement(); double d27 = vec36.horizontalDistance(); if (d27 > 0.01) { -@@ -545,7 +_,7 @@ +@@ -544,7 +_,7 @@ BlockState blockstate = this.level().getBlockState(new BlockPos(i, j, k)); if (BaseRailBlock.isRail(blockstate)) { @@ -175,7 +175,7 @@ p_38098_ = (double)j; if (railshape.isAscending()) { p_38098_ = (double)(j + 1); -@@ -584,7 +_,7 @@ +@@ -583,7 +_,7 @@ BlockState blockstate = this.level().getBlockState(new BlockPos(i, j, k)); if (BaseRailBlock.isRail(blockstate)) { @@ -184,7 +184,7 @@ Pair pair = exits(railshape); Vec3i vec3i = pair.getFirst(); Vec3i vec3i1 = pair.getSecond(); -@@ -648,6 +_,10 @@ +@@ -647,6 +_,10 @@ @Override public void push(Entity p_38165_) { @@ -195,7 +195,7 @@ if (!this.level().isClientSide) { if (!p_38165_.noPhysics && !this.noPhysics) { if (!this.hasPassenger(p_38165_)) { -@@ -686,13 +_,11 @@ +@@ -685,13 +_,11 @@ Vec3 vec32 = this.getDeltaMovement(); Vec3 vec33 = p_38165_.getDeltaMovement(); @@ -211,7 +211,7 @@ p_38165_.setDeltaMovement(vec33.multiply(0.2, 1.0, 0.2)); p_38165_.push(vec32.x + d0, 0.0, vec32.z + d1); this.setDeltaMovement(vec32.multiply(0.95, 1.0, 0.95)); -@@ -791,6 +_,42 @@ +@@ -790,6 +_,42 @@ public void setCustomDisplay(boolean p_38139_) { this.getEntityData().set(DATA_ID_CUSTOM_DISPLAY, p_38139_); } diff --git a/patches/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch b/patches/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch index 64050a18a5b..cec5eec538c 100644 --- a/patches/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch +++ b/patches/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java +++ b/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java -@@ -94,6 +_,8 @@ +@@ -95,6 +_,8 @@ @Override public InteractionResult interact(Player p_38232_, InteractionHand p_38233_) { diff --git a/patches/net/minecraft/world/entity/vehicle/Boat.java.patch b/patches/net/minecraft/world/entity/vehicle/Boat.java.patch index 8958f7418d3..9e28a5834e3 100644 --- a/patches/net/minecraft/world/entity/vehicle/Boat.java.patch +++ b/patches/net/minecraft/world/entity/vehicle/Boat.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/world/entity/vehicle/Boat.java +++ b/net/minecraft/world/entity/vehicle/Boat.java -@@ -52,7 +_,7 @@ +@@ -51,7 +_,7 @@ + import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; - import org.joml.Vector3f; -public class Boat extends VehicleEntity implements VariantHolder { +public class Boat extends VehicleEntity implements VariantHolder, net.neoforged.neoforge.common.extensions.IBoatExtension { private static final EntityDataAccessor DATA_ID_TYPE = SynchedEntityData.defineId(Boat.class, EntityDataSerializers.INT); private static final EntityDataAccessor DATA_ID_PADDLE_LEFT = SynchedEntityData.defineId(Boat.class, EntityDataSerializers.BOOLEAN); private static final EntityDataAccessor DATA_ID_PADDLE_RIGHT = SynchedEntityData.defineId(Boat.class, EntityDataSerializers.BOOLEAN); -@@ -476,7 +_,7 @@ - for(int i2 = i1; i2 < j1; ++i2) { +@@ -471,7 +_,7 @@ + for (int i2 = i1; i2 < j1; i2++) { blockpos$mutableblockpos.set(l1, k1, i2); FluidState fluidstate = this.level().getFluidState(blockpos$mutableblockpos); - if (fluidstate.is(FluidTags.WATER)) { @@ -18,17 +18,17 @@ f = Math.max(f, fluidstate.getHeight(this.level(), blockpos$mutableblockpos)); } -@@ -522,7 +_,7 @@ +@@ -517,7 +_,7 @@ voxelshape, BooleanOp.AND )) { - f += blockstate.getBlock().getFriction(); + f += blockstate.getFriction(this.level(), blockpos$mutableblockpos, this); - ++k1; + k1++; } } -@@ -551,7 +_,7 @@ - for(int i2 = i1; i2 < j1; ++i2) { +@@ -546,7 +_,7 @@ + for (int i2 = i1; i2 < j1; i2++) { blockpos$mutableblockpos.set(k1, l1, i2); FluidState fluidstate = this.level().getFluidState(blockpos$mutableblockpos); - if (fluidstate.is(FluidTags.WATER)) { @@ -36,8 +36,8 @@ float f = (float)l1 + fluidstate.getHeight(this.level(), blockpos$mutableblockpos); this.waterLevel = Math.max((double)f, this.waterLevel); flag |= aabb.minY < (double)f; -@@ -581,7 +_,7 @@ - for(int i2 = i1; i2 < j1; ++i2) { +@@ -576,7 +_,7 @@ + for (int i2 = i1; i2 < j1; i2++) { blockpos$mutableblockpos.set(k1, l1, i2); FluidState fluidstate = this.level().getFluidState(blockpos$mutableblockpos); - if (fluidstate.is(FluidTags.WATER) @@ -45,7 +45,7 @@ && d0 < (double)((float)blockpos$mutableblockpos.getY() + fluidstate.getHeight(this.level(), blockpos$mutableblockpos))) { if (!fluidstate.isSource()) { return Boat.Status.UNDER_FLOWING_WATER; -@@ -795,7 +_,7 @@ +@@ -794,7 +_,7 @@ } this.resetFallDistance(); @@ -54,7 +54,7 @@ this.fallDistance -= (float)p_38307_; } } -@@ -827,7 +_,7 @@ +@@ -826,7 +_,7 @@ @Override protected boolean canAddPassenger(Entity p_38390_) { diff --git a/patches/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch b/patches/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch index 4793246e8ab..d9d498b5e6a 100644 --- a/patches/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch +++ b/patches/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/vehicle/ContainerEntity.java +++ b/net/minecraft/world/entity/vehicle/ContainerEntity.java -@@ -101,6 +_,9 @@ +@@ -107,6 +_,9 @@ this.setLootTable(null); LootParams.Builder lootparams$builder = new LootParams.Builder((ServerLevel)this.level()).withParameter(LootContextParams.ORIGIN, this.position()); diff --git a/patches/net/minecraft/world/entity/vehicle/MinecartFurnace.java.patch b/patches/net/minecraft/world/entity/vehicle/MinecartFurnace.java.patch index 843d88da1f7..2d4d876d571 100644 --- a/patches/net/minecraft/world/entity/vehicle/MinecartFurnace.java.patch +++ b/patches/net/minecraft/world/entity/vehicle/MinecartFurnace.java.patch @@ -8,8 +8,8 @@ + if (ret.consumesAction()) return ret; ItemStack itemstack = p_38562_.getItemInHand(p_38563_); if (INGREDIENT.test(itemstack) && this.fuel + 3600 <= 32000) { - if (!p_38562_.getAbilities().instabuild) { -@@ -131,6 +_,11 @@ + itemstack.consume(1, p_38562_); +@@ -128,6 +_,11 @@ } return InteractionResult.sidedSuccess(this.level().isClientSide); diff --git a/patches/net/minecraft/world/food/FoodData.java.patch b/patches/net/minecraft/world/food/FoodData.java.patch index 4f4656a57d8..04c31223a0d 100644 --- a/patches/net/minecraft/world/food/FoodData.java.patch +++ b/patches/net/minecraft/world/food/FoodData.java.patch @@ -1,19 +1,17 @@ --- a/net/minecraft/world/food/FoodData.java +++ b/net/minecraft/world/food/FoodData.java -@@ -23,9 +_,15 @@ - this.saturationLevel = Math.min(this.saturationLevel + (float)p_38708_ * p_38709_ * 2.0F, (float)this.foodLevel); +@@ -27,8 +_,13 @@ + this.add(p_38708_, FoodConstants.saturationByModifier(p_38708_, p_38709_)); } + // Use the LivingEntity sensitive version in favour of this. + @Deprecated - public void eat(Item p_38713_, ItemStack p_38714_) { -+ this.eat(p_38713_, p_38714_, null); + public void eat(ItemStack p_38714_) { +- FoodProperties foodproperties = p_38714_.get(DataComponents.FOOD); ++ this.eat(p_38714_, null); + } -+ -+ public void eat(Item p_38713_, ItemStack p_38714_, @org.jetbrains.annotations.Nullable net.minecraft.world.entity.LivingEntity entity) { - if (p_38713_.isEdible()) { -- FoodProperties foodproperties = p_38713_.getFoodProperties(); -+ FoodProperties foodproperties = p_38714_.getFoodProperties(entity); - this.eat(foodproperties.getNutrition(), foodproperties.getSaturationModifier()); ++ public void eat(ItemStack p_38714_, @org.jetbrains.annotations.Nullable net.minecraft.world.entity.LivingEntity entity) { ++ FoodProperties foodproperties = p_38714_.getFoodProperties(entity); + if (foodproperties != null) { + this.add(foodproperties.nutrition(), foodproperties.saturation()); } - } diff --git a/patches/net/minecraft/world/food/FoodProperties.java.patch b/patches/net/minecraft/world/food/FoodProperties.java.patch index 75f445fb586..3677e653e6f 100644 --- a/patches/net/minecraft/world/food/FoodProperties.java.patch +++ b/patches/net/minecraft/world/food/FoodProperties.java.patch @@ -1,73 +1,43 @@ --- a/net/minecraft/world/food/FoodProperties.java +++ b/net/minecraft/world/food/FoodProperties.java -@@ -11,15 +_,26 @@ - private final boolean isMeat; - private final boolean canAlwaysEat; - private final boolean fastFood; -- private final List> effects; -- -+ private final List, Float>> effects; -+ -+ private FoodProperties(FoodProperties.Builder builder) { -+ this.nutrition = builder.nutrition; -+ this.saturationModifier = builder.saturationModifier; -+ this.isMeat = builder.isMeat; -+ this.canAlwaysEat = builder.canAlwaysEat; -+ this.fastFood = builder.fastFood; -+ this.effects = builder.effects; -+ } -+ -+ // Forge: Use builder method instead -+ @Deprecated - FoodProperties(int p_38730_, float p_38731_, boolean p_38732_, boolean p_38733_, boolean p_38734_, List> p_38735_) { - this.nutrition = p_38730_; - this.saturationModifier = p_38731_; - this.isMeat = p_38732_; - this.canAlwaysEat = p_38733_; - this.fastFood = p_38734_; -- this.effects = p_38735_; -+ this.effects = p_38735_.stream().map(pair -> Pair., Float>of(pair::getFirst, pair.getSecond())).collect(java.util.stream.Collectors.toList()); - } - - public int getNutrition() { -@@ -43,7 +_,7 @@ - } - - public List> getEffects() { -- return this.effects; -+ return this.effects.stream().map(pair -> Pair.of(pair.getFirst() != null ? pair.getFirst().get() : null, pair.getSecond())).collect(java.util.stream.Collectors.toList()); - } - - public static class Builder { -@@ -52,7 +_,7 @@ - private boolean isMeat; - private boolean canAlwaysEat; - private boolean fastFood; -- private final List> effects = Lists.newArrayList(); -+ private final List, Float>> effects = Lists.newArrayList(); - - public FoodProperties.Builder nutrition(int p_38761_) { - this.nutrition = p_38761_; -@@ -79,13 +_,20 @@ +@@ -68,18 +_,25 @@ return this; } -+ public FoodProperties.Builder effect(java.util.function.Supplier effectIn, float probability) { -+ this.effects.add(Pair.of(effectIn, probability)); -+ return this; -+ } -+ -+ // Forge: Use supplier method instead ++ // Neo: Use supplier method instead + @Deprecated public FoodProperties.Builder effect(MobEffectInstance p_38763_, float p_38764_) { -- this.effects.add(Pair.of(p_38763_, p_38764_)); -+ this.effects.add(Pair.of(() -> p_38763_, p_38764_)); + this.effects.add(new FoodProperties.PossibleEffect(p_38763_, p_38764_)); return this; } ++ public FoodProperties.Builder effect(java.util.function.Supplier effectIn, float probability) { ++ this.effects.add(new FoodProperties.PossibleEffect(effectIn, probability)); ++ return this; ++ } ++ public FoodProperties build() { -- return new FoodProperties(this.nutrition, this.saturationModifier, this.isMeat, this.canAlwaysEat, this.fastFood, this.effects); -+ return new FoodProperties(this); + float f = FoodConstants.saturationByModifier(this.nutrition, this.saturationModifier); + return new FoodProperties(this.nutrition, f, this.canAlwaysEat, this.eatSeconds, this.effects.build()); + } + } + +- public static record PossibleEffect(MobEffectInstance effect, float probability) { ++ public static record PossibleEffect(java.util.function.Supplier effectSupplier, float probability) { + public static final Codec CODEC = RecordCodecBuilder.create( + p_337893_ -> p_337893_.group( + MobEffectInstance.CODEC.fieldOf("effect").forGetter(FoodProperties.PossibleEffect::effect), +@@ -95,8 +_,12 @@ + FoodProperties.PossibleEffect::new + ); + ++ private PossibleEffect(MobEffectInstance effect, float probability) { ++ this(() -> effect, probability); ++ } ++ + public MobEffectInstance effect() { +- return new MobEffectInstance(this.effect); ++ return new MobEffectInstance(this.effectSupplier.get()); } } } diff --git a/patches/net/minecraft/world/inventory/AbstractContainerMenu.java.patch b/patches/net/minecraft/world/inventory/AbstractContainerMenu.java.patch index b79bb55d6d3..71020741bd3 100644 --- a/patches/net/minecraft/world/inventory/AbstractContainerMenu.java.patch +++ b/patches/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 -@@ -404,6 +_,7 @@ +@@ -401,6 +_,7 @@ ItemStack itemstack10 = this.getCarried(); p_150434_.updateTutorialInventoryAction(itemstack10, slot7.getItem(), clickaction); if (!this.tryItemClickBehaviourOverride(p_150434_, clickaction, slot7, itemstack9, itemstack10)) { @@ -8,32 +8,3 @@ if (itemstack9.isEmpty()) { if (!itemstack10.isEmpty()) { int i3 = clickaction == ClickAction.PRIMARY ? itemstack10.getCount() : 1; -@@ -609,14 +_,15 @@ - ItemStack itemstack = slot.getItem(); - if (!itemstack.isEmpty() && ItemStack.isSameItemSameTags(p_38904_, itemstack)) { - int j = itemstack.getCount() + p_38904_.getCount(); -- if (j <= p_38904_.getMaxStackSize()) { -+ int maxSize = Math.min(slot.getMaxStackSize(), p_38904_.getMaxStackSize()); -+ if (j <= maxSize) { - p_38904_.setCount(0); - itemstack.setCount(j); - slot.setChanged(); - flag = true; -- } else if (itemstack.getCount() < p_38904_.getMaxStackSize()) { -- p_38904_.shrink(p_38904_.getMaxStackSize() - itemstack.getCount()); -- itemstack.setCount(p_38904_.getMaxStackSize()); -+ } else if (itemstack.getCount() < maxSize) { -+ p_38904_.shrink(maxSize - itemstack.getCount()); -+ itemstack.setCount(maxSize); - slot.setChanged(); - flag = true; - } -@@ -703,7 +_,7 @@ - return switch(p_279288_) { - case 0 -> Mth.floor((float)p_279172_.getCount() / (float)p_279393_.size()); - case 1 -> 1; -- case 2 -> p_279172_.getItem().getMaxStackSize(); -+ case 2 -> p_279172_.getMaxStackSize(); - default -> p_279172_.getCount(); - }; - } diff --git a/patches/net/minecraft/world/inventory/AnvilMenu.java.patch b/patches/net/minecraft/world/inventory/AnvilMenu.java.patch index 2c73a120754..38ae222fff1 100644 --- a/patches/net/minecraft/world/inventory/AnvilMenu.java.patch +++ b/patches/net/minecraft/world/inventory/AnvilMenu.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/AnvilMenu.java +++ b/net/minecraft/world/inventory/AnvilMenu.java -@@ -77,6 +_,8 @@ +@@ -79,6 +_,8 @@ p_150474_.giveExperienceLevels(-this.cost.get()); } @@ -9,43 +9,45 @@ this.inputSlots.setItem(0, ItemStack.EMPTY); if (this.repairItemCountCost > 0) { ItemStack itemstack = this.inputSlots.getItem(1); -@@ -93,7 +_,7 @@ +@@ -95,7 +_,7 @@ this.cost.set(0); this.access.execute((p_150479_, p_150480_) -> { BlockState blockstate = p_150479_.getBlockState(p_150480_); -- if (!p_150474_.getAbilities().instabuild && blockstate.is(BlockTags.ANVIL) && p_150474_.getRandom().nextFloat() < 0.12F) { +- if (!p_150474_.hasInfiniteMaterials() && blockstate.is(BlockTags.ANVIL) && p_150474_.getRandom().nextFloat() < 0.12F) { + if (!p_150474_.getAbilities().instabuild && blockstate.is(BlockTags.ANVIL) && p_150474_.getRandom().nextFloat() < breakChance) { BlockState blockstate1 = AnvilBlock.damage(blockstate); if (blockstate1 == null) { p_150479_.removeBlock(p_150480_, false); -@@ -124,8 +_,11 @@ - Map map = EnchantmentHelper.getEnchantments(itemstack1); - j += itemstack.getBaseRepairCost() + (itemstack2.isEmpty() ? 0 : itemstack2.getBaseRepairCost()); +@@ -124,8 +_,10 @@ + j += (long)itemstack.getOrDefault(DataComponents.REPAIR_COST, Integer.valueOf(0)).intValue() + + (long)itemstack2.getOrDefault(DataComponents.REPAIR_COST, Integer.valueOf(0)).intValue(); this.repairItemCountCost = 0; + boolean flag = false; -+ + if (!net.neoforged.neoforge.common.CommonHooks.onAnvilChange(this, itemstack, itemstack2, resultSlots, itemName, j, this.player)) return; if (!itemstack2.isEmpty()) { -- boolean flag = itemstack2.is(Items.ENCHANTED_BOOK) && !EnchantedBookItem.getEnchantments(itemstack2).isEmpty(); -+ flag = itemstack2.getItem() == Items.ENCHANTED_BOOK && !EnchantedBookItem.getEnchantments(itemstack2).isEmpty(); +- boolean flag = itemstack2.has(DataComponents.STORED_ENCHANTMENTS); ++ flag = itemstack2.has(DataComponents.STORED_ENCHANTMENTS); if (itemstack1.isDamageableItem() && itemstack1.getItem().isValidRepairItem(itemstack, itemstack2)) { int l2 = Math.min(itemstack1.getDamageValue(), itemstack1.getMaxDamage() / 4); if (l2 <= 0) { -@@ -242,6 +_,7 @@ +@@ -228,6 +_,7 @@ i += k; - itemstack1.resetHoverName(); + itemstack1.remove(DataComponents.CUSTOM_NAME); } + if (flag && !itemstack1.isBookEnchantable(itemstack2)) itemstack1 = ItemStack.EMPTY; - this.cost.set(j + i); - if (i <= 0) { -@@ -307,5 +_,9 @@ + int k2 = (int)Mth.clamp(j + (long)i, 0L, 2147483647L); + this.cost.set(k2); +@@ -297,5 +_,12 @@ public int getCost() { return this.cost.get(); + } + -+ public void setMaximumCost(int value) { -+ this.cost.set(value); ++ /** ++ * Neo: Sets the cost. Will be clamped to an integer. ++ */ ++ public void setMaximumCost(long value) { ++ this.cost.set((int)Mth.clamp(value, 0L, Integer.MAX_VALUE)); } } diff --git a/patches/net/minecraft/world/inventory/BeaconMenu.java.patch b/patches/net/minecraft/world/inventory/BeaconMenu.java.patch index 2a352f71c62..8df10e8f260 100644 --- a/patches/net/minecraft/world/inventory/BeaconMenu.java.patch +++ b/patches/net/minecraft/world/inventory/BeaconMenu.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/BeaconMenu.java +++ b/net/minecraft/world/inventory/BeaconMenu.java -@@ -97,10 +_,8 @@ +@@ -98,10 +_,8 @@ } slot.onQuickCraft(itemstack1, itemstack); diff --git a/patches/net/minecraft/world/inventory/BrewingStandMenu.java.patch b/patches/net/minecraft/world/inventory/BrewingStandMenu.java.patch index 40abcf9cda7..9b9d7142ef0 100644 --- a/patches/net/minecraft/world/inventory/BrewingStandMenu.java.patch +++ b/patches/net/minecraft/world/inventory/BrewingStandMenu.java.patch @@ -1,37 +1,67 @@ --- a/net/minecraft/world/inventory/BrewingStandMenu.java +++ b/net/minecraft/world/inventory/BrewingStandMenu.java -@@ -77,7 +_,7 @@ +@@ -41,9 +_,9 @@ + this.brewingStand = p_39095_; + this.brewingStandData = p_39096_; + PotionBrewing potionbrewing = p_39094_.player.level().potionBrewing(); +- this.addSlot(new BrewingStandMenu.PotionSlot(p_39095_, 0, 56, 51)); +- this.addSlot(new BrewingStandMenu.PotionSlot(p_39095_, 1, 79, 58)); +- this.addSlot(new BrewingStandMenu.PotionSlot(p_39095_, 2, 102, 51)); ++ this.addSlot(new BrewingStandMenu.PotionSlot(potionbrewing, p_39095_, 0, 56, 51)); ++ this.addSlot(new BrewingStandMenu.PotionSlot(potionbrewing, p_39095_, 1, 79, 58)); ++ this.addSlot(new BrewingStandMenu.PotionSlot(potionbrewing, p_39095_, 2, 102, 51)); + this.ingredientSlot = this.addSlot(new BrewingStandMenu.IngredientsSlot(potionbrewing, p_39095_, 3, 79, 17)); + this.addSlot(new BrewingStandMenu.FuelSlot(p_39095_, 4, 17, 17)); + this.addDataSlots(p_39096_); +@@ -81,7 +_,7 @@ if (!this.moveItemStackTo(itemstack1, 3, 4, false)) { return ItemStack.EMPTY; } -- } else if (BrewingStandMenu.PotionSlot.mayPlaceItem(itemstack) && itemstack.getCount() == 1) { -+ } else if (BrewingStandMenu.PotionSlot.mayPlaceItem(itemstack)) { +- } else if (BrewingStandMenu.PotionSlot.mayPlaceItem(itemstack)) { ++ } else if (BrewingStandMenu.PotionSlot.mayPlaceItem(p_39100_.level().potionBrewing(), itemstack)) { if (!this.moveItemStackTo(itemstack1, 0, 3, false)) { return ItemStack.EMPTY; } -@@ -151,7 +_,7 @@ +@@ -158,13 +_,20 @@ + } + + static class PotionSlot extends Slot { ++ private final PotionBrewing potionBrewing; ++ + public PotionSlot(Container p_39123_, int p_39124_, int p_39125_, int p_39126_) { ++ this(PotionBrewing.EMPTY, p_39123_, p_39124_, p_39125_, p_39126_); ++ } ++ ++ public PotionSlot(PotionBrewing potionBrewing, Container p_39123_, int p_39124_, int p_39125_, int p_39126_) { + super(p_39123_, p_39124_, p_39125_, p_39126_); ++ this.potionBrewing = potionBrewing; + } @Override - public boolean mayPlace(ItemStack p_39121_) { -- return PotionBrewing.isIngredient(p_39121_); -+ return net.neoforged.neoforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_39121_); + public boolean mayPlace(ItemStack p_39132_) { +- return mayPlaceItem(p_39132_); ++ return mayPlaceItem(this.potionBrewing, p_39132_); } @Override -@@ -179,6 +_,7 @@ +@@ -176,14 +_,20 @@ public void onTake(Player p_150499_, ItemStack p_150500_) { - Potion potion = PotionUtils.getPotion(p_150500_); - if (p_150499_ instanceof ServerPlayer) { + Optional> optional = p_150500_.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).potion(); + if (optional.isPresent() && p_150499_ instanceof ServerPlayer serverplayer) { + net.neoforged.neoforge.event.EventHooks.onPlayerBrewedPotion(p_150499_, p_150500_); - CriteriaTriggers.BREWED_POTION.trigger((ServerPlayer)p_150499_, potion.builtInRegistryHolder()); + CriteriaTriggers.BREWED_POTION.trigger(serverplayer, optional.get()); } -@@ -186,7 +_,7 @@ + super.onTake(p_150499_, p_150500_); } ++ @Deprecated // Neo: use the overload that takes PotionBrewing instead public static boolean mayPlaceItem(ItemStack p_39134_) { -- return p_39134_.is(Items.POTION) || p_39134_.is(Items.SPLASH_POTION) || p_39134_.is(Items.LINGERING_POTION) || p_39134_.is(Items.GLASS_BOTTLE); -+ return net.neoforged.neoforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_39134_); + return p_39134_.is(Items.POTION) || p_39134_.is(Items.SPLASH_POTION) || p_39134_.is(Items.LINGERING_POTION) || p_39134_.is(Items.GLASS_BOTTLE); ++ } ++ ++ public static boolean mayPlaceItem(PotionBrewing potionBrewing, ItemStack p_39134_) { ++ return potionBrewing.isInput(p_39134_) || p_39134_.is(Items.GLASS_BOTTLE); } } } diff --git a/patches/net/minecraft/world/inventory/EnchantmentMenu.java.patch b/patches/net/minecraft/world/inventory/EnchantmentMenu.java.patch index f3076135249..42e27b416e4 100644 --- a/patches/net/minecraft/world/inventory/EnchantmentMenu.java.patch +++ b/patches/net/minecraft/world/inventory/EnchantmentMenu.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/EnchantmentMenu.java +++ b/net/minecraft/world/inventory/EnchantmentMenu.java -@@ -58,7 +_,7 @@ +@@ -57,7 +_,7 @@ this.addSlot(new Slot(this.enchantSlots, 1, 35, 47) { @Override public boolean mayPlace(ItemStack p_39517_) { @@ -9,23 +9,23 @@ } @Override -@@ -95,23 +_,24 @@ +@@ -94,23 +_,24 @@ ItemStack itemstack = p_39461_.getItem(0); if (!itemstack.isEmpty() && itemstack.isEnchantable()) { - this.access.execute((p_39485_, p_39486_) -> { + this.access.execute((p_337902_, p_337903_) -> { - int j = 0; + float j = 0; - for(BlockPos blockpos : EnchantmentTableBlock.BOOKSHELF_OFFSETS) { - if (EnchantmentTableBlock.isValidBookShelf(p_39485_, p_39486_, blockpos)) { -- ++j; -+ j += p_39485_.getBlockState(p_39486_.offset(blockpos)).getEnchantPowerBonus(p_39485_, p_39486_.offset(blockpos)); + for (BlockPos blockpos : EnchantingTableBlock.BOOKSHELF_OFFSETS) { + if (EnchantingTableBlock.isValidBookShelf(p_337902_, p_337903_, blockpos)) { +- j++; ++ j += p_337902_.getBlockState(p_337903_.offset(blockpos)).getEnchantPowerBonus(p_337902_, p_337903_.offset(blockpos)); } } this.random.setSeed((long)this.enchantmentSeed.get()); - for(int k = 0; k < 3; ++k) { + for (int k = 0; k < 3; k++) { - this.costs[k] = EnchantmentHelper.getEnchantmentCost(this.random, k, j, itemstack); + this.costs[k] = EnchantmentHelper.getEnchantmentCost(this.random, k, (int)j, itemstack); this.enchantClue[k] = -1; @@ -33,19 +33,11 @@ if (this.costs[k] < k + 1) { this.costs[k] = 0; } -+ this.costs[k] = net.neoforged.neoforge.event.EventHooks.onEnchantmentLevelSet(p_39485_, p_39486_, k, (int)j, itemstack, costs[k]); ++ this.costs[k] = net.neoforged.neoforge.event.EventHooks.onEnchantmentLevelSet(p_337902_, p_337903_, k, (int)j, itemstack, costs[k]); } - for(int l = 0; l < 3; ++l) { -@@ -164,6 +_,7 @@ - if (compoundtag != null) { - itemstack2.setTag(compoundtag.copy()); - } -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyStackAttachments(itemstack, itemstack2); - - this.enchantSlots.setItem(0, itemstack2); - } -@@ -250,7 +_,7 @@ + for (int l = 0; l < 3; l++) { +@@ -239,7 +_,7 @@ if (!this.moveItemStackTo(itemstack1, 2, 38, true)) { return ItemStack.EMPTY; } diff --git a/patches/net/minecraft/world/inventory/FurnaceResultSlot.java.patch b/patches/net/minecraft/world/inventory/FurnaceResultSlot.java.patch index 53cbbbf968f..b437d67b28c 100644 --- a/patches/net/minecraft/world/inventory/FurnaceResultSlot.java.patch +++ b/patches/net/minecraft/world/inventory/FurnaceResultSlot.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/FurnaceResultSlot.java +++ b/net/minecraft/world/inventory/FurnaceResultSlot.java -@@ -53,5 +_,6 @@ +@@ -49,5 +_,6 @@ } this.removeCount = 0; diff --git a/patches/net/minecraft/world/inventory/GrindstoneMenu.java.patch b/patches/net/minecraft/world/inventory/GrindstoneMenu.java.patch index 6b81d193f17..4e8f80190f1 100644 --- a/patches/net/minecraft/world/inventory/GrindstoneMenu.java.patch +++ b/patches/net/minecraft/world/inventory/GrindstoneMenu.java.patch @@ -12,15 +12,15 @@ this.addSlot(new Slot(this.repairSlots, 0, 49, 19) { @Override public boolean mayPlace(ItemStack p_39607_) { -- return p_39607_.isDamageableItem() || p_39607_.is(Items.ENCHANTED_BOOK) || p_39607_.isEnchanted(); -+ return p_39607_.isDamageableItem() || p_39607_.is(Items.ENCHANTED_BOOK) || p_39607_.isEnchanted() || p_39607_.canGrindstoneRepair(); +- return p_39607_.isDamageableItem() || EnchantmentHelper.hasAnyEnchantments(p_39607_); ++ return p_39607_.isDamageableItem() || EnchantmentHelper.hasAnyEnchantments(p_39607_) || p_39607_.canGrindstoneRepair(); } }); this.addSlot(new Slot(this.repairSlots, 1, 49, 40) { @Override public boolean mayPlace(ItemStack p_39616_) { -- return p_39616_.isDamageableItem() || p_39616_.is(Items.ENCHANTED_BOOK) || p_39616_.isEnchanted(); -+ return p_39616_.isDamageableItem() || p_39616_.is(Items.ENCHANTED_BOOK) || p_39616_.isEnchanted() || p_39616_.canGrindstoneRepair(); +- return p_39616_.isDamageableItem() || EnchantmentHelper.hasAnyEnchantments(p_39616_); ++ return p_39616_.isDamageableItem() || EnchantmentHelper.hasAnyEnchantments(p_39616_) || p_39616_.canGrindstoneRepair(); } }); this.addSlot(new Slot(this.resultSlots, 2, 129, 34) { @@ -40,51 +40,29 @@ int l = 0; l += this.getExperienceFromItem(GrindstoneMenu.this.repairSlots.getItem(0)); l += this.getExperienceFromItem(GrindstoneMenu.this.repairSlots.getItem(1)); -@@ -128,6 +_,8 @@ - ItemStack itemstack1 = this.repairSlots.getItem(1); - boolean flag = !itemstack.isEmpty() || !itemstack1.isEmpty(); - boolean flag1 = !itemstack.isEmpty() && !itemstack1.isEmpty(); -+ this.xp = net.neoforged.neoforge.common.CommonHooks.onGrindstoneChange(itemstack, itemstack1, this.resultSlots, -1); -+ if (this.xp == Integer.MIN_VALUE) +@@ -130,6 +_,8 @@ + + private ItemStack computeResult(ItemStack p_332654_, ItemStack p_332736_) { + boolean flag = !p_332654_.isEmpty() || !p_332736_.isEmpty(); ++ this.xp = net.neoforged.neoforge.common.CommonHooks.onGrindstoneChange(p_332654_, p_332736_, this.resultSlots, -1); ++ if (this.xp != Integer.MIN_VALUE) return ItemStack.EMPTY; // Porting 1.20.5 check if this is correct if (!flag) { - this.resultSlots.setItem(0, ItemStack.EMPTY); - } else { -@@ -150,12 +_,13 @@ + return ItemStack.EMPTY; + } else if (p_332654_.getCount() <= 1 && p_332736_.getCount() <= 1) { +@@ -154,7 +_,7 @@ + int k = p_332686_.getMaxDamage() - p_332686_.getDamageValue(); + int l = j + k + i * 5 / 100; + int i1 = 1; +- if (!p_332723_.isDamageableItem()) { ++ if (!p_332723_.isDamageableItem() || !p_332723_.isRepairable()) { + if (p_332723_.getMaxStackSize() < 2 || !ItemStack.matches(p_332723_, p_332686_)) { + return ItemStack.EMPTY; } - - Item item = itemstack.getItem(); -- int k = item.getMaxDamage() - itemstack.getDamageValue(); -- int l = item.getMaxDamage() - itemstack1.getDamageValue(); -- int i1 = k + l + item.getMaxDamage() * 5 / 100; -- i = Math.max(item.getMaxDamage() - i1, 0); -+ int k = itemstack.getMaxDamage() - itemstack.getDamageValue(); -+ int l = itemstack.getMaxDamage() - itemstack1.getDamageValue(); -+ int i1 = k + l + itemstack.getMaxDamage() * 5 / 100; -+ i = Math.max(itemstack.getMaxDamage() - i1, 0); - itemstack2 = this.mergeEnchants(itemstack, itemstack1); -- if (!itemstack2.isDamageableItem()) { -+ if (!itemstack2.isRepairable()) i = itemstack.getDamageValue(); -+ if (!itemstack2.isDamageableItem() || !itemstack2.isRepairable()) { - if (!ItemStack.matches(itemstack, itemstack1)) { - this.resultSlots.setItem(0, ItemStack.EMPTY); - this.broadcastChanges(); -@@ -170,6 +_,10 @@ - itemstack2 = flag3 ? itemstack : itemstack1; +@@ -166,6 +_,7 @@ + if (itemstack.isDamageableItem()) { + itemstack.set(DataComponents.MAX_DAMAGE, i); + itemstack.setDamageValue(Math.max(i - l, 0)); ++ if (!p_332686_.isRepairable()) itemstack.setDamageValue(p_332723_.getDamageValue()); } -+ // Forge: Skip the repair if the result would give an item stack with a count not normally obtainable -+ if (j > itemstack2.getMaxStackSize()) -+ this.resultSlots.setItem(0, ItemStack.EMPTY); -+ else - this.resultSlots.setItem(0, this.removeNonCurses(itemstack2, i, j)); - } - -@@ -182,7 +_,7 @@ - - for(Entry entry : map.entrySet()) { - Enchantment enchantment = entry.getKey(); -- if (!enchantment.isCurse() || EnchantmentHelper.getItemEnchantmentLevel(enchantment, itemstack) == 0) { -+ if (!enchantment.isCurse() || EnchantmentHelper.getTagEnchantmentLevel(enchantment, itemstack) == 0) { - itemstack.enchant(enchantment, entry.getValue()); - } - } + this.mergeEnchantsFrom(itemstack, p_332686_); diff --git a/patches/net/minecraft/world/inventory/InventoryMenu.java.patch b/patches/net/minecraft/world/inventory/InventoryMenu.java.patch index 810b7719b90..03fe9e62d25 100644 --- a/patches/net/minecraft/world/inventory/InventoryMenu.java.patch +++ b/patches/net/minecraft/world/inventory/InventoryMenu.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/InventoryMenu.java +++ b/net/minecraft/world/inventory/InventoryMenu.java -@@ -68,7 +_,7 @@ +@@ -70,7 +_,7 @@ @Override public boolean mayPlace(ItemStack p_39746_) { diff --git a/patches/net/minecraft/world/inventory/MenuType.java.patch b/patches/net/minecraft/world/inventory/MenuType.java.patch index 3acd5802686..7d0eaf4e2d5 100644 --- a/patches/net/minecraft/world/inventory/MenuType.java.patch +++ b/patches/net/minecraft/world/inventory/MenuType.java.patch @@ -16,7 +16,7 @@ + } + + @Override -+ public T create(int windowId, Inventory playerInv, net.minecraft.network.FriendlyByteBuf extraData) { ++ public T create(int windowId, Inventory playerInv, net.minecraft.network.RegistryFriendlyByteBuf extraData) { + if (this.constructor instanceof net.neoforged.neoforge.network.IContainerFactory) { + return ((net.neoforged.neoforge.network.IContainerFactory) this.constructor).create(windowId, playerInv, extraData); + } diff --git a/patches/net/minecraft/world/inventory/ResultSlot.java.patch b/patches/net/minecraft/world/inventory/ResultSlot.java.patch index c3aad3a82d7..2ebbcbd5789 100644 --- a/patches/net/minecraft/world/inventory/ResultSlot.java.patch +++ b/patches/net/minecraft/world/inventory/ResultSlot.java.patch @@ -7,8 +7,8 @@ + net.neoforged.neoforge.event.EventHooks.firePlayerCraftingEvent(this.player, p_40185_, this.craftSlots); } - Container container = this.container; -@@ -59,7 +_,9 @@ + if (this.container instanceof RecipeCraftingHolder recipecraftingholder) { +@@ -58,7 +_,9 @@ @Override public void onTake(Player p_150638_, ItemStack p_150639_) { this.checkTakeAchievements(p_150639_); @@ -16,5 +16,5 @@ NonNullList nonnulllist = p_150638_.level().getRecipeManager().getRemainingItemsFor(RecipeType.CRAFTING, this.craftSlots, p_150638_.level()); + net.neoforged.neoforge.common.CommonHooks.setCraftingPlayer(null); - for(int i = 0; i < nonnulllist.size(); ++i) { + for (int i = 0; i < nonnulllist.size(); i++) { ItemStack itemstack = this.craftSlots.getItem(i); diff --git a/patches/net/minecraft/world/item/ArmorItem.java.patch b/patches/net/minecraft/world/item/ArmorItem.java.patch deleted file mode 100644 index 684cf40cfd1..00000000000 --- a/patches/net/minecraft/world/item/ArmorItem.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/item/ArmorItem.java -+++ b/net/minecraft/world/item/ArmorItem.java -@@ -80,7 +_,7 @@ - UUID uuid = ARMOR_MODIFIER_UUID_PER_TYPE.get(p_266831_); - builder.put(Attributes.ARMOR, new AttributeModifier(uuid, "Armor modifier", (double)this.defense, AttributeModifier.Operation.ADDITION)); - builder.put(Attributes.ARMOR_TOUGHNESS, new AttributeModifier(uuid, "Armor toughness", (double)this.toughness, AttributeModifier.Operation.ADDITION)); -- if (p_40386_ == ArmorMaterials.NETHERITE) { -+ if (this.knockbackResistance > 0) { - builder.put( - Attributes.KNOCKBACK_RESISTANCE, - new AttributeModifier(uuid, "Armor knockback resistance", (double)this.knockbackResistance, AttributeModifier.Operation.ADDITION) diff --git a/patches/net/minecraft/world/item/ArrowItem.java.patch b/patches/net/minecraft/world/item/ArrowItem.java.patch index 88ea6a4f278..1d3c13e074d 100644 --- a/patches/net/minecraft/world/item/ArrowItem.java.patch +++ b/patches/net/minecraft/world/item/ArrowItem.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/item/ArrowItem.java +++ b/net/minecraft/world/item/ArrowItem.java -@@ -15,4 +_,9 @@ - arrow.setEffectsFromItem(p_40514_); +@@ -23,4 +_,9 @@ + arrow.pickup = AbstractArrow.Pickup.ALLOWED; return arrow; } + -+ public boolean isInfinite(ItemStack stack, ItemStack bow, net.minecraft.world.entity.player.Player player) { -+ int enchant = net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.INFINITY_ARROWS, bow); -+ return enchant <= 0 ? false : this.getClass() == ArrowItem.class; ++ public boolean isInfinite(ItemStack stack, ItemStack bow, net.minecraft.world.entity.LivingEntity livingEntity) { ++ int enchant = net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.INFINITY, bow); ++ return enchant > 0 && this.getClass() == net.minecraft.world.item.ArrowItem.class; + } } diff --git a/patches/net/minecraft/world/item/AxeItem.java.patch b/patches/net/minecraft/world/item/AxeItem.java.patch index 4b5485d3287..30f2614f111 100644 --- a/patches/net/minecraft/world/item/AxeItem.java.patch +++ b/patches/net/minecraft/world/item/AxeItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/AxeItem.java +++ b/net/minecraft/world/item/AxeItem.java -@@ -55,7 +_,7 @@ +@@ -56,7 +_,7 @@ Level level = p_40529_.getLevel(); BlockPos blockpos = p_40529_.getClickedPos(); Player player = p_40529_.getPlayer(); @@ -9,7 +9,7 @@ if (optional.isEmpty()) { return InteractionResult.PASS; } else { -@@ -74,20 +_,19 @@ +@@ -75,20 +_,19 @@ } } @@ -34,7 +34,7 @@ if (optional2.isPresent()) { p_308922_.playSound(p_309192_, p_308899_, SoundEvents.AXE_WAX_OFF, SoundSource.BLOCKS, 1.0F, 1.0F); p_308922_.levelEvent(p_309192_, 3004, p_308899_, 0); -@@ -99,8 +_,19 @@ +@@ -100,8 +_,19 @@ } } diff --git a/patches/net/minecraft/world/item/BannerItem.java.patch b/patches/net/minecraft/world/item/BannerItem.java.patch deleted file mode 100644 index 7a0387a3475..00000000000 --- a/patches/net/minecraft/world/item/BannerItem.java.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/net/minecraft/world/item/BannerItem.java -+++ b/net/minecraft/world/item/BannerItem.java -@@ -37,9 +_,10 @@ - holder.unwrapKey() - .map(p_220002_ -> p_220002_.location().toShortLanguageKey()) - .ifPresent( -- p_220006_ -> p_40544_.add( -- Component.translatable("block.minecraft.banner." + p_220006_ + "." + dyecolor.getName()).withStyle(ChatFormatting.GRAY) -- ) -+ p_220006_ -> { -+ net.minecraft.resources.ResourceLocation fileLoc = new net.minecraft.resources.ResourceLocation(p_220006_); -+ p_40544_.add(Component.translatable("block." + fileLoc.getNamespace() + ".banner." + fileLoc.getPath() + "." + dyecolor.getSerializedName()).withStyle(ChatFormatting.GRAY)); -+ } - ); - } - } diff --git a/patches/net/minecraft/world/item/BlockItem.java.patch b/patches/net/minecraft/world/item/BlockItem.java.patch index aac45ad39a4..a8ef2e4e882 100644 --- a/patches/net/minecraft/world/item/BlockItem.java.patch +++ b/patches/net/minecraft/world/item/BlockItem.java.patch @@ -14,7 +14,7 @@ SoundSource.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F -@@ -102,10 +_,16 @@ +@@ -99,10 +_,16 @@ } } @@ -31,7 +31,7 @@ @Nullable public BlockPlaceContext updatePlacementContext(BlockPlaceContext p_40609_) { return p_40609_; -@@ -208,6 +_,10 @@ +@@ -193,6 +_,10 @@ public void registerBlocks(Map p_40607_, Item p_40608_) { p_40607_.put(this.getBlock(), p_40608_); diff --git a/patches/net/minecraft/world/item/BoneMealItem.java.patch b/patches/net/minecraft/world/item/BoneMealItem.java.patch index a4bf461c4e4..5cbc49f60f7 100644 --- a/patches/net/minecraft/world/item/BoneMealItem.java.patch +++ b/patches/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 -@@ -38,7 +_,7 @@ +@@ -37,7 +_,7 @@ Level level = p_40637_.getLevel(); BlockPos blockpos = p_40637_.getClickedPos(); BlockPos blockpos1 = blockpos.relative(p_40637_.getClickedFace()); @@ -8,8 +8,8 @@ + if (applyBonemeal(p_40637_.getItemInHand(), level, blockpos, p_40637_.getPlayer())) { if (!level.isClientSide) { p_40637_.getPlayer().gameEvent(GameEvent.ITEM_INTERACT_FINISH); - level.levelEvent(1505, blockpos, 0); -@@ -61,8 +_,17 @@ + level.levelEvent(1505, blockpos, 15); +@@ -60,8 +_,17 @@ } } @@ -24,6 +24,6 @@ BlockState blockstate = p_40629_.getBlockState(p_40630_); + int hook = net.neoforged.neoforge.event.EventHooks.onApplyBonemeal(player, p_40629_, p_40630_, blockstate, p_40628_); + if (hook != 0) return hook > 0; - Block block = blockstate.getBlock(); - if (block instanceof BonemealableBlock bonemealableblock && bonemealableblock.isValidBonemealTarget(p_40629_, p_40630_, blockstate)) { + if (blockstate.getBlock() instanceof BonemealableBlock bonemealableblock && bonemealableblock.isValidBonemealTarget(p_40629_, p_40630_, blockstate)) { if (p_40629_ instanceof ServerLevel) { + if (bonemealableblock.isBonemealSuccess(p_40629_, p_40629_.random, p_40630_, blockstate)) { diff --git a/patches/net/minecraft/world/item/BowItem.java.patch b/patches/net/minecraft/world/item/BowItem.java.patch index 2350734da1f..1273d2f5fe4 100644 --- a/patches/net/minecraft/world/item/BowItem.java.patch +++ b/patches/net/minecraft/world/item/BowItem.java.patch @@ -1,32 +1,15 @@ --- a/net/minecraft/world/item/BowItem.java +++ b/net/minecraft/world/item/BowItem.java -@@ -27,18 +_,23 @@ - Player player = (Player)p_40669_; - boolean flag = player.getAbilities().instabuild || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.INFINITY_ARROWS, p_40667_) > 0; +@@ -25,7 +_,7 @@ + public void releaseUsing(ItemStack p_40667_, Level p_40668_, LivingEntity p_40669_, int p_40670_) { + if (p_40669_ instanceof Player player) { ItemStack itemstack = player.getProjectile(p_40667_); -+ -+ int i = this.getUseDuration(p_40667_) - p_40670_; -+ i = net.neoforged.neoforge.event.EventHooks.onArrowLoose(p_40667_, p_40668_, player, i, !itemstack.isEmpty() || flag); -+ if (i < 0) return; -+ - if (!itemstack.isEmpty() || flag) { - if (itemstack.isEmpty()) { - itemstack = new ItemStack(Items.ARROW); - } - -- int i = this.getUseDuration(p_40667_) - p_40670_; +- if (!itemstack.isEmpty()) { ++ if (!itemstack.isEmpty()) { // Porting 1.20.5 redo EventHooks.onArrowLoose + int i = this.getUseDuration(p_40667_) - p_40670_; float f = getPowerForTime(i); if (!((double)f < 0.1)) { -- boolean flag1 = flag && itemstack.is(Items.ARROW); -+ boolean flag1 = player.getAbilities().instabuild || (itemstack.getItem() instanceof ArrowItem && ((ArrowItem)itemstack.getItem()).isInfinite(itemstack, p_40667_, player)); - if (!p_40668_.isClientSide) { - ArrowItem arrowitem = (ArrowItem)(itemstack.getItem() instanceof ArrowItem ? itemstack.getItem() : Items.ARROW); - AbstractArrow abstractarrow = arrowitem.createArrow(p_40668_, itemstack, player); -+ abstractarrow = customArrow(abstractarrow, itemstack); - abstractarrow.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, f * 3.0F, 1.0F); - if (f == 1.0F) { - abstractarrow.setCritArrow(true); -@@ -113,6 +_,10 @@ +@@ -81,6 +_,10 @@ public InteractionResultHolder use(Level p_40672_, Player p_40673_, InteractionHand p_40674_) { ItemStack itemstack = p_40673_.getItemInHand(p_40674_); boolean flag = !p_40673_.getProjectile(itemstack).isEmpty(); @@ -34,17 +17,6 @@ + InteractionResultHolder ret = net.neoforged.neoforge.event.EventHooks.onArrowNock(itemstack, p_40672_, p_40673_, p_40674_, flag); + if (ret != null) return ret; + - if (!p_40673_.getAbilities().instabuild && !flag) { + if (!p_40673_.hasInfiniteMaterials() && !flag) { return InteractionResultHolder.fail(itemstack); } else { -@@ -124,6 +_,10 @@ - @Override - public Predicate getAllSupportedProjectiles() { - return ARROW_ONLY; -+ } -+ -+ public AbstractArrow customArrow(AbstractArrow arrow, ItemStack stack) { -+ return arrow; - } - - @Override diff --git a/patches/net/minecraft/world/item/BrushItem.java.patch b/patches/net/minecraft/world/item/BrushItem.java.patch index 3b9e4d848bb..500b92816bb 100644 --- a/patches/net/minecraft/world/item/BrushItem.java.patch +++ b/patches/net/minecraft/world/item/BrushItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/BrushItem.java +++ b/net/minecraft/world/item/BrushItem.java -@@ -148,4 +_,9 @@ +@@ -142,4 +_,9 @@ }; } } diff --git a/patches/net/minecraft/world/item/BucketItem.java.patch b/patches/net/minecraft/world/item/BucketItem.java.patch index 95ae7ab273e..5e6502be953 100644 --- a/patches/net/minecraft/world/item/BucketItem.java.patch +++ b/patches/net/minecraft/world/item/BucketItem.java.patch @@ -1,30 +1,5 @@ --- a/net/minecraft/world/item/BucketItem.java +++ b/net/minecraft/world/item/BucketItem.java -@@ -29,11 +_,24 @@ - import net.minecraft.world.phys.HitResult; - - public class BucketItem extends Item implements DispensibleContainerItem { -+ /** Neo: Field accesses are redirected to {@link #getFluid()} with a coremod. */ - private final Fluid content; - -+ // Forge: Use the other constructor that takes a Supplier -+ @Deprecated - public BucketItem(Fluid p_40689_, Item.Properties p_40690_) { - super(p_40690_); - this.content = p_40689_; -+ this.fluidSupplier = () -> p_40689_; -+ } -+ -+ /** -+ * @param supplier A fluid supplier such as {@link net.neoforged.neoforge.registries.DeferredHolder} -+ */ -+ public BucketItem(java.util.function.Supplier supplier, Item.Properties builder) { -+ super(builder); -+ this.content = null; -+ this.fluidSupplier = supplier; - } - - @Override @@ -42,6 +_,8 @@ BlockHitResult blockhitresult = getPlayerPOVHitResult( p_40703_, p_40704_, this.content == Fluids.EMPTY ? ClipContext.Fluid.SOURCE_ONLY : ClipContext.Fluid.NONE @@ -34,7 +9,7 @@ if (blockhitresult.getType() == HitResult.Type.MISS) { return InteractionResultHolder.pass(itemstack); } else if (blockhitresult.getType() != HitResult.Type.BLOCK) { -@@ -59,7 +_,7 @@ +@@ -58,7 +_,7 @@ ItemStack itemstack2 = bucketpickup.pickupBlock(p_40704_, p_40703_, blockpos, blockstate1); if (!itemstack2.isEmpty()) { p_40704_.awardStat(Stats.ITEM_USED.get(this)); @@ -43,7 +18,7 @@ p_40703_.gameEvent(p_40704_, GameEvent.FLUID_PICKUP, blockpos); ItemStack itemstack1 = ItemUtils.createFilledResult(itemstack, p_40704_, itemstack2); if (!p_40703_.isClientSide) { -@@ -73,8 +_,8 @@ +@@ -72,8 +_,8 @@ return InteractionResultHolder.fail(itemstack); } else { BlockState blockstate = p_40703_.getBlockState(blockpos); @@ -54,32 +29,19 @@ this.checkExtraContent(p_40704_, p_40703_, itemstack, blockpos2); if (p_40704_ instanceof ServerPlayer) { CriteriaTriggers.PLACED_BLOCK.trigger((ServerPlayer)p_40704_, blockpos2, itemstack); -@@ -98,9 +_,14 @@ +@@ -97,7 +_,11 @@ } @Override -+ @Deprecated //Forge: use the ItemStack sensitive version ++ @Deprecated // Neo: use the ItemStack sensitive version public boolean emptyContents(@Nullable Player p_150716_, Level p_150717_, BlockPos p_150718_, @Nullable BlockHitResult p_150719_) { - Fluid $$6 = this.content; -- if (!($$6 instanceof FlowingFluid)) { + return this.emptyContents(p_150716_, p_150717_, p_150718_, p_150719_, null); + } -+ + public boolean emptyContents(@Nullable Player p_150716_, Level p_150717_, BlockPos p_150718_, @Nullable BlockHitResult p_150719_, @Nullable ItemStack container) { -+ if (!(this.content instanceof FlowingFluid)) { + if (!(this.content instanceof FlowingFluid flowingfluid)) { return false; } else { - FlowingFluid flowingfluid; -@@ -109,7 +_,7 @@ - boolean flag2; - BlockState blockstate; - label82: { -- flowingfluid = (FlowingFluid)$$6; -+ flowingfluid = (FlowingFluid)this.content; - blockstate = p_150717_.getBlockState(p_150718_); - $$7 = blockstate.getBlock(); - $$8 = blockstate.canBeReplaced(this.content); -@@ -128,8 +_,12 @@ +@@ -124,8 +_,12 @@ } boolean flag1 = flag2; @@ -93,7 +55,7 @@ } else if (p_150717_.dimensionType().ultraWarm() && this.content.is(FluidTags.WATER)) { int l = p_150718_.getX(); int i = p_150718_.getY(); -@@ -151,7 +_,7 @@ +@@ -147,7 +_,7 @@ return true; } else { @@ -102,7 +64,7 @@ liquidblockcontainer1.placeLiquid(p_150717_, p_150718_, blockstate, flowingfluid.getSource(false)); this.playEmptySound(p_150716_, p_150717_, p_150718_); return true; -@@ -172,8 +_,17 @@ +@@ -168,8 +_,18 @@ } protected void playEmptySound(@Nullable Player p_40696_, LevelAccessor p_40697_, BlockPos p_40698_) { @@ -113,11 +75,12 @@ p_40697_.gameEvent(p_40696_, GameEvent.FLUID_PLACE, p_40698_); + } + -+ private final java.util.function.Supplier fluidSupplier; -+ public Fluid getFluid() { return fluidSupplier.get(); } -+ + protected boolean canBlockContainFluid(@Nullable Player player, Level worldIn, BlockPos posIn, BlockState blockstate) + { + return blockstate.getBlock() instanceof LiquidBlockContainer && ((LiquidBlockContainer)blockstate.getBlock()).canPlaceLiquid(player, worldIn, posIn, blockstate, this.content); ++ } ++ ++ public Fluid getFluid() { ++ return this.content; } } diff --git a/patches/net/minecraft/world/item/BundleItem.java.patch b/patches/net/minecraft/world/item/BundleItem.java.patch index 8954a607069..945917f07c1 100644 --- a/patches/net/minecraft/world/item/BundleItem.java.patch +++ b/patches/net/minecraft/world/item/BundleItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/BundleItem.java +++ b/net/minecraft/world/item/BundleItem.java -@@ -40,7 +_,7 @@ +@@ -38,7 +_,7 @@ @Override public boolean overrideStackedOnOther(ItemStack p_150733_, Slot p_150734_, ClickAction p_150735_, Player p_150736_) { @@ -8,12 +8,12 @@ + if (p_150733_.getCount() != 1 || p_150735_ != ClickAction.SECONDARY) { return false; } else { - ItemStack itemstack = p_150734_.getItem(); -@@ -63,6 +_,7 @@ + BundleContents bundlecontents = p_150733_.get(DataComponents.BUNDLE_CONTENTS); +@@ -71,6 +_,7 @@ public boolean overrideOtherStackedOnMe( ItemStack p_150742_, ItemStack p_150743_, Slot p_150744_, ClickAction p_150745_, Player p_150746_, SlotAccess p_150747_ ) { + if (p_150742_.getCount() != 1) return false; if (p_150745_ == ClickAction.SECONDARY && p_150744_.allowModification(p_150746_)) { - if (p_150743_.isEmpty()) { - removeOne(p_150742_).ifPresent(p_186347_ -> { + BundleContents bundlecontents = p_150742_.get(DataComponents.BUNDLE_CONTENTS); + if (bundlecontents == null) { diff --git a/patches/net/minecraft/world/item/CompassItem.java.patch b/patches/net/minecraft/world/item/CompassItem.java.patch deleted file mode 100644 index c942fef1406..00000000000 --- a/patches/net/minecraft/world/item/CompassItem.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/world/item/CompassItem.java -+++ b/net/minecraft/world/item/CompassItem.java -@@ -103,6 +_,7 @@ - ItemStack itemstack1 = new ItemStack(Items.COMPASS, 1); - CompoundTag compoundtag = itemstack.hasTag() ? itemstack.getTag().copy() : new CompoundTag(); - itemstack1.setTag(compoundtag); -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyStackAttachments(itemstack, itemstack1); - if (!player.getAbilities().instabuild) { - itemstack.shrink(1); - } diff --git a/patches/net/minecraft/world/item/CreativeModeTabs.java.patch b/patches/net/minecraft/world/item/CreativeModeTabs.java.patch index d9673177cbd..7cb899d0d47 100644 --- a/patches/net/minecraft/world/item/CreativeModeTabs.java.patch +++ b/patches/net/minecraft/world/item/CreativeModeTabs.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/world/item/CreativeModeTabs.java +++ b/net/minecraft/world/item/CreativeModeTabs.java -@@ -1800,7 +_,7 @@ - ) { +@@ -1883,7 +_,7 @@ p_270903_.listElements() .map(Holder::value) -- .filter(p_270008_ -> p_270380_.contains(p_270008_.category)) + .filter(p_337914_ -> p_337914_.isEnabled(p_338678_)) +- .filter(p_335280_ -> p_270380_.contains(p_335280_.getSupportedItems())) + .filter(p_270008_ -> p_270008_.allowedInCreativeTab(Items.ENCHANTED_BOOK, p_270380_)) .map(p_270038_ -> EnchantedBookItem.createForEnchantment(new EnchantmentInstance(p_270038_, p_270038_.getMaxLevel()))) .forEach(p_269989_ -> p_270868_.accept(p_269989_, p_270407_)); } -@@ -1810,7 +_,7 @@ - ) { +@@ -1898,7 +_,7 @@ p_270628_.listElements() .map(Holder::value) -- .filter(p_269991_ -> p_271024_.contains(p_269991_.category)) + .filter(p_337930_ -> p_337930_.isEnabled(p_338625_)) +- .filter(p_335276_ -> p_271024_.contains(p_335276_.getSupportedItems())) + .filter(p_269991_ -> p_269991_.allowedInCreativeTab(Items.ENCHANTED_BOOK, p_271024_)) .flatMap( p_270024_ -> IntStream.rangeClosed(p_270024_.getMinLevel(), p_270024_.getMaxLevel()) diff --git a/patches/net/minecraft/world/item/CrossbowItem.java.patch b/patches/net/minecraft/world/item/CrossbowItem.java.patch index 8216d6c3e1c..96bf507c43a 100644 --- a/patches/net/minecraft/world/item/CrossbowItem.java.patch +++ b/patches/net/minecraft/world/item/CrossbowItem.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/item/CrossbowItem.java +++ b/net/minecraft/world/item/CrossbowItem.java -@@ -258,6 +_,7 @@ - } - - public static void performShooting(Level p_40888_, LivingEntity p_40889_, InteractionHand p_40890_, ItemStack p_40891_, float p_40892_, float p_40893_) { -+ if (p_40889_ instanceof Player player && net.neoforged.neoforge.event.EventHooks.onArrowLoose(p_40891_, p_40889_.level(), player, 1, true) < 0) return; - List list = getChargedProjectiles(p_40891_); - float[] afloat = getShotPitches(p_40889_.getRandom()); - +@@ -168,6 +_,7 @@ + Level p_40888_, LivingEntity p_40889_, InteractionHand p_40890_, ItemStack p_40891_, float p_40892_, float p_40893_, @Nullable LivingEntity p_331602_ + ) { + if (!p_40888_.isClientSide()) { ++ if (p_40889_ instanceof Player player && net.neoforged.neoforge.event.EventHooks.onArrowLoose(p_40891_, p_40889_.level(), player, 1, true) < 0) return; + ChargedProjectiles chargedprojectiles = p_40891_.set(DataComponents.CHARGED_PROJECTILES, ChargedProjectiles.EMPTY); + if (chargedprojectiles != null && !chargedprojectiles.isEmpty()) { + this.shoot(p_40888_, p_40889_, p_40890_, p_40891_, chargedprojectiles.getItems(), p_40892_, p_40893_, p_40889_ instanceof Player, p_331602_); diff --git a/patches/net/minecraft/world/item/DiggerItem.java.patch b/patches/net/minecraft/world/item/DiggerItem.java.patch deleted file mode 100644 index 29d8c1ae2f7..00000000000 --- a/patches/net/minecraft/world/item/DiggerItem.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/net/minecraft/world/item/DiggerItem.java -+++ b/net/minecraft/world/item/DiggerItem.java -@@ -67,7 +_,11 @@ - } - - @Override -+ @Deprecated // FORGE: Use stack sensitive variant below - public boolean isCorrectToolForDrops(BlockState p_150816_) { -+ if (net.neoforged.neoforge.common.TierSortingRegistry.isTierSorted(getTier())) { -+ return net.neoforged.neoforge.common.TierSortingRegistry.isCorrectTierForDrops(getTier(), p_150816_) && p_150816_.is(this.blocks); -+ } - int i = this.getTier().getLevel(); - if (i < 3 && p_150816_.is(BlockTags.NEEDS_DIAMOND_TOOL)) { - return false; -@@ -76,5 +_,11 @@ - } else { - return i < 1 && p_150816_.is(BlockTags.NEEDS_STONE_TOOL) ? false : p_150816_.is(this.blocks); - } -+ } -+ -+ // FORGE START -+ @Override -+ public boolean isCorrectToolForDrops(ItemStack stack, BlockState state) { -+ return state.is(blocks) && net.neoforged.neoforge.common.TierSortingRegistry.isCorrectTierForDrops(getTier(), state); - } - } diff --git a/patches/net/minecraft/world/item/DyeColor.java.patch b/patches/net/minecraft/world/item/DyeColor.java.patch index 4c9d0a22450..c075965d602 100644 --- a/patches/net/minecraft/world/item/DyeColor.java.patch +++ b/patches/net/minecraft/world/item/DyeColor.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/DyeColor.java +++ b/net/minecraft/world/item/DyeColor.java -@@ -38,6 +_,7 @@ +@@ -42,6 +_,7 @@ private final MapColor mapColor; private final float[] textureDiffuseColors; private final int fireworkColor; @@ -8,15 +8,15 @@ private final int textColor; private DyeColor(int p_41046_, String p_41047_, int p_41048_, MapColor p_285297_, int p_41050_, int p_41051_) { -@@ -48,6 +_,7 @@ +@@ -52,6 +_,7 @@ int i = (p_41048_ & 0xFF0000) >> 16; int j = (p_41048_ & 0xFF00) >> 8; int k = (p_41048_ & 0xFF) >> 0; -+ this.tag = net.minecraft.tags.ItemTags.create(new net.minecraft.resources.ResourceLocation("forge", "dyes/" + p_41047_)); ++ this.tag = net.minecraft.tags.ItemTags.create(new net.minecraft.resources.ResourceLocation("c", "dyes/" + p_41047_)); this.textureDiffuseColors = new float[]{(float)i / 255.0F, (float)j / 255.0F, (float)k / 255.0F}; this.fireworkColor = p_41050_; } -@@ -100,5 +_,23 @@ +@@ -104,5 +_,23 @@ @Override public String getSerializedName() { return this.name; diff --git a/patches/net/minecraft/world/item/DyeableHorseArmorItem.java.patch b/patches/net/minecraft/world/item/DyeableHorseArmorItem.java.patch deleted file mode 100644 index 9f1f31844b7..00000000000 --- a/patches/net/minecraft/world/item/DyeableHorseArmorItem.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/world/item/DyeableHorseArmorItem.java -+++ b/net/minecraft/world/item/DyeableHorseArmorItem.java -@@ -4,4 +_,7 @@ - public DyeableHorseArmorItem(int p_41110_, String p_41111_, Item.Properties p_41112_) { - super(p_41110_, p_41111_, p_41112_); - } -+ public DyeableHorseArmorItem(int p_41110_, net.minecraft.resources.ResourceLocation p_41111_, Item.Properties p_41112_) { -+ super(p_41110_, p_41111_, p_41112_); -+ } - } diff --git a/patches/net/minecraft/world/item/ElytraItem.java.patch b/patches/net/minecraft/world/item/ElytraItem.java.patch index 6878eb7a097..7dedbef32a0 100644 --- a/patches/net/minecraft/world/item/ElytraItem.java.patch +++ b/patches/net/minecraft/world/item/ElytraItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/ElytraItem.java +++ b/net/minecraft/world/item/ElytraItem.java -@@ -30,6 +_,25 @@ +@@ -31,6 +_,25 @@ } @Override @@ -14,7 +14,7 @@ + int nextFlightTick = flightTicks + 1; + if (nextFlightTick % 10 == 0) { + if (nextFlightTick % 20 == 0) { -+ stack.hurtAndBreak(1, entity, e -> e.broadcastBreakEvent(net.minecraft.world.entity.EquipmentSlot.CHEST)); ++ stack.hurtAndBreak(1, entity, net.minecraft.world.entity.EquipmentSlot.CHEST); + } + entity.gameEvent(net.minecraft.world.level.gameevent.GameEvent.ELYTRA_GLIDE); + } @@ -23,6 +23,6 @@ + } + + @Override - public SoundEvent getEquipSound() { + public Holder getEquipSound() { return SoundEvents.ARMOR_EQUIP_ELYTRA; } diff --git a/patches/net/minecraft/world/item/FireworkRocketItem.java.patch b/patches/net/minecraft/world/item/FireworkRocketItem.java.patch deleted file mode 100644 index 14b77c8a9ae..00000000000 --- a/patches/net/minecraft/world/item/FireworkRocketItem.java.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- a/net/minecraft/world/item/FireworkRocketItem.java -+++ b/net/minecraft/world/item/FireworkRocketItem.java -@@ -122,7 +_,7 @@ - return itemstack; - } - -- public static enum Shape { -+ public static enum Shape implements net.neoforged.neoforge.common.IExtensibleEnum { - SMALL_BALL(0, "small_ball"), - LARGE_BALL(1, "large_ball"), - STAR(2, "star"), -@@ -148,8 +_,28 @@ - return this.name; - } - -+ public void save(net.minecraft.nbt.CompoundTag tag) { -+ tag.putByte("Type", (byte) getId()); -+ tag.putString("neoforge:shape_type", name()); -+ } -+ -+ /** Use {getShape(ComoundTag)} */ -+ @Deprecated - public static FireworkRocketItem.Shape byId(int p_41238_) { - return BY_ID.apply(p_41238_); -+ } -+ -+ public static FireworkRocketItem.Shape getShape(net.minecraft.nbt.CompoundTag tag) { -+ String name = tag.contains("neoforge:shape_type", net.minecraft.nbt.Tag.TAG_STRING) ? tag.getString("neoforge:shape_type") : null; -+ if (name == null) return byId(tag.getByte("Type")); -+ for (Shape ret : values()) -+ if (ret.name().equals(name)) -+ return ret; -+ return SMALL_BALL; -+ } -+ -+ public static Shape create(String registryName, int id, String shapeName) { -+ throw new IllegalStateException("Enum not extended"); - } - } - } diff --git a/patches/net/minecraft/world/item/FireworkStarItem.java.patch b/patches/net/minecraft/world/item/FireworkStarItem.java.patch deleted file mode 100644 index e8224cf8ea7..00000000000 --- a/patches/net/minecraft/world/item/FireworkStarItem.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/item/FireworkStarItem.java -+++ b/net/minecraft/world/item/FireworkStarItem.java -@@ -23,7 +_,7 @@ - } - - public static void appendHoverText(CompoundTag p_41257_, List p_41258_) { -- FireworkRocketItem.Shape fireworkrocketitem$shape = FireworkRocketItem.Shape.byId(p_41257_.getByte("Type")); -+ FireworkRocketItem.Shape fireworkrocketitem$shape = FireworkRocketItem.Shape.getShape(p_41257_); - p_41258_.add(Component.translatable("item.minecraft.firework_star.shape." + fireworkrocketitem$shape.getName()).withStyle(ChatFormatting.GRAY)); - int[] aint = p_41257_.getIntArray("Colors"); - if (aint.length > 0) { diff --git a/patches/net/minecraft/world/item/FishingRodItem.java.patch b/patches/net/minecraft/world/item/FishingRodItem.java.patch index 54acf904782..a8a582f03ad 100644 --- a/patches/net/minecraft/world/item/FishingRodItem.java.patch +++ b/patches/net/minecraft/world/item/FishingRodItem.java.patch @@ -1,18 +1,18 @@ --- a/net/minecraft/world/item/FishingRodItem.java +++ b/net/minecraft/world/item/FishingRodItem.java -@@ -22,7 +_,11 @@ +@@ -23,7 +_,11 @@ if (p_41291_.fishing != null) { if (!p_41290_.isClientSide) { int i = p_41291_.fishing.retrieve(itemstack); + ItemStack original = itemstack.copy(); - itemstack.hurtAndBreak(i, p_41291_, p_41288_ -> p_41288_.broadcastBreakEvent(p_41292_)); + itemstack.hurtAndBreak(i, p_41291_, LivingEntity.getSlotForHand(p_41292_)); + if(itemstack.isEmpty()) { + net.neoforged.neoforge.event.EventHooks.onPlayerDestroyItem(p_41291_, original, p_41292_); + } } p_41290_.playSound( -@@ -63,5 +_,12 @@ +@@ -64,5 +_,12 @@ @Override public int getEnchantmentValue() { return 1; diff --git a/patches/net/minecraft/world/item/FoodOnAStickItem.java.patch b/patches/net/minecraft/world/item/FoodOnAStickItem.java.patch deleted file mode 100644 index 2402e3e0b16..00000000000 --- a/patches/net/minecraft/world/item/FoodOnAStickItem.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/world/item/FoodOnAStickItem.java -+++ b/net/minecraft/world/item/FoodOnAStickItem.java -@@ -31,6 +_,7 @@ - if (itemstack.isEmpty()) { - ItemStack itemstack1 = new ItemStack(Items.FISHING_ROD); - itemstack1.setTag(itemstack.getTag()); -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyStackAttachments(itemstack, itemstack1); - return InteractionResultHolder.success(itemstack1); - } - diff --git a/patches/net/minecraft/world/item/HoeItem.java.patch b/patches/net/minecraft/world/item/HoeItem.java.patch index 9068726fcd6..685c8b7c01a 100644 --- a/patches/net/minecraft/world/item/HoeItem.java.patch +++ b/patches/net/minecraft/world/item/HoeItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/HoeItem.java +++ b/net/minecraft/world/item/HoeItem.java -@@ -22,6 +_,12 @@ +@@ -23,6 +_,12 @@ import net.minecraft.world.level.gameevent.GameEvent; public class HoeItem extends DiggerItem { @@ -13,7 +13,7 @@ protected static final Map, Consumer>> TILLABLES = Maps.newHashMap( ImmutableMap.of( Blocks.GRASS_BLOCK, -@@ -45,7 +_,8 @@ +@@ -46,7 +_,8 @@ public InteractionResult useOn(UseOnContext p_41341_) { Level level = p_41341_.getLevel(); BlockPos blockpos = p_41341_.getClickedPos(); @@ -23,7 +23,7 @@ if (pair == null) { return InteractionResult.PASS; } else { -@@ -85,5 +_,10 @@ +@@ -86,5 +_,10 @@ public static boolean onlyIfAirAbove(UseOnContext p_150857_) { return p_150857_.getClickedFace() != Direction.DOWN && p_150857_.getLevel().getBlockState(p_150857_.getClickedPos().above()).isAir(); diff --git a/patches/net/minecraft/world/item/HorseArmorItem.java.patch b/patches/net/minecraft/world/item/HorseArmorItem.java.patch deleted file mode 100644 index 825fa1c86cd..00000000000 --- a/patches/net/minecraft/world/item/HorseArmorItem.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/net/minecraft/world/item/HorseArmorItem.java -+++ b/net/minecraft/world/item/HorseArmorItem.java -@@ -5,16 +_,20 @@ - public class HorseArmorItem extends Item { - private static final String TEX_FOLDER = "textures/entity/horse/"; - private final int protection; -- private final String texture; -+ private final ResourceLocation texture; - - public HorseArmorItem(int p_41364_, String p_41365_, Item.Properties p_41366_) { -+ this(p_41364_, new ResourceLocation("textures/entity/horse/armor/horse_armor_" + p_41365_ + ".png"), p_41366_); -+ } -+ -+ public HorseArmorItem(int p_41364_, ResourceLocation p_41365_, Item.Properties p_41366_) { - super(p_41366_); - this.protection = p_41364_; -- this.texture = "textures/entity/horse/armor/horse_armor_" + p_41365_ + ".png"; -+ this.texture = p_41365_; - } - - public ResourceLocation getTexture() { -- return new ResourceLocation(this.texture); -+ return texture; - } - - public int getProtection() { diff --git a/patches/net/minecraft/world/item/Item.java.patch b/patches/net/minecraft/world/item/Item.java.patch index 33d805107ee..f590b6c6973 100644 --- a/patches/net/minecraft/world/item/Item.java.patch +++ b/patches/net/minecraft/world/item/Item.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/Item.java +++ b/net/minecraft/world/item/Item.java -@@ -50,9 +_,9 @@ +@@ -54,9 +_,9 @@ import net.minecraft.world.phys.Vec3; import org.slf4j.Logger; @@ -9,12 +9,12 @@ private static final Logger LOGGER = LogUtils.getLogger(); - public static final Map BY_BLOCK = Maps.newHashMap(); + public static final Map BY_BLOCK = net.neoforged.neoforge.registries.GameData.getBlockItemMap(); - protected static final UUID BASE_ATTACK_DAMAGE_UUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); - protected static final UUID BASE_ATTACK_SPEED_UUID = UUID.fromString("FA233E1C-4180-4865-B01B-BCCE9785ACA3"); - public static final int MAX_STACK_SIZE = 64; -@@ -92,12 +_,14 @@ - this.foodProperties = p_41383_.foodProperties; - this.isFireResistant = p_41383_.isFireResistant; + public static final UUID BASE_ATTACK_DAMAGE_UUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); + public static final UUID BASE_ATTACK_SPEED_UUID = UUID.fromString("FA233E1C-4180-4865-B01B-BCCE9785ACA3"); + public static final int DEFAULT_MAX_STACK_SIZE = 64; +@@ -87,12 +_,14 @@ + this.components = p_41383_.buildAndValidateComponents(); + this.craftingRemainingItem = p_41383_.craftingRemainingItem; this.requiredFeatures = p_41383_.requiredFeatures; - if (SharedConstants.IS_RUNNING_IN_IDE) { + if (SharedConstants.IS_RUNNING_IN_IDE && false) { @@ -28,7 +28,7 @@ } @Deprecated -@@ -108,6 +_,8 @@ +@@ -111,6 +_,8 @@ public void onUseTick(Level p_41428_, LivingEntity p_41429_, ItemStack p_41430_, int p_41431_) { } @@ -37,48 +37,32 @@ public void onDestroyed(ItemEntity p_150887_) { } -@@ -132,9 +_,9 @@ - } +@@ -137,7 +_,7 @@ public InteractionResultHolder use(Level p_41432_, Player p_41433_, InteractionHand p_41434_) { -- if (this.isEdible()) { -- ItemStack itemstack = p_41433_.getItemInHand(p_41434_); -- if (p_41433_.canEat(this.getFoodProperties().canAlwaysEat())) { -+ ItemStack itemstack = p_41433_.getItemInHand(p_41434_); -+ if (itemstack.isEdible()) { -+ if (p_41433_.canEat(itemstack.getFoodProperties(p_41433_).canAlwaysEat())) { + ItemStack itemstack = p_41433_.getItemInHand(p_41434_); +- FoodProperties foodproperties = itemstack.get(DataComponents.FOOD); ++ FoodProperties foodproperties = itemstack.getFoodProperties(p_41433_); + if (foodproperties != null) { + if (p_41433_.canEat(foodproperties.canAlwaysEat())) { p_41433_.startUsingItem(p_41434_); - return InteractionResultHolder.consume(itemstack); - } else { -@@ -149,10 +_,12 @@ - return this.isEdible() ? p_41411_.eat(p_41410_, p_41409_) : p_41409_; - } - -+ @Deprecated // Use ItemStack sensitive version. - public final int getMaxStackSize() { - return this.maxStackSize; - } - -+ @Deprecated // Use ItemStack sensitive version. - public final int getMaxDamage() { - return this.maxDamage; - } -@@ -166,11 +_,12 @@ +@@ -159,12 +_,13 @@ } public int getBarWidth(ItemStack p_150900_) { -- return Math.round(13.0F - (float)p_150900_.getDamageValue() * 13.0F / (float)this.maxDamage); +- return Mth.clamp(Math.round(13.0F - (float)p_150900_.getDamageValue() * 13.0F / (float)p_150900_.getMaxDamage()), 0, 13); + return Math.round(13.0F - (float)p_150900_.getDamageValue() * 13.0F / (float)this.getMaxDamage(p_150900_)); } public int getBarColor(ItemStack p_150901_) { -- float f = Math.max(0.0F, ((float)this.maxDamage - (float)p_150901_.getDamageValue()) / (float)this.maxDamage); + int i = p_150901_.getMaxDamage(); +- float f = Math.max(0.0F, ((float)i - (float)p_150901_.getDamageValue()) / (float)i); + float stackMaxDamage = this.getMaxDamage(p_150901_); + float f = Math.max(0.0F, (stackMaxDamage - (float)p_150901_.getDamageValue()) / stackMaxDamage); return Mth.hsvToRgb(f / 3.0F, 1.0F, 1.0F); } -@@ -206,7 +_,7 @@ +@@ -214,7 +_,7 @@ @Override public String toString() { @@ -87,7 +71,7 @@ } protected String getOrCreateDescriptionId() { -@@ -230,10 +_,12 @@ +@@ -234,10 +_,12 @@ } @Nullable @@ -100,48 +84,32 @@ public boolean hasCraftingRemainingItem() { return this.craftingRemainingItem != null; } -@@ -258,7 +_,7 @@ - - public int getUseDuration(ItemStack p_41454_) { - if (p_41454_.getItem().isEdible()) { -- return this.getFoodProperties().isFastFood() ? 16 : 32; -+ return p_41454_.getFoodProperties(null).isFastFood() ? 16 : 32; - } else { - return 0; - } -@@ -300,7 +_,7 @@ +@@ -261,7 +_,7 @@ } - public boolean isEnchantable(ItemStack p_41456_) { -- return this.getMaxStackSize() == 1 && this.canBeDepleted(); -+ return this.getMaxStackSize(p_41456_) == 1 && this.isDamageable(p_41456_); + public int getUseDuration(ItemStack p_41454_) { +- FoodProperties foodproperties = p_41454_.get(DataComponents.FOOD); ++ FoodProperties foodproperties = p_41454_.getFoodProperties(null); + return foodproperties != null ? foodproperties.eatDurationTicks() : 0; } - protected static BlockHitResult getPlayerPOVHitResult(Level p_41436_, Player p_41437_, ClipContext.Fluid p_41438_) { -@@ -313,11 +_,14 @@ - float f5 = Mth.sin(-f * (float) (Math.PI / 180.0)); - float f6 = f3 * f4; - float f7 = f2 * f4; -- double d0 = 5.0; -- Vec3 vec31 = vec3.add((double)f6 * 5.0, (double)f5 * 5.0, (double)f7 * 5.0); -+ double d0 = p_41437_.getBlockReach(); -+ if (!p_41437_.isCreative() && d0 != 0) d0 += 0.5D; // The vanilla constant here was 5.0, but the default survival block reach is 4.5. Creative default is already 5.0. -+ Vec3 vec31 = vec3.add((double)f6 * d0, (double)f5 * d0, (double)f7 * d0); +@@ -293,6 +_,8 @@ return p_41436_.clip(new ClipContext(vec3, vec31, ClipContext.Block.OUTLINE, p_41438_, p_41437_)); } -+ /** Forge: Use ItemStack sensitive version. */ ++ /** @deprecated Neo: Use ItemStack sensitive version. */ + @Deprecated public int getEnchantmentValue() { return 0; } -@@ -326,12 +_,20 @@ +@@ -301,13 +_,20 @@ return false; } -+ @Deprecated // Use ItemStack sensitive version. - public Multimap getDefaultAttributeModifiers(EquipmentSlot p_41388_) { - return ImmutableMultimap.of(); +- @Deprecated ++ @Deprecated // Use ItemStack sensitive version or data components. (deprecated by vanilla too) + public ItemAttributeModifiers getDefaultAttributeModifiers() { + return ItemAttributeModifiers.EMPTY; } + protected final boolean canRepair; @@ -157,65 +125,64 @@ } public ItemStack getDefaultInstance() { -@@ -342,6 +_,8 @@ - return this.foodProperties != null; - } - -+ // Use IForgeItem#getFoodProperties(ItemStack, LivingEntity) in favour of this. -+ @Deprecated - @Nullable - public FoodProperties getFoodProperties() { - return this.foodProperties; -@@ -372,6 +_,32 @@ +@@ -335,13 +_,40 @@ return this.requiredFeatures; } -+ // FORGE START +- public static class Properties { ++ // NEO START + private Object renderProperties; + + /* + DO NOT CALL, IT WILL DISAPPEAR IN THE FUTURE + Call RenderProperties.get instead -+ */ ++ */ + public Object getRenderPropertiesInternal() { + return renderProperties; + } + + private void initClient() { + // Minecraft instance isn't available in datagen, so don't call initializeClient if in datagen -+ if (net.neoforged.fml.loading.FMLEnvironment.dist == net.neoforged.api.distmarker.Dist.CLIENT && !net.neoforged.fml.loading.FMLLoader.getLaunchHandler().isData()) { -+ initializeClient(properties -> { -+ if (properties == this) -+ throw new IllegalStateException("Don't extend IItemRenderProperties in your item, use an anonymous class instead."); -+ this.renderProperties = properties; -+ }); -+ } ++ if (net.neoforged.fml.loading.FMLEnvironment.dist == net.neoforged.api.distmarker.Dist.CLIENT && !net.neoforged.fml.loading.FMLLoader.getLaunchHandler().isData()) { ++ initializeClient(properties -> { ++ if (properties == this) ++ throw new IllegalStateException("Don't extend IItemRenderProperties in your item, use an anonymous class instead."); ++ this.renderProperties = properties; ++ }); ++ } + } + + public void initializeClient(java.util.function.Consumer consumer) { + } -+ // END FORGE ++ // END NEO + - public static class Properties { - int maxStackSize = 64; - int maxDamage; -@@ -382,6 +_,7 @@ - FoodProperties foodProperties; - boolean isFireResistant; ++ public static class Properties implements net.neoforged.neoforge.common.extensions.IItemPropertiesExtensions { + private static final Interner COMPONENT_INTERNER = Interners.newStrongInterner(); + @Nullable + private DataComponentMap.Builder components; + @Nullable + Item craftingRemainingItem; FeatureFlagSet requiredFeatures = FeatureFlags.VANILLA_SET; + private boolean canRepair = true; public Item.Properties food(FoodProperties p_41490_) { - this.foodProperties = p_41490_; -@@ -419,6 +_,11 @@ + return this.component(DataComponents.FOOD, p_41490_); +@@ -371,12 +_,18 @@ + return this.component(DataComponents.FIRE_RESISTANT, Unit.INSTANCE); + } - public Item.Properties fireResistant() { - this.isFireResistant = true; ++ public Item.Properties setNoRepair() { ++ canRepair = false; + return this; + } + -+ public Item.Properties setNoRepair() { -+ canRepair = false; + public Item.Properties requiredFeatures(FeatureFlag... p_250948_) { + this.requiredFeatures = FeatureFlags.REGISTRY.subset(p_250948_); return this; } + public Item.Properties component(DataComponentType p_330871_, T p_330323_) { ++ net.neoforged.neoforge.common.CommonHooks.validateComponent(p_330323_); + if (this.components == null) { + this.components = DataComponentMap.builder().addAll(DataComponents.COMMON_ITEM_COMPONENTS); + } diff --git a/patches/net/minecraft/world/item/ItemStack.java.patch b/patches/net/minecraft/world/item/ItemStack.java.patch index 17a83bcd12a..c8a94292f08 100644 --- a/patches/net/minecraft/world/item/ItemStack.java.patch +++ b/patches/net/minecraft/world/item/ItemStack.java.patch @@ -1,93 +1,26 @@ --- a/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java -@@ -81,12 +_,13 @@ - import net.minecraft.world.level.block.state.pattern.BlockInWorld; +@@ -92,7 +_,7 @@ + import org.apache.commons.lang3.mutable.MutableBoolean; import org.slf4j.Logger; --public final class ItemStack { -+public final class ItemStack extends net.neoforged.neoforge.attachment.AttachmentHolder implements net.neoforged.neoforge.common.extensions.IItemStackExtension { - public static final Codec CODEC = RecordCodecBuilder.create( - p_311716_ -> p_311716_.group( - BuiltInRegistries.ITEM.holderByNameCodec().fieldOf("id").forGetter(ItemStack::getItemHolder), - Codec.INT.fieldOf("Count").forGetter(ItemStack::getCount), -- CompoundTag.CODEC.optionalFieldOf("tag").forGetter(p_281115_ -> Optional.ofNullable(p_281115_.getTag())) -+ CompoundTag.CODEC.optionalFieldOf("tag").forGetter(p_281115_ -> Optional.ofNullable(p_281115_.getTag())), -+ ExtraCodecs.strictOptionalField(CompoundTag.CODEC, ATTACHMENTS_NBT_KEY).forGetter(s -> Optional.ofNullable(s.serializeAttachments())) - ) - .apply(p_311716_, ItemStack::new) - ); -@@ -97,14 +_,17 @@ - public static final Codec ADVANCEMENT_ICON_CODEC = RecordCodecBuilder.create( - p_311717_ -> p_311717_.group( - BuiltInRegistries.ITEM.holderByNameCodec().fieldOf("item").forGetter(ItemStack::getItemHolder), -- ExtraCodecs.strictOptionalField(TagParser.AS_CODEC, "nbt").forGetter(p_311718_ -> Optional.ofNullable(p_311718_.getTag())) -+ ExtraCodecs.strictOptionalField(TagParser.AS_CODEC, "nbt").forGetter(p_311718_ -> Optional.ofNullable(p_311718_.getTag())), -+ ExtraCodecs.strictOptionalField(TagParser.AS_CODEC, ATTACHMENTS_NBT_KEY).forGetter(s -> Optional.ofNullable(s.serializeAttachments())) - ) -- .apply(p_311717_, (p_311722_, p_311723_) -> new ItemStack(p_311722_, 1, p_311723_)) -+ .apply(p_311717_, (p_311722_, p_311723_, attachments) -> new ItemStack(p_311722_, 1, p_311723_, attachments)) - ); - public static final Codec ITEM_WITH_COUNT_CODEC = RecordCodecBuilder.create( - p_311720_ -> p_311720_.group( - ITEM_NON_AIR_CODEC.fieldOf("item").forGetter(ItemStack::getItem), -- ExtraCodecs.strictOptionalField(ExtraCodecs.POSITIVE_INT, "count", 1).forGetter(ItemStack::getCount) -+ ExtraCodecs.strictOptionalField(ExtraCodecs.POSITIVE_INT, "count", 1).forGetter(ItemStack::getCount), -+ ExtraCodecs.strictOptionalField(net.neoforged.neoforge.common.crafting.CraftingHelper.TAG_CODEC, "nbt").forGetter(stack -> java.util.Optional.ofNullable(net.neoforged.neoforge.common.crafting.CraftingHelper.getTagForWriting(stack))), -+ ExtraCodecs.strictOptionalField(net.neoforged.neoforge.common.crafting.CraftingHelper.TAG_CODEC, ATTACHMENTS_NBT_KEY).forGetter(s -> Optional.ofNullable(s.serializeAttachments())) - ) - .apply(p_311720_, ItemStack::new) - ); -@@ -162,18 +_,30 @@ +-public final class ItemStack implements DataComponentHolder { ++public final class ItemStack implements DataComponentHolder, net.neoforged.neoforge.common.extensions.IItemStackExtension, net.neoforged.neoforge.common.MutableDataComponentHolder { + public static final Codec> ITEM_NON_AIR_CODEC = BuiltInRegistries.ITEM + .holderByNameCodec() + .validate( +@@ -234,6 +_,10 @@ + return !this.isEmpty() ? this.components.asPatch() : DataComponentPatch.EMPTY; } - public ItemStack(Holder p_312081_, int p_41605_, Optional p_41606_) { -+ this(p_312081_.value(), p_41605_, p_41606_); ++ public boolean isComponentsPatchEmpty() { ++ return !this.isEmpty() ? this.components.isPatchEmpty() : true; + } -+ public ItemStack(ItemLike p_312081_, int p_41605_, Optional p_41606_) { - this(p_312081_, p_41605_); - p_41606_.ifPresent(this::setTag); - } -+ private ItemStack(Holder p_312081_, int p_41605_, Optional p_41606_, Optional attachmentsNbt) { -+ this(p_312081_.value(), p_41605_, p_41606_, attachmentsNbt); -+ } -+ private ItemStack(ItemLike p_312081_, int p_41605_, Optional p_41606_, Optional attachmentsNbt) { -+ this(p_312081_, p_41605_, attachmentsNbt.orElse(null)); -+ p_41606_.ifPresent(this::setTag); -+ } - - public ItemStack(Holder p_220155_, int p_220156_) { - this(p_220155_.value(), p_220156_); - } - -- public ItemStack(ItemLike p_41601_, int p_41602_) { -+ public ItemStack(ItemLike p_41601_, int p_41602_) { this(p_41601_, p_41602_, (CompoundTag) null); } -+ public ItemStack(ItemLike p_41601_, int p_41602_, @Nullable CompoundTag attachmentsNbt) { - this.item = p_41601_.asItem(); - this.count = p_41602_; -- if (this.item.canBeDepleted()) { -+ if (attachmentsNbt != null) deserializeAttachments(attachmentsNbt); -+ if (this.item.isDamageable(this)) { - this.setDamageValue(this.getDamageValue()); - } - } -@@ -187,10 +_,15 @@ - this.count = p_41608_.getByte("Count"); - if (p_41608_.contains("tag", 10)) { - this.tag = p_41608_.getCompound("tag").copy(); -+ if (this.tag.contains(ATTACHMENTS_NBT_KEY, Tag.TAG_COMPOUND)) { // Neo: Read contained attachments -+ deserializeAttachments(this.tag.getCompound(ATTACHMENTS_NBT_KEY)); -+ this.tag = net.neoforged.neoforge.attachment.AttachmentInternals.cleanTag(this.tag); -+ } -+ if (this.tag != null) - this.getItem().verifyTagAfterLoad(this.tag); - } - -- if (this.getItem().canBeDepleted()) { -+ if (this.getItem().isDamageable(this)) { - this.setDamageValue(this.getDamageValue()); - } ++ + public ItemStack(ItemLike p_41599_) { + this(p_41599_, 1); } -@@ -250,7 +_,7 @@ +@@ -327,7 +_,7 @@ } public boolean is(Holder p_220166_) { @@ -96,13 +29,13 @@ } public boolean is(HolderSet p_298683_) { -@@ -262,6 +_,23 @@ +@@ -339,13 +_,30 @@ } public InteractionResult useOn(UseOnContext p_41662_) { + if (p_41662_.getPlayer() != null) { // TODO 1.20.5: Make event accept nullable player, and remove this check. + var e = net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.entity.player.UseItemOnBlockEvent(p_41662_, net.neoforged.neoforge.event.entity.player.UseItemOnBlockEvent.UsePhase.ITEM_AFTER_BLOCK)); -+ if (e.isCanceled()) return e.getCancellationResult(); ++ if (e.isCanceled()) return e.getCancellationResult().result(); + } + if (!p_41662_.getLevel().isClientSide) return net.neoforged.neoforge.common.CommonHooks.onPlaceItemIntoWorld(p_41662_); + return onItemUse(p_41662_, (c) -> getItem().useOn(p_41662_)); @@ -111,7 +44,7 @@ + public InteractionResult onItemUseFirst(UseOnContext p_41662_) { + if (p_41662_.getPlayer() != null) { // TODO 1.20.5: Make event accept nullable player, and remove this check. + var e = net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.entity.player.UseItemOnBlockEvent(p_41662_, net.neoforged.neoforge.event.entity.player.UseItemOnBlockEvent.UsePhase.ITEM_BEFORE_BLOCK)); -+ if (e.isCanceled()) return e.getCancellationResult(); ++ if (e.isCanceled()) return e.getCancellationResult().result(); + } + return onItemUse(p_41662_, (c) -> getItem().onItemUseFirst(this, p_41662_)); + } @@ -119,46 +52,25 @@ + private InteractionResult onItemUse(UseOnContext p_41662_, java.util.function.Function callback) { Player player = p_41662_.getPlayer(); BlockPos blockpos = p_41662_.getClickedPos(); - BlockInWorld blockinworld = new BlockInWorld(p_41662_.getLevel(), blockpos, false); -@@ -271,7 +_,7 @@ + if (player != null && !player.getAbilities().mayBuild && !this.canPlaceOnBlockInAdventureMode(new BlockInWorld(p_41662_.getLevel(), blockpos, false))) { return InteractionResult.PASS; } else { Item item = this.getItem(); - InteractionResult interactionresult = item.useOn(p_41662_); + InteractionResult interactionresult = callback.apply(p_41662_); - if (player != null && interactionresult.shouldAwardStats()) { + if (player != null && interactionresult.indicateItemUse()) { player.awardStat(Stats.ITEM_USED.get(item)); } -@@ -296,15 +_,16 @@ - ResourceLocation resourcelocation = BuiltInRegistries.ITEM.getKey(this.getItem()); - p_41740_.putString("id", resourcelocation == null ? "minecraft:air" : resourcelocation.toString()); - p_41740_.putByte("Count", (byte)this.count); -- if (this.tag != null) { -- p_41740_.put("tag", this.tag.copy()); -+ var tag = net.neoforged.neoforge.attachment.AttachmentInternals.addAttachmentsToTag(this.tag, this, true); -+ if (tag != null) { -+ p_41740_.put("tag", tag); - } - - return p_41740_; +@@ -387,7 +_,7 @@ } public int getMaxStackSize() { -- return this.getItem().getMaxStackSize(); +- return this.getOrDefault(DataComponents.MAX_STACK_SIZE, Integer.valueOf(1)); + return this.getItem().getMaxStackSize(this); } public boolean isStackable() { -@@ -312,7 +_,7 @@ - } - - public boolean isDamageableItem() { -- if (!this.isEmpty() && this.getItem().getMaxDamage() > 0) { -+ if (!this.isEmpty() && this.getItem().isDamageable(this)) { - CompoundTag compoundtag = this.getTag(); - return compoundtag == null || !compoundtag.getBoolean("Unbreakable"); - } else { -@@ -321,19 +_,19 @@ +@@ -399,23 +_,28 @@ } public boolean isDamaged() { @@ -167,126 +79,99 @@ } public int getDamageValue() { -- return this.tag == null ? 0 : this.tag.getInt("Damage"); +- return Mth.clamp(this.getOrDefault(DataComponents.DAMAGE, Integer.valueOf(0)), 0, this.getMaxDamage()); + return this.getItem().getDamage(this); } public void setDamageValue(int p_41722_) { -- this.getOrCreateTag().putInt("Damage", Math.max(0, p_41722_)); +- this.set(DataComponents.DAMAGE, Mth.clamp(p_41722_, 0, this.getMaxDamage())); + this.getItem().setDamage(this, p_41722_); } public int getMaxDamage() { -- return this.getItem().getMaxDamage(); +- return this.getOrDefault(DataComponents.MAX_DAMAGE, Integer.valueOf(0)); + return this.getItem().getMaxDamage(this); } - public boolean hurt(int p_220158_, RandomSource p_220159_, @Nullable ServerPlayer p_220160_) { -@@ -369,6 +_,7 @@ - public void hurtAndBreak(int p_41623_, T p_41624_, Consumer p_41625_) { - if (!p_41624_.level().isClientSide && (!(p_41624_ instanceof Player) || !((Player)p_41624_).getAbilities().instabuild)) { - if (this.isDamageableItem()) { -+ p_41623_ = this.getItem().damageItem(this, p_41623_, p_41624_, p_41625_); - if (this.hurt(p_41623_, p_41624_.getRandom(), p_41624_ instanceof ServerPlayer ? (ServerPlayer)p_41624_ : null)) { - p_41625_.accept(p_41624_); - Item item = this.getItem(); -@@ -418,7 +_,7 @@ - } - - public boolean isCorrectToolForDrops(BlockState p_41736_) { -- return this.getItem().isCorrectToolForDrops(p_41736_); -+ return this.getItem().isCorrectToolForDrops(this, p_41736_); - } - - public InteractionResult interactLivingEntity(Player p_41648_, LivingEntity p_41649_, InteractionHand p_41650_) { -@@ -430,6 +_,7 @@ - return EMPTY; - } else { - ItemStack itemstack = new ItemStack(this.getItem(), this.count); -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyStackAttachments(this, itemstack); - itemstack.setPopTime(this.getPopTime()); - if (this.tag != null) { - itemstack.tag = this.tag.copy(); -@@ -465,8 +_,17 @@ - if (!p_150943_.is(p_150944_.getItem())) { - return false; - } else { -- return p_150943_.isEmpty() && p_150944_.isEmpty() ? true : Objects.equals(p_150943_.tag, p_150944_.tag); -+ return p_150943_.isEmpty() && p_150944_.isEmpty() ? true : Objects.equals(p_150943_.tag, p_150944_.tag) && p_150943_.areAttachmentsCompatible(p_150944_); - } + public void hurtAndBreak(int p_220158_, RandomSource p_220159_, @Nullable ServerPlayer p_220160_, Runnable p_320659_) { ++ hurtAndBreak(p_220158_, p_220159_, (LivingEntity) p_220160_, p_320659_); + } + -+ /** -+ * Neo: Check if the attachments of this stack and another stack are compatible. -+ * If not, they cannot be stacked. -+ * @see #areAttachmentsCompatible(net.neoforged.neoforge.attachment.AttachmentHolder, net.neoforged.neoforge.attachment.AttachmentHolder) -+ */ -+ public boolean areAttachmentsCompatible(ItemStack other) { -+ return areAttachmentsCompatible(this, other); - } ++ public void hurtAndBreak(int p_220158_, RandomSource p_220159_, @Nullable LivingEntity p_220160_, Runnable p_320659_) { + if (this.isDamageableItem()) { ++ p_220158_ = getItem().damageItem(this, p_220158_, p_220160_, p_320659_); + if (p_220158_ > 0) { + int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.UNBREAKING, this); + int j = 0; +@@ -432,8 +_,8 @@ + } + } - public String getDescriptionId() { -@@ -560,7 +_,7 @@ +- if (p_220160_ != null && p_220158_ != 0) { +- CriteriaTriggers.ITEM_DURABILITY_CHANGED.trigger(p_220160_, this, this.getDamageValue() + p_220158_); ++ if (p_220160_ instanceof ServerPlayer sp && p_220158_ != 0) { ++ CriteriaTriggers.ITEM_DURABILITY_CHANGED.trigger(sp, this, this.getDamageValue() + p_220158_); + } - public void setTag(@Nullable CompoundTag p_41752_) { - this.tag = p_41752_; -- if (this.getItem().canBeDepleted()) { -+ if (this.getItem().isDamageable(this)) { - this.setDamageValue(this.getDamageValue()); - } + int l = this.getDamageValue() + p_220158_; +@@ -450,7 +_,7 @@ + return; + } -@@ -619,7 +_,7 @@ +- this.hurtAndBreak(p_41623_, p_41624_.getRandom(), p_41624_ instanceof ServerPlayer serverplayer ? serverplayer : null, () -> { ++ this.hurtAndBreak(p_41623_, p_41624_.getRandom(), p_41624_, () -> { + p_41624_.broadcastBreakEvent(p_319898_); + Item item = this.getItem(); + this.shrink(1); +@@ -706,7 +_,7 @@ + return List.of(); + } else { + List list = Lists.newArrayList(); +- MutableComponent mutablecomponent = Component.empty().append(this.getHoverName()).withStyle(this.getRarity().color()); ++ MutableComponent mutablecomponent = Component.empty().append(this.getHoverName()).withStyle(this.getRarity().getStyleModifier()); + if (this.has(DataComponents.CUSTOM_NAME)) { + mutablecomponent.withStyle(ChatFormatting.ITALIC); + } +@@ -761,6 +_,7 @@ + list.add(DISABLED_ITEM_TOOLTIP); + } - public List getTooltipLines(@Nullable Player p_41652_, TooltipFlag p_41653_) { - List list = Lists.newArrayList(); -- MutableComponent mutablecomponent = Component.empty().append(this.getHoverName()).withStyle(this.getRarity().color); -+ MutableComponent mutablecomponent = Component.empty().append(this.getHoverName()).withStyle(this.getRarity().getStyleModifier()); - if (this.hasCustomHoverName()) { - mutablecomponent.withStyle(ChatFormatting.ITALIC); - } -@@ -792,6 +_,7 @@ - list.add(DISABLED_ITEM_TOOLTIP); ++ net.neoforged.neoforge.event.EventHooks.onItemTooltip(this, p_41652_, list, p_41653_, p_339637_); + return list; } - -+ net.neoforged.neoforge.event.EventHooks.onItemTooltip(this, p_41652_, list, p_41653_); - return list; - } - -@@ -800,7 +_,7 @@ } +@@ -901,11 +_,15 @@ - private int getHideFlags() { -- return this.hasTag() && this.tag.contains("HideFlags", 99) ? this.tag.getInt("HideFlags") : 0; -+ return this.hasTag() && this.tag.contains("HideFlags", 99) ? this.tag.getInt("HideFlags") : this.getItem().getDefaultTooltipHideFlags(this); - } - - public void hideTooltipPart(ItemStack.TooltipPart p_41655_) { -@@ -921,9 +_,10 @@ - } - } + public void forEachModifier(EquipmentSlot p_332001_, BiConsumer, AttributeModifier> p_330882_) { + ItemAttributeModifiers itemattributemodifiers = this.getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.EMPTY); ++ com.google.common.collect.Multimap, AttributeModifier> multimap; ++ multimap = com.google.common.collect.LinkedHashMultimap.create(); + if (!itemattributemodifiers.modifiers().isEmpty()) { +- itemattributemodifiers.forEach(p_332001_, p_330882_); ++ itemattributemodifiers.forEach(p_332001_, multimap::put); } else { -- multimap = this.getItem().getDefaultAttributeModifiers(p_41639_); -+ multimap = this.getItem().getAttributeModifiers(p_41639_, this); +- this.getItem().getDefaultAttributeModifiers().forEach(p_332001_, p_330882_); ++ this.getItem().getAttributeModifiers(this).forEach(p_332001_, multimap::put); } - -+ multimap = net.neoforged.neoforge.common.CommonHooks.getAttributeModifiers(this, p_41639_, multimap); - return multimap; ++ multimap = net.neoforged.neoforge.common.CommonHooks.getAttributeModifiers(this, p_332001_, multimap); ++ multimap.forEach(p_330882_); } -@@ -951,7 +_,7 @@ + public Component getDisplayName() { +@@ -916,7 +_,7 @@ MutableComponent mutablecomponent1 = ComponentUtils.wrapInSquareBrackets(mutablecomponent); if (!this.isEmpty()) { -- mutablecomponent1.withStyle(this.getRarity().color) +- mutablecomponent1.withStyle(this.getRarity().color()) + mutablecomponent1.withStyle(this.getRarity().getStyleModifier()) .withStyle(p_220170_ -> p_220170_.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_ITEM, new HoverEvent.ItemStackInfo(this)))); } -@@ -1002,6 +_,8 @@ +@@ -973,6 +_,8 @@ this.getItem().onUseTick(p_41732_, p_41733_, this, p_41734_); } -+ /** @deprecated Forge: Use {@linkplain IItemStackExtension#onDestroyed(ItemEntity, net.minecraft.world.damagesource.DamageSource) damage source sensitive version} */ ++ /** @deprecated Forge: Use {@linkplain net.neoforged.neoforge.common.extensions.IItemStackExtension#onDestroyed(ItemEntity, net.minecraft.world.damagesource.DamageSource) damage source sensitive version} */ + @Deprecated public void onDestroyed(ItemEntity p_150925_) { this.getItem().onDestroyed(p_150925_); diff --git a/patches/net/minecraft/world/item/Items.java.patch b/patches/net/minecraft/world/item/Items.java.patch index fde825291a0..487c71e0b86 100644 --- a/patches/net/minecraft/world/item/Items.java.patch +++ b/patches/net/minecraft/world/item/Items.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/Items.java +++ b/net/minecraft/world/item/Items.java -@@ -1685,11 +_,23 @@ +@@ -2089,11 +_,23 @@ } public static Item registerBlock(Block p_252092_, Block... p_248886_) { @@ -14,7 +14,7 @@ + } + } -- for(Block block : p_248886_) { +- for (Block block : p_248886_) { - Item.BY_BLOCK.put(block, blockitem); - } + @Override diff --git a/patches/net/minecraft/world/item/MapItem.java.patch b/patches/net/minecraft/world/item/MapItem.java.patch index 4d73927181c..159280f4f40 100644 --- a/patches/net/minecraft/world/item/MapItem.java.patch +++ b/patches/net/minecraft/world/item/MapItem.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/item/MapItem.java +++ b/net/minecraft/world/item/MapItem.java -@@ -58,6 +_,16 @@ +@@ -57,6 +_,16 @@ @Nullable public static MapItemSavedData getSavedData(ItemStack p_42854_, Level p_42855_) { -+ // Forge: Add instance method so that mods can override ++ // Neo: Add instance method so that mods can override + Item map = p_42854_.getItem(); + if(map instanceof MapItem) { + return ((MapItem)map).getCustomMapData(p_42854_, p_42855_); @@ -14,6 +14,6 @@ + + @Nullable + protected MapItemSavedData getCustomMapData(ItemStack p_42854_, Level p_42855_) { - Integer integer = getMapId(p_42854_); - return getSavedData(integer, p_42855_); + MapId mapid = p_42854_.get(DataComponents.MAP_ID); + return getSavedData(mapid, p_42855_); } diff --git a/patches/net/minecraft/world/item/MilkBucketItem.java.patch b/patches/net/minecraft/world/item/MilkBucketItem.java.patch index ad3855d4917..b6b9842af96 100644 --- a/patches/net/minecraft/world/item/MilkBucketItem.java.patch +++ b/patches/net/minecraft/world/item/MilkBucketItem.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/item/MilkBucketItem.java +++ b/net/minecraft/world/item/MilkBucketItem.java -@@ -28,7 +_,7 @@ - } +@@ -25,7 +_,7 @@ + p_42923_.consume(1, p_42925_); if (!p_42924_.isClientSide) { - p_42925_.removeAllEffects(); + p_42925_.removeEffectsCuredBy(net.neoforged.neoforge.common.EffectCures.MILK); diff --git a/patches/net/minecraft/world/item/MobBucketItem.java.patch b/patches/net/minecraft/world/item/MobBucketItem.java.patch deleted file mode 100644 index 0ed7536c03b..00000000000 --- a/patches/net/minecraft/world/item/MobBucketItem.java.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- a/net/minecraft/world/item/MobBucketItem.java -+++ b/net/minecraft/world/item/MobBucketItem.java -@@ -22,13 +_,18 @@ - import net.minecraft.world.level.material.Fluid; - - public class MobBucketItem extends BucketItem { -- private final EntityType type; -- private final SoundEvent emptySound; -+ private final java.util.function.Supplier> entityTypeSupplier; -+ private final java.util.function.Supplier emptySoundSupplier; - -+ @Deprecated - public MobBucketItem(EntityType p_151137_, Fluid p_151138_, SoundEvent p_151139_, Item.Properties p_151140_) { -- super(p_151138_, p_151140_); -- this.type = p_151137_; -- this.emptySound = p_151139_; -+ this(() -> p_151137_, () -> p_151138_, () -> p_151139_, p_151140_); -+ } -+ -+ public MobBucketItem(java.util.function.Supplier> entitySupplier, java.util.function.Supplier fluidSupplier, java.util.function.Supplier soundSupplier, Item.Properties properties) { -+ super(fluidSupplier, properties); -+ this.emptySoundSupplier = soundSupplier; -+ this.entityTypeSupplier = entitySupplier; - } - - @Override -@@ -41,11 +_,11 @@ - - @Override - protected void playEmptySound(@Nullable Player p_151151_, LevelAccessor p_151152_, BlockPos p_151153_) { -- p_151152_.playSound(p_151151_, p_151153_, this.emptySound, SoundSource.NEUTRAL, 1.0F, 1.0F); -+ p_151152_.playSound(p_151151_, p_151153_, getEmptySound(), SoundSource.NEUTRAL, 1.0F, 1.0F); - } - - private void spawn(ServerLevel p_151142_, ItemStack p_151143_, BlockPos p_151144_) { -- Entity entity = this.type.spawn(p_151142_, p_151143_, null, p_151144_, MobSpawnType.BUCKET, true, false); -+ Entity entity = getFishType().spawn(p_151142_, p_151143_, null, p_151144_, MobSpawnType.BUCKET, true, false); - if (entity instanceof Bucketable bucketable) { - bucketable.loadFromBucketTag(p_151143_.getOrCreateTag()); - bucketable.setFromBucket(true); -@@ -54,7 +_,7 @@ - - @Override - public void appendHoverText(ItemStack p_151155_, @Nullable Level p_151156_, List p_151157_, TooltipFlag p_151158_) { -- if (this.type == EntityType.TROPICAL_FISH) { -+ if (getFishType() == EntityType.TROPICAL_FISH) { - CompoundTag compoundtag = p_151155_.getTag(); - if (compoundtag != null && compoundtag.contains("BucketVariantTag", 3)) { - int i = compoundtag.getInt("BucketVariantTag"); -@@ -79,5 +_,14 @@ - p_151157_.add(mutablecomponent); - } - } -+ } -+ -+ // Forge Start -+ protected EntityType getFishType() { -+ return entityTypeSupplier.get(); -+ } -+ -+ protected SoundEvent getEmptySound() { -+ return emptySoundSupplier.get(); - } - } diff --git a/patches/net/minecraft/world/item/PickaxeItem.java.patch b/patches/net/minecraft/world/item/PickaxeItem.java.patch index 31dcab7549f..9b4d5c6b712 100644 --- a/patches/net/minecraft/world/item/PickaxeItem.java.patch +++ b/patches/net/minecraft/world/item/PickaxeItem.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/item/PickaxeItem.java +++ b/net/minecraft/world/item/PickaxeItem.java @@ -6,4 +_,9 @@ - public PickaxeItem(Tier p_42961_, int p_42962_, float p_42963_, Item.Properties p_42964_) { - super((float)p_42962_, p_42963_, p_42961_, BlockTags.MINEABLE_WITH_PICKAXE, p_42964_); + public PickaxeItem(Tier p_42961_, Item.Properties p_42964_) { + super(p_42961_, BlockTags.MINEABLE_WITH_PICKAXE, p_42964_); } + + @Override diff --git a/patches/net/minecraft/world/item/ProjectileWeaponItem.java.patch b/patches/net/minecraft/world/item/ProjectileWeaponItem.java.patch new file mode 100644 index 00000000000..4ca03974f83 --- /dev/null +++ b/patches/net/minecraft/world/item/ProjectileWeaponItem.java.patch @@ -0,0 +1,30 @@ +--- a/net/minecraft/world/item/ProjectileWeaponItem.java ++++ b/net/minecraft/world/item/ProjectileWeaponItem.java +@@ -108,7 +_,7 @@ + abstractarrow.setPierceLevel((byte)j); + } + +- return abstractarrow; ++ return customArrow(abstractarrow, p_330846_); + } + + protected static boolean hasInfiniteArrows(ItemStack p_330642_, ItemStack p_332202_, boolean p_331512_) { +@@ -133,7 +_,7 @@ + } + + protected static ItemStack useAmmo(ItemStack p_331207_, ItemStack p_331434_, LivingEntity p_330302_, boolean p_330934_) { +- boolean flag = !p_330934_ && !hasInfiniteArrows(p_331207_, p_331434_, p_330302_.hasInfiniteMaterials()); ++ boolean flag = !p_330934_ && !(p_330302_.hasInfiniteMaterials() || (p_331434_.getItem() instanceof ArrowItem && ((ArrowItem)p_331434_.getItem()).isInfinite(p_331434_, p_331207_, p_330302_))); + if (!flag) { + ItemStack itemstack1 = p_331434_.copyWithCount(1); + itemstack1.set(DataComponents.INTANGIBLE_PROJECTILE, Unit.INSTANCE); +@@ -146,5 +_,9 @@ + + return itemstack; + } ++ } ++ ++ public AbstractArrow customArrow(AbstractArrow arrow, net.minecraft.world.item.ItemStack stack) { ++ return arrow; + } + } diff --git a/patches/net/minecraft/world/item/Rarity.java.patch b/patches/net/minecraft/world/item/Rarity.java.patch index cb12a73707a..736a7489453 100644 --- a/patches/net/minecraft/world/item/Rarity.java.patch +++ b/patches/net/minecraft/world/item/Rarity.java.patch @@ -1,40 +1,60 @@ --- a/net/minecraft/world/item/Rarity.java +++ b/net/minecraft/world/item/Rarity.java -@@ -2,15 +_,36 @@ +@@ -9,7 +_,7 @@ + import net.minecraft.util.ByIdMap; + import net.minecraft.util.StringRepresentable; - import net.minecraft.ChatFormatting; - --public enum Rarity { -+public enum Rarity implements net.neoforged.neoforge.common.IExtensibleEnum { - COMMON(ChatFormatting.WHITE), - UNCOMMON(ChatFormatting.YELLOW), - RARE(ChatFormatting.AQUA), - EPIC(ChatFormatting.LIGHT_PURPLE); - -+ /** @deprecated Forge: Use {@link #getStyleModifier()} */ -+ @Deprecated - public final ChatFormatting color; +-public enum Rarity implements StringRepresentable { ++public enum Rarity implements StringRepresentable, net.neoforged.neoforge.common.IExtensibleEnum { + COMMON(0, "common", ChatFormatting.WHITE), + UNCOMMON(1, "uncommon", ChatFormatting.YELLOW), + RARE(2, "rare", ChatFormatting.AQUA), +@@ -21,19 +_,46 @@ + private final int id; + private final String name; + private final ChatFormatting color; + private final java.util.function.UnaryOperator styleModifier; - private Rarity(ChatFormatting p_43028_) { + private Rarity(int p_336096_, String p_335642_, ChatFormatting p_43028_) { + this.id = p_336096_; + this.name = p_335642_; this.color = p_43028_; +- } +- + this.styleModifier = style -> style.withColor(p_43028_); + } + -+ Rarity(java.util.function.UnaryOperator styleModifier) { ++ Rarity(net.minecraft.resources.ResourceLocation serializedName, java.util.function.UnaryOperator styleModifier) { ++ this.id = 0; ++ this.name = java.util.Objects.requireNonNull(serializedName, "Modded Rarities must have a non-null serializedName").toString(); + this.color = ChatFormatting.BLACK; + this.styleModifier = styleModifier; + } + ++ Rarity(net.minecraft.resources.ResourceLocation serializedName, ChatFormatting color) { ++ this(0, java.util.Objects.requireNonNull(serializedName, "Modded Rarities must have a non-null serializedName").toString(), color); ++ } ++ ++ /** @deprecated Forge: Use {@link #getStyleModifier()} */ ++ @Deprecated + public ChatFormatting color() { + return this.color; + } + + public java.util.function.UnaryOperator getStyleModifier() { + return this.styleModifier; + } + -+ public static Rarity create(String name, ChatFormatting color) { + @Override + public String getSerializedName() { + return this.name; ++ } ++ ++ public static Rarity create(String name, net.minecraft.resources.ResourceLocation serializedName, ChatFormatting color) { + throw new IllegalStateException("Enum not extended"); + } + -+ public static Rarity create(String name, java.util.function.UnaryOperator styleModifier) { ++ public static Rarity create(String name, net.minecraft.resources.ResourceLocation serializedName, java.util.function.UnaryOperator styleModifier) { + throw new IllegalStateException("Enum not extended"); } } diff --git a/patches/net/minecraft/world/item/RecordItem.java.patch b/patches/net/minecraft/world/item/RecordItem.java.patch index 8ec63a856c0..901019c8c43 100644 --- a/patches/net/minecraft/world/item/RecordItem.java.patch +++ b/patches/net/minecraft/world/item/RecordItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/RecordItem.java +++ b/net/minecraft/world/item/RecordItem.java -@@ -22,17 +_,42 @@ +@@ -21,17 +_,42 @@ import net.minecraft.world.level.gameevent.GameEvent; public class RecordItem extends Item { @@ -43,7 +43,7 @@ } @Override -@@ -81,7 +_,7 @@ +@@ -79,7 +_,7 @@ } public SoundEvent getSound() { diff --git a/patches/net/minecraft/world/item/ShearsItem.java.patch b/patches/net/minecraft/world/item/ShearsItem.java.patch index 47785c12871..f23ea5f1412 100644 --- a/patches/net/minecraft/world/item/ShearsItem.java.patch +++ b/patches/net/minecraft/world/item/ShearsItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/ShearsItem.java +++ b/net/minecraft/world/item/ShearsItem.java -@@ -59,6 +_,27 @@ +@@ -55,6 +_,27 @@ } @Override @@ -9,10 +9,10 @@ + if (entity.level().isClientSide) return InteractionResult.CONSUME; + BlockPos pos = entity.blockPosition(); + if (target.isShearable(stack, entity.level(), pos)) { -+ target.onSheared(player, stack, entity.level(), pos, stack.getEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.BLOCK_FORTUNE)) ++ target.onSheared(player, stack, entity.level(), pos, stack.getEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.FORTUNE)) + .forEach(drop -> target.spawnShearedDrop(entity.level(), pos, drop)); + entity.gameEvent(GameEvent.SHEAR, player); -+ stack.hurtAndBreak(1, player, e -> e.broadcastBreakEvent(hand)); ++ stack.hurtAndBreak(1, player, hand == net.minecraft.world.InteractionHand.MAIN_HAND ? net.minecraft.world.entity.EquipmentSlot.MAINHAND : net.minecraft.world.entity.EquipmentSlot.OFFHAND); + } + return InteractionResult.SUCCESS; + } diff --git a/patches/net/minecraft/world/item/ShieldItem.java.patch b/patches/net/minecraft/world/item/ShieldItem.java.patch index 857f951e390..8b271dd31df 100644 --- a/patches/net/minecraft/world/item/ShieldItem.java.patch +++ b/patches/net/minecraft/world/item/ShieldItem.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/item/ShieldItem.java +++ b/net/minecraft/world/item/ShieldItem.java -@@ -59,6 +_,13 @@ - return compoundtag != null ? DyeColor.byId(compoundtag.getInt("Base")) : DyeColor.WHITE; +@@ -53,6 +_,13 @@ + return p_43092_.is(ItemTags.PLANKS) || super.isValidRepairItem(p_43091_, p_43092_); } + /* ******************** FORGE START ******************** */ diff --git a/patches/net/minecraft/world/item/ShovelItem.java.patch b/patches/net/minecraft/world/item/ShovelItem.java.patch index dc8c7872935..f42a9820f7d 100644 --- a/patches/net/minecraft/world/item/ShovelItem.java.patch +++ b/patches/net/minecraft/world/item/ShovelItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/ShovelItem.java +++ b/net/minecraft/world/item/ShovelItem.java -@@ -43,7 +_,7 @@ +@@ -44,7 +_,7 @@ return InteractionResult.PASS; } else { Player player = p_43119_.getPlayer(); @@ -9,7 +9,7 @@ BlockState blockstate2 = null; if (blockstate1 != null && level.getBlockState(blockpos.above()).isAir()) { level.playSound(player, blockpos, SoundEvents.SHOVEL_FLATTEN, SoundSource.BLOCKS, 1.0F, 1.0F); -@@ -71,5 +_,15 @@ +@@ -72,5 +_,15 @@ return InteractionResult.PASS; } } diff --git a/patches/net/minecraft/world/item/SpawnEggItem.java.patch b/patches/net/minecraft/world/item/SpawnEggItem.java.patch index d33a715f8bd..039545cc2e3 100644 --- a/patches/net/minecraft/world/item/SpawnEggItem.java.patch +++ b/patches/net/minecraft/world/item/SpawnEggItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/SpawnEggItem.java +++ b/net/minecraft/world/item/SpawnEggItem.java -@@ -39,11 +_,14 @@ +@@ -42,11 +_,14 @@ private final int highlightColor; private final EntityType defaultType; @@ -15,7 +15,7 @@ BY_ID.put(p_43207_, this); } -@@ -135,6 +_,8 @@ +@@ -134,6 +_,8 @@ @Nullable public static SpawnEggItem byId(@Nullable EntityType p_43214_) { @@ -24,17 +24,12 @@ return BY_ID.get(p_43214_); } -@@ -146,16 +_,16 @@ - if (p_43229_ != null && p_43229_.contains("EntityTag", 10)) { - CompoundTag compoundtag = p_43229_.getCompound("EntityTag"); - if (compoundtag.contains("id", 8)) { -- return EntityType.byString(compoundtag.getString("id")).orElse(this.defaultType); -+ return EntityType.byString(compoundtag.getString("id")).orElse(this.getDefaultType()); - } - } +@@ -143,12 +_,12 @@ -- return this.defaultType; -+ return this.getDefaultType(); + public EntityType getType(ItemStack p_330335_) { + CustomData customdata = p_330335_.getOrDefault(DataComponents.ENTITY_DATA, CustomData.EMPTY); +- return !customdata.isEmpty() ? customdata.read(ENTITY_TYPE_FIELD_CODEC).result().orElse(this.defaultType) : this.defaultType; ++ return !customdata.isEmpty() ? customdata.read(ENTITY_TYPE_FIELD_CODEC).result().orElse(getDefaultType()) : getDefaultType(); } @Override @@ -44,7 +39,7 @@ } public Optional spawnOffspringFromSpawnEgg( -@@ -192,5 +_,9 @@ +@@ -179,5 +_,9 @@ } } } diff --git a/patches/net/minecraft/world/item/SwordItem.java.patch b/patches/net/minecraft/world/item/SwordItem.java.patch index 50e79886d60..85af2c98f18 100644 --- a/patches/net/minecraft/world/item/SwordItem.java.patch +++ b/patches/net/minecraft/world/item/SwordItem.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/item/SwordItem.java +++ b/net/minecraft/world/item/SwordItem.java -@@ -75,4 +_,9 @@ - public Multimap getDefaultAttributeModifiers(EquipmentSlot p_43274_) { - return p_43274_ == EquipmentSlot.MAINHAND ? this.defaultModifiers : super.getDefaultAttributeModifiers(p_43274_); +@@ -55,4 +_,9 @@ + p_43278_.hurtAndBreak(1, p_43280_, EquipmentSlot.MAINHAND); + return true; } + + @Override diff --git a/patches/net/minecraft/world/item/Tier.java.patch b/patches/net/minecraft/world/item/Tier.java.patch deleted file mode 100644 index 0babe64aa7c..00000000000 --- a/patches/net/minecraft/world/item/Tier.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/net/minecraft/world/item/Tier.java -+++ b/net/minecraft/world/item/Tier.java -@@ -9,9 +_,12 @@ - - float getAttackDamageBonus(); - -+ @Deprecated // FORGE: Use TierSortingRegistry to define which tiers are better than others - int getLevel(); - - int getEnchantmentValue(); - - Ingredient getRepairIngredient(); -+ -+ @org.jetbrains.annotations.Nullable default net.minecraft.tags.TagKey getTag() { return null; } - } diff --git a/patches/net/minecraft/world/item/Tiers.java.patch b/patches/net/minecraft/world/item/Tiers.java.patch index f6a44f5d764..48dc1da1b89 100644 --- a/patches/net/minecraft/world/item/Tiers.java.patch +++ b/patches/net/minecraft/world/item/Tiers.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/Tiers.java +++ b/net/minecraft/world/item/Tiers.java -@@ -58,4 +_,6 @@ +@@ -61,4 +_,6 @@ public Ingredient getRepairIngredient() { return this.repairIngredient.get(); } diff --git a/patches/net/minecraft/world/item/TridentItem.java.patch b/patches/net/minecraft/world/item/TridentItem.java.patch index e11c6abd628..26e3ad362f9 100644 --- a/patches/net/minecraft/world/item/TridentItem.java.patch +++ b/patches/net/minecraft/world/item/TridentItem.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/item/TridentItem.java +++ b/net/minecraft/world/item/TridentItem.java -@@ -151,4 +_,9 @@ - public int getEnchantmentValue() { - return 1; +@@ -160,4 +_,9 @@ + throwntrident.pickup = AbstractArrow.Pickup.ALLOWED; + return throwntrident; } + + @Override diff --git a/patches/net/minecraft/world/item/alchemy/PotionBrewing.java.patch b/patches/net/minecraft/world/item/alchemy/PotionBrewing.java.patch new file mode 100644 index 00000000000..9c3be6f23f3 --- /dev/null +++ b/patches/net/minecraft/world/item/alchemy/PotionBrewing.java.patch @@ -0,0 +1,102 @@ +--- a/net/minecraft/world/item/alchemy/PotionBrewing.java ++++ b/net/minecraft/world/item/alchemy/PotionBrewing.java +@@ -19,15 +_,37 @@ + private final List containers; + private final List> potionMixes; + private final List> containerMixes; ++ private final net.neoforged.neoforge.common.brewing.BrewingRecipeRegistry registry; + + PotionBrewing(List p_340915_, List> p_341164_, List> p_341170_) { ++ this(p_340915_, p_341164_, p_341170_, List.of()); ++ } ++ ++ PotionBrewing(List p_340915_, List> p_341164_, List> p_341170_, List recipes) { + this.containers = p_340915_; + this.potionMixes = p_341164_; + this.containerMixes = p_341170_; ++ this.registry = new net.neoforged.neoforge.common.brewing.BrewingRecipeRegistry(recipes); + } + + public boolean isIngredient(ItemStack p_43507_) { +- return this.isContainerIngredient(p_43507_) || this.isPotionIngredient(p_43507_); ++ return this.registry.isValidIngredient(p_43507_) || this.isContainerIngredient(p_43507_) || this.isPotionIngredient(p_43507_); ++ } ++ ++ /** ++ * Checks if an item stack is a valid input for brewing, ++ * for use in the lower 3 slots where water bottles would normally go. ++ */ ++ public boolean isInput(ItemStack stack) { ++ return this.registry.isValidInput(stack) || isContainer(stack); ++ } ++ ++ /** ++ * Retrieves recipes that use the more general interface. ++ * This does NOT include the container and potion mixes. ++ */ ++ public List getRecipes() { ++ return registry.recipes(); + } + + private boolean isContainer(ItemStack p_341168_) { +@@ -71,6 +_,7 @@ + } + + public boolean hasMix(ItemStack p_43509_, ItemStack p_43510_) { ++ if (registry.hasOutput(p_43509_, p_43510_)) return true; + return !this.isContainer(p_43509_) ? false : this.hasContainerMix(p_43509_, p_43510_) || this.hasPotionMix(p_43509_, p_43510_); + } + +@@ -103,6 +_,8 @@ + if (p_43531_.isEmpty()) { + return p_43531_; + } else { ++ var customMix = registry.getOutput(p_43531_, p_43530_); // Parameters are swapped compared to what vanilla passes! ++ if (!customMix.isEmpty()) return customMix; + Optional> optional = p_43531_.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).potion(); + if (optional.isEmpty()) { + return p_43531_; +@@ -127,6 +_,7 @@ + public static PotionBrewing bootstrap(FeatureFlagSet p_341301_) { + PotionBrewing.Builder potionbrewing$builder = new PotionBrewing.Builder(p_341301_); + addVanillaMixes(potionbrewing$builder); ++ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.brewing.RegisterBrewingRecipesEvent(potionbrewing$builder)); + return potionbrewing$builder.build(); + } + +@@ -194,6 +_,7 @@ + private final List containers = new ArrayList<>(); + private final List> potionMixes = new ArrayList<>(); + private final List> containerMixes = new ArrayList<>(); ++ private final List recipes = new ArrayList<>(); + private final FeatureFlagSet enabledFeatures; + + public Builder(FeatureFlagSet p_340975_) { +@@ -237,8 +_,26 @@ + } + } + ++ /** ++ * Adds a new simple brewing recipe. ++ * ++ * @param input the ingredient that goes in the same slot as water bottles would ++ * @param ingredient the ingredient that goes in the same slot as nether wart would ++ * @param output the item stack that will replace the input once brewing is done ++ */ ++ public void addRecipe(Ingredient input, Ingredient ingredient, ItemStack output) { ++ addRecipe(new net.neoforged.neoforge.common.brewing.BrewingRecipe(input, ingredient, output)); ++ } ++ ++ /** ++ * Adds a new brewing recipe with custom logic. ++ */ ++ public void addRecipe(net.neoforged.neoforge.common.brewing.IBrewingRecipe recipe) { ++ this.recipes.add(recipe); ++ } ++ + public PotionBrewing build() { +- return new PotionBrewing(List.copyOf(this.containers), List.copyOf(this.potionMixes), List.copyOf(this.containerMixes)); ++ return new PotionBrewing(List.copyOf(this.containers), List.copyOf(this.potionMixes), List.copyOf(this.containerMixes), List.copyOf(this.recipes)); + } + } + diff --git a/patches/net/minecraft/world/item/component/FireworkExplosion.java.patch b/patches/net/minecraft/world/item/component/FireworkExplosion.java.patch new file mode 100644 index 00000000000..da064b016e2 --- /dev/null +++ b/patches/net/minecraft/world/item/component/FireworkExplosion.java.patch @@ -0,0 +1,40 @@ +--- a/net/minecraft/world/item/component/FireworkExplosion.java ++++ b/net/minecraft/world/item/component/FireworkExplosion.java +@@ -107,7 +_,7 @@ + return new FireworkExplosion(this.shape, this.colors, new IntArrayList(p_330678_), this.hasTrail, this.hasTwinkle); + } + +- public static enum Shape implements StringRepresentable { ++ public static enum Shape implements StringRepresentable, net.neoforged.neoforge.common.IExtensibleEnum { + SMALL_BALL(0, "small_ball"), + LARGE_BALL(1, "large_ball"), + STAR(2, "star"), +@@ -117,8 +_,8 @@ + private static final IntFunction BY_ID = ByIdMap.continuous( + FireworkExplosion.Shape::getId, values(), ByIdMap.OutOfBoundsStrategy.ZERO + ); +- public static final StreamCodec STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, FireworkExplosion.Shape::getId); +- public static final Codec CODEC = StringRepresentable.fromValues(FireworkExplosion.Shape::values); ++ public static final StreamCodec STREAM_CODEC = net.neoforged.neoforge.common.IExtensibleEnum.createStreamCodecForExtensibleEnum(Shape::values); ++ public static final Codec CODEC = net.neoforged.neoforge.common.IExtensibleEnum.createCodecForExtensibleEnum(Shape::values, Shape::getShape); + private final int id; + private final String name; + +@@ -137,6 +_,17 @@ + + public static FireworkExplosion.Shape byId(int p_330838_) { + return BY_ID.apply(p_330838_); ++ } ++ ++ public static FireworkExplosion.Shape getShape(String name) { ++ for (Shape ret : values()) ++ if (ret.name().equals(name)) ++ return ret; ++ return SMALL_BALL; ++ } ++ ++ public static Shape create(String registryName, int id, String shapeName) { ++ throw new IllegalStateException("Enum not extended"); + } + + @Override diff --git a/patches/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java.patch b/patches/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java.patch index 58770c3a126..ba676d13aee 100644 --- a/patches/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java.patch +++ b/patches/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java +++ b/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java -@@ -79,8 +_,8 @@ - for(int i = 0; i < nonnulllist.size(); ++i) { +@@ -80,8 +_,8 @@ + for (int i = 0; i < nonnulllist.size(); i++) { ItemStack itemstack = p_43791_.getItem(i); if (!itemstack.isEmpty()) { - if (itemstack.getItem().hasCraftingRemainingItem()) { - nonnulllist.set(i, new ItemStack(itemstack.getItem().getCraftingRemainingItem())); + if (itemstack.hasCraftingRemainingItem()) { + nonnulllist.set(i, itemstack.getCraftingRemainingItem()); - } else if (itemstack.hasTag() && BannerBlockEntity.getPatternCount(itemstack) > 0) { + } else if (!itemstack.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY).layers().isEmpty()) { nonnulllist.set(i, itemstack.copyWithCount(1)); } diff --git a/patches/net/minecraft/world/item/crafting/BookCloningRecipe.java.patch b/patches/net/minecraft/world/item/crafting/BookCloningRecipe.java.patch index cecf8743663..8644f5f5839 100644 --- a/patches/net/minecraft/world/item/crafting/BookCloningRecipe.java.patch +++ b/patches/net/minecraft/world/item/crafting/BookCloningRecipe.java.patch @@ -1,16 +1,8 @@ --- a/net/minecraft/world/item/crafting/BookCloningRecipe.java +++ b/net/minecraft/world/item/crafting/BookCloningRecipe.java -@@ -68,6 +_,7 @@ - CompoundTag compoundtag = itemstack.getTag().copy(); - compoundtag.putInt("generation", WrittenBookItem.getGeneration(itemstack) + 1); - itemstack2.setTag(compoundtag); -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyStackAttachments(itemstack, itemstack2); - return itemstack2; - } else { - return ItemStack.EMPTY; -@@ -79,8 +_,8 @@ +@@ -84,8 +_,8 @@ - for(int i = 0; i < nonnulllist.size(); ++i) { + for (int i = 0; i < nonnulllist.size(); i++) { ItemStack itemstack = p_43820_.getItem(i); - if (itemstack.getItem().hasCraftingRemainingItem()) { - nonnulllist.set(i, new ItemStack(itemstack.getItem().getCraftingRemainingItem())); diff --git a/patches/net/minecraft/world/item/crafting/FireworkStarRecipe.java.patch b/patches/net/minecraft/world/item/crafting/FireworkStarRecipe.java.patch deleted file mode 100644 index 564e8dd3d66..00000000000 --- a/patches/net/minecraft/world/item/crafting/FireworkStarRecipe.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/item/crafting/FireworkStarRecipe.java -+++ b/net/minecraft/world/item/crafting/FireworkStarRecipe.java -@@ -118,7 +_,7 @@ - } - - compoundtag.putIntArray("Colors", list); -- compoundtag.putByte("Type", (byte)fireworkrocketitem$shape.getId()); -+ fireworkrocketitem$shape.save(compoundtag); - return itemstack; - } - diff --git a/patches/net/minecraft/world/item/crafting/Ingredient.java.patch b/patches/net/minecraft/world/item/crafting/Ingredient.java.patch index fce09774867..bdf88358c48 100644 --- a/patches/net/minecraft/world/item/crafting/Ingredient.java.patch +++ b/patches/net/minecraft/world/item/crafting/Ingredient.java.patch @@ -1,192 +1,221 @@ --- a/net/minecraft/world/item/crafting/Ingredient.java +++ b/net/minecraft/world/item/crafting/Ingredient.java -@@ -34,15 +_,36 @@ +@@ -29,15 +_,54 @@ + + public final class Ingredient implements Predicate { + public static final Ingredient EMPTY = new Ingredient(Stream.empty()); +- public static final StreamCodec CONTENTS_STREAM_CODEC = ItemStack.LIST_STREAM_CODEC +- .map(p_319730_ -> fromValues(p_319730_.stream().map(Ingredient.ItemValue::new)), p_319731_ -> Arrays.asList(p_319731_.getItems())); ++ public static final StreamCodec CONTENTS_STREAM_CODEC = new StreamCodec<>() { ++ private static final StreamCodec CUSTOM_INGREDIENT_CODEC = net.minecraft.network.codec.ByteBufCodecs.registry(net.neoforged.neoforge.registries.NeoForgeRegistries.Keys.INGREDIENT_TYPES) ++ .dispatch(c -> c.getType(), t -> t.streamCodec()); ++ ++ @Override ++ public void encode(RegistryFriendlyByteBuf buf, Ingredient ingredient) { ++ if (ingredient.isSimple()) { ++ ItemStack.LIST_STREAM_CODEC.encode(buf, Arrays.asList(ingredient.getItems())); ++ } else { ++ buf.writeVarInt(-1); ++ CUSTOM_INGREDIENT_CODEC.encode(buf, ingredient.customIngredient); ++ } ++ } ++ ++ @Override ++ public Ingredient decode(RegistryFriendlyByteBuf buf) { ++ var size = buf.readVarInt(); ++ if (size == -1) { ++ return new Ingredient(CUSTOM_INGREDIENT_CODEC.decode(buf)); ++ } ++ return fromValues(Stream.generate(() -> ItemStack.STREAM_CODEC.decode(buf)).limit(size).map(Ingredient.ItemValue::new)); ++ } ++ }; + private final Ingredient.Value[] values; + @Nullable private ItemStack[] itemStacks; @Nullable private IntList stackingIds; - public static final Codec CODEC = codec(true); - public static final Codec CODEC_NONEMPTY = codec(false); -+ private final java.util.function.Supplier> type; -+ @Nullable private Boolean areAllStacksEmpty; ++ @Nullable ++ private net.neoforged.neoforge.common.crafting.ICustomIngredient customIngredient = null; + -+ public static final Codec VANILLA_CODEC = codec(true); -+ public static final Codec VANILLA_CODEC_NONEMPTY = codec(false); -+ public static final Codec CODEC = net.neoforged.neoforge.common.crafting.CraftingHelper.makeIngredientCodec(true, VANILLA_CODEC); -+ public static final Codec CODEC_NONEMPTY = net.neoforged.neoforge.common.crafting.CraftingHelper.makeIngredientCodec(false, VANILLA_CODEC_NONEMPTY); -+ public static final Codec> LIST_CODEC = CODEC.listOf(); -+ public static final Codec> LIST_CODEC_NONEMPTY = CODEC_NONEMPTY.listOf(); ++ /** ++ * This codec allows both the {@code {...}} and {@code [{...}, {...}, ...]} syntax. ++ * {@code []} is allowed for empty ingredients, and will only match empty stacks. ++ */ ++ public static final Codec CODEC = net.neoforged.neoforge.common.crafting.CraftingHelper.makeIngredientCodec(true); ++ /** ++ * Same as {@link #CODEC} except that empty ingredients ({@code []}) are not allowed. ++ */ ++ public static final Codec CODEC_NONEMPTY = net.neoforged.neoforge.common.crafting.CraftingHelper.makeIngredientCodec(false); ++ /** ++ * This is a codec that only allows the {@code {...}} syntax. ++ * Array ingredients are serialized using the CompoundIngredient custom ingredient type: ++ * {@code { "type": "neoforge:compound", "ingredients": [{...}, {...}, ...] }}. ++ */ ++ public static final com.mojang.serialization.MapCodec MAP_CODEC_NONEMPTY = net.neoforged.neoforge.common.crafting.CraftingHelper.makeIngredientMapCodec(); ++ public static final Codec> LIST_CODEC = MAP_CODEC_NONEMPTY.codec().listOf(); ++ public static final Codec> LIST_CODEC_NONEMPTY = LIST_CODEC.validate(list -> list.isEmpty() ? DataResult.error(() -> "Item array cannot be empty, at least one item must be defined") : DataResult.success(list)); - protected Ingredient(Stream p_43907_) { -- this.values = p_43907_.toArray(p_43933_ -> new Ingredient.Value[p_43933_]); -+ this(p_43907_, net.neoforged.neoforge.common.NeoForgeMod.VANILLA_INGREDIENT_TYPE); + private Ingredient(Stream p_43907_) { + this.values = p_43907_.toArray(Ingredient.Value[]::new); +@@ -47,9 +_,20 @@ + this.values = p_301044_; } - private Ingredient(Ingredient.Value[] p_301044_) { -+ this(p_301044_, net.neoforged.neoforge.common.NeoForgeMod.VANILLA_INGREDIENT_TYPE); -+ } -+ -+ protected Ingredient(Stream p_43907_, java.util.function.Supplier> type) { -+ this.values = p_43907_.toArray(Value[]::new); -+ this.type = type; -+ } -+ -+ private Ingredient(Ingredient.Value[] p_301044_, java.util.function.Supplier> type) { - this.values = p_301044_; -+ this.type = type; ++ public Ingredient(net.neoforged.neoforge.common.crafting.ICustomIngredient customIngredient) { ++ this(new Value[0]); ++ this.customIngredient = customIngredient; + } + -+ public net.neoforged.neoforge.common.crafting.IngredientType getType() { -+ return type.get(); - } - public ItemStack[] getItems() { -@@ -63,7 +_,7 @@ + if (this.itemStacks == null) { ++ if (this.customIngredient != null) { ++ this.itemStacks = this.customIngredient.getItems() ++ .distinct()//Mimic vanilla that calls distinct on the stacks ++ .toArray(ItemStack[]::new); ++ } else { + this.itemStacks = Arrays.stream(this.values).flatMap(p_43916_ -> p_43916_.getItems().stream()).distinct().toArray(ItemStack[]::new); ++ } + } + + return this.itemStacks; +@@ -58,6 +_,8 @@ + public boolean test(@Nullable ItemStack p_43914_) { + if (p_43914_ == null) { + return false; ++ } else if (this.customIngredient != null) { ++ return this.customIngredient.test(p_43914_); + } else if (this.isEmpty()) { return p_43914_.isEmpty(); } else { - for(ItemStack itemstack : this.getItems()) { -- if (itemstack.is(p_43914_.getItem())) { -+ if (areStacksEqual(itemstack, p_43914_)) { - return true; - } - } -@@ -72,6 +_,10 @@ - } +@@ -86,13 +_,65 @@ + return this.stackingIds; } -+ protected boolean areStacksEqual(ItemStack left, ItemStack right) { -+ return left.is(right.getItem()); ++ /** ++ * Returns {@code true} if this ingredient is explicitly chosen to be empty, i.e. using {@code []}. ++ */ + public boolean isEmpty() { +- return this.values.length == 0; ++ return this.values.length == 0 && !isCustom(); + } + - public IntList getStackingIds() { - if (this.stackingIds == null) { - ItemStack[] aitemstack = this.getItems(); -@@ -88,11 +_,39 @@ ++ /** ++ * Returns {@code true} if this ingredient has an empty stack list. ++ * Unlike {@link #isEmpty()}, this will catch "accidentally empty" ingredients, ++ * for example a tag ingredient that has an empty tag. ++ */ ++ public boolean hasNoItems() { ++ ItemStack[] items = getItems(); ++ if (items.length == 0) ++ return true; ++ if (items.length == 1) { ++ // If we potentially added a barrier due to the ingredient being an empty tag, try and check if it is the stack we added ++ ItemStack item = items[0]; ++ return item.getItem() == net.minecraft.world.item.Items.BARRIER && item.getHoverName() instanceof net.minecraft.network.chat.MutableComponent hoverName && hoverName.getString().startsWith("Empty Tag: "); ++ } ++ return false; } - public final void toNetwork(FriendlyByteBuf p_43924_) { -- p_43924_.writeCollection(Arrays.asList(this.getItems()), FriendlyByteBuf::writeItem); -+ if (synchronizeWithContents()) { -+ p_43924_.writeCollection(Arrays.asList(this.getItems()), FriendlyByteBuf::writeItem); -+ } -+ else { -+ p_43924_.writeVarInt(-1); -+ p_43924_.writeWithCodec(net.minecraft.nbt.NbtOps.INSTANCE, CODEC, this); + @Override + public boolean equals(Object p_301003_) { +- return p_301003_ instanceof Ingredient ingredient ? Arrays.equals((Object[])this.values, (Object[])ingredient.values) : false; ++ return p_301003_ instanceof Ingredient ingredient ? java.util.Objects.equals(this.customIngredient, ingredient.customIngredient) && Arrays.equals((Object[])this.values, (Object[])ingredient.values) : false; ++ } ++ ++ @Override ++ public int hashCode() { ++ if (this.customIngredient != null) { ++ return this.customIngredient.hashCode(); + } ++ return Arrays.hashCode(this.values); + } + + /** -+ * {@return if {@code true}, this ingredient will be synchronized using its contents, as in vanilla, otherwise it will be synchronized via the {@link #codec(boolean) codec}} ++ * Retrieves the underlying values of this ingredient. ++ * If this is a {@linkplain #isCustom custom ingredient}, an exception is thrown. + */ -+ public boolean synchronizeWithContents() { -+ return true; ++ public Value[] getValues() { ++ if (isCustom()) { ++ throw new IllegalStateException("Cannot retrieve values from custom ingredient!"); ++ } ++ return this.values; + } + -+ private boolean areAllStacksEmpty() { -+ Boolean empty = this.areAllStacksEmpty; -+ if (empty == null) { -+ boolean allEmpty = true; -+ for (ItemStack stack : this.getItems()) { -+ if (!stack.isEmpty()) { -+ allEmpty = false; -+ break; -+ } -+ } -+ this.areAllStacksEmpty = empty = allEmpty; -+ } -+ return empty; - } - - public boolean isEmpty() { -- return this.values.length == 0; -+ return this.values.length == 0 || this.areAllStacksEmpty(); - } - - @Override -@@ -100,6 +_,10 @@ - return p_301003_ instanceof Ingredient ingredient ? Arrays.equals((Object[])this.values, (Object[])ingredient.values) : false; - } - + public boolean isSimple() { -+ return true; ++ return this.customIngredient == null || this.customIngredient.isSimple(); + } + - public static Ingredient fromValues(Stream p_43939_) { - Ingredient ingredient = new Ingredient(p_43939_); - return ingredient.isEmpty() ? EMPTY : ingredient; -@@ -125,11 +_,21 @@ - return fromValues(Stream.of(new Ingredient.TagValue(p_204133_))); - } - -+ public static Ingredient fromJson(com.google.gson.JsonElement element, boolean nonEmpty) { -+ Codec codec = nonEmpty ? CODEC : CODEC_NONEMPTY; -+ return net.minecraft.Util.getOrThrow(codec.parse(com.mojang.serialization.JsonOps.INSTANCE, element), IllegalStateException::new); ++ @Nullable ++ public net.neoforged.neoforge.common.crafting.ICustomIngredient getCustomIngredient() { ++ return this.customIngredient; + } + - public static Ingredient fromNetwork(FriendlyByteBuf p_43941_) { -- return fromValues(p_43941_.readList(FriendlyByteBuf::readItem).stream().map(Ingredient.ItemValue::new)); -+ var size = p_43941_.readVarInt(); -+ if (size == -1) { -+ return p_43941_.readWithCodecTrusted(net.minecraft.nbt.NbtOps.INSTANCE, CODEC); -+ } -+ return new Ingredient(Stream.generate(() -> new Ingredient.ItemValue(p_43941_.readItem())).limit(size)); ++ public boolean isCustom() { ++ return this.customIngredient != null; } + public static Ingredient fromValues(Stream p_43939_) { +@@ -120,6 +_,7 @@ + return fromValues(Stream.of(new Ingredient.TagValue(p_204133_))); + } + ++ @Deprecated // Neo: We take over the codec creation entirely to support custom ingredients - see CraftingHelper private static Codec codec(boolean p_301074_) { -+ //PATCH: 1.20.2: Wrap in dispatch codec with fallback. Codec codec = Codec.list(Ingredient.Value.CODEC) .comapFlatMap( - p_300810_ -> !p_301074_ && p_300810_.size() < 1 -@@ -152,7 +_,11 @@ - ); +@@ -144,10 +_,11 @@ } -- public static record ItemValue(ItemStack item) implements Ingredient.Value { -+ public static record ItemValue(ItemStack item, java.util.function.BiFunction comparator) implements Ingredient.Value { -+ public ItemValue(ItemStack item) { -+ this(item, ItemValue::areStacksEqual); -+ } -+ - static final Codec CODEC = RecordCodecBuilder.create( - p_311727_ -> p_311727_.group(ItemStack.SINGLE_ITEM_CODEC.fieldOf("item").forGetter(p_300919_ -> p_300919_.item)) - .apply(p_311727_, Ingredient.ItemValue::new) -@@ -164,7 +_,7 @@ - return false; - } else { - Ingredient.ItemValue ingredient$itemvalue = (Ingredient.ItemValue)p_301316_; -- return ingredient$itemvalue.item.getItem().equals(this.item.getItem()) && ingredient$itemvalue.item.getCount() == this.item.getCount(); -+ return comparator().apply(item(), ingredient$itemvalue.item()); - } - } + public static record ItemValue(ItemStack item) implements Ingredient.Value { +- static final Codec CODEC = RecordCodecBuilder.create( ++ static final com.mojang.serialization.MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec( + p_330109_ -> p_330109_.group(ItemStack.SIMPLE_ITEM_CODEC.fieldOf("item").forGetter(p_300919_ -> p_300919_.item)) + .apply(p_330109_, Ingredient.ItemValue::new) + ); ++ static final Codec CODEC = MAP_CODEC.codec(); -@@ -172,6 +_,11 @@ - public Collection getItems() { - return Collections.singleton(this.item); - } -+ -+ private static boolean areStacksEqual(ItemStack left, ItemStack right) { -+ return left.getItem().equals(right.getItem()) -+ && left.getCount() == right.getCount(); -+ } + @Override + public boolean equals(Object p_301316_) { +@@ -163,10 +_,11 @@ } public static record TagValue(TagKey tag) implements Ingredient.Value { -@@ -193,6 +_,9 @@ +- static final Codec CODEC = RecordCodecBuilder.create( ++ static final com.mojang.serialization.MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec( + p_301118_ -> p_301118_.group(TagKey.codec(Registries.ITEM).fieldOf("tag").forGetter(p_301154_ -> p_301154_.tag)) + .apply(p_301118_, Ingredient.TagValue::new) + ); ++ static final Codec CODEC = MAP_CODEC.codec(); + + @Override + public boolean equals(Object p_301162_) { +@@ -181,12 +_,18 @@ list.add(new ItemStack(holder)); } -+ if (list.size() == 0) { -+ list.add(new ItemStack(net.minecraft.world.level.block.Blocks.BARRIER).setHoverName(net.minecraft.network.chat.Component.literal("Empty Tag: " + this.tag.location()))); ++ if (list.isEmpty()) { ++ net.minecraft.world.item.ItemStack itemStack = new net.minecraft.world.item.ItemStack(net.minecraft.world.level.block.Blocks.BARRIER); ++ itemStack.set(net.minecraft.core.component.DataComponents.CUSTOM_NAME, net.minecraft.network.chat.Component.literal("Empty Tag: " + this.tag.location())); ++ list.add(itemStack); + } return list; } } -@@ -210,5 +_,9 @@ + ++ // Neo: Do not extend this interface. For custom ingredient behaviors see ICustomIngredient. + public interface Value { +- Codec CODEC = Codec.xor(Ingredient.ItemValue.CODEC, Ingredient.TagValue.CODEC) ++ com.mojang.serialization.MapCodec MAP_CODEC = net.neoforged.neoforge.common.util.NeoForgeExtraCodecs.xor(Ingredient.ItemValue.MAP_CODEC, Ingredient.TagValue.MAP_CODEC) + .xmap(p_300956_ -> p_300956_.map(p_300932_ -> p_300932_, p_301313_ -> p_301313_), p_301304_ -> { + if (p_301304_ instanceof Ingredient.TagValue ingredient$tagvalue) { + return Either.right(ingredient$tagvalue); +@@ -196,6 +_,7 @@ + throw new UnsupportedOperationException("This is neither an item value nor a tag value."); + } }); ++ Codec CODEC = MAP_CODEC.codec(); Collection getItems(); -+ } -+ -+ public final Value[] getValues() { -+ return values; } - } diff --git a/patches/net/minecraft/world/item/crafting/Recipe.java.patch b/patches/net/minecraft/world/item/crafting/Recipe.java.patch index 47417181852..a0782ea1c03 100644 --- a/patches/net/minecraft/world/item/crafting/Recipe.java.patch +++ b/patches/net/minecraft/world/item/crafting/Recipe.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/world/item/crafting/Recipe.java +++ b/net/minecraft/world/item/crafting/Recipe.java -@@ -12,6 +_,7 @@ +@@ -16,6 +_,7 @@ public interface Recipe { Codec> CODEC = BuiltInRegistries.RECIPE_SERIALIZER.byNameCodec().dispatch(Recipe::getSerializer, RecipeSerializer::codec); + Codec>>> CONDITIONAL_CODEC = net.neoforged.neoforge.common.conditions.ConditionalOps.createConditionalCodecWithConditions(CODEC); + StreamCodec> STREAM_CODEC = ByteBufCodecs.registry(Registries.RECIPE_SERIALIZER) + .dispatch(Recipe::getSerializer, RecipeSerializer::streamCodec); - boolean matches(C p_44002_, Level p_44003_); - -@@ -25,9 +_,9 @@ +@@ -31,9 +_,9 @@ NonNullList nonnulllist = NonNullList.withSize(p_44004_.getContainerSize(), ItemStack.EMPTY); - for(int i = 0; i < nonnulllist.size(); ++i) { + for (int i = 0; i < nonnulllist.size(); i++) { - Item item = p_44004_.getItem(i).getItem(); + ItemStack item = p_44004_.getItem(i); if (item.hasCraftingRemainingItem()) { @@ -20,11 +20,11 @@ } } -@@ -60,6 +_,6 @@ +@@ -66,6 +_,6 @@ default boolean isIncomplete() { NonNullList nonnulllist = this.getIngredients(); - return nonnulllist.isEmpty() || nonnulllist.stream().anyMatch(p_151268_ -> p_151268_.getItems().length == 0); -+ return nonnulllist.isEmpty() || nonnulllist.stream().anyMatch(net.neoforged.neoforge.common.CommonHooks::hasNoElements); ++ return nonnulllist.isEmpty() || nonnulllist.stream().anyMatch(Ingredient::hasNoItems); } } diff --git a/patches/net/minecraft/world/item/crafting/RecipeManager.java.patch b/patches/net/minecraft/world/item/crafting/RecipeManager.java.patch index 3ce8a30d40f..c4f01d12d03 100644 --- a/patches/net/minecraft/world/item/crafting/RecipeManager.java.patch +++ b/patches/net/minecraft/world/item/crafting/RecipeManager.java.patch @@ -1,47 +1,27 @@ --- a/net/minecraft/world/item/crafting/RecipeManager.java +++ b/net/minecraft/world/item/crafting/RecipeManager.java -@@ -45,17 +_,23 @@ - } - - protected void apply(Map p_44037_, ResourceManager p_44038_, ProfilerFiller p_44039_) { -+ var ops = this.makeConditionalOps(); +@@ -50,16 +_,22 @@ this.hasErrors = false; - Map, Builder>> map = Maps.newHashMap(); - Builder> builder = ImmutableMap.builder(); + Builder, RecipeHolder> builder = ImmutableMultimap.builder(); + com.google.common.collect.ImmutableMap.Builder> builder1 = ImmutableMap.builder(); +- RegistryOps registryops = this.registries.createSerializationContext(JsonOps.INSTANCE); ++ RegistryOps registryops = this.makeConditionalOps(); // Neo: add condition context - for(Entry entry : p_44037_.entrySet()) { + for (Entry entry : p_44037_.entrySet()) { ResourceLocation resourcelocation = entry.getKey(); + if (resourcelocation.getPath().startsWith("_")) continue; //Forge: filter anything beginning with "_" as it's used for metadata. try { -- RecipeHolder recipeholder = fromJson(resourcelocation, GsonHelper.convertToJsonObject(entry.getValue(), "top element")); -- map.computeIfAbsent(recipeholder.value().getType(), p_44075_ -> ImmutableMap.builder()).put(resourcelocation, recipeholder); -- builder.put(resourcelocation, recipeholder); -+ Optional> recipeHolderOptional = fromJson(resourcelocation, GsonHelper.convertToJsonObject(entry.getValue(), "top element"), ops); -+ recipeHolderOptional.ifPresentOrElse(recipeholder -> { -+ map.computeIfAbsent(recipeholder.value().getType(), p_44075_ -> ImmutableMap.builder()).put(resourcelocation, recipeholder); -+ builder.put(resourcelocation, recipeholder); +- Recipe recipe = Recipe.CODEC.parse(registryops, entry.getValue()).getOrThrow(JsonParseException::new); ++ var decoded = Recipe.CONDITIONAL_CODEC.parse(registryops, entry.getValue()).getOrThrow(JsonParseException::new); ++ decoded.ifPresentOrElse(r -> { ++ Recipe recipe = r.carrier(); + RecipeHolder recipeholder = new RecipeHolder<>(resourcelocation, recipe); + builder.put(recipe.getType(), recipeholder); + builder1.put(resourcelocation, recipeholder); + }, () -> { -+ LOGGER.debug("Skipping loading recipe {} as it's conditions were not met", resourcelocation); ++ LOGGER.debug("Skipping loading recipe {} as its conditions were not met", resourcelocation); + }); } catch (IllegalArgumentException | JsonParseException jsonparseexception) { LOGGER.error("Parsing error loading recipe {}", resourcelocation, jsonparseexception); } -@@ -136,9 +_,15 @@ - return this.recipes.values().stream().flatMap(p_220258_ -> p_220258_.keySet().stream()); - } - -+ /** @deprecated Forge: use {@linkplain #fromJson(ResourceLocation, JsonObject, com.mojang.serialization.DynamicOps) overload with context}. */ -+ @Deprecated - protected static RecipeHolder fromJson(ResourceLocation p_44046_, JsonObject p_44047_) { -- Recipe recipe = Util.getOrThrow(Recipe.CODEC.parse(JsonOps.INSTANCE, p_44047_), JsonParseException::new); -- return new RecipeHolder<>(p_44046_, recipe); -+ return fromJson(p_44046_, p_44047_, JsonOps.INSTANCE).orElseThrow(); -+ } -+ -+ public static Optional> fromJson(ResourceLocation p_44046_, JsonObject p_44047_, com.mojang.serialization.DynamicOps jsonElementOps) { -+ Optional> recipe = net.neoforged.neoforge.common.conditions.ICondition.getWithWithConditionsCodec(Recipe.CONDITIONAL_CODEC, jsonElementOps, p_44047_); -+ return recipe.map(r -> new RecipeHolder<>(p_44046_, r)); - } - - public void replaceRecipes(Iterable> p_44025_) { diff --git a/patches/net/minecraft/world/item/crafting/RepairItemRecipe.java.patch b/patches/net/minecraft/world/item/crafting/RepairItemRecipe.java.patch index 6141870ee8a..74b99612022 100644 --- a/patches/net/minecraft/world/item/crafting/RepairItemRecipe.java.patch +++ b/patches/net/minecraft/world/item/crafting/RepairItemRecipe.java.patch @@ -1,38 +1,13 @@ --- a/net/minecraft/world/item/crafting/RepairItemRecipe.java +++ b/net/minecraft/world/item/crafting/RepairItemRecipe.java -@@ -27,7 +_,7 @@ - list.add(itemstack); - if (list.size() > 1) { - ItemStack itemstack1 = list.get(0); -- if (!itemstack.is(itemstack1.getItem()) || itemstack1.getCount() != 1 || itemstack.getCount() != 1 || !itemstack1.getItem().canBeDepleted() -+ if (!itemstack.is(itemstack1.getItem()) || itemstack1.getCount() != 1 || itemstack.getCount() != 1 || !itemstack1.isRepairable() - ) - { - return false; -@@ -48,7 +_,7 @@ - list.add(itemstack); - if (list.size() > 1) { - ItemStack itemstack1 = list.get(0); -- if (!itemstack.is(itemstack1.getItem()) || itemstack1.getCount() != 1 || itemstack.getCount() != 1 || !itemstack1.getItem().canBeDepleted() -+ if (!itemstack.is(itemstack1.getItem()) || itemstack1.getCount() != 1 || itemstack.getCount() != 1 || !itemstack1.isRepairable() - ) - { - return ItemStack.EMPTY; -@@ -60,12 +_,12 @@ - if (list.size() == 2) { - ItemStack itemstack3 = list.get(0); - ItemStack itemstack4 = list.get(1); -- if (itemstack3.is(itemstack4.getItem()) && itemstack3.getCount() == 1 && itemstack4.getCount() == 1 && itemstack3.getItem().canBeDepleted()) { -+ if (itemstack3.is(itemstack4.getItem()) && itemstack3.getCount() == 1 && itemstack4.getCount() == 1 && itemstack3.isRepairable()) { - Item item = itemstack3.getItem(); -- int j = item.getMaxDamage() - itemstack3.getDamageValue(); -- int k = item.getMaxDamage() - itemstack4.getDamageValue(); -- int l = j + k + item.getMaxDamage() * 5 / 100; -- int i1 = item.getMaxDamage() - l; -+ int j = itemstack3.getMaxDamage() - itemstack3.getDamageValue(); -+ int k = itemstack3.getMaxDamage() - itemstack4.getDamageValue(); -+ int l = j + k + itemstack3.getMaxDamage() * 5 / 100; -+ int i1 = itemstack3.getMaxDamage() - l; - if (i1 < 0) { - i1 = 0; - } +@@ -48,7 +_,9 @@ + && p_336139_.has(DataComponents.MAX_DAMAGE) + && p_335795_.has(DataComponents.MAX_DAMAGE) + && p_336139_.has(DataComponents.DAMAGE) +- && p_335795_.has(DataComponents.DAMAGE); ++ && p_335795_.has(DataComponents.DAMAGE) ++ && p_336139_.isRepairable() ++ && p_335795_.isRepairable(); + } + + public boolean matches(CraftingContainer p_44138_, Level p_44139_) { diff --git a/patches/net/minecraft/world/item/crafting/ShapedRecipe.java.patch b/patches/net/minecraft/world/item/crafting/ShapedRecipe.java.patch index 398aa6f4458..87b636751b7 100644 --- a/patches/net/minecraft/world/item/crafting/ShapedRecipe.java.patch +++ b/patches/net/minecraft/world/item/crafting/ShapedRecipe.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/crafting/ShapedRecipe.java +++ b/net/minecraft/world/item/crafting/ShapedRecipe.java -@@ -11,7 +_,7 @@ +@@ -12,7 +_,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -9,34 +9,12 @@ final ShapedRecipePattern pattern; final ItemStack result; final String group; -@@ -41,11 +_,21 @@ - } - - @Override -+ public int getRecipeWidth() { -+ return getWidth(); -+ } -+ -+ @Override - public CraftingBookCategory category() { - return this.category; - } - - @Override -+ public int getRecipeHeight() { -+ return getHeight(); -+ } -+ -+ @Override - public ItemStack getResultItem(RegistryAccess p_266881_) { - return this.result; - } -@@ -84,7 +_,7 @@ +@@ -85,7 +_,7 @@ @Override public boolean isIncomplete() { NonNullList nonnulllist = this.getIngredients(); - return nonnulllist.isEmpty() || nonnulllist.stream().filter(p_151277_ -> !p_151277_.isEmpty()).anyMatch(p_151273_ -> p_151273_.getItems().length == 0); -+ return nonnulllist.isEmpty() || nonnulllist.stream().filter(p_151277_ -> !p_151277_.isEmpty()).anyMatch(net.neoforged.neoforge.common.CommonHooks::hasNoElements); ++ return nonnulllist.isEmpty() || nonnulllist.stream().filter(p_151277_ -> !p_151277_.isEmpty()).anyMatch(Ingredient::hasNoItems); } public static class Serializer implements RecipeSerializer { diff --git a/patches/net/minecraft/world/item/crafting/ShapedRecipePattern.java.patch b/patches/net/minecraft/world/item/crafting/ShapedRecipePattern.java.patch index 337ed943561..d85beee4b82 100644 --- a/patches/net/minecraft/world/item/crafting/ShapedRecipePattern.java.patch +++ b/patches/net/minecraft/world/item/crafting/ShapedRecipePattern.java.patch @@ -31,7 +31,7 @@ public static final MapCodec MAP_CODEC = ShapedRecipePattern.Data.MAP_CODEC .flatXmap( ShapedRecipePattern::unpack, -@@ -176,16 +_,16 @@ +@@ -179,16 +_,16 @@ public static record Data(Map key, List pattern) { private static final Codec> PATTERN_CODEC = Codec.STRING.listOf().comapFlatMap(p_312085_ -> { @@ -44,7 +44,7 @@ } else { int i = p_312085_.get(0).length(); - for(String s : p_312085_) { + for (String s : p_312085_) { - if (s.length() > 3) { - return DataResult.error(() -> "Invalid pattern: too many columns, 3 is maximum"); + if (s.length() > maxWidth) { diff --git a/patches/net/minecraft/world/item/crafting/ShapelessRecipe.java.patch b/patches/net/minecraft/world/item/crafting/ShapelessRecipe.java.patch index 36f0d04589d..715c305c8ff 100644 --- a/patches/net/minecraft/world/item/crafting/ShapelessRecipe.java.patch +++ b/patches/net/minecraft/world/item/crafting/ShapelessRecipe.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/crafting/ShapelessRecipe.java +++ b/net/minecraft/world/item/crafting/ShapelessRecipe.java -@@ -19,12 +_,14 @@ +@@ -20,12 +_,14 @@ final CraftingBookCategory category; final ItemStack result; final NonNullList ingredients; @@ -15,17 +15,17 @@ } @Override -@@ -54,17 +_,20 @@ +@@ -55,17 +_,20 @@ public boolean matches(CraftingContainer p_44262_, Level p_44263_) { StackedContents stackedcontents = new StackedContents(); + java.util.List inputs = new java.util.ArrayList<>(); int i = 0; - for(int j = 0; j < p_44262_.getContainerSize(); ++j) { + for (int j = 0; j < p_44262_.getContainerSize(); j++) { ItemStack itemstack = p_44262_.getItem(j); if (!itemstack.isEmpty()) { - ++i; + i++; + if (isSimple) stackedcontents.accountStack(itemstack, 1); + else inputs.add(itemstack); @@ -36,24 +36,13 @@ + return i == this.ingredients.size() && (isSimple ? stackedcontents.canCraft(this, null) : net.neoforged.neoforge.common.util.RecipeMatcher.findMatches(inputs, this.ingredients) != null); } - public ItemStack assemble(CraftingContainer p_44260_, RegistryAccess p_266797_) { -@@ -77,6 +_,7 @@ - } - - public static class Serializer implements RecipeSerializer { -+ private static final net.minecraft.resources.ResourceLocation NAME = new net.minecraft.resources.ResourceLocation("minecraft", "crafting_shapeless"); - private static final Codec CODEC = RecordCodecBuilder.create( - p_311734_ -> p_311734_.group( - ExtraCodecs.strictOptionalField(Codec.STRING, "group", "").forGetter(p_301127_ -> p_301127_.group), -@@ -87,14 +_,13 @@ + public ItemStack assemble(CraftingContainer p_44260_, HolderLookup.Provider p_335725_) { +@@ -88,12 +_,12 @@ .fieldOf("ingredients") .flatXmap( p_301021_ -> { -- Ingredient[] aingredient = p_301021_.stream() -- .filter(p_300883_ -> !p_300883_.isEmpty()) -- .toArray(p_300865_ -> new Ingredient[p_300865_]); -+ Ingredient[] aingredient = p_301021_ -+ .toArray(Ingredient[]::new); //Forge skip the empty check and immediatly create the array. +- Ingredient[] aingredient = p_301021_.stream().filter(p_300883_ -> !p_300883_.isEmpty()).toArray(Ingredient[]::new); ++ Ingredient[] aingredient = p_301021_.toArray(Ingredient[]::new); // Neo skip the empty check and immediately create the array. if (aingredient.length == 0) { return DataResult.error(() -> "No ingredients for shapeless recipe"); } else { diff --git a/patches/net/minecraft/world/item/crafting/ShulkerBoxColoring.java.patch b/patches/net/minecraft/world/item/crafting/ShulkerBoxColoring.java.patch index a4f10048280..0b556d02aac 100644 --- a/patches/net/minecraft/world/item/crafting/ShulkerBoxColoring.java.patch +++ b/patches/net/minecraft/world/item/crafting/ShulkerBoxColoring.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/world/item/crafting/ShulkerBoxColoring.java @@ -25,7 +_,7 @@ if (Block.byItem(itemstack.getItem()) instanceof ShulkerBoxBlock) { - ++i; + i++; } else { - if (!(itemstack.getItem() instanceof DyeItem)) { + if (!itemstack.is(net.neoforged.neoforge.common.Tags.Items.DYES)) { @@ -11,14 +11,14 @@ @@ -43,7 +_,7 @@ - public ItemStack assemble(CraftingContainer p_44322_, RegistryAccess p_266985_) { + public ItemStack assemble(CraftingContainer p_44322_, HolderLookup.Provider p_335717_) { ItemStack itemstack = ItemStack.EMPTY; - DyeItem dyeitem = (DyeItem)Items.WHITE_DYE; + net.minecraft.world.item.DyeColor dyecolor = net.minecraft.world.item.DyeColor.WHITE; - for(int i = 0; i < p_44322_.getContainerSize(); ++i) { + for (int i = 0; i < p_44322_.getContainerSize(); i++) { ItemStack itemstack1 = p_44322_.getItem(i); -@@ -51,13 +_,15 @@ +@@ -51,13 +_,14 @@ Item item = itemstack1.getItem(); if (Block.byItem(item) instanceof ShulkerBoxBlock) { itemstack = itemstack1; @@ -31,9 +31,8 @@ } } -- ItemStack itemstack2 = ShulkerBoxBlock.getColoredItemStack(dyeitem.getDyeColor()); -+ ItemStack itemstack2 = ShulkerBoxBlock.getColoredItemStack(dyecolor); -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyStackAttachments(itemstack, itemstack2); - if (itemstack.hasTag()) { - itemstack2.setTag(itemstack.getTag().copy()); - } +- Block block = ShulkerBoxBlock.getBlockByColor(dyeitem.getDyeColor()); ++ Block block = ShulkerBoxBlock.getBlockByColor(dyecolor); + return itemstack.transmuteCopy(block, 1); + } + diff --git a/patches/net/minecraft/world/item/crafting/SimpleCookingSerializer.java.patch b/patches/net/minecraft/world/item/crafting/SimpleCookingSerializer.java.patch index 2eea3b863fb..090c3de77ec 100644 --- a/patches/net/minecraft/world/item/crafting/SimpleCookingSerializer.java.patch +++ b/patches/net/minecraft/world/item/crafting/SimpleCookingSerializer.java.patch @@ -1,15 +1,11 @@ --- a/net/minecraft/world/item/crafting/SimpleCookingSerializer.java +++ b/net/minecraft/world/item/crafting/SimpleCookingSerializer.java -@@ -19,11 +_,7 @@ - ExtraCodecs.strictOptionalField(Codec.STRING, "group", "").forGetter(p_300832_ -> p_300832_.group), +@@ -20,7 +_,7 @@ + Codec.STRING.optionalFieldOf("group", "").forGetter(p_300832_ -> p_300832_.group), CookingBookCategory.CODEC.fieldOf("category").orElse(CookingBookCategory.MISC).forGetter(p_300828_ -> p_300828_.category), Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(p_300833_ -> p_300833_.ingredient), -- BuiltInRegistries.ITEM -- .byNameCodec() -- .xmap(ItemStack::new, ItemStack::getItem) -- .fieldOf("result") -- .forGetter(p_300827_ -> p_300827_.result), -+ net.neoforged.neoforge.common.crafting.CraftingHelper.smeltingResultCodec().fieldOf("result").forGetter(p_300827_ -> p_300827_.result), +- ItemStack.STRICT_SINGLE_ITEM_CODEC.fieldOf("result").forGetter(p_300827_ -> p_300827_.result), ++ ItemStack.CODEC.fieldOf("result").forGetter(p_300827_ -> p_300827_.result), Codec.FLOAT.fieldOf("experience").orElse(0.0F).forGetter(p_300826_ -> p_300826_.experience), Codec.INT.fieldOf("cookingtime").orElse(p_44331_).forGetter(p_300834_ -> p_300834_.cookingTime) ) diff --git a/patches/net/minecraft/world/item/crafting/SmithingTransformRecipe.java.patch b/patches/net/minecraft/world/item/crafting/SmithingTransformRecipe.java.patch index b95e850477f..7d94f428dd5 100644 --- a/patches/net/minecraft/world/item/crafting/SmithingTransformRecipe.java.patch +++ b/patches/net/minecraft/world/item/crafting/SmithingTransformRecipe.java.patch @@ -1,19 +1,11 @@ --- a/net/minecraft/world/item/crafting/SmithingTransformRecipe.java +++ b/net/minecraft/world/item/crafting/SmithingTransformRecipe.java -@@ -36,6 +_,7 @@ - if (compoundtag != null) { - itemstack.setTag(compoundtag.copy()); - } -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyStackAttachments(p_267036_.getItem(1), itemstack); - - return itemstack; - } -@@ -67,7 +_,7 @@ +@@ -63,7 +_,7 @@ @Override public boolean isIncomplete() { - return Stream.of(this.template, this.base, this.addition).anyMatch(Ingredient::isEmpty); -+ return Stream.of(this.template, this.base, this.addition).anyMatch(net.neoforged.neoforge.common.CommonHooks::hasNoElements); ++ return Stream.of(this.template, this.base, this.addition).anyMatch(Ingredient::hasNoItems); } public static class Serializer implements RecipeSerializer { diff --git a/patches/net/minecraft/world/item/crafting/SmithingTrimRecipe.java.patch b/patches/net/minecraft/world/item/crafting/SmithingTrimRecipe.java.patch index f3f0e069a10..91cdb963c3b 100644 --- a/patches/net/minecraft/world/item/crafting/SmithingTrimRecipe.java.patch +++ b/patches/net/minecraft/world/item/crafting/SmithingTrimRecipe.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/item/crafting/SmithingTrimRecipe.java +++ b/net/minecraft/world/item/crafting/SmithingTrimRecipe.java -@@ -96,7 +_,7 @@ +@@ -92,7 +_,7 @@ @Override public boolean isIncomplete() { - return Stream.of(this.template, this.base, this.addition).anyMatch(Ingredient::isEmpty); -+ return Stream.of(this.template, this.base, this.addition).anyMatch(net.neoforged.neoforge.common.CommonHooks::hasNoElements); ++ return Stream.of(this.template, this.base, this.addition).anyMatch(Ingredient::hasNoItems); } public static class Serializer implements RecipeSerializer { diff --git a/patches/net/minecraft/world/item/enchantment/DiggingEnchantment.java.patch b/patches/net/minecraft/world/item/enchantment/DiggingEnchantment.java.patch deleted file mode 100644 index e4c931d7176..00000000000 --- a/patches/net/minecraft/world/item/enchantment/DiggingEnchantment.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/world/item/enchantment/DiggingEnchantment.java -+++ b/net/minecraft/world/item/enchantment/DiggingEnchantment.java -@@ -26,6 +_,6 @@ - - @Override - public boolean canEnchant(ItemStack p_44668_) { -- return p_44668_.is(Items.SHEARS) ? true : super.canEnchant(p_44668_); -+ return p_44668_.getItem() instanceof net.minecraft.world.item.ShearsItem ? true : super.canEnchant(p_44668_); - } - } diff --git a/patches/net/minecraft/world/item/enchantment/Enchantment.java.patch b/patches/net/minecraft/world/item/enchantment/Enchantment.java.patch index 5aefb515338..099bffc9c80 100644 --- a/patches/net/minecraft/world/item/enchantment/Enchantment.java.patch +++ b/patches/net/minecraft/world/item/enchantment/Enchantment.java.patch @@ -1,32 +1,32 @@ --- a/net/minecraft/world/item/enchantment/Enchantment.java +++ b/net/minecraft/world/item/enchantment/Enchantment.java -@@ -17,7 +_,7 @@ - import net.minecraft.world.entity.MobType; +@@ -23,7 +_,7 @@ + import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; --public abstract class Enchantment { -+public abstract class Enchantment implements net.neoforged.neoforge.common.extensions.IEnchantmentExtension { - private final EquipmentSlot[] slots; - private final Enchantment.Rarity rarity; - public final EnchantmentCategory category; -@@ -73,6 +_,7 @@ +-public class Enchantment implements FeatureElement { ++public class Enchantment implements FeatureElement, net.neoforged.neoforge.common.extensions.IEnchantmentExtension { + private final Enchantment.EnchantmentDefinition definition; + @Nullable + protected String descriptionId; +@@ -131,6 +_,7 @@ return 0; } + @Deprecated // Forge: Use ItemStack aware version in IForgeEnchantment - public float getDamageBonus(int p_44682_, MobType p_44683_) { + public float getDamageBonus(int p_44682_, @Nullable EntityType p_320800_) { return 0.0F; } -@@ -113,7 +_,7 @@ +@@ -171,7 +_,7 @@ } public boolean canEnchant(ItemStack p_44689_) { -- return this.category.canEnchant(p_44689_.getItem()); +- return p_44689_.getItem().builtInRegistryHolder().is(this.definition.supportedItems()); + return canApplyAtEnchantingTable(p_44689_); } public void doPostAttack(LivingEntity p_44686_, Entity p_44687_, int p_44688_) { -@@ -135,6 +_,24 @@ +@@ -196,6 +_,24 @@ } public boolean isDiscoverable() { diff --git a/patches/net/minecraft/world/item/enchantment/EnchantmentCategory.java.patch b/patches/net/minecraft/world/item/enchantment/EnchantmentCategory.java.patch deleted file mode 100644 index a04aa3c42d3..00000000000 --- a/patches/net/minecraft/world/item/enchantment/EnchantmentCategory.java.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/net/minecraft/world/item/enchantment/EnchantmentCategory.java -+++ b/net/minecraft/world/item/enchantment/EnchantmentCategory.java -@@ -13,7 +_,7 @@ - import net.minecraft.world.item.Vanishable; - import net.minecraft.world.level.block.Block; - --public enum EnchantmentCategory { -+public enum EnchantmentCategory implements net.neoforged.neoforge.common.IExtensibleEnum { - ARMOR { - @Override - public boolean canEnchant(Item p_44751_) { -@@ -115,5 +_,19 @@ - } - }; - -- public abstract boolean canEnchant(Item p_44743_); -+ private java.util.function.Predicate delegate; -+ -+ private EnchantmentCategory() {} -+ -+ private EnchantmentCategory(java.util.function.Predicate delegate) { -+ this.delegate = delegate; -+ } -+ -+ public static EnchantmentCategory create(String name, java.util.function.Predicate delegate) { -+ throw new IllegalStateException("Enum not extended"); -+ } -+ -+ public boolean canEnchant(Item p_44743_) { -+ return this.delegate == null ? false : this.delegate.test(p_44743_); -+ } - } diff --git a/patches/net/minecraft/world/item/enchantment/EnchantmentHelper.java.patch b/patches/net/minecraft/world/item/enchantment/EnchantmentHelper.java.patch index 154ec355cf0..852ddadac23 100644 --- a/patches/net/minecraft/world/item/enchantment/EnchantmentHelper.java.patch +++ b/patches/net/minecraft/world/item/enchantment/EnchantmentHelper.java.patch @@ -1,52 +1,37 @@ --- a/net/minecraft/world/item/enchantment/EnchantmentHelper.java +++ b/net/minecraft/world/item/enchantment/EnchantmentHelper.java -@@ -60,7 +_,14 @@ - return BuiltInRegistries.ENCHANTMENT.getKey(p_182433_); - } +@@ -33,9 +_,10 @@ + public class EnchantmentHelper { + private static final float SWIFT_SNEAK_EXTRA_FACTOR = 0.15F; -+ /** @deprecated forge: use {@link #getTagEnchantmentLevel(Enchantment, ItemStack)} or {@link ItemStack#getEnchantmentLevel(Enchantment)} */ ++ /** @deprecated Neo: Use {@link ItemStack#getEnchantmentLevel(Enchantment)} for gameplay logic. Use the data component when modifying the enchantments. */ + @Deprecated public static int getItemEnchantmentLevel(Enchantment p_44844_, ItemStack p_44845_) { +- ItemEnchantments itemenchantments = p_44845_.getOrDefault(DataComponents.ENCHANTMENTS, ItemEnchantments.EMPTY); +- return itemenchantments.getLevel(p_44844_); + return p_44845_.getEnchantmentLevel(p_44844_); -+ } -+ -+ /** Gets the enchantment level from NBT. Generally should use {@link ItemStack#getEnchantmentLevel(Enchantment)} for gameplay logic */ -+ public static int getTagEnchantmentLevel(Enchantment p_44844_, ItemStack p_44845_) { - if (p_44845_.isEmpty()) { - return 0; - } else { -@@ -79,6 +_,7 @@ - } } -+ /** Gets all enchantment levels from NBT. Use {@link ItemStack#getAllEnchantments()} for gameplay logic */ - public static Map getEnchantments(ItemStack p_44832_) { - ListTag listtag = p_44832_.is(Items.ENCHANTED_BOOK) ? EnchantedBookItem.getEnchantments(p_44832_) : p_44832_.getEnchantmentTags(); - return deserializeEnchantments(listtag); -@@ -118,6 +_,13 @@ + public static ItemEnchantments updateEnchantments(ItemStack p_331034_, Consumer p_332031_) { +@@ -78,7 +_,7 @@ + } private static void runIterationOnItem(EnchantmentHelper.EnchantmentVisitor p_44851_, ItemStack p_44852_) { - if (!p_44852_.isEmpty()) { -+ if (true) { // forge: redirect enchantment logic to allow non-NBT enchants -+ for (Map.Entry entry : p_44852_.getAllEnchantments().entrySet()) { -+ p_44851_.accept(entry.getKey(), entry.getValue()); -+ } -+ return; -+ } -+ - ListTag listtag = p_44852_.getEnchantmentTags(); +- ItemEnchantments itemenchantments = p_44852_.getOrDefault(DataComponents.ENCHANTMENTS, ItemEnchantments.EMPTY); ++ ItemEnchantments itemenchantments = p_44852_.getAllEnchantments(); // Neo: Allow gameplay enchantments to run too. - for(int i = 0; i < listtag.size(); ++i) { -@@ -143,7 +_,7 @@ + for (Entry> entry : itemenchantments.entrySet()) { + p_44851_.accept(entry.getKey().value(), entry.getIntValue()); +@@ -99,7 +_,7 @@ - public static float getDamageBonus(ItemStack p_44834_, MobType p_44835_) { + public static float getDamageBonus(ItemStack p_44834_, @Nullable EntityType p_320195_) { MutableFloat mutablefloat = new MutableFloat(); -- runIterationOnItem((p_44887_, p_44888_) -> mutablefloat.add(p_44887_.getDamageBonus(p_44888_, p_44835_)), p_44834_); -+ runIterationOnItem((p_44887_, p_44888_) -> mutablefloat.add(p_44887_.getDamageBonus(p_44888_, p_44835_, p_44834_)), p_44834_); +- runIterationOnItem((p_319741_, p_319742_) -> mutablefloat.add(p_319741_.getDamageBonus(p_319742_, p_320195_)), p_44834_); ++ runIterationOnItem((p_44887_, p_44888_) -> mutablefloat.add(p_44887_.getDamageBonus(p_44888_, p_320195_, p_44834_)), p_44834_); return mutablefloat.floatValue(); } -@@ -158,6 +_,7 @@ +@@ -125,6 +_,7 @@ runIterationOnInventory(enchantmenthelper$enchantmentvisitor, p_44824_.getAllSlots()); } @@ -54,7 +39,7 @@ if (p_44825_ instanceof Player) { runIterationOnItem(enchantmenthelper$enchantmentvisitor, p_44824_.getMainHandItem()); } -@@ -169,6 +_,7 @@ +@@ -136,6 +_,7 @@ runIterationOnInventory(enchantmenthelper$enchantmentvisitor, p_44897_.getAllSlots()); } @@ -62,7 +47,7 @@ if (p_44897_ instanceof Player) { runIterationOnItem(enchantmenthelper$enchantmentvisitor, p_44897_.getMainHandItem()); } -@@ -290,7 +_,7 @@ +@@ -263,7 +_,7 @@ public static int getEnchantmentCost(RandomSource p_220288_, int p_220289_, int p_220290_, ItemStack p_220291_) { Item item = p_220291_.getItem(); @@ -71,8 +56,8 @@ if (i <= 0) { return 0; } else { -@@ -328,7 +_,7 @@ - public static List selectEnchantment(RandomSource p_220298_, ItemStack p_220299_, int p_220300_, boolean p_220301_) { +@@ -298,7 +_,7 @@ + ) { List list = Lists.newArrayList(); Item item = p_220299_.getItem(); - int i = item.getEnchantmentValue(); @@ -80,12 +65,12 @@ if (i <= 0) { return list; } else { -@@ -383,7 +_,7 @@ - boolean flag = p_44819_.is(Items.BOOK); - - for(Enchantment enchantment : BuiltInRegistries.ENCHANTMENT) { -- if ((!enchantment.isTreasureOnly() || p_44820_) && enchantment.isDiscoverable() && (enchantment.category.canEnchant(item) || flag)) { -+ if ((!enchantment.isTreasureOnly() || p_44820_) && enchantment.isDiscoverable() && (enchantment.canApplyAtEnchantingTable(p_44819_) || (flag && enchantment.isAllowedOnBooks()))) { - for(int i = enchantment.getMaxLevel(); i > enchantment.getMinLevel() - 1; --i) { +@@ -355,7 +_,7 @@ + if (enchantment.isEnabled(p_338712_) + && (!enchantment.isTreasureOnly() || p_44820_) + && enchantment.isDiscoverable() +- && (flag || enchantment.canEnchant(p_44819_) && enchantment.isPrimaryItem(p_44819_))) { ++ && ((flag && enchantment.isAllowedOnBooks()) || enchantment.canApplyAtEnchantingTable(p_44819_) && enchantment.isPrimaryItem(p_44819_))) { + for (int i = enchantment.getMaxLevel(); i > enchantment.getMinLevel() - 1; i--) { if (p_44818_ >= enchantment.getMinCost(i) && p_44818_ <= enchantment.getMaxCost(i)) { list.add(new EnchantmentInstance(enchantment, i)); diff --git a/patches/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch b/patches/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch index 580b4140240..4196e69fc2f 100644 --- a/patches/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch +++ b/patches/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java +++ b/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java -@@ -49,7 +_,13 @@ +@@ -33,7 +_,13 @@ BlockState blockstate2 = p_45020_.getBlockState(blockpos); if (blockstate2 == FrostedIceBlock.meltsInto() && blockstate.canSurvive(p_45020_, blockpos) diff --git a/patches/net/minecraft/world/item/trading/MerchantOffer.java.patch b/patches/net/minecraft/world/item/trading/MerchantOffer.java.patch deleted file mode 100644 index c644be5fbab..00000000000 --- a/patches/net/minecraft/world/item/trading/MerchantOffer.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/world/item/trading/MerchantOffer.java -+++ b/net/minecraft/world/item/trading/MerchantOffer.java -@@ -90,7 +_,7 @@ - } else { - int i = this.baseCostA.getCount(); - int j = Math.max(0, Mth.floor((float)(i * this.demand) * this.priceMultiplier)); -- return this.baseCostA.copyWithCount(Mth.clamp(i + j + this.specialPriceDiff, 1, this.baseCostA.getItem().getMaxStackSize())); -+ return this.baseCostA.copyWithCount(Mth.clamp(i + j + this.specialPriceDiff, 1, this.baseCostA.getMaxStackSize())); - } - } - -@@ -197,7 +_,7 @@ - return true; - } else { - ItemStack itemstack = p_45366_.copy(); -- if (itemstack.getItem().canBeDepleted()) { -+ if (itemstack.getItem().isDamageable(itemstack)) { - itemstack.setDamageValue(itemstack.getDamageValue()); - } - diff --git a/patches/net/minecraft/world/level/BaseSpawner.java.patch b/patches/net/minecraft/world/level/BaseSpawner.java.patch index 966fea600b7..30f6a4df8ce 100644 --- a/patches/net/minecraft/world/level/BaseSpawner.java.patch +++ b/patches/net/minecraft/world/level/BaseSpawner.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/BaseSpawner.java +++ b/net/minecraft/world/level/BaseSpawner.java -@@ -152,14 +_,14 @@ +@@ -151,14 +_,14 @@ entity.moveTo(entity.getX(), entity.getY(), entity.getZ(), randomsource.nextFloat() * 360.0F, 0.0F); if (entity instanceof Mob mob) { @@ -10,17 +10,17 @@ continue; } -- if (spawndata.getEntityToSpawn().size() == 1 && spawndata.getEntityToSpawn().contains("id", 8)) { -- ((Mob)entity) -- .finalizeSpawn(p_151312_, p_151312_.getCurrentDifficultyAt(entity.blockPosition()), MobSpawnType.SPAWNER, null, null); +- boolean flag1 = spawndata.getEntityToSpawn().size() == 1 && spawndata.getEntityToSpawn().contains("id", 8); +- if (flag1) { +- ((Mob)entity).finalizeSpawn(p_151312_, p_151312_.getCurrentDifficultyAt(entity.blockPosition()), MobSpawnType.SPAWNER, null); + // Forge: Patch in FinalizeSpawn for spawners so it may be fired unconditionally, instead of only when vanilla normally would trigger it. -+ var event = net.neoforged.neoforge.event.EventHooks.onFinalizeSpawnSpawner(mob, p_151312_, p_151312_.getCurrentDifficultyAt(entity.blockPosition()), null, compoundtag, this); ++ var event = net.neoforged.neoforge.event.EventHooks.onFinalizeSpawnSpawner(mob, p_151312_, p_151312_.getCurrentDifficultyAt(entity.blockPosition()), null, this); + if (event != null && spawndata.getEntityToSpawn().size() == 1 && spawndata.getEntityToSpawn().contains("id", 8)) { -+ ((Mob)entity).finalizeSpawn(p_151312_, event.getDifficulty(), event.getSpawnType(), event.getSpawnData(), event.getSpawnTag()); ++ ((Mob)entity).finalizeSpawn(p_151312_, event.getDifficulty(), event.getSpawnType(), event.getSpawnData()); } - } -@@ -306,4 +_,12 @@ + spawndata.getEquipment().ifPresent(mob::equip); +@@ -309,4 +_,12 @@ public double getoSpin() { return this.oSpin; } diff --git a/patches/net/minecraft/world/level/Explosion.java.patch b/patches/net/minecraft/world/level/Explosion.java.patch index 7306fc7244e..1ed4425e85c 100644 --- a/patches/net/minecraft/world/level/Explosion.java.patch +++ b/patches/net/minecraft/world/level/Explosion.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/level/Explosion.java +++ b/net/minecraft/world/level/Explosion.java -@@ -267,6 +_,7 @@ +@@ -268,6 +_,7 @@ int j2 = Mth.floor(this.z - (double)f2 - 1.0); int j1 = Mth.floor(this.z + (double)f2 + 1.0); List list = this.level.getEntities(this.source, new AABB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); + net.neoforged.neoforge.event.EventHooks.onExplosionDetonate(this.level, this, list, f2); Vec3 vec3 = new Vec3(this.x, this.y, this.z); - for(Entity entity : list) { + for (Entity entity : list) { diff --git a/patches/net/minecraft/world/level/ForcedChunksSavedData.java.patch b/patches/net/minecraft/world/level/ForcedChunksSavedData.java.patch index 18578fb0711..5fe433a7d53 100644 --- a/patches/net/minecraft/world/level/ForcedChunksSavedData.java.patch +++ b/patches/net/minecraft/world/level/ForcedChunksSavedData.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/world/level/ForcedChunksSavedData.java +++ b/net/minecraft/world/level/ForcedChunksSavedData.java -@@ -24,16 +_,31 @@ +@@ -25,16 +_,31 @@ } - public static ForcedChunksSavedData load(CompoundTag p_151484_) { + public static ForcedChunksSavedData load(CompoundTag p_151484_, HolderLookup.Provider p_323940_) { - return new ForcedChunksSavedData(new LongOpenHashSet(p_151484_.getLongArray("Forced"))); + ForcedChunksSavedData savedData = new ForcedChunksSavedData(new LongOpenHashSet(p_151484_.getLongArray("Forced"))); + net.neoforged.neoforge.common.world.chunk.ForcedChunkManager.readModForcedChunks(p_151484_, savedData.blockForcedChunks, savedData.entityForcedChunks); @@ -11,7 +11,7 @@ } @Override - public CompoundTag save(CompoundTag p_46120_) { + public CompoundTag save(CompoundTag p_46120_, HolderLookup.Provider p_324573_) { p_46120_.putLongArray("Forced", this.chunks.toLongArray()); + net.neoforged.neoforge.common.world.chunk.ForcedChunkManager.writeModForcedChunks(p_46120_, this.blockForcedChunks, this.entityForcedChunks); return p_46120_; diff --git a/patches/net/minecraft/world/level/Level.java.patch b/patches/net/minecraft/world/level/Level.java.patch index a1edbaaa91c..0a588ca277d 100644 --- a/patches/net/minecraft/world/level/Level.java.patch +++ b/patches/net/minecraft/world/level/Level.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -73,7 +_,7 @@ +@@ -75,7 +_,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.scores.Scoreboard; @@ -9,7 +9,7 @@ public static final Codec> RESOURCE_KEY_CODEC = ResourceKey.codec(Registries.DIMENSION); public static final ResourceKey OVERWORLD = ResourceKey.create(Registries.DIMENSION, new ResourceLocation("overworld")); public static final ResourceKey NETHER = ResourceKey.create(Registries.DIMENSION, new ResourceLocation("the_nether")); -@@ -112,6 +_,11 @@ +@@ -113,6 +_,11 @@ private final RegistryAccess registryAccess; private final DamageSources damageSources; private long subTickCount; @@ -129,7 +129,7 @@ } @@ -656,7 +_,7 @@ - Explosion.BlockInteraction explosion$blockinteraction = switch(p_312265_) { + Explosion.BlockInteraction explosion$blockinteraction = switch (p_312265_) { case NONE -> Explosion.BlockInteraction.KEEP; case BLOCK -> this.getDestroyType(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY); - case MOB -> this.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) @@ -139,7 +139,7 @@ case TNT -> this.getDestroyType(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY); @@ -677,6 +_,7 @@ p_312060_, - p_311784_ + p_320283_ ); + if (net.neoforged.neoforge.event.EventHooks.onExplosionStart(this, explosion)) return explosion; explosion.explode(); @@ -159,7 +159,7 @@ + if (false) if (p_151522_ instanceof EnderDragon) { - for(EnderDragonPart enderdragonpart : ((EnderDragon)p_151522_).getSubEntities()) { + for (EnderDragonPart enderdragonpart : ((EnderDragon)p_151522_).getSubEntities()) { if (p_151522_ != p_46536_ && p_46538_.test(enderdragonpart)) { @@ -797,6 +_,11 @@ } @@ -180,7 +180,7 @@ + + if (false) if (p_261454_ instanceof EnderDragon enderdragon) { - for(EnderDragonPart enderdragonpart : enderdragon.getSubEntities()) { + for (EnderDragonPart enderdragonpart : enderdragon.getSubEntities()) { T t = p_261885_.tryCast(enderdragonpart); @@ -837,6 +_,15 @@ @@ -198,11 +198,11 @@ } @Nullable -@@ -969,16 +_,15 @@ +@@ -965,16 +_,15 @@ public abstract Scoreboard getScoreboard(); public void updateNeighbourForOutputSignal(BlockPos p_46718_, Block p_46719_) { -- for(Direction direction : Direction.Plane.HORIZONTAL) { +- for (Direction direction : Direction.Plane.HORIZONTAL) { + for(Direction direction : Direction.values()) { BlockPos blockpos = p_46718_.relative(direction); if (this.hasChunkAt(blockpos)) { @@ -219,7 +219,7 @@ this.neighborChanged(blockstate, blockpos, p_46719_, p_46718_, false); } } -@@ -1070,6 +_,24 @@ +@@ -1062,6 +_,18 @@ @Override public BiomeManager getBiomeManager() { return this.biomeManager; @@ -235,12 +235,6 @@ + if (value > maxEntityRadius) + maxEntityRadius = value; + return maxEntityRadius; -+ } -+ -+ @Override -+ @Nullable -+ public net.neoforged.neoforge.client.model.data.ModelDataManager.Active getModelDataManager() { -+ return null; } public final boolean isDebug() { diff --git a/patches/net/minecraft/world/level/NaturalSpawner.java.patch b/patches/net/minecraft/world/level/NaturalSpawner.java.patch index 7ba66045e1e..34b083ee3bd 100644 --- a/patches/net/minecraft/world/level/NaturalSpawner.java.patch +++ b/patches/net/minecraft/world/level/NaturalSpawner.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java -@@ -47,6 +_,7 @@ +@@ -45,6 +_,7 @@ import net.minecraft.world.phys.Vec3; import org.slf4j.Logger; @@ -8,7 +8,7 @@ public final class NaturalSpawner { private static final Logger LOGGER = LogUtils.getLogger(); private static final int MIN_SPAWN_DISTANCE = 24; -@@ -71,7 +_,7 @@ +@@ -69,7 +_,7 @@ continue; } @@ -17,8 +17,8 @@ if (mobcategory != MobCategory.MISC) { BlockPos blockpos = entity.blockPosition(); p_186527_.query( -@@ -201,7 +_,7 @@ - ++l1; +@@ -199,7 +_,7 @@ + l1++; p_47040_.addFreshEntityWithPassengers(mob); p_47044_.run(mob, p_47041_); - if (j >= mob.getMaxSpawnClusterSize()) { @@ -26,16 +26,16 @@ return; } -@@ -278,7 +_,7 @@ - && p_46993_.removeWhenFarAway(p_46994_)) { - return false; - } else { -- return p_46993_.checkSpawnRules(p_46992_, MobSpawnType.NATURAL) && p_46993_.checkSpawnObstruction(p_46992_); -+ return net.neoforged.neoforge.event.EventHooks.checkSpawnPosition(p_46993_, p_46992_, MobSpawnType.NATURAL); - } +@@ -272,7 +_,7 @@ + return p_46994_ > (double)(p_46993_.getType().getCategory().getDespawnDistance() * p_46993_.getType().getCategory().getDespawnDistance()) + && p_46993_.removeWhenFarAway(p_46994_) + ? false +- : p_46993_.checkSpawnRules(p_46992_, MobSpawnType.NATURAL) && p_46993_.checkSpawnObstruction(p_46992_); ++ : net.neoforged.neoforge.event.EventHooks.checkSpawnPosition(p_46993_, p_46992_, MobSpawnType.NATURAL); } -@@ -310,9 +_,14 @@ + private static Optional getRandomSpawnMobAt( +@@ -303,9 +_,14 @@ BlockPos p_220448_, @Nullable Holder p_220449_ ) { @@ -53,38 +53,7 @@ } public static boolean isInNetherFortressBounds(BlockPos p_220456_, ServerLevel p_220457_, MobCategory p_220458_, StructureManager p_220459_) { -@@ -351,6 +_,13 @@ - if (p_47052_ == SpawnPlacements.Type.NO_RESTRICTIONS) { - return true; - } else if (p_47055_ != null && p_47053_.getWorldBorder().isWithinBounds(p_47054_)) { -+ return p_47052_.canSpawnAt(p_47053_, p_47054_, p_47055_); -+ } -+ return false; -+ } -+ -+ public static boolean canSpawnAtBody(SpawnPlacements.Type p_47052_, LevelReader p_47053_, BlockPos p_47054_, @Nullable EntityType p_47055_) { -+ { - BlockState blockstate = p_47053_.getBlockState(p_47054_); - FluidState fluidstate = p_47053_.getFluidState(p_47054_); - BlockPos blockpos = p_47054_.above(); -@@ -363,15 +_,13 @@ - case ON_GROUND: - default: - BlockState blockstate1 = p_47053_.getBlockState(blockpos1); -- if (!blockstate1.isValidSpawn(p_47053_, blockpos1, p_47055_)) { -+ if (!blockstate1.isValidSpawn(p_47053_, blockpos1, p_47052_, p_47055_)) { - return false; - } else { - return isValidEmptySpawnBlock(p_47053_, p_47054_, blockstate, fluidstate, p_47055_) - && isValidEmptySpawnBlock(p_47053_, blockpos, p_47053_.getBlockState(blockpos), p_47053_.getFluidState(blockpos), p_47055_); - } - } -- } else { -- return false; - } - } - -@@ -431,8 +_,7 @@ +@@ -392,8 +_,7 @@ entity.moveTo(d0, (double)blockpos.getY(), d1, p_220454_.nextFloat() * 360.0F, 0.0F); if (entity instanceof Mob mob @@ -92,5 +61,5 @@ - && mob.checkSpawnObstruction(p_220451_)) { + && net.neoforged.neoforge.event.EventHooks.checkSpawnPosition(mob, p_220451_, MobSpawnType.CHUNK_GENERATION)) { spawngroupdata = mob.finalizeSpawn( - p_220451_, p_220451_.getCurrentDifficultyAt(mob.blockPosition()), MobSpawnType.CHUNK_GENERATION, spawngroupdata, null + p_220451_, p_220451_.getCurrentDifficultyAt(mob.blockPosition()), MobSpawnType.CHUNK_GENERATION, spawngroupdata ); diff --git a/patches/net/minecraft/world/level/block/AbstractCauldronBlock.java.patch b/patches/net/minecraft/world/level/block/AbstractCauldronBlock.java.patch index 3ca300683b8..a2e27deb03d 100644 --- a/patches/net/minecraft/world/level/block/AbstractCauldronBlock.java.patch +++ b/patches/net/minecraft/world/level/block/AbstractCauldronBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/AbstractCauldronBlock.java +++ b/net/minecraft/world/level/block/AbstractCauldronBlock.java -@@ -102,4 +_,22 @@ +@@ -101,4 +_,22 @@ protected void receiveStalactiteDrip(BlockState p_151975_, Level p_151976_, BlockPos p_151977_, Fluid p_151978_) { } diff --git a/patches/net/minecraft/world/level/block/BambooSaplingBlock.java.patch b/patches/net/minecraft/world/level/block/BambooSaplingBlock.java.patch index 1363816780a..7505c61bc06 100644 --- a/patches/net/minecraft/world/level/block/BambooSaplingBlock.java.patch +++ b/patches/net/minecraft/world/level/block/BambooSaplingBlock.java.patch @@ -3,7 +3,7 @@ @@ -88,7 +_,7 @@ @Override - public float getDestroyProgress(BlockState p_48981_, Player p_48982_, BlockGetter p_48983_, BlockPos p_48984_) { + protected float getDestroyProgress(BlockState p_48981_, Player p_48982_, BlockGetter p_48983_, BlockPos p_48984_) { - return p_48982_.getMainHandItem().getItem() instanceof SwordItem ? 1.0F : super.getDestroyProgress(p_48981_, p_48982_, p_48983_, p_48984_); + return p_48982_.getMainHandItem().canPerformAction(net.neoforged.neoforge.common.ToolActions.SWORD_DIG) ? 1.0F : super.getDestroyProgress(p_48981_, p_48982_, p_48983_, p_48984_); } diff --git a/patches/net/minecraft/world/level/block/BambooStalkBlock.java.patch b/patches/net/minecraft/world/level/block/BambooStalkBlock.java.patch index d0aca5073e4..82c3d8dce38 100644 --- a/patches/net/minecraft/world/level/block/BambooStalkBlock.java.patch +++ b/patches/net/minecraft/world/level/block/BambooStalkBlock.java.patch @@ -11,7 +11,7 @@ protected static final float LARGE_LEAVES_AABB_OFFSET = 5.0F; @@ -130,10 +_,11 @@ @Override - public void randomTick(BlockState p_261931_, ServerLevel p_261751_, BlockPos p_261616_, RandomSource p_261766_) { + protected void randomTick(BlockState p_261931_, ServerLevel p_261751_, BlockPos p_261616_, RandomSource p_261766_) { if (p_261931_.getValue(STAGE) == 0) { - if (p_261766_.nextInt(3) == 0 && p_261751_.isEmptyBlock(p_261616_.above()) && p_261751_.getRawBrightness(p_261616_.above(), 0) >= 9) { + if (p_261751_.isEmptyBlock(p_261616_.above()) && p_261751_.getRawBrightness(p_261616_.above(), 0) >= 9) { @@ -26,7 +26,7 @@ @@ -193,7 +_,7 @@ @Override - public float getDestroyProgress(BlockState p_261691_, Player p_262171_, BlockGetter p_261621_, BlockPos p_261500_) { + protected float getDestroyProgress(BlockState p_261691_, Player p_262171_, BlockGetter p_261621_, BlockPos p_261500_) { - return p_262171_.getMainHandItem().getItem() instanceof SwordItem ? 1.0F : super.getDestroyProgress(p_261691_, p_262171_, p_261621_, p_261500_); + return p_262171_.getMainHandItem().canPerformAction(net.neoforged.neoforge.common.ToolActions.SWORD_DIG) ? 1.0F : super.getDestroyProgress(p_261691_, p_262171_, p_261621_, p_261500_); } diff --git a/patches/net/minecraft/world/level/block/BaseFireBlock.java.patch b/patches/net/minecraft/world/level/block/BaseFireBlock.java.patch index dcfb0bc2e2e..c4bc4e334fc 100644 --- a/patches/net/minecraft/world/level/block/BaseFireBlock.java.patch +++ b/patches/net/minecraft/world/level/block/BaseFireBlock.java.patch @@ -8,10 +8,10 @@ if (optional.isPresent()) { optional.get().createPortalBlocks(); return; -@@ -189,7 +_,7 @@ +@@ -185,7 +_,7 @@ boolean flag = false; - for(Direction direction : Direction.values()) { + for (Direction direction : Direction.values()) { - if (p_49270_.getBlockState(blockpos$mutableblockpos.set(p_49271_).move(direction)).is(Blocks.OBSIDIAN)) { + if (p_49270_.getBlockState(blockpos$mutableblockpos.set(p_49271_).move(direction)).isPortalFrame(p_49270_, blockpos$mutableblockpos)) { flag = true; diff --git a/patches/net/minecraft/world/level/block/BaseRailBlock.java.patch b/patches/net/minecraft/world/level/block/BaseRailBlock.java.patch index e98253961e3..af4fb513e8f 100644 --- a/patches/net/minecraft/world/level/block/BaseRailBlock.java.patch +++ b/patches/net/minecraft/world/level/block/BaseRailBlock.java.patch @@ -11,7 +11,7 @@ public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; @@ -49,6 +_,7 @@ @Override - public VoxelShape getShape(BlockState p_49403_, BlockGetter p_49404_, BlockPos p_49405_, CollisionContext p_49406_) { + protected VoxelShape getShape(BlockState p_49403_, BlockGetter p_49404_, BlockPos p_49405_, CollisionContext p_49406_) { RailShape railshape = p_49403_.is(this) ? p_49403_.getValue(this.getShapeProperty()) : null; + RailShape railShape2 = p_49403_.is(this) ? getRailDirection(p_49403_, p_49404_, p_49405_, null) : null; return railshape != null && railshape.isAscending() ? HALF_BLOCK_AABB : FLAT_AABB; @@ -19,7 +19,7 @@ @@ -76,7 +_,7 @@ @Override - public void neighborChanged(BlockState p_49377_, Level p_49378_, BlockPos p_49379_, Block p_49380_, BlockPos p_49381_, boolean p_49382_) { + protected void neighborChanged(BlockState p_49377_, Level p_49378_, BlockPos p_49379_, Block p_49380_, BlockPos p_49381_, boolean p_49382_) { if (!p_49378_.isClientSide && p_49378_.getBlockState(p_49379_).is(this)) { - RailShape railshape = p_49377_.getValue(this.getShapeProperty()); + RailShape railshape = getRailDirection(p_49377_, p_49378_, p_49379_, null); @@ -27,7 +27,7 @@ dropResources(p_49377_, p_49378_, p_49379_); p_49378_.removeBlock(p_49379_, p_49382_); @@ -121,7 +_,7 @@ - public void onRemove(BlockState p_49384_, Level p_49385_, BlockPos p_49386_, BlockState p_49387_, boolean p_49388_) { + protected void onRemove(BlockState p_49384_, Level p_49385_, BlockPos p_49386_, BlockState p_49387_, boolean p_49388_) { if (!p_49388_) { super.onRemove(p_49384_, p_49385_, p_49386_, p_49387_, p_49388_); - if (p_49384_.getValue(this.getShapeProperty()).isAscending()) { @@ -49,7 +49,7 @@ @Override @@ -158,5 +_,15 @@ @Override - public FluidState getFluidState(BlockState p_152158_) { + protected FluidState getFluidState(BlockState p_152158_) { return p_152158_.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(p_152158_); + } + diff --git a/patches/net/minecraft/world/level/block/BeehiveBlock.java.patch b/patches/net/minecraft/world/level/block/BeehiveBlock.java.patch index 6926bca1967..46dc3cac7f1 100644 --- a/patches/net/minecraft/world/level/block/BeehiveBlock.java.patch +++ b/patches/net/minecraft/world/level/block/BeehiveBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/BeehiveBlock.java +++ b/net/minecraft/world/level/block/BeehiveBlock.java -@@ -124,7 +_,7 @@ +@@ -126,7 +_,7 @@ boolean flag = false; if (i >= 5) { - Item item = itemstack.getItem(); -- if (itemstack.is(Items.SHEARS)) { -+ if (itemstack.canPerformAction(net.neoforged.neoforge.common.ToolActions.SHEARS_HARVEST)) { - p_49625_.playSound(p_49627_, p_49627_.getX(), p_49627_.getY(), p_49627_.getZ(), SoundEvents.BEEHIVE_SHEAR, SoundSource.BLOCKS, 1.0F, 1.0F); - dropHoneycomb(p_49625_, p_49626_); - itemstack.hurtAndBreak(1, p_49627_, p_49571_ -> p_49571_.broadcastBreakEvent(p_49628_)); + Item item = p_316844_.getItem(); +- if (p_316844_.is(Items.SHEARS)) { ++ if (p_316844_.canPerformAction(net.neoforged.neoforge.common.ToolActions.SHEARS_HARVEST)) { + p_316306_.playSound(p_316824_, p_316824_.getX(), p_316824_.getY(), p_316824_.getZ(), SoundEvents.BEEHIVE_SHEAR, SoundSource.BLOCKS, 1.0F, 1.0F); + dropHoneycomb(p_316306_, p_316497_); + p_316844_.hurtAndBreak(1, p_316824_, LivingEntity.getSlotForHand(p_316436_)); diff --git a/patches/net/minecraft/world/level/block/Block.java.patch b/patches/net/minecraft/world/level/block/Block.java.patch index 6493bb29869..de3380cdbc1 100644 --- a/patches/net/minecraft/world/level/block/Block.java.patch +++ b/patches/net/minecraft/world/level/block/Block.java.patch @@ -30,7 +30,7 @@ } public static boolean isExceptionForConnection(BlockState p_152464_) { -@@ -213,6 +_,8 @@ +@@ -209,6 +_,8 @@ BlockState blockstate = p_152446_.getBlockState(p_152449_); if (p_152445_.skipRendering(blockstate, p_152448_)) { return false; @@ -39,7 +39,7 @@ } else if (blockstate.canOcclude()) { Block.BlockStatePairKey block$blockstatepairkey = new Block.BlockStatePairKey(p_152445_, blockstate, p_152448_); Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = OCCLUSION_CACHE.get(); -@@ -305,9 +_,12 @@ +@@ -297,9 +_,12 @@ public static void dropResources( BlockState p_49882_, Level p_49883_, BlockPos p_49884_, @Nullable BlockEntity p_49885_, @Nullable Entity p_49886_, ItemStack p_49887_ ) { @@ -53,7 +53,7 @@ } } -@@ -335,7 +_,7 @@ +@@ -327,7 +_,7 @@ } private static void popResource(Level p_152441_, Supplier p_152442_, ItemStack p_152443_) { @@ -62,7 +62,7 @@ ItemEntity itementity = p_152442_.get(); itementity.setDefaultPickUpDelay(); p_152441_.addFreshEntity(itementity); -@@ -343,11 +_,12 @@ +@@ -335,11 +_,12 @@ } public void popExperience(ServerLevel p_49806_, BlockPos p_49807_, int p_49808_) { @@ -76,7 +76,7 @@ public float getExplosionResistance() { return this.explosionResistance; } -@@ -366,7 +_,8 @@ +@@ -358,7 +_,8 @@ public void playerDestroy(Level p_49827_, Player p_49828_, BlockPos p_49829_, BlockState p_49830_, @Nullable BlockEntity p_49831_, ItemStack p_49832_) { p_49828_.awardStat(Stats.BLOCK_MINED.get(this)); p_49828_.causeFoodExhaustion(0.005F); @@ -86,7 +86,7 @@ } public void setPlacedBy(Level p_49847_, BlockPos p_49848_, BlockState p_49849_, @Nullable LivingEntity p_49850_, ItemStack p_49851_) { -@@ -394,8 +_,10 @@ +@@ -386,8 +_,10 @@ public void updateEntityAfterFallOn(BlockGetter p_49821_, Entity p_49822_) { p_49822_.setDeltaMovement(p_49822_.getDeltaMovement().multiply(1.0, 0.0, 1.0)); @@ -97,7 +97,7 @@ public ItemStack getCloneItemStack(LevelReader p_304395_, BlockPos p_49824_, BlockState p_49825_) { return new ItemStack(this); } -@@ -429,6 +_,7 @@ +@@ -421,6 +_,7 @@ public void handlePrecipitation(BlockState p_152450_, Level p_152451_, BlockPos p_152452_, Biome.Precipitation p_152453_) { } @@ -105,15 +105,7 @@ public boolean dropFromExplosion(Explosion p_49826_) { return true; } -@@ -464,6 +_,7 @@ - return p_152456_.setValue(p_152457_, p_152455_.getValue(p_152457_)); - } - -+ @Deprecated //Forge: Use more sensitive version {@link IForgeBlockState#getSoundType(IWorldReader, BlockPos, Entity) } - public SoundType getSoundType(BlockState p_49963_) { - return this.soundType; - } -@@ -498,6 +_,75 @@ +@@ -486,6 +_,75 @@ return this.stateDefinition.getPossibleStates().stream().collect(ImmutableMap.toImmutableMap(Function.identity(), p_152459_)); } diff --git a/patches/net/minecraft/world/level/block/Blocks.java.patch b/patches/net/minecraft/world/level/block/Blocks.java.patch index 31c5d0b61ac..05ecb280eab 100644 --- a/patches/net/minecraft/world/level/block/Blocks.java.patch +++ b/patches/net/minecraft/world/level/block/Blocks.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/Blocks.java +++ b/net/minecraft/world/level/block/Blocks.java -@@ -756,7 +_,7 @@ +@@ -755,7 +_,7 @@ public static final Block RED_BED = register("red_bed", bed(DyeColor.RED)); public static final Block BLACK_BED = register("black_bed", bed(DyeColor.BLACK)); public static final Block POWERED_RAIL = register( @@ -9,10 +9,10 @@ ); public static final Block DETECTOR_RAIL = register( "detector_rail", new DetectorRailBlock(BlockBehaviour.Properties.of().noCollission().strength(0.7F).sound(SoundType.METAL)) -@@ -7802,7 +_,8 @@ +@@ -7841,7 +_,8 @@ static { - for(Block block : BuiltInRegistries.BLOCK) { - for(BlockState blockstate : block.getStateDefinition().getPossibleStates()) { + for (Block block : BuiltInRegistries.BLOCK) { + for (BlockState blockstate : block.getStateDefinition().getPossibleStates()) { - Block.BLOCK_STATE_REGISTRY.add(blockstate); + // Neo: comment out, it's done in NeoForgeRegistryCallbacks + //Block.BLOCK_STATE_REGISTRY.add(blockstate); diff --git a/patches/net/minecraft/world/level/block/BushBlock.java.patch b/patches/net/minecraft/world/level/block/BushBlock.java.patch index e4aabd2efc1..f0d823f9472 100644 --- a/patches/net/minecraft/world/level/block/BushBlock.java.patch +++ b/patches/net/minecraft/world/level/block/BushBlock.java.patch @@ -11,7 +11,7 @@ } @@ -33,6 +_,8 @@ @Override - public boolean canSurvive(BlockState p_51028_, LevelReader p_51029_, BlockPos p_51030_) { + protected boolean canSurvive(BlockState p_51028_, LevelReader p_51029_, BlockPos p_51030_) { BlockPos blockpos = p_51030_.below(); + if (p_51028_.getBlock() == this) //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. + return p_51029_.getBlockState(blockpos).canSustainPlant(p_51029_, blockpos, Direction.UP, this); @@ -20,8 +20,8 @@ @@ -44,5 +_,12 @@ @Override - public boolean isPathfindable(BlockState p_51023_, BlockGetter p_51024_, BlockPos p_51025_, PathComputationType p_51026_) { - return p_51026_ == PathComputationType.AIR && !this.hasCollision ? true : super.isPathfindable(p_51023_, p_51024_, p_51025_, p_51026_); + protected boolean isPathfindable(BlockState p_51023_, PathComputationType p_51026_) { + return p_51026_ == PathComputationType.AIR && !this.hasCollision ? true : super.isPathfindable(p_51023_, p_51026_); + } + + @Override diff --git a/patches/net/minecraft/world/level/block/CactusBlock.java.patch b/patches/net/minecraft/world/level/block/CactusBlock.java.patch index cb0661b1fff..10a127e82f3 100644 --- a/patches/net/minecraft/world/level/block/CactusBlock.java.patch +++ b/patches/net/minecraft/world/level/block/CactusBlock.java.patch @@ -12,7 +12,7 @@ @@ -41,6 +_,7 @@ @Override - public void tick(BlockState p_220908_, ServerLevel p_220909_, BlockPos p_220910_, RandomSource p_220911_) { + protected void tick(BlockState p_220908_, ServerLevel p_220909_, BlockPos p_220910_, RandomSource p_220911_) { + if (!p_220909_.isAreaLoaded(p_220910_, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update if (!p_220908_.canSurvive(p_220909_, p_220910_)) { p_220909_.destroyBlock(p_220910_, true); @@ -45,7 +45,7 @@ @Override @@ -115,5 +_,15 @@ @Override - public boolean isPathfindable(BlockState p_51143_, BlockGetter p_51144_, BlockPos p_51145_, PathComputationType p_51146_) { + protected boolean isPathfindable(BlockState p_51143_, PathComputationType p_51146_) { return false; + } + diff --git a/patches/net/minecraft/world/level/block/CampfireBlock.java.patch b/patches/net/minecraft/world/level/block/CampfireBlock.java.patch index 226b499103e..148f8e6d3e6 100644 --- a/patches/net/minecraft/world/level/block/CampfireBlock.java.patch +++ b/patches/net/minecraft/world/level/block/CampfireBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/CampfireBlock.java +++ b/net/minecraft/world/level/block/CampfireBlock.java -@@ -282,7 +_,7 @@ +@@ -283,7 +_,7 @@ return true; } diff --git a/patches/net/minecraft/world/level/block/CauldronBlock.java.patch b/patches/net/minecraft/world/level/block/CauldronBlock.java.patch index 8b27224d4ab..c22d2458c3b 100644 --- a/patches/net/minecraft/world/level/block/CauldronBlock.java.patch +++ b/patches/net/minecraft/world/level/block/CauldronBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/CauldronBlock.java +++ b/net/minecraft/world/level/block/CauldronBlock.java -@@ -60,6 +_,7 @@ +@@ -58,6 +_,7 @@ @Override protected void receiveStalactiteDrip(BlockState p_152940_, Level p_152941_, BlockPos p_152942_, Fluid p_152943_) { diff --git a/patches/net/minecraft/world/level/block/ChestBlock.java.patch b/patches/net/minecraft/world/level/block/ChestBlock.java.patch index ac6268c8194..99655a4e313 100644 --- a/patches/net/minecraft/world/level/block/ChestBlock.java.patch +++ b/patches/net/minecraft/world/level/block/ChestBlock.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/world/level/block/ChestBlock.java +++ b/net/minecraft/world/level/block/ChestBlock.java -@@ -374,7 +_,8 @@ +@@ -357,7 +_,8 @@ @Override - public BlockState mirror(BlockState p_51549_, Mirror p_51550_) { + protected BlockState mirror(BlockState p_51549_, Mirror p_51550_) { - return p_51549_.rotate(p_51550_.getRotation(p_51549_.getValue(FACING))); + BlockState rotated = p_51549_.rotate(p_51550_.getRotation(p_51549_.getValue(FACING))); + return p_51550_ == Mirror.NONE ? rotated : rotated.setValue(TYPE, rotated.getValue(TYPE).getOpposite()); // Forge: Fixed MC-134110 Structure mirroring breaking apart double chests diff --git a/patches/net/minecraft/world/level/block/CocoaBlock.java.patch b/patches/net/minecraft/world/level/block/CocoaBlock.java.patch index ba98db3e302..d004d4e3d82 100644 --- a/patches/net/minecraft/world/level/block/CocoaBlock.java.patch +++ b/patches/net/minecraft/world/level/block/CocoaBlock.java.patch @@ -3,7 +3,7 @@ @@ -64,10 +_,11 @@ @Override - public void randomTick(BlockState p_221000_, ServerLevel p_221001_, BlockPos p_221002_, RandomSource p_221003_) { + protected void randomTick(BlockState p_221000_, ServerLevel p_221001_, BlockPos p_221002_, RandomSource p_221003_) { - if (p_221001_.random.nextInt(5) == 0) { + if (true) { int i = p_221000_.getValue(AGE); diff --git a/patches/net/minecraft/world/level/block/ComparatorBlock.java.patch b/patches/net/minecraft/world/level/block/ComparatorBlock.java.patch index 5d6a79477e4..c8fc89171c1 100644 --- a/patches/net/minecraft/world/level/block/ComparatorBlock.java.patch +++ b/patches/net/minecraft/world/level/block/ComparatorBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/ComparatorBlock.java +++ b/net/minecraft/world/level/block/ComparatorBlock.java -@@ -204,4 +_,16 @@ +@@ -199,4 +_,16 @@ protected void createBlockStateDefinition(StateDefinition.Builder p_51887_) { p_51887_.add(FACING, MODE, POWERED); } @@ -13,7 +13,7 @@ + @Override + public void onNeighborChange(BlockState state, net.minecraft.world.level.LevelReader world, BlockPos pos, BlockPos neighbor) { + if (pos.getY() == neighbor.getY() && world instanceof Level && !((Level)world).isClientSide()) { -+ state.neighborChanged((Level)world, pos, world.getBlockState(neighbor).getBlock(), neighbor, false); ++ state.handleNeighborChanged((Level)world, pos, world.getBlockState(neighbor).getBlock(), neighbor, false); + } + } } diff --git a/patches/net/minecraft/world/level/block/ComposterBlock.java.patch b/patches/net/minecraft/world/level/block/ComposterBlock.java.patch index 1ffe618e4a2..fd6fc537dcc 100644 --- a/patches/net/minecraft/world/level/block/ComposterBlock.java.patch +++ b/patches/net/minecraft/world/level/block/ComposterBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/ComposterBlock.java +++ b/net/minecraft/world/level/block/ComposterBlock.java -@@ -47,6 +_,8 @@ +@@ -48,6 +_,8 @@ public static final int MIN_LEVEL = 0; public static final int MAX_LEVEL = 7; public static final IntegerProperty LEVEL = BlockStateProperties.LEVEL_COMPOSTER; @@ -9,7 +9,7 @@ public static final Object2FloatMap COMPOSTABLES = new Object2FloatOpenHashMap<>(); private static final int AABB_SIDE_THICKNESS = 2; private static final VoxelShape OUTER_SHAPE = Shapes.block(); -@@ -226,13 +_,22 @@ +@@ -227,6 +_,15 @@ if (p_51978_.getValue(LEVEL) == 7) { p_51979_.scheduleTick(p_51980_, p_51978_.getBlock(), 20); } @@ -18,22 +18,23 @@ + } + + @Override -+ public void onRemove(BlockState p_60515_, Level p_60516_, BlockPos p_60517_, BlockState p_60518_, boolean p_60519_) { ++ protected void onRemove(BlockState p_60515_, Level p_60516_, BlockPos p_60517_, BlockState p_60518_, boolean p_60519_) { + super.onRemove(p_60515_, p_60516_, p_60517_, p_60518_, p_60519_); + // Neo: Invalidate composter capabilities when a composter is removed + if (!p_60515_.is(p_60518_.getBlock())) p_60516_.invalidateCapabilities(p_60517_); } @Override - public InteractionResult use(BlockState p_51949_, Level p_51950_, BlockPos p_51951_, Player p_51952_, InteractionHand p_51953_, BlockHitResult p_51954_) { - int i = p_51949_.getValue(LEVEL); - ItemStack itemstack = p_51952_.getItemInHand(p_51953_); -- if (i < 8 && COMPOSTABLES.containsKey(itemstack.getItem())) { -+ if (i < 8 && getValue(itemstack) > 0) { - if (i < 7 && !p_51950_.isClientSide) { - BlockState blockstate = addItem(p_51952_, p_51949_, p_51950_, p_51951_, itemstack); - p_51950_.levelEvent(1500, p_51951_, p_51949_ != blockstate ? 1 : 0); -@@ -253,7 +_,7 @@ +@@ -234,7 +_,7 @@ + ItemStack p_316332_, BlockState p_316118_, Level p_316624_, BlockPos p_316660_, Player p_316715_, InteractionHand p_316472_, BlockHitResult p_316606_ + ) { + int i = p_316118_.getValue(LEVEL); +- if (i < 8 && COMPOSTABLES.containsKey(p_316332_.getItem())) { ++ if (i < 8 && getValue(p_316332_) > 0) { + if (i < 7 && !p_316624_.isClientSide) { + BlockState blockstate = addItem(p_316715_, p_316118_, p_316624_, p_316660_, p_316332_); + p_316624_.levelEvent(1500, p_316660_, p_316118_ != blockstate ? 1 : 0); +@@ -261,7 +_,7 @@ public static BlockState insertItem(Entity p_270919_, BlockState p_270087_, ServerLevel p_270284_, ItemStack p_270253_, BlockPos p_270678_) { int i = p_270087_.getValue(LEVEL); @@ -42,7 +43,7 @@ BlockState blockstate = addItem(p_270919_, p_270087_, p_270284_, p_270678_, p_270253_); p_270253_.shrink(1); return blockstate; -@@ -284,7 +_,7 @@ +@@ -292,7 +_,7 @@ static BlockState addItem(@Nullable Entity p_270464_, BlockState p_270603_, LevelAccessor p_270151_, BlockPos p_270547_, ItemStack p_270354_) { int i = p_270603_.getValue(LEVEL); @@ -51,7 +52,7 @@ if ((i != 0 || !(f > 0.0F)) && !(p_270151_.getRandom().nextDouble() < (double)f)) { return p_270603_; } else { -@@ -384,7 +_,7 @@ +@@ -392,7 +_,7 @@ @Override public boolean canPlaceItemThroughFace(int p_52028_, ItemStack p_52029_, @Nullable Direction p_52030_) { @@ -60,7 +61,7 @@ } @Override -@@ -442,5 +_,11 @@ +@@ -450,5 +_,11 @@ ComposterBlock.empty(null, this.state, this.level, this.pos); this.changed = true; } diff --git a/patches/net/minecraft/world/level/block/ConcretePowderBlock.java.patch b/patches/net/minecraft/world/level/block/ConcretePowderBlock.java.patch index 61c6b4be8e8..30355c02201 100644 --- a/patches/net/minecraft/world/level/block/ConcretePowderBlock.java.patch +++ b/patches/net/minecraft/world/level/block/ConcretePowderBlock.java.patch @@ -27,7 +27,7 @@ boolean flag = false; BlockPos.MutableBlockPos blockpos$mutableblockpos = p_52066_.mutable(); - for(Direction direction : Direction.values()) { + for (Direction direction : Direction.values()) { BlockState blockstate = p_52065_.getBlockState(blockpos$mutableblockpos); - if (direction != Direction.DOWN || canSolidify(blockstate)) { + if (direction != Direction.DOWN || state.canBeHydrated(p_52065_, p_52066_, blockstate.getFluidState(), blockpos$mutableblockpos)) { @@ -41,7 +41,7 @@ @@ -76,7 +_,7 @@ @Override - public BlockState updateShape(BlockState p_52074_, Direction p_52075_, BlockState p_52076_, LevelAccessor p_52077_, BlockPos p_52078_, BlockPos p_52079_) { + protected BlockState updateShape(BlockState p_52074_, Direction p_52075_, BlockState p_52076_, LevelAccessor p_52077_, BlockPos p_52078_, BlockPos p_52079_) { - return touchesLiquid(p_52077_, p_52078_) + return touchesLiquid(p_52077_, p_52078_, p_52074_) ? this.concrete.defaultBlockState() diff --git a/patches/net/minecraft/world/level/block/CoralBlock.java.patch b/patches/net/minecraft/world/level/block/CoralBlock.java.patch index b24ed10f964..5a1ed63e3c4 100644 --- a/patches/net/minecraft/world/level/block/CoralBlock.java.patch +++ b/patches/net/minecraft/world/level/block/CoralBlock.java.patch @@ -5,7 +5,7 @@ protected boolean scanForWater(BlockGetter p_52135_, BlockPos p_52136_) { + BlockState state = p_52135_.getBlockState(p_52136_); - for(Direction direction : Direction.values()) { + for (Direction direction : Direction.values()) { FluidState fluidstate = p_52135_.getFluidState(p_52136_.relative(direction)); - if (fluidstate.is(FluidTags.WATER)) { + if (state.canBeHydrated(p_52135_, p_52136_, fluidstate, p_52136_.relative(direction))) { diff --git a/patches/net/minecraft/world/level/block/CropBlock.java.patch b/patches/net/minecraft/world/level/block/CropBlock.java.patch index 66570649771..30100c78d64 100644 --- a/patches/net/minecraft/world/level/block/CropBlock.java.patch +++ b/patches/net/minecraft/world/level/block/CropBlock.java.patch @@ -3,7 +3,7 @@ @@ -84,12 +_,14 @@ @Override - public void randomTick(BlockState p_221050_, ServerLevel p_221051_, BlockPos p_221052_, RandomSource p_221053_) { + protected void randomTick(BlockState p_221050_, ServerLevel p_221051_, BlockPos p_221052_, RandomSource p_221053_) { + if (!p_221051_.isAreaLoaded(p_221052_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light if (p_221051_.getRawBrightness(p_221052_, 0) >= 9) { int i = this.getAge(p_221050_); @@ -17,7 +17,7 @@ } } @@ -117,9 +_,9 @@ - for(int j = -1; j <= 1; ++j) { + for (int j = -1; j <= 1; j++) { float f1 = 0.0F; BlockState blockstate = p_52274_.getBlockState(blockpos.offset(i, 0, j)); - if (blockstate.is(Blocks.FARMLAND)) { @@ -31,7 +31,7 @@ @@ -164,7 +_,7 @@ @Override - public void entityInside(BlockState p_52277_, Level p_52278_, BlockPos p_52279_, Entity p_52280_) { + protected void entityInside(BlockState p_52277_, Level p_52278_, BlockPos p_52279_, Entity p_52280_) { - if (p_52280_ instanceof Ravager && p_52278_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (p_52280_ instanceof Ravager && net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(p_52278_, p_52280_)) { p_52278_.destroyBlock(p_52279_, true, p_52280_); diff --git a/patches/net/minecraft/world/level/block/DropExperienceBlock.java.patch b/patches/net/minecraft/world/level/block/DropExperienceBlock.java.patch index 415c4cff820..9bb64440903 100644 --- a/patches/net/minecraft/world/level/block/DropExperienceBlock.java.patch +++ b/patches/net/minecraft/world/level/block/DropExperienceBlock.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/world/level/block/DropExperienceBlock.java @@ -30,8 +_,11 @@ @Override - public void spawnAfterBreak(BlockState p_221086_, ServerLevel p_221087_, BlockPos p_221088_, ItemStack p_221089_, boolean p_221090_) { + protected void spawnAfterBreak(BlockState p_221086_, ServerLevel p_221087_, BlockPos p_221088_, ItemStack p_221089_, boolean p_221090_) { super.spawnAfterBreak(p_221086_, p_221087_, p_221088_, p_221089_, p_221090_); - if (p_221090_) { - this.tryDropExperience(p_221087_, p_221088_, p_221089_, this.xpRange); diff --git a/patches/net/minecraft/world/level/block/DropperBlock.java.patch b/patches/net/minecraft/world/level/block/DropperBlock.java.patch index 7ecf9aae7c7..d130ce886b2 100644 --- a/patches/net/minecraft/world/level/block/DropperBlock.java.patch +++ b/patches/net/minecraft/world/level/block/DropperBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/DropperBlock.java +++ b/net/minecraft/world/level/block/DropperBlock.java -@@ -55,7 +_,7 @@ +@@ -56,7 +_,7 @@ p_52944_.levelEvent(1001, p_52945_, 0); } else { ItemStack itemstack = dispenserblockentity.getItem(i); diff --git a/patches/net/minecraft/world/level/block/EnchantingTableBlock.java.patch b/patches/net/minecraft/world/level/block/EnchantingTableBlock.java.patch new file mode 100644 index 00000000000..7bca3e7ddf2 --- /dev/null +++ b/patches/net/minecraft/world/level/block/EnchantingTableBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/level/block/EnchantingTableBlock.java ++++ b/net/minecraft/world/level/block/EnchantingTableBlock.java +@@ -47,7 +_,7 @@ + } + + public static boolean isValidBookShelf(Level p_340976_, BlockPos p_340984_, BlockPos p_341294_) { +- return p_340976_.getBlockState(p_340984_.offset(p_341294_)).is(BlockTags.ENCHANTMENT_POWER_PROVIDER) ++ return p_340976_.getBlockState(p_340984_.offset(p_341294_)).getEnchantPowerBonus(p_340976_, p_340984_.offset(p_341294_)) != 0 + && p_340976_.getBlockState(p_340984_.offset(p_341294_.getX() / 2, p_341294_.getY(), p_341294_.getZ() / 2)) + .is(BlockTags.ENCHANTMENT_POWER_TRANSMITTER); + } diff --git a/patches/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch b/patches/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch deleted file mode 100644 index 8c5ee13256a..00000000000 --- a/patches/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/block/EnchantmentTableBlock.java -+++ b/net/minecraft/world/level/block/EnchantmentTableBlock.java -@@ -50,7 +_,7 @@ - } - - public static boolean isValidBookShelf(Level p_207910_, BlockPos p_207911_, BlockPos p_207912_) { -- return p_207910_.getBlockState(p_207911_.offset(p_207912_)).is(BlockTags.ENCHANTMENT_POWER_PROVIDER) -+ return p_207910_.getBlockState(p_207911_.offset(p_207912_)).getEnchantPowerBonus(p_207910_, p_207911_.offset(p_207912_)) != 0 - && p_207910_.getBlockState(p_207911_.offset(p_207912_.getX() / 2, p_207912_.getY(), p_207912_.getZ() / 2)) - .is(BlockTags.ENCHANTMENT_POWER_TRANSMITTER); - } diff --git a/patches/net/minecraft/world/level/block/FarmBlock.java.patch b/patches/net/minecraft/world/level/block/FarmBlock.java.patch index a8abd2b11dc..73a1ea523f5 100644 --- a/patches/net/minecraft/world/level/block/FarmBlock.java.patch +++ b/patches/net/minecraft/world/level/block/FarmBlock.java.patch @@ -24,7 +24,7 @@ private static boolean isNearWater(LevelReader p_53259_, BlockPos p_53260_) { + BlockState state = p_53259_.getBlockState(p_53260_); - for(BlockPos blockpos : BlockPos.betweenClosed(p_53260_.offset(-4, 0, -4), p_53260_.offset(4, 1, 4))) { + for (BlockPos blockpos : BlockPos.betweenClosed(p_53260_.offset(-4, 0, -4), p_53260_.offset(4, 1, 4))) { - if (p_53259_.getFluidState(blockpos).is(FluidTags.WATER)) { + if (state.canBeHydrated(p_53259_, p_53260_, p_53259_.getFluidState(blockpos), blockpos)) { return true; diff --git a/patches/net/minecraft/world/level/block/FenceGateBlock.java.patch b/patches/net/minecraft/world/level/block/FenceGateBlock.java.patch index aa22fba5385..e31aaf5e230 100644 --- a/patches/net/minecraft/world/level/block/FenceGateBlock.java.patch +++ b/patches/net/minecraft/world/level/block/FenceGateBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/FenceGateBlock.java +++ b/net/minecraft/world/level/block/FenceGateBlock.java -@@ -32,7 +_,9 @@ +@@ -31,7 +_,9 @@ public class FenceGateBlock extends HorizontalDirectionalBlock { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( @@ -11,7 +11,7 @@ .apply(p_308823_, FenceGateBlock::new) ); public static final BooleanProperty OPEN = BlockStateProperties.OPEN; -@@ -50,6 +_,8 @@ +@@ -49,6 +_,8 @@ protected static final VoxelShape X_OCCLUSION_SHAPE = Shapes.or(Block.box(7.0, 5.0, 0.0, 9.0, 16.0, 2.0), Block.box(7.0, 5.0, 14.0, 9.0, 16.0, 16.0)); protected static final VoxelShape Z_OCCLUSION_SHAPE_LOW = Shapes.or(Block.box(0.0, 2.0, 7.0, 2.0, 13.0, 9.0), Block.box(14.0, 2.0, 7.0, 16.0, 13.0, 9.0)); protected static final VoxelShape X_OCCLUSION_SHAPE_LOW = Shapes.or(Block.box(7.0, 2.0, 0.0, 9.0, 13.0, 2.0), Block.box(7.0, 2.0, 14.0, 9.0, 13.0, 16.0)); @@ -20,7 +20,7 @@ private final WoodType type; @Override -@@ -58,8 +_,17 @@ +@@ -57,8 +_,17 @@ } public FenceGateBlock(WoodType p_273340_, BlockBehaviour.Properties p_273352_) { @@ -40,7 +40,7 @@ this.registerDefaultState( this.stateDefinition .any() -@@ -170,7 +_,7 @@ +@@ -169,7 +_,7 @@ p_53366_.playSound( p_53368_, p_53367_, @@ -49,7 +49,7 @@ SoundSource.BLOCKS, 1.0F, p_53366_.getRandom().nextFloat() * 0.1F + 0.9F -@@ -187,7 +_,7 @@ +@@ -186,7 +_,7 @@ p_311813_.playSound( null, p_312680_, @@ -58,7 +58,7 @@ SoundSource.BLOCKS, 1.0F, p_311813_.getRandom().nextFloat() * 0.1F + 0.9F -@@ -208,7 +_,7 @@ +@@ -207,7 +_,7 @@ p_53373_.playSound( null, p_53374_, diff --git a/patches/net/minecraft/world/level/block/FireBlock.java.patch b/patches/net/minecraft/world/level/block/FireBlock.java.patch index d574e278362..0842498c3ae 100644 --- a/patches/net/minecraft/world/level/block/FireBlock.java.patch +++ b/patches/net/minecraft/world/level/block/FireBlock.java.patch @@ -8,7 +8,7 @@ + if (!this.canCatchFire(p_53471_, blockpos, Direction.UP) && !blockstate.isFaceSturdy(p_53471_, blockpos, Direction.UP)) { BlockState blockstate1 = this.defaultBlockState(); - for(Direction direction : Direction.values()) { + for (Direction direction : Direction.values()) { BooleanProperty booleanproperty = PROPERTY_BY_DIRECTION.get(direction); if (booleanproperty != null) { - blockstate1 = blockstate1.setValue(booleanproperty, Boolean.valueOf(this.canBurn(p_53471_.getBlockState(p_53472_.relative(direction))))); @@ -52,7 +52,7 @@ + this.checkBurnOut(p_221161_, p_221162_.south(), 300 + k, p_221163_, i, Direction.NORTH); BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); - for(int l = -1; l <= 1; ++l) { + for (int l = -1; l <= 1; l++) { @@ -240,33 +_,32 @@ || p_53429_.isRainingAt(p_53430_.south()); } @@ -96,7 +96,7 @@ @@ -277,7 +_,7 @@ private boolean isValidFireLocation(BlockGetter p_53486_, BlockPos p_53487_) { - for(Direction direction : Direction.values()) { + for (Direction direction : Direction.values()) { - if (this.canBurn(p_53486_.getBlockState(p_53487_.relative(direction)))) { + if (this.canCatchFire(p_53486_, p_53487_.relative(direction), direction.getOpposite())) { return true; @@ -104,7 +104,7 @@ } @@ -293,7 +_,7 @@ - for(Direction direction : Direction.values()) { + for (Direction direction : Direction.values()) { BlockState blockstate = p_221157_.getBlockState(p_221158_.relative(direction)); - i = Math.max(this.getIgniteOdds(blockstate), i); + i = Math.max(blockstate.getFireSpreadSpeed(p_221157_, p_221158_.relative(direction), direction.getOpposite()), i); diff --git a/patches/net/minecraft/world/level/block/FlowerBlock.java.patch b/patches/net/minecraft/world/level/block/FlowerBlock.java.patch deleted file mode 100644 index 848ca271d74..00000000000 --- a/patches/net/minecraft/world/level/block/FlowerBlock.java.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- a/net/minecraft/world/level/block/FlowerBlock.java -+++ b/net/minecraft/world/level/block/FlowerBlock.java -@@ -21,20 +_,27 @@ - ); - protected static final float AABB_OFFSET = 3.0F; - protected static final VoxelShape SHAPE = Block.box(5.0, 0.0, 5.0, 11.0, 10.0, 11.0); -- private final List suspiciousStewEffects; -+ private final java.util.function.Supplier> suspiciousStewEffectSupplier; -+ -+ public FlowerBlock(java.util.function.Supplier effectSupplier, int p_53513_, BlockBehaviour.Properties p_53514_) { -+ super(p_53514_); -+ this.suspiciousStewEffectSupplier = () -> makeEffectList(effectSupplier.get(), p_53513_); -+ } - - @Override - public MapCodec codec() { - return CODEC; - } - -+ /** @deprecated FORGE: Use supplier version instead */ -+ @Deprecated - public FlowerBlock(MobEffect p_53512_, int p_53513_, BlockBehaviour.Properties p_53514_) { - this(makeEffectList(p_53512_, p_53513_), p_53514_); - } - - public FlowerBlock(List p_304513_, BlockBehaviour.Properties p_304822_) { - super(p_304822_); -- this.suspiciousStewEffects = p_304513_; -+ this.suspiciousStewEffectSupplier = () -> p_304513_; - } - - protected static List makeEffectList(MobEffect p_304981_, int p_304406_) { -@@ -56,6 +_,6 @@ - - @Override - public List getSuspiciousEffects() { -- return this.suspiciousStewEffects; -+ return this.suspiciousStewEffectSupplier.get(); - } - } diff --git a/patches/net/minecraft/world/level/block/FlowerPotBlock.java.patch b/patches/net/minecraft/world/level/block/FlowerPotBlock.java.patch index 3d349da8037..fc5bc0ea45b 100644 --- a/patches/net/minecraft/world/level/block/FlowerPotBlock.java.patch +++ b/patches/net/minecraft/world/level/block/FlowerPotBlock.java.patch @@ -43,25 +43,25 @@ } @Override -@@ -62,7 +_,7 @@ - public InteractionResult use(BlockState p_53540_, Level p_53541_, BlockPos p_53542_, Player p_53543_, InteractionHand p_53544_, BlockHitResult p_53545_) { - ItemStack itemstack = p_53543_.getItemInHand(p_53544_); - Item item = itemstack.getItem(); -- BlockState blockstate = (item instanceof BlockItem ? POTTED_BY_CONTENT.getOrDefault(((BlockItem)item).getBlock(), Blocks.AIR) : Blocks.AIR) -+ BlockState blockstate = (item instanceof BlockItem ? getEmptyPot().fullPots.getOrDefault(net.minecraft.core.registries.BuiltInRegistries.BLOCK.getKey(((BlockItem)item).getBlock()), () -> Blocks.AIR).get() : Blocks.AIR) +@@ -58,7 +_,7 @@ + ItemStack p_316610_, BlockState p_316240_, Level p_316456_, BlockPos p_316502_, Player p_316491_, InteractionHand p_316444_, BlockHitResult p_316826_ + ) { + BlockState blockstate = (p_316610_.getItem() instanceof BlockItem blockitem +- ? POTTED_BY_CONTENT.getOrDefault(blockitem.getBlock(), Blocks.AIR) ++ ? getEmptyPot().fullPots.getOrDefault(net.minecraft.core.registries.BuiltInRegistries.BLOCK.getKey(blockitem.getBlock()), () -> Blocks.AIR).get() + : Blocks.AIR) .defaultBlockState(); - boolean flag = blockstate.is(Blocks.AIR); - boolean flag1 = this.isEmpty(); -@@ -81,7 +_,7 @@ - p_53543_.drop(itemstack1, false); - } - -- p_53541_.setBlock(p_53542_, Blocks.FLOWER_POT.defaultBlockState(), 3); -+ p_53541_.setBlock(p_53542_, getEmptyPot().defaultBlockState(), 3); + if (blockstate.isAir()) { +@@ -84,7 +_,7 @@ + p_316338_.drop(itemstack, false); } - p_53541_.gameEvent(p_53543_, GameEvent.BLOCK_CHANGE, p_53542_); -@@ -108,11 +_,32 @@ +- p_316655_.setBlock(p_316654_, Blocks.FLOWER_POT.defaultBlockState(), 3); ++ p_316655_.setBlock(p_316654_, getEmptyPot().defaultBlockState(), 3); + p_316655_.gameEvent(p_316338_, GameEvent.BLOCK_CHANGE, p_316654_); + return InteractionResult.sidedSuccess(p_316655_.isClientSide); + } +@@ -107,11 +_,32 @@ } public Block getPotted() { @@ -70,7 +70,7 @@ } @Override - public boolean isPathfindable(BlockState p_53535_, BlockGetter p_53536_, BlockPos p_53537_, PathComputationType p_53538_) { + protected boolean isPathfindable(BlockState p_53535_, PathComputationType p_53538_) { return false; } + diff --git a/patches/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch b/patches/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch index 7feadf75292..197469ef8aa 100644 --- a/patches/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch +++ b/patches/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch @@ -3,7 +3,7 @@ @@ -42,10 +_,11 @@ @Override - public void randomTick(BlockState p_221350_, ServerLevel p_221351_, BlockPos p_221352_, RandomSource p_221353_) { + protected void randomTick(BlockState p_221350_, ServerLevel p_221351_, BlockPos p_221352_, RandomSource p_221353_) { - if (p_221350_.getValue(AGE) < 25 && p_221353_.nextDouble() < this.growPerTickProbability) { + if (p_221350_.getValue(AGE) < 25 && net.neoforged.neoforge.common.CommonHooks.onCropsGrowPre(p_221351_, p_221352_.relative(this.growthDirection), p_221351_.getBlockState(p_221352_.relative(this.growthDirection)), p_221353_.nextDouble() < this.growPerTickProbability)) { BlockPos blockpos = p_221352_.relative(this.growthDirection); diff --git a/patches/net/minecraft/world/level/block/LiquidBlock.java.patch b/patches/net/minecraft/world/level/block/LiquidBlock.java.patch index 97aab8e6724..bc1dea49693 100644 --- a/patches/net/minecraft/world/level/block/LiquidBlock.java.patch +++ b/patches/net/minecraft/world/level/block/LiquidBlock.java.patch @@ -1,56 +1,9 @@ --- a/net/minecraft/world/level/block/LiquidBlock.java +++ b/net/minecraft/world/level/block/LiquidBlock.java -@@ -51,7 +_,9 @@ - .apply(p_308830_, LiquidBlock::new) - ); - public static final IntegerProperty LEVEL = BlockStateProperties.LEVEL; -- protected final FlowingFluid fluid; -+ /** Neo: Field accesses are redirected to {@link #getFluid()} with a coremod. */ -+ @Deprecated // Use getFluid -+ private final FlowingFluid fluid; - private final List stateCache; - public static final VoxelShape STABLE_SHAPE = Block.box(0.0, 0.0, 0.0, 16.0, 8.0, 16.0); - public static final ImmutableList POSSIBLE_FLOW_DIRECTIONS = ImmutableList.of( -@@ -63,6 +_,7 @@ - return CODEC; - } - -+ @Deprecated // Forge: Use the constructor that takes a supplier - public LiquidBlock(FlowingFluid p_54694_, BlockBehaviour.Properties p_54695_) { - super(p_54695_); - this.fluid = p_54694_; -@@ -75,6 +_,19 @@ - - this.stateCache.add(p_54694_.getFlowing(8, true)); - this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0))); -+ fluidStateCacheInitialized = true; -+ supplier = () -> p_54694_; -+ } -+ -+ /** -+ * @param fluid A fluid supplier such as {@link net.neoforged.neoforge.registries.DeferredHolder} -+ */ -+ public LiquidBlock(java.util.function.Supplier fluid, BlockBehaviour.Properties p_54695_) { -+ super(p_54695_); -+ this.fluid = null; -+ this.stateCache = Lists.newArrayList(); -+ this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0))); -+ this.supplier = fluid; - } - - @Override -@@ -109,6 +_,7 @@ - @Override - public FluidState getFluidState(BlockState p_54765_) { - int i = p_54765_.getValue(LEVEL); -+ if (!fluidStateCacheInitialized) initFluidStateCache(); - return this.stateCache.get(Math.min(i, 8)); - } - @@ -134,7 +_,7 @@ @Override - public void onPlace(BlockState p_54754_, Level p_54755_, BlockPos p_54756_, BlockState p_54757_, boolean p_54758_) { + protected void onPlace(BlockState p_54754_, Level p_54755_, BlockPos p_54756_, BlockState p_54757_, boolean p_54758_) { - if (this.shouldSpreadLiquid(p_54755_, p_54756_, p_54754_)) { + if (!net.neoforged.neoforge.fluids.FluidInteractionRegistry.canInteract(p_54755_, p_54756_)) { p_54755_.scheduleTick(p_54756_, p_54754_.getFluidState().getType(), this.fluid.getTickDelay(p_54755_)); @@ -59,7 +12,7 @@ @@ -150,11 +_,12 @@ @Override - public void neighborChanged(BlockState p_54709_, Level p_54710_, BlockPos p_54711_, Block p_54712_, BlockPos p_54713_, boolean p_54714_) { + protected void neighborChanged(BlockState p_54709_, Level p_54710_, BlockPos p_54711_, Block p_54712_, BlockPos p_54713_, boolean p_54714_) { - if (this.shouldSpreadLiquid(p_54710_, p_54711_, p_54709_)) { + if (!net.neoforged.neoforge.fluids.FluidInteractionRegistry.canInteract(p_54710_, p_54711_)) { p_54710_.scheduleTick(p_54711_, p_54709_.getFluidState().getType(), this.fluid.getTickDelay(p_54710_)); @@ -70,29 +23,3 @@ private boolean shouldSpreadLiquid(Level p_54697_, BlockPos p_54698_, BlockState p_54699_) { if (this.fluid.is(FluidTags.LAVA)) { boolean flag = p_54697_.getBlockState(p_54698_.below()).is(Blocks.SOUL_SOIL); -@@ -195,6 +_,25 @@ - return new ItemStack(this.fluid.getBucket()); - } else { - return ItemStack.EMPTY; -+ } -+ } -+ -+ // Forge start -+ private final java.util.function.Supplier supplier; -+ public FlowingFluid getFluid() { -+ return (FlowingFluid)supplier.get(); -+ } -+ -+ private boolean fluidStateCacheInitialized = false; -+ protected synchronized void initFluidStateCache() { -+ if (fluidStateCacheInitialized == false) { -+ this.stateCache.add(getFluid().getSource(false)); -+ -+ for (int i = 1; i < 8; ++i) -+ this.stateCache.add(getFluid().getFlowing(8 - i, false)); -+ -+ this.stateCache.add(getFluid().getFlowing(8, true)); -+ fluidStateCacheInitialized = true; - } - } - diff --git a/patches/net/minecraft/world/level/block/MushroomBlock.java.patch b/patches/net/minecraft/world/level/block/MushroomBlock.java.patch index 5a11312d50d..7c60905760d 100644 --- a/patches/net/minecraft/world/level/block/MushroomBlock.java.patch +++ b/patches/net/minecraft/world/level/block/MushroomBlock.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/level/block/MushroomBlock.java +++ b/net/minecraft/world/level/block/MushroomBlock.java -@@ -88,7 +_,7 @@ - if (blockstate.is(BlockTags.MUSHROOM_GROW_BLOCK)) { - return true; - } else { -- return p_54881_.getRawBrightness(p_54882_, 0) < 13 && this.mayPlaceOn(blockstate, p_54881_, blockpos); -+ return p_54881_.getRawBrightness(p_54882_, 0) < 13 && blockstate.canSustainPlant(p_54881_, blockpos, net.minecraft.core.Direction.UP, this); - } +@@ -87,7 +_,7 @@ + BlockState blockstate = p_54881_.getBlockState(blockpos); + return blockstate.is(BlockTags.MUSHROOM_GROW_BLOCK) + ? true +- : p_54881_.getRawBrightness(p_54882_, 0) < 13 && this.mayPlaceOn(blockstate, p_54881_, blockpos); ++ : p_54881_.getRawBrightness(p_54882_, 0) < 13 && blockstate.canSustainPlant(p_54881_, blockpos, net.minecraft.core.Direction.UP, this); } -@@ -99,8 +_,10 @@ + public boolean growMushroom(ServerLevel p_221774_, BlockPos p_221775_, BlockState p_221776_, RandomSource p_221777_) { +@@ -97,8 +_,10 @@ if (optional.isEmpty()) { return false; } else { diff --git a/patches/net/minecraft/world/level/block/NetherWartBlock.java.patch b/patches/net/minecraft/world/level/block/NetherWartBlock.java.patch index 95735a59083..2860dd6f519 100644 --- a/patches/net/minecraft/world/level/block/NetherWartBlock.java.patch +++ b/patches/net/minecraft/world/level/block/NetherWartBlock.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/world/level/block/NetherWartBlock.java @@ -55,9 +_,10 @@ @Override - public void randomTick(BlockState p_221806_, ServerLevel p_221807_, BlockPos p_221808_, RandomSource p_221809_) { + protected void randomTick(BlockState p_221806_, ServerLevel p_221807_, BlockPos p_221808_, RandomSource p_221809_) { int i = p_221806_.getValue(AGE); - if (i < 3 && p_221809_.nextInt(10) == 0) { + if (i < 3 && net.neoforged.neoforge.common.CommonHooks.onCropsGrowPre(p_221807_, p_221808_, p_221806_, p_221809_.nextInt(10) == 0)) { diff --git a/patches/net/minecraft/world/level/block/NoteBlock.java.patch b/patches/net/minecraft/world/level/block/NoteBlock.java.patch index 01e91d43ce7..5c0e59dbd27 100644 --- a/patches/net/minecraft/world/level/block/NoteBlock.java.patch +++ b/patches/net/minecraft/world/level/block/NoteBlock.java.patch @@ -1,20 +1,20 @@ --- a/net/minecraft/world/level/block/NoteBlock.java +++ b/net/minecraft/world/level/block/NoteBlock.java -@@ -104,7 +_,9 @@ - } else if (p_55035_.isClientSide) { +@@ -110,7 +_,9 @@ + if (p_316774_.isClientSide) { return InteractionResult.SUCCESS; } else { -- p_55034_ = p_55034_.cycle(NOTE); -+ int _new = net.neoforged.neoforge.common.CommonHooks.onNoteChange(p_55035_, p_55036_, p_55034_, p_55034_.getValue(NOTE), p_55034_.cycle(NOTE).getValue(NOTE)); +- p_316441_ = p_316441_.cycle(NOTE); ++ int _new = net.neoforged.neoforge.common.CommonHooks.onNoteChange(p_316774_, p_316344_, p_316441_, p_316441_.getValue(NOTE), p_316441_.cycle(NOTE).getValue(NOTE)); + if (_new == -1) return InteractionResult.FAIL; -+ p_55034_ = p_55034_.setValue(NOTE, _new); - p_55035_.setBlock(p_55036_, p_55034_, 3); - this.playNote(p_55037_, p_55034_, p_55035_, p_55036_); - p_55037_.awardStat(Stats.TUNE_NOTEBLOCK); -@@ -126,6 +_,9 @@ ++ p_316441_ = p_316441_.setValue(NOTE, _new); + p_316774_.setBlock(p_316344_, p_316441_, 3); + this.playNote(p_316884_, p_316441_, p_316774_, p_316344_); + p_316884_.awardStat(Stats.TUNE_NOTEBLOCK); +@@ -132,6 +_,9 @@ @Override - public boolean triggerEvent(BlockState p_55023_, Level p_55024_, BlockPos p_55025_, int p_55026_, int p_55027_) { + protected boolean triggerEvent(BlockState p_55023_, Level p_55024_, BlockPos p_55025_, int p_55026_, int p_55027_) { + net.neoforged.neoforge.event.level.NoteBlockEvent.Play e = new net.neoforged.neoforge.event.level.NoteBlockEvent.Play(p_55024_, p_55025_, p_55023_, p_55023_.getValue(NOTE), p_55023_.getValue(INSTRUMENT)); + if (net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(e).isCanceled()) return false; + p_55023_ = p_55023_.setValue(NOTE, e.getVanillaNoteId()).setValue(INSTRUMENT, e.getInstrument()); diff --git a/patches/net/minecraft/world/level/block/PointedDripstoneBlock.java.patch b/patches/net/minecraft/world/level/block/PointedDripstoneBlock.java.patch index 93e5e043fe1..433f12e7c78 100644 --- a/patches/net/minecraft/world/level/block/PointedDripstoneBlock.java.patch +++ b/patches/net/minecraft/world/level/block/PointedDripstoneBlock.java.patch @@ -26,7 +26,7 @@ BlockPos blockpos = findTip(p_221860_, p_221861_, p_221862_, 11, false); if (blockpos != null) { if (optional.get().sourceState.is(Blocks.MUD) && fluid == Fluids.WATER) { -@@ -409,7 +_,8 @@ +@@ -411,7 +_,8 @@ double d2 = (double)((float)(p_154073_.getY() + 1) - 0.6875F) - 0.0625; double d3 = (double)p_154073_.getZ() + 0.5 + vec3.z; Fluid fluid = getDripFluid(p_154072_, p_154075_); @@ -36,7 +36,7 @@ p_154072_.addParticle(particleoptions, d1, d2, d3, 0.0, 0.0, 0.0); } -@@ -561,7 +_,7 @@ +@@ -563,7 +_,7 @@ } private static boolean canFillCauldron(Fluid p_154159_) { diff --git a/patches/net/minecraft/world/level/block/PoweredRailBlock.java.patch b/patches/net/minecraft/world/level/block/PoweredRailBlock.java.patch index 6f6a3e10d08..8f925a7093b 100644 --- a/patches/net/minecraft/world/level/block/PoweredRailBlock.java.patch +++ b/patches/net/minecraft/world/level/block/PoweredRailBlock.java.patch @@ -26,10 +26,10 @@ boolean flag = true; - RailShape railshape = p_55222_.getValue(SHAPE); + RailShape railshape = p_55222_.getValue(getShapeProperty()); - switch(railshape) { + switch (railshape) { case NORTH_SOUTH: if (p_55223_) { -@@ -112,18 +_,18 @@ +@@ -110,18 +_,18 @@ protected boolean isSameRailWithPower(Level p_55226_, BlockPos p_55227_, boolean p_55228_, int p_55229_, RailShape p_55230_) { BlockState blockstate = p_55226_.getBlockState(p_55227_); @@ -52,7 +52,7 @@ } } else { return false; -@@ -143,7 +_,7 @@ +@@ -141,7 +_,7 @@ if (flag1 != flag) { p_55233_.setBlock(p_55234_, p_55232_.setValue(POWERED, Boolean.valueOf(flag1)), 3); p_55233_.updateNeighborsAt(p_55234_.below(), this); @@ -61,7 +61,7 @@ p_55233_.updateNeighborsAt(p_55234_.above(), this); } } -@@ -175,6 +_,9 @@ +@@ -173,6 +_,9 @@ return p_55240_.setValue(SHAPE, RailShape.SOUTH_EAST); case NORTH_EAST: return p_55240_.setValue(SHAPE, RailShape.SOUTH_WEST); @@ -70,8 +70,8 @@ + return p_55240_; } case COUNTERCLOCKWISE_90: - switch((RailShape)p_55240_.getValue(SHAPE)) { -@@ -274,6 +_,10 @@ + switch ((RailShape)p_55240_.getValue(SHAPE)) { +@@ -272,6 +_,10 @@ @Override protected void createBlockStateDefinition(StateDefinition.Builder p_55243_) { diff --git a/patches/net/minecraft/world/level/block/PumpkinBlock.java.patch b/patches/net/minecraft/world/level/block/PumpkinBlock.java.patch index afeba8d1319..961523813df 100644 --- a/patches/net/minecraft/world/level/block/PumpkinBlock.java.patch +++ b/patches/net/minecraft/world/level/block/PumpkinBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/PumpkinBlock.java +++ b/net/minecraft/world/level/block/PumpkinBlock.java -@@ -33,7 +_,7 @@ - @Override - public InteractionResult use(BlockState p_55289_, Level p_55290_, BlockPos p_55291_, Player p_55292_, InteractionHand p_55293_, BlockHitResult p_55294_) { - ItemStack itemstack = p_55292_.getItemInHand(p_55293_); -- if (itemstack.is(Items.SHEARS)) { -+ if (itemstack.canPerformAction(net.neoforged.neoforge.common.ToolActions.SHEARS_CARVE)) { - if (!p_55290_.isClientSide) { - Direction direction = p_55294_.getDirection(); - Direction direction1 = direction.getAxis() == Direction.Axis.Y ? p_55292_.getDirection().getOpposite() : direction; +@@ -35,7 +_,7 @@ + protected ItemInteractionResult useItemOn( + ItemStack p_316383_, BlockState p_316676_, Level p_316272_, BlockPos p_316484_, Player p_316367_, InteractionHand p_316216_, BlockHitResult p_316827_ + ) { +- if (!p_316383_.is(Items.SHEARS)) { ++ if (!p_316383_.canPerformAction(net.neoforged.neoforge.common.ToolActions.SHEARS_CARVE)) { + return super.useItemOn(p_316383_, p_316676_, p_316272_, p_316484_, p_316367_, p_316216_, p_316827_); + } else if (p_316272_.isClientSide) { + return ItemInteractionResult.sidedSuccess(p_316272_.isClientSide); diff --git a/patches/net/minecraft/world/level/block/RedStoneOreBlock.java.patch b/patches/net/minecraft/world/level/block/RedStoneOreBlock.java.patch index 535c54c83c5..e0c787463be 100644 --- a/patches/net/minecraft/world/level/block/RedStoneOreBlock.java.patch +++ b/patches/net/minecraft/world/level/block/RedStoneOreBlock.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/level/block/RedStoneOreBlock.java +++ b/net/minecraft/world/level/block/RedStoneOreBlock.java -@@ -87,10 +_,10 @@ +@@ -88,10 +_,10 @@ @Override - public void spawnAfterBreak(BlockState p_221907_, ServerLevel p_221908_, BlockPos p_221909_, ItemStack p_221910_, boolean p_221911_) { + protected void spawnAfterBreak(BlockState p_221907_, ServerLevel p_221908_, BlockPos p_221909_, ItemStack p_221910_, boolean p_221911_) { super.spawnAfterBreak(p_221907_, p_221908_, p_221909_, p_221910_, p_221911_); - if (p_221911_ && EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, p_221910_) == 0) { - int i = 1 + p_221908_.random.nextInt(5); diff --git a/patches/net/minecraft/world/level/block/RedStoneWireBlock.java.patch b/patches/net/minecraft/world/level/block/RedStoneWireBlock.java.patch index 5514cf1208d..79ce4b3f60f 100644 --- a/patches/net/minecraft/world/level/block/RedStoneWireBlock.java.patch +++ b/patches/net/minecraft/world/level/block/RedStoneWireBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/net/minecraft/world/level/block/RedStoneWireBlock.java -@@ -254,7 +_,7 @@ +@@ -253,7 +_,7 @@ BlockState blockstate = p_55523_.getBlockState(blockpos); if (p_55526_) { boolean flag = blockstate.getBlock() instanceof TrapDoorBlock || this.canSurviveOn(p_55523_, blockpos, blockstate); @@ -9,7 +9,7 @@ if (blockstate.isFaceSturdy(p_55523_, blockpos, p_55525_.getOpposite())) { return RedstoneSide.UP; } -@@ -263,10 +_,14 @@ +@@ -262,10 +_,14 @@ } } diff --git a/patches/net/minecraft/world/level/block/SaplingBlock.java.patch b/patches/net/minecraft/world/level/block/SaplingBlock.java.patch index eb57701ff09..a0b98fc1dd1 100644 --- a/patches/net/minecraft/world/level/block/SaplingBlock.java.patch +++ b/patches/net/minecraft/world/level/block/SaplingBlock.java.patch @@ -3,7 +3,7 @@ @@ -46,6 +_,7 @@ @Override - public void randomTick(BlockState p_222011_, ServerLevel p_222012_, BlockPos p_222013_, RandomSource p_222014_) { + protected void randomTick(BlockState p_222011_, ServerLevel p_222012_, BlockPos p_222013_, RandomSource p_222014_) { + if (!p_222012_.isAreaLoaded(p_222013_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light if (p_222012_.getMaxLocalRawBrightness(p_222013_.above()) >= 9 && p_222014_.nextInt(7) == 0) { this.advanceTree(p_222012_, p_222013_, p_222011_, p_222014_); diff --git a/patches/net/minecraft/world/level/block/SculkCatalystBlock.java.patch b/patches/net/minecraft/world/level/block/SculkCatalystBlock.java.patch index aabd3e2e1d7..ef5e723ab48 100644 --- a/patches/net/minecraft/world/level/block/SculkCatalystBlock.java.patch +++ b/patches/net/minecraft/world/level/block/SculkCatalystBlock.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/world/level/block/SculkCatalystBlock.java @@ -66,8 +_,11 @@ @Override - public void spawnAfterBreak(BlockState p_222109_, ServerLevel p_222110_, BlockPos p_222111_, ItemStack p_222112_, boolean p_222113_) { + protected void spawnAfterBreak(BlockState p_222109_, ServerLevel p_222110_, BlockPos p_222111_, ItemStack p_222112_, boolean p_222113_) { super.spawnAfterBreak(p_222109_, p_222110_, p_222111_, p_222112_, p_222113_); - if (p_222113_) { - this.tryDropExperience(p_222110_, p_222111_, p_222112_, this.xpRange); diff --git a/patches/net/minecraft/world/level/block/SculkSensorBlock.java.patch b/patches/net/minecraft/world/level/block/SculkSensorBlock.java.patch index 1ecf2b6a95d..8223c95c39c 100644 --- a/patches/net/minecraft/world/level/block/SculkSensorBlock.java.patch +++ b/patches/net/minecraft/world/level/block/SculkSensorBlock.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/level/block/SculkSensorBlock.java +++ b/net/minecraft/world/level/block/SculkSensorBlock.java -@@ -293,8 +_,11 @@ +@@ -292,8 +_,11 @@ @Override - public void spawnAfterBreak(BlockState p_222142_, ServerLevel p_222143_, BlockPos p_222144_, ItemStack p_222145_, boolean p_222146_) { + protected void spawnAfterBreak(BlockState p_222142_, ServerLevel p_222143_, BlockPos p_222144_, ItemStack p_222145_, boolean p_222146_) { super.spawnAfterBreak(p_222142_, p_222143_, p_222144_, p_222145_, p_222146_); - if (p_222146_) { - this.tryDropExperience(p_222143_, p_222144_, p_222145_, ConstantInt.of(5)); diff --git a/patches/net/minecraft/world/level/block/SculkShriekerBlock.java.patch b/patches/net/minecraft/world/level/block/SculkShriekerBlock.java.patch index c5f6967d3d0..5cc5d1dd9c3 100644 --- a/patches/net/minecraft/world/level/block/SculkShriekerBlock.java.patch +++ b/patches/net/minecraft/world/level/block/SculkShriekerBlock.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/world/level/block/SculkShriekerBlock.java @@ -141,9 +_,12 @@ @Override - public void spawnAfterBreak(BlockState p_222192_, ServerLevel p_222193_, BlockPos p_222194_, ItemStack p_222195_, boolean p_222196_) { + protected void spawnAfterBreak(BlockState p_222192_, ServerLevel p_222193_, BlockPos p_222194_, ItemStack p_222195_, boolean p_222196_) { super.spawnAfterBreak(p_222192_, p_222193_, p_222194_, p_222195_, p_222196_); - if (p_222196_) { - this.tryDropExperience(p_222193_, p_222194_, p_222195_, ConstantInt.of(5)); diff --git a/patches/net/minecraft/world/level/block/SoundType.java.patch b/patches/net/minecraft/world/level/block/SoundType.java.patch index c16dd647eb2..0d3a12b6cd2 100644 --- a/patches/net/minecraft/world/level/block/SoundType.java.patch +++ b/patches/net/minecraft/world/level/block/SoundType.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/SoundType.java +++ b/net/minecraft/world/level/block/SoundType.java -@@ -762,6 +_,7 @@ +@@ -777,6 +_,7 @@ private final SoundEvent hitSound; private final SoundEvent fallSound; diff --git a/patches/net/minecraft/world/level/block/SpawnerBlock.java.patch b/patches/net/minecraft/world/level/block/SpawnerBlock.java.patch index 33c7970ac90..e2a92f48c72 100644 --- a/patches/net/minecraft/world/level/block/SpawnerBlock.java.patch +++ b/patches/net/minecraft/world/level/block/SpawnerBlock.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/world/level/block/SpawnerBlock.java @@ -46,10 +_,12 @@ @Override - public void spawnAfterBreak(BlockState p_222477_, ServerLevel p_222478_, BlockPos p_222479_, ItemStack p_222480_, boolean p_222481_) { + protected void spawnAfterBreak(BlockState p_222477_, ServerLevel p_222478_, BlockPos p_222479_, ItemStack p_222480_, boolean p_222481_) { super.spawnAfterBreak(p_222477_, p_222478_, p_222479_, p_222480_, p_222481_); - if (p_222481_) { - int i = 15 + p_222478_.random.nextInt(15) + p_222478_.random.nextInt(15); diff --git a/patches/net/minecraft/world/level/block/SpongeBlock.java.patch b/patches/net/minecraft/world/level/block/SpongeBlock.java.patch index f14ae78fe1f..69c47ae16d2 100644 --- a/patches/net/minecraft/world/level/block/SpongeBlock.java.patch +++ b/patches/net/minecraft/world/level/block/SpongeBlock.java.patch @@ -16,4 +16,4 @@ + if (!spongeState.canBeHydrated(p_56808_, p_56809_, fluidstate, p_294069_)) { return false; } else { - Block block = blockstate.getBlock(); + if (blockstate.getBlock() instanceof BucketPickup bucketpickup diff --git a/patches/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch b/patches/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch index 16de39696ca..2f24cf95b15 100644 --- a/patches/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch +++ b/patches/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java @@ -42,8 +_,10 @@ @Override - public void randomTick(BlockState p_222508_, ServerLevel p_222509_, BlockPos p_222510_, RandomSource p_222511_) { + protected void randomTick(BlockState p_222508_, ServerLevel p_222509_, BlockPos p_222510_, RandomSource p_222511_) { if (!canBeGrass(p_222508_, p_222509_, p_222510_)) { + if (!p_222509_.isAreaLoaded(p_222510_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading p_222509_.setBlockAndUpdate(p_222510_, Blocks.DIRT.defaultBlockState()); diff --git a/patches/net/minecraft/world/level/block/StairBlock.java.patch b/patches/net/minecraft/world/level/block/StairBlock.java.patch deleted file mode 100644 index f95eedc97a0..00000000000 --- a/patches/net/minecraft/world/level/block/StairBlock.java.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- a/net/minecraft/world/level/block/StairBlock.java -+++ b/net/minecraft/world/level/block/StairBlock.java -@@ -27,7 +_,7 @@ - - public class StairBlock extends Block implements SimpleWaterloggedBlock { - public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( -- p_308839_ -> p_308839_.group(BlockState.CODEC.fieldOf("base_state").forGetter(p_304378_ -> p_304378_.baseState), propertiesCodec()) -+ p_308839_ -> p_308839_.group(BlockState.CODEC.fieldOf("base_state").forGetter(StairBlock::getModelState), propertiesCodec()) - .apply(p_308839_, StairBlock::new) - ); - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; -@@ -47,6 +_,7 @@ - protected static final VoxelShape[] TOP_SHAPES = makeShapes(TOP_AABB, OCTET_NNN, OCTET_PNN, OCTET_NNP, OCTET_PNP); - protected static final VoxelShape[] BOTTOM_SHAPES = makeShapes(BOTTOM_AABB, OCTET_NPN, OCTET_PPN, OCTET_NPP, OCTET_PPP); - private static final int[] SHAPE_BY_STATE = new int[]{12, 5, 3, 10, 14, 13, 7, 11, 13, 7, 11, 14, 8, 4, 1, 2, 4, 1, 2, 8}; -+ /** Neo: Field accesses are redirected to {@link #getModelBlock()} with a coremod. */ - private final Block base; - protected final BlockState baseState; - -@@ -84,7 +_,12 @@ - return voxelshape; - } - -+ @Deprecated // Forge: Use the other constructor that takes a Supplier - public StairBlock(BlockState p_56862_, BlockBehaviour.Properties p_56863_) { -+ this(() -> p_56862_, p_56863_); -+ } -+ -+ public StairBlock(java.util.function.Supplier p_56862_, BlockBehaviour.Properties p_56863_) { - super(p_56863_); - this.registerDefaultState( - this.stateDefinition -@@ -94,8 +_,9 @@ - .setValue(SHAPE, StairsShape.STRAIGHT) - .setValue(WATERLOGGED, Boolean.valueOf(false)) - ); -- this.base = p_56862_.getBlock(); -- this.baseState = p_56862_; -+ this.base = Blocks.AIR; -+ this.baseState = Blocks.AIR.defaultBlockState(); -+ this.stateSupplier = p_56862_; - } - - @Override -@@ -243,4 +_,14 @@ - public boolean isPathfindable(BlockState p_56891_, BlockGetter p_56892_, BlockPos p_56893_, PathComputationType p_56894_) { - return false; - } -+ -+ // Forge Start -+ private final java.util.function.Supplier stateSupplier; -+ private Block getModelBlock() { -+ return getModelState().getBlock(); -+ } -+ protected BlockState getModelState() { -+ return stateSupplier.get(); -+ } -+ // Forge end - } diff --git a/patches/net/minecraft/world/level/block/StemBlock.java.patch b/patches/net/minecraft/world/level/block/StemBlock.java.patch index 638c17a55c2..9d78d1dd4fd 100644 --- a/patches/net/minecraft/world/level/block/StemBlock.java.patch +++ b/patches/net/minecraft/world/level/block/StemBlock.java.patch @@ -3,7 +3,7 @@ @@ -79,18 +_,18 @@ @Override - public void randomTick(BlockState p_222538_, ServerLevel p_222539_, BlockPos p_222540_, RandomSource p_222541_) { + protected void randomTick(BlockState p_222538_, ServerLevel p_222539_, BlockPos p_222540_, RandomSource p_222541_) { + if (!p_222539_.isAreaLoaded(p_222540_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light if (p_222539_.getRawBrightness(p_222540_, 0) >= 9) { float f = CropBlock.getGrowthSpeed(this, p_222539_, p_222540_); diff --git a/patches/net/minecraft/world/level/block/SugarCaneBlock.java.patch b/patches/net/minecraft/world/level/block/SugarCaneBlock.java.patch index 4aa3b4977d6..170176d0de4 100644 --- a/patches/net/minecraft/world/level/block/SugarCaneBlock.java.patch +++ b/patches/net/minecraft/world/level/block/SugarCaneBlock.java.patch @@ -28,14 +28,14 @@ @@ -79,6 +_,8 @@ @Override - public boolean canSurvive(BlockState p_57175_, LevelReader p_57176_, BlockPos p_57177_) { + protected boolean canSurvive(BlockState p_57175_, LevelReader p_57176_, BlockPos p_57177_) { + BlockState soil = p_57176_.getBlockState(p_57177_.below()); + if (soil.canSustainPlant(p_57176_, p_57177_.below(), Direction.UP, this)) return true; BlockState blockstate = p_57176_.getBlockState(p_57177_.below()); if (blockstate.is(this)) { return true; @@ -89,7 +_,7 @@ - for(Direction direction : Direction.Plane.HORIZONTAL) { + for (Direction direction : Direction.Plane.HORIZONTAL) { BlockState blockstate1 = p_57176_.getBlockState(blockpos.relative(direction)); FluidState fluidstate = p_57176_.getFluidState(blockpos.relative(direction)); - if (fluidstate.is(FluidTags.WATER) || blockstate1.is(Blocks.FROSTED_ICE)) { diff --git a/patches/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch b/patches/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch index 05227b72b89..3c4ea82cf36 100644 --- a/patches/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch +++ b/patches/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch @@ -1,15 +1,14 @@ --- a/net/minecraft/world/level/block/SweetBerryBushBlock.java +++ b/net/minecraft/world/level/block/SweetBerryBushBlock.java -@@ -68,10 +_,11 @@ +@@ -69,9 +_,10 @@ @Override - public void randomTick(BlockState p_222563_, ServerLevel p_222564_, BlockPos p_222565_, RandomSource p_222566_) { + protected void randomTick(BlockState p_222563_, ServerLevel p_222564_, BlockPos p_222565_, RandomSource p_222566_) { int i = p_222563_.getValue(AGE); - if (i < 3 && p_222566_.nextInt(5) == 0 && p_222564_.getRawBrightness(p_222565_.above(), 0) >= 9) { + if (i < 3 && p_222564_.getRawBrightness(p_222565_.above(), 0) >= 9 && net.neoforged.neoforge.common.CommonHooks.onCropsGrowPre(p_222564_, p_222565_, p_222563_, p_222566_.nextInt(5) == 0)) { BlockState blockstate = p_222563_.setValue(AGE, Integer.valueOf(i + 1)); p_222564_.setBlock(p_222565_, blockstate, 2); - p_222564_.gameEvent(GameEvent.BLOCK_CHANGE, p_222565_, GameEvent.Context.of(blockstate)); + net.neoforged.neoforge.common.CommonHooks.onCropsGrowPost(p_222564_, p_222565_, p_222563_); + p_222564_.gameEvent(GameEvent.BLOCK_CHANGE, p_222565_, GameEvent.Context.of(blockstate)); } } - diff --git a/patches/net/minecraft/world/level/block/TntBlock.java.patch b/patches/net/minecraft/world/level/block/TntBlock.java.patch index 2b6c30c534f..39d67717bc7 100644 --- a/patches/net/minecraft/world/level/block/TntBlock.java.patch +++ b/patches/net/minecraft/world/level/block/TntBlock.java.patch @@ -8,7 +8,7 @@ + explode(world, pos, igniter); + } + - public void onPlace(BlockState p_57466_, Level p_57467_, BlockPos p_57468_, BlockState p_57469_, boolean p_57470_) { + protected void onPlace(BlockState p_57466_, Level p_57467_, BlockPos p_57468_, BlockState p_57469_, boolean p_57470_) { if (!p_57469_.is(p_57466_.getBlock())) { if (p_57467_.hasNeighborSignal(p_57468_)) { - explode(p_57467_, p_57468_); @@ -18,7 +18,7 @@ } @@ -53,7 +_,7 @@ @Override - public void neighborChanged(BlockState p_57457_, Level p_57458_, BlockPos p_57459_, Block p_57460_, BlockPos p_57461_, boolean p_57462_) { + protected void neighborChanged(BlockState p_57457_, Level p_57458_, BlockPos p_57459_, Block p_57460_, BlockPos p_57461_, boolean p_57462_) { if (p_57458_.hasNeighborSignal(p_57459_)) { - explode(p_57458_, p_57459_); + onCaughtFire(p_57457_, p_57458_, p_57459_, null, null); @@ -47,16 +47,16 @@ private static void explode(Level p_57437_, BlockPos p_57438_, @Nullable LivingEntity p_57439_) { if (!p_57437_.isClientSide) { PrimedTnt primedtnt = new PrimedTnt(p_57437_, (double)p_57438_.getX() + 0.5, (double)p_57438_.getY(), (double)p_57438_.getZ() + 0.5, p_57439_); -@@ -98,7 +_,7 @@ - if (!itemstack.is(Items.FLINT_AND_STEEL) && !itemstack.is(Items.FIRE_CHARGE)) { - return super.use(p_57450_, p_57451_, p_57452_, p_57453_, p_57454_, p_57455_); +@@ -99,7 +_,7 @@ + if (!p_316149_.is(Items.FLINT_AND_STEEL) && !p_316149_.is(Items.FIRE_CHARGE)) { + return super.useItemOn(p_316149_, p_316217_, p_316520_, p_316601_, p_316770_, p_316393_, p_316532_); } else { -- explode(p_57451_, p_57452_, p_57453_); -+ onCaughtFire(p_57450_, p_57451_, p_57452_, p_57455_.getDirection(), p_57453_); - p_57451_.setBlock(p_57452_, Blocks.AIR.defaultBlockState(), 11); - Item item = itemstack.getItem(); - if (!p_57453_.isCreative()) { -@@ -120,7 +_,7 @@ +- explode(p_316520_, p_316601_, p_316770_); ++ onCaughtFire(p_316217_, p_316520_, p_316601_, p_316532_.getDirection(), p_316770_); + p_316520_.setBlock(p_316601_, Blocks.AIR.defaultBlockState(), 11); + Item item = p_316149_.getItem(); + if (!p_316770_.isCreative()) { +@@ -121,7 +_,7 @@ BlockPos blockpos = p_57431_.getBlockPos(); Entity entity = p_57432_.getOwner(); if (p_57432_.isOnFire() && p_57432_.mayInteract(p_57429_, blockpos)) { diff --git a/patches/net/minecraft/world/level/block/TrapDoorBlock.java.patch b/patches/net/minecraft/world/level/block/TrapDoorBlock.java.patch index 5d3ca626220..84183a1c7ad 100644 --- a/patches/net/minecraft/world/level/block/TrapDoorBlock.java.patch +++ b/patches/net/minecraft/world/level/block/TrapDoorBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/TrapDoorBlock.java +++ b/net/minecraft/world/level/block/TrapDoorBlock.java -@@ -204,6 +_,19 @@ +@@ -203,6 +_,19 @@ return super.updateShape(p_57554_, p_57555_, p_57556_, p_57557_, p_57558_, p_57559_); } diff --git a/patches/net/minecraft/world/level/block/TurtleEggBlock.java.patch b/patches/net/minecraft/world/level/block/TurtleEggBlock.java.patch index 5ef6615f8ee..143ed3c617d 100644 --- a/patches/net/minecraft/world/level/block/TurtleEggBlock.java.patch +++ b/patches/net/minecraft/world/level/block/TurtleEggBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/TurtleEggBlock.java +++ b/net/minecraft/world/level/block/TurtleEggBlock.java -@@ -177,7 +_,7 @@ - } else if (!(p_57769_ instanceof LivingEntity)) { +@@ -171,7 +_,7 @@ + if (p_57769_ instanceof Turtle || p_57769_ instanceof Bat) { return false; } else { -- return p_57769_ instanceof Player || p_57768_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); -+ return p_57769_ instanceof Player || net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(p_57768_, p_57769_); +- return !(p_57769_ instanceof LivingEntity) ? false : p_57769_ instanceof Player || p_57768_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); ++ return !(p_57769_ instanceof LivingEntity) ? false : p_57769_ instanceof Player || net.neoforged.neoforge.event.EventHooks.getMobGriefingEvent(p_57768_, p_57769_); } } } diff --git a/patches/net/minecraft/world/level/block/VineBlock.java.patch b/patches/net/minecraft/world/level/block/VineBlock.java.patch index 8248ecea648..f83b32be8e2 100644 --- a/patches/net/minecraft/world/level/block/VineBlock.java.patch +++ b/patches/net/minecraft/world/level/block/VineBlock.java.patch @@ -11,7 +11,7 @@ public static final BooleanProperty NORTH = PipeBlock.NORTH; @@ -183,7 +_,7 @@ @Override - public void randomTick(BlockState p_222655_, ServerLevel p_222656_, BlockPos p_222657_, RandomSource p_222658_) { + protected void randomTick(BlockState p_222655_, ServerLevel p_222656_, BlockPos p_222657_, RandomSource p_222658_) { if (p_222656_.getGameRules().getBoolean(GameRules.RULE_DO_VINES_SPREAD)) { - if (p_222658_.nextInt(4) == 0) { + if (p_222656_.random.nextInt(4) == 0 && p_222656_.isAreaLoaded(p_222657_, 4)) { // Forge: check area to prevent loading unloaded chunks diff --git a/patches/net/minecraft/world/level/block/WeatheringCopperStairBlock.java.patch b/patches/net/minecraft/world/level/block/WeatheringCopperStairBlock.java.patch deleted file mode 100644 index 6e9e3898a6e..00000000000 --- a/patches/net/minecraft/world/level/block/WeatheringCopperStairBlock.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/block/WeatheringCopperStairBlock.java -+++ b/net/minecraft/world/level/block/WeatheringCopperStairBlock.java -@@ -13,7 +_,7 @@ - public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( - p_308852_ -> p_308852_.group( - WeatheringCopper.WeatherState.CODEC.fieldOf("weathering_state").forGetter(ChangeOverTimeBlock::getAge), -- BlockState.CODEC.fieldOf("base_state").forGetter(p_304556_ -> p_304556_.baseState), -+ BlockState.CODEC.fieldOf("base_state").forGetter(StairBlock::getModelState), - propertiesCodec() - ) - .apply(p_308852_, WeatheringCopperStairBlock::new) diff --git a/patches/net/minecraft/world/level/block/WebBlock.java.patch b/patches/net/minecraft/world/level/block/WebBlock.java.patch index b9f66617101..46e92a07149 100644 --- a/patches/net/minecraft/world/level/block/WebBlock.java.patch +++ b/patches/net/minecraft/world/level/block/WebBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/WebBlock.java +++ b/net/minecraft/world/level/block/WebBlock.java -@@ -8,7 +_,7 @@ +@@ -10,7 +_,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; diff --git a/patches/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch b/patches/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch index 32bd58dd54c..3afc5628b46 100644 --- a/patches/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch +++ b/patches/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 -@@ -59,6 +_,7 @@ +@@ -60,6 +_,7 @@ public static final int NUM_DATA_VALUES = 4; public static final int BURN_TIME_STANDARD = 200; public static final int BURN_COOL_SPEED = 2; @@ -8,9 +8,9 @@ protected NonNullList items = NonNullList.withSize(3, ItemStack.EMPTY); int litTime; int litDuration; -@@ -69,9 +_,14 @@ +@@ -72,9 +_,14 @@ public int get(int p_58431_) { - switch(p_58431_) { + switch (p_58431_) { case 0: + if (litDuration > Short.MAX_VALUE) { + // Neo: preserve litTime / litDuration ratio on the client as data slots are synced as shorts. @@ -24,21 +24,31 @@ case 2: return AbstractFurnaceBlockEntity.this.cookingProgress; case 3: -@@ -111,10 +_,29 @@ +@@ -114,18 +_,40 @@ ) { super(p_154991_, p_154992_, p_154993_); this.quickCheck = RecipeManager.createCheck((RecipeType)p_154994_); + this.recipeType = p_154994_; } + public static void invalidateCache() { + fuelCache = null; + } + + /** + * @deprecated Neo: get burn times by calling {@link net.neoforged.neoforge.common.extensions.IItemStackExtension#getBurnTime(RecipeType)} + */ + @Deprecated public static Map getFuel() { - Map map = Maps.newLinkedHashMap(); -+ buildFuels((e, time) -> e.ifRight(tag -> add(map, tag, time)).ifLeft(item -> add(map, item, time))); -+ return map; + Map map = fuelCache; + if (map != null) { + return map; + } else { + Map map1 = Maps.newLinkedHashMap(); ++ buildFuels((e, time) -> e.ifRight(tag -> add(map1, tag, time)).ifLeft(item -> add(map1, item, time))); ++ fuelCache = map1; ++ return map1; ++ } + } + + private static void add(java.util.function.ObjIntConsumer>> consumer, ItemLike item, int time) { @@ -50,22 +60,24 @@ + } + + @org.jetbrains.annotations.ApiStatus.Internal -+ public static void buildFuels(java.util.function.ObjIntConsumer>> map) { - add(map, Items.LAVA_BUCKET, 20000); - add(map, Blocks.COAL_BLOCK, 16000); - add(map, Items.BLAZE_ROD, 2400); -@@ -174,7 +_,6 @@ - add(map, Blocks.AZALEA, 100); - add(map, Blocks.FLOWERING_AZALEA, 100); - add(map, Blocks.MANGROVE_ROOTS, 300); -- return map; ++ public static void buildFuels(java.util.function.ObjIntConsumer>> map1) { ++ { + add(map1, Items.LAVA_BUCKET, 20000); + add(map1, Blocks.COAL_BLOCK, 16000); + add(map1, Items.BLAZE_ROD, 2400); +@@ -185,8 +_,6 @@ + add(map1, Blocks.AZALEA, 100); + add(map1, Blocks.FLOWERING_AZALEA, 100); + add(map1, Blocks.MANGROVE_ROOTS, 300); +- fuelCache = map1; +- return map1; + } } - private static boolean isNeverAFurnaceFuel(Item p_58398_) { -@@ -213,9 +_,9 @@ - super.load(p_155025_); +@@ -226,9 +_,9 @@ + super.loadAdditional(p_155025_, p_323468_); this.items = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); - ContainerHelper.loadAllItems(p_155025_, this.items); + ContainerHelper.loadAllItems(p_155025_, this.items, p_323468_); - this.litTime = p_155025_.getShort("BurnTime"); - this.cookingProgress = p_155025_.getShort("CookTime"); - this.cookingTotalTime = p_155025_.getShort("CookTimeTotal"); @@ -75,20 +87,20 @@ this.litDuration = this.getBurnDuration(this.items.get(1)); CompoundTag compoundtag = p_155025_.getCompound("RecipesUsed"); -@@ -227,9 +_,9 @@ +@@ -240,9 +_,9 @@ @Override - protected void saveAdditional(CompoundTag p_187452_) { - super.saveAdditional(p_187452_); + protected void saveAdditional(CompoundTag p_187452_, HolderLookup.Provider p_323656_) { + super.saveAdditional(p_187452_, p_323656_); - p_187452_.putShort("BurnTime", (short)this.litTime); - p_187452_.putShort("CookTime", (short)this.cookingProgress); - p_187452_.putShort("CookTimeTotal", (short)this.cookingTotalTime); + p_187452_.putInt("BurnTime", this.litTime); + p_187452_.putInt("CookTime", this.cookingProgress); + p_187452_.putInt("CookTimeTotal", this.cookingTotalTime); - ContainerHelper.saveAllItems(p_187452_, this.items); + ContainerHelper.saveAllItems(p_187452_, this.items, p_323656_); CompoundTag compoundtag = new CompoundTag(); this.recipesUsed.forEach((p_187449_, p_187450_) -> compoundtag.putInt(p_187449_.toString(), p_187450_)); -@@ -255,28 +_,30 @@ +@@ -268,28 +_,30 @@ } int i = p_155017_.getMaxStackSize(); @@ -115,7 +127,7 @@ - if (p_155017_.isLit() && canBurn(p_155014_.registryAccess(), recipeholder, p_155017_.items, i)) { + if (p_155017_.isLit() && p_155017_.canBurn(p_155014_.registryAccess(), recipeholder, p_155017_.items, i)) { - ++p_155017_.cookingProgress; + p_155017_.cookingProgress++; if (p_155017_.cookingProgress == p_155017_.cookingTotalTime) { p_155017_.cookingProgress = 0; p_155017_.cookingTotalTime = getTotalCookTime(p_155014_, p_155017_); @@ -124,7 +136,7 @@ p_155017_.setRecipeUsed(recipeholder); } -@@ -300,9 +_,9 @@ +@@ -313,9 +_,9 @@ } } @@ -136,20 +148,19 @@ if (itemstack.isEmpty()) { return false; } else { -@@ -311,10 +_,10 @@ - return true; - } else if (!ItemStack.isSameItem(itemstack1, itemstack)) { +@@ -325,9 +_,9 @@ + } else if (!ItemStack.isSameItemSameComponents(itemstack1, itemstack)) { return false; -- } else if (itemstack1.getCount() < p_155008_ && itemstack1.getCount() < itemstack1.getMaxStackSize()) { -+ } else if (itemstack1.getCount() + itemstack.getCount() <= p_155008_ && itemstack1.getCount() + itemstack.getCount() <= itemstack1.getMaxStackSize()) { // Forge fix: make furnace respect stack sizes in furnace recipes - return true; } else { -- return itemstack1.getCount() < itemstack.getMaxStackSize(); -+ return itemstack1.getCount() + itemstack.getCount() <= itemstack.getMaxStackSize(); // Forge fix: make furnace respect stack sizes in furnace recipes +- return itemstack1.getCount() < p_155008_ && itemstack1.getCount() < itemstack1.getMaxStackSize() ++ return itemstack1.getCount() + itemstack.getCount() <= p_155008_ && itemstack1.getCount() + itemstack.getCount() <= itemstack1.getMaxStackSize() // Neo fix: make furnace respect stack sizes in furnace recipes + ? true +- : itemstack1.getCount() < itemstack.getMaxStackSize(); ++ : itemstack1.getCount() + itemstack.getCount() <= itemstack.getMaxStackSize(); // Neo fix: make furnace respect stack sizes in furnace recipes } } } else { -@@ -322,15 +_,15 @@ +@@ -335,15 +_,15 @@ } } @@ -163,22 +174,23 @@ ItemStack itemstack2 = p_267073_.get(2); if (itemstack2.isEmpty()) { p_267073_.set(2, itemstack1.copy()); - } else if (itemstack2.is(itemstack1.getItem())) { + } else if (ItemStack.isSameItemSameComponents(itemstack2, itemstack1)) { - itemstack2.grow(1); + itemstack2.grow(itemstack1.getCount()); } if (itemstack.is(Blocks.WET_SPONGE.asItem()) && !p_267073_.get(1).isEmpty() && p_267073_.get(1).is(Items.BUCKET)) { -@@ -349,7 +_,7 @@ +@@ -361,8 +_,7 @@ + if (p_58343_.isEmpty()) { return 0; } else { - Item item = p_58343_.getItem(); +- Item item = p_58343_.getItem(); - return getFuel().getOrDefault(item, 0); + return p_58343_.getBurnTime(this.recipeType); } } -@@ -358,7 +_,7 @@ +@@ -371,7 +_,7 @@ } public static boolean isFuel(ItemStack p_58400_) { @@ -187,7 +199,7 @@ } @Override -@@ -444,7 +_,7 @@ +@@ -429,7 +_,7 @@ return true; } else { ItemStack itemstack = this.items.get(1); diff --git a/patches/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch b/patches/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch index dd7cbb07bd7..2183064ba61 100644 --- a/patches/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch +++ b/patches/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -@@ -132,8 +_,8 @@ - for(int i1 = 0; i1 < 10 && blockpos.getY() <= l; ++i1) { +@@ -139,8 +_,8 @@ + for (int i1 = 0; i1 < 10 && blockpos.getY() <= l; i1++) { BlockState blockstate = p_155108_.getBlockState(blockpos); Block block = blockstate.getBlock(); - if (block instanceof BeaconBeamBlock) { diff --git a/patches/net/minecraft/world/level/block/entity/BlockEntity.java.patch b/patches/net/minecraft/world/level/block/entity/BlockEntity.java.patch index b4f01478d64..bd6dfcb5561 100644 --- a/patches/net/minecraft/world/level/block/entity/BlockEntity.java.patch +++ b/patches/net/minecraft/world/level/block/entity/BlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/net/minecraft/world/level/block/entity/BlockEntity.java -@@ -15,7 +_,7 @@ +@@ -26,7 +_,7 @@ import net.minecraft.world.level.block.state.BlockState; import org.slf4j.Logger; @@ -9,30 +9,35 @@ private static final Logger LOGGER = LogUtils.getLogger(); private final BlockEntityType type; @Nullable -@@ -23,6 +_,7 @@ - protected final BlockPos worldPosition; +@@ -35,6 +_,8 @@ protected boolean remove; private BlockState blockState; + private DataComponentMap components = DataComponentMap.EMPTY; ++ @Nullable + private CompoundTag customPersistentData; public BlockEntity(BlockEntityType p_155228_, BlockPos p_155229_, BlockState p_155230_) { this.type = p_155228_; -@@ -48,9 +_,14 @@ +@@ -60,6 +_,8 @@ + } + + protected void loadAdditional(CompoundTag p_338466_, HolderLookup.Provider p_338445_) { ++ if (p_338466_.contains("NeoForgeData", net.minecraft.nbt.Tag.TAG_COMPOUND)) this.customPersistentData = p_338466_.getCompound("NeoForgeData"); ++ if (p_338466_.contains(ATTACHMENTS_NBT_KEY, net.minecraft.nbt.Tag.TAG_COMPOUND)) deserializeAttachments(p_338445_, p_338466_.getCompound(ATTACHMENTS_NBT_KEY)); } - public void load(CompoundTag p_155245_) { -+ if (p_155245_.contains("NeoForgeData", net.minecraft.nbt.Tag.TAG_COMPOUND)) this.customPersistentData = p_155245_.getCompound("NeoForgeData"); -+ if (p_155245_.contains(ATTACHMENTS_NBT_KEY, net.minecraft.nbt.Tag.TAG_COMPOUND)) deserializeAttachments(p_155245_.getCompound(ATTACHMENTS_NBT_KEY)); + public final void loadWithComponents(CompoundTag p_338356_, HolderLookup.Provider p_338558_) { +@@ -75,6 +_,9 @@ } - protected void saveAdditional(CompoundTag p_187471_) { + protected void saveAdditional(CompoundTag p_187471_, HolderLookup.Provider p_323635_) { + if (this.customPersistentData != null) p_187471_.put("NeoForgeData", this.customPersistentData.copy()); -+ var attachmentsTag = serializeAttachments(); ++ var attachmentsTag = serializeAttachments(p_323635_); + if (attachmentsTag != null) p_187471_.put(ATTACHMENTS_NBT_KEY, attachmentsTag); } - public final CompoundTag saveWithFullMetadata() { -@@ -161,10 +_,14 @@ + public final CompoundTag saveWithFullMetadata(HolderLookup.Provider p_323767_) { +@@ -204,10 +_,14 @@ public void setRemoved() { this.remove = true; @@ -47,12 +52,10 @@ } public boolean triggerEvent(int p_58889_, int p_58890_) { -@@ -185,6 +_,27 @@ - - public BlockEntityType getType() { +@@ -230,6 +_,27 @@ return this.type; -+ } -+ + } + + @Override + public CompoundTag getPersistentData() { + if (this.customPersistentData == null) @@ -72,6 +75,24 @@ + public final T removeData(net.neoforged.neoforge.attachment.AttachmentType type) { + setChanged(); + return super.removeData(type); - } - ++ } ++ @Deprecated + public void setBlockState(BlockState p_155251_) { + this.blockState = p_155251_; +@@ -298,5 +_,15 @@ + T get(DataComponentType p_338658_); + + T getOrDefault(DataComponentType p_338573_, T p_338734_); ++ ++ // Neo: Utility for modded component types, to remove the need to invoke '.value()' ++ @Nullable ++ default T get(java.util.function.Supplier> componentType) { ++ return get(componentType.get()); ++ } ++ ++ default T getOrDefault(java.util.function.Supplier> componentType, T value) { ++ return getOrDefault(componentType.get(), value); ++ } + } + } diff --git a/patches/net/minecraft/world/level/block/entity/BlockEntityType.java.patch b/patches/net/minecraft/world/level/block/entity/BlockEntityType.java.patch index aecbef7ee5d..467125fac25 100644 --- a/patches/net/minecraft/world/level/block/entity/BlockEntityType.java.patch +++ b/patches/net/minecraft/world/level/block/entity/BlockEntityType.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/BlockEntityType.java +++ b/net/minecraft/world/level/block/entity/BlockEntityType.java -@@ -299,6 +_,11 @@ +@@ -301,6 +_,11 @@ return this.validBlocks.contains(p_155263_.getBlock()); } diff --git a/patches/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch b/patches/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch index 5dae4e6ef3a..3718abbc9dc 100644 --- a/patches/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch +++ b/patches/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch @@ -1,28 +1,20 @@ --- a/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java -@@ -152,6 +_,7 @@ - - private static boolean isBrewable(NonNullList p_155295_) { - ItemStack itemstack = p_155295_.get(3); -+ if (!itemstack.isEmpty()) return net.neoforged.neoforge.common.brewing.BrewingRecipeRegistry.canBrew(p_155295_, itemstack, SLOTS_FOR_SIDES); // divert to VanillaBrewingRegistry - if (itemstack.isEmpty()) { - return false; - } else if (!PotionBrewing.isIngredient(itemstack)) { -@@ -169,21 +_,21 @@ +@@ -164,6 +_,7 @@ } private static void doBrew(Level p_155291_, BlockPos p_155292_, NonNullList p_155293_) { + if (net.neoforged.neoforge.event.EventHooks.onPotionAttemptBrew(p_155293_)) return; ItemStack itemstack = p_155293_.get(3); + PotionBrewing potionbrewing = p_155291_.potionBrewing(); + +@@ -171,15 +_,17 @@ + p_155293_.set(i, potionbrewing.mix(itemstack, p_155293_.get(i))); + } -- for(int i = 0; i < 3; ++i) { -- p_155293_.set(i, PotionBrewing.mix(itemstack, p_155293_.get(i))); -- } -- - itemstack.shrink(1); - if (itemstack.getItem().hasCraftingRemainingItem()) { - ItemStack itemstack1 = new ItemStack(itemstack.getItem().getCraftingRemainingItem()); -+ net.neoforged.neoforge.common.brewing.BrewingRecipeRegistry.brewPotions(p_155293_, itemstack, SLOTS_FOR_SIDES); + net.neoforged.neoforge.event.EventHooks.onPotionBrewed(p_155293_); + if (itemstack.hasCraftingRemainingItem()) { + ItemStack itemstack1 = itemstack.getCraftingRemainingItem(); @@ -37,17 +29,19 @@ p_155293_.set(3, itemstack); p_155291_.levelEvent(1035, p_155292_, 0); -@@ -236,11 +_,11 @@ +@@ -204,13 +_,13 @@ + @Override public boolean canPlaceItem(int p_59017_, ItemStack p_59018_) { ++ PotionBrewing potionbrewing = this.level != null ? this.level.potionBrewing() : PotionBrewing.EMPTY; if (p_59017_ == 3) { -- return PotionBrewing.isIngredient(p_59018_); -+ return net.neoforged.neoforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_59018_); - } else if (p_59017_ == 4) { - return p_59018_.is(Items.BLAZE_POWDER); +- PotionBrewing potionbrewing = this.level != null ? this.level.potionBrewing() : PotionBrewing.EMPTY; + return potionbrewing.isIngredient(p_59018_); } else { -- return (p_59018_.is(Items.POTION) || p_59018_.is(Items.SPLASH_POTION) || p_59018_.is(Items.LINGERING_POTION) || p_59018_.is(Items.GLASS_BOTTLE)) -+ return net.neoforged.neoforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_59018_) - && this.getItem(p_59017_).isEmpty(); + return p_59017_ == 4 + ? p_59018_.is(Items.BLAZE_POWDER) +- : (p_59018_.is(Items.POTION) || p_59018_.is(Items.SPLASH_POTION) || p_59018_.is(Items.LINGERING_POTION) || p_59018_.is(Items.GLASS_BOTTLE)) ++ : (potionbrewing.isInput(p_59018_) || p_59018_.is(Items.GLASS_BOTTLE)) + && this.getItem(p_59017_).isEmpty(); } } diff --git a/patches/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch b/patches/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch index 7fbeae5a6ee..5657e27e33a 100644 --- a/patches/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch +++ b/patches/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/ChestBlockEntity.java +++ b/net/minecraft/world/level/block/entity/ChestBlockEntity.java -@@ -172,6 +_,17 @@ +@@ -173,6 +_,17 @@ return ChestMenu.threeRows(p_59082_, p_59083_, this); } diff --git a/patches/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch b/patches/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch index 90be7634618..8ddf54889aa 100644 --- a/patches/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch +++ b/patches/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/level/block/entity/ConduitBlockEntity.java +++ b/net/minecraft/world/level/block/entity/ConduitBlockEntity.java -@@ -151,10 +_,8 @@ +@@ -152,10 +_,8 @@ BlockPos blockpos1 = p_155416_.offset(j1, k1, l1); BlockState blockstate = p_155415_.getBlockState(blockpos1); -- for(Block block : VALID_BLOCKS) { +- for (Block block : VALID_BLOCKS) { - if (blockstate.is(block)) { - p_155417_.add(blockpos1); - } diff --git a/patches/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch b/patches/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch index b3c943fee93..f6b7d8b619d 100644 --- a/patches/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch +++ b/patches/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch @@ -1,25 +1,23 @@ --- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java -@@ -131,7 +_,8 @@ - return true; +@@ -137,6 +_,7 @@ } -- private static boolean ejectItems(Level p_155563_, BlockPos p_155564_, BlockState p_155565_, Container p_155566_) { -+ private static boolean ejectItems(Level p_155563_, BlockPos p_155564_, BlockState p_155565_, HopperBlockEntity p_155566_) { -+ if (net.neoforged.neoforge.items.VanillaInventoryCodeHooks.insertHook(p_155566_)) return true; - Container container = getAttachedContainer(p_155563_, p_155564_, p_155565_); + private static boolean ejectItems(Level p_155563_, BlockPos p_155564_, HopperBlockEntity p_326256_) { ++ if (net.neoforged.neoforge.items.VanillaInventoryCodeHooks.insertHook(p_326256_)) return true; + Container container = getAttachedContainer(p_155563_, p_155564_, p_326256_); if (container == null) { return false; -@@ -176,6 +_,8 @@ - } - +@@ -214,6 +_,8 @@ public static boolean suckInItems(Level p_155553_, Hopper p_155554_) { + BlockPos blockpos = BlockPos.containing(p_155554_.getLevelX(), p_155554_.getLevelY() + 1.0, p_155554_.getLevelZ()); + BlockState blockstate = p_155553_.getBlockState(blockpos); + Boolean ret = net.neoforged.neoforge.items.VanillaInventoryCodeHooks.extractHook(p_155553_, p_155554_); + if (ret != null) return ret; - Container container = getSourceContainer(p_155553_, p_155554_); + Container container = getSourceContainer(p_155553_, p_155554_, blockpos, blockstate); if (container != null) { Direction direction = Direction.DOWN; -@@ -421,5 +_,9 @@ +@@ -470,5 +_,9 @@ @Override protected AbstractContainerMenu createMenu(int p_59312_, Inventory p_59313_) { return new HopperMenu(p_59312_, p_59313_, this); diff --git a/patches/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch b/patches/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch index b5fe538e57a..b569d86d98a 100644 --- a/patches/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch +++ b/patches/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java +++ b/net/minecraft/world/level/block/entity/SpawnerBlockEntity.java -@@ -29,6 +_,8 @@ +@@ -30,6 +_,8 @@ p_155771_.sendBlockUpdated(p_155772_, blockstate, blockstate, 4); } } diff --git a/patches/net/minecraft/world/level/block/grower/TreeGrower.java.patch b/patches/net/minecraft/world/level/block/grower/TreeGrower.java.patch index b5745a7b27d..58544d94e64 100644 --- a/patches/net/minecraft/world/level/block/grower/TreeGrower.java.patch +++ b/patches/net/minecraft/world/level/block/grower/TreeGrower.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/grower/TreeGrower.java +++ b/net/minecraft/world/level/block/grower/TreeGrower.java -@@ -131,6 +_,9 @@ +@@ -130,6 +_,9 @@ .registryOrThrow(Registries.CONFIGURED_FEATURE) .getHolder(resourcekey) .orElse(null); @@ -8,9 +8,9 @@ + holder = event.getFeature(); + if (event.getResult() == net.neoforged.bus.api.Event.Result.DENY) return false; if (holder != null) { - for(int i = 0; i >= -1; --i) { - for(int j = 0; j >= -1; --j) { -@@ -164,6 +_,9 @@ + for (int i = 0; i >= -1; i--) { + for (int j = 0; j >= -1; j--) { +@@ -163,6 +_,9 @@ .registryOrThrow(Registries.CONFIGURED_FEATURE) .getHolder(resourcekey1) .orElse(null); diff --git a/patches/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch b/patches/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch index 1bcbf0b6e6c..0f685960e1d 100644 --- a/patches/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch +++ b/patches/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/net/minecraft/world/level/block/piston/PistonBaseBlock.java -@@ -187,6 +_,7 @@ +@@ -186,6 +_,7 @@ } if (p_60195_ == 0) { @@ -8,15 +8,15 @@ if (!this.moveBlocks(p_60193_, p_60194_, direction, true)) { return false; } -@@ -195,6 +_,7 @@ +@@ -194,6 +_,7 @@ p_60193_.playSound(null, p_60194_, SoundEvents.PISTON_EXTEND, SoundSource.BLOCKS, 0.5F, p_60193_.random.nextFloat() * 0.25F + 0.6F); p_60193_.gameEvent(GameEvent.BLOCK_ACTIVATE, p_60194_, GameEvent.Context.of(blockstate)); } else if (p_60195_ == 1 || p_60195_ == 2) { + if (net.neoforged.neoforge.event.EventHooks.onPistonMovePre(p_60193_, p_60194_, direction, false)) return false; - BlockEntity blockentity1 = p_60193_.getBlockEntity(p_60194_.relative(direction)); - if (blockentity1 instanceof PistonMovingBlockEntity) { - ((PistonMovingBlockEntity)blockentity1).finalTick(); -@@ -246,6 +_,7 @@ + BlockEntity blockentity = p_60193_.getBlockEntity(p_60194_.relative(direction)); + if (blockentity instanceof PistonMovingBlockEntity) { + ((PistonMovingBlockEntity)blockentity).finalTick(); +@@ -243,6 +_,7 @@ p_60193_.gameEvent(GameEvent.BLOCK_DEACTIVATE, p_60194_, GameEvent.Context.of(blockstate1)); } @@ -24,7 +24,7 @@ return true; } -@@ -317,8 +_,7 @@ +@@ -314,8 +_,7 @@ BlockState blockstate1 = p_60182_.getBlockState(blockpos2); BlockEntity blockentity = blockstate1.hasBlockEntity() ? p_60182_.getBlockEntity(blockpos2) : null; dropResources(blockstate1, p_60182_, blockpos2, blockentity); @@ -34,9 +34,9 @@ if (!blockstate1.is(BlockTags.FIRE)) { p_60182_.addDestroyBlockEffect(blockpos2, blockstate1); } -@@ -390,6 +_,10 @@ +@@ -387,6 +_,10 @@ @Override - public BlockState rotate(BlockState p_60215_, Rotation p_60216_) { + protected BlockState rotate(BlockState p_60215_, Rotation p_60216_) { return p_60215_.setValue(FACING, p_60216_.rotate(p_60215_.getValue(FACING))); + } + diff --git a/patches/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch b/patches/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch index 0a605926e69..94bcbb53d76 100644 --- a/patches/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch +++ b/patches/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -@@ -114,7 +_,7 @@ +@@ -115,7 +_,7 @@ List list = p_155911_.getEntities(null, PistonMath.getMovementArea(aabb, direction, d0).minmax(aabb)); if (!list.isEmpty()) { List list1 = voxelshape.toAabbs(); @@ -8,4 +8,4 @@ + boolean flag = p_155914_.movedState.isSlimeBlock(); //TODO: is this patch really needed the logic of the original seems sound revisit later Iterator iterator = list.iterator(); - while(true) { + while (true) { diff --git a/patches/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch b/patches/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch index bf8b798e082..1c478815b3c 100644 --- a/patches/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch +++ b/patches/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch @@ -2,14 +2,14 @@ +++ b/net/minecraft/world/level/block/piston/PistonStructureResolver.java @@ -50,7 +_,7 @@ } else { - for(int i = 0; i < this.toPush.size(); ++i) { + for (int i = 0; i < this.toPush.size(); i++) { BlockPos blockpos = this.toPush.get(i); - if (isSticky(this.level.getBlockState(blockpos)) && !this.addBranchingBlocks(blockpos)) { + if (this.level.getBlockState(blockpos).isStickyBlock() && !this.addBranchingBlocks(blockpos)) { return false; } } -@@ -59,20 +_,6 @@ +@@ -59,18 +_,6 @@ } } @@ -20,21 +20,19 @@ - private static boolean canStickToEachOther(BlockState p_155940_, BlockState p_155941_) { - if (p_155940_.is(Blocks.HONEY_BLOCK) && p_155941_.is(Blocks.SLIME_BLOCK)) { - return false; -- } else if (p_155940_.is(Blocks.SLIME_BLOCK) && p_155941_.is(Blocks.HONEY_BLOCK)) { -- return false; - } else { -- return isSticky(p_155940_) || isSticky(p_155941_); +- return p_155940_.is(Blocks.SLIME_BLOCK) && p_155941_.is(Blocks.HONEY_BLOCK) ? false : isSticky(p_155940_) || isSticky(p_155941_); - } - } - private boolean addBlockLine(BlockPos p_60434_, Direction p_60435_) { BlockState blockstate = this.level.getBlockState(p_60434_); if (blockstate.isAir()) { -@@ -88,12 +_,13 @@ +@@ -86,12 +_,13 @@ if (i + this.toPush.size() > 12) { return false; } else { -- while(isSticky(blockstate)) { +- while (isSticky(blockstate)) { + BlockState oldState; + while(blockstate.isStickyBlock()) { BlockPos blockpos = p_60434_.relative(this.pushDirection.getOpposite(), i); @@ -47,16 +45,16 @@ || !PistonBaseBlock.isPushable(blockstate, this.level, blockpos, this.pushDirection, false, this.pushDirection.getOpposite()) || blockpos.equals(this.pistonPos)) { break; -@@ -121,7 +_,7 @@ +@@ -119,7 +_,7 @@ - for(int k = 0; k <= j + l; ++k) { + for (int k = 0; k <= j + l; k++) { BlockPos blockpos2 = this.toPush.get(k); - if (isSticky(this.level.getBlockState(blockpos2)) && !this.addBranchingBlocks(blockpos2)) { + if (this.level.getBlockState(blockpos2).isStickyBlock() && !this.addBranchingBlocks(blockpos2)) { return false; } } -@@ -176,7 +_,7 @@ +@@ -174,7 +_,7 @@ if (direction.getAxis() != this.pushDirection.getAxis()) { BlockPos blockpos = p_60432_.relative(direction); BlockState blockstate1 = this.level.getBlockState(blockpos); diff --git a/patches/net/minecraft/world/level/block/state/BlockBehaviour.java.patch b/patches/net/minecraft/world/level/block/state/BlockBehaviour.java.patch index 26f8fd790ef..9455370fed0 100644 --- a/patches/net/minecraft/world/level/block/state/BlockBehaviour.java.patch +++ b/patches/net/minecraft/world/level/block/state/BlockBehaviour.java.patch @@ -1,33 +1,33 @@ --- a/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -110,6 +_,17 @@ +@@ -112,6 +_,17 @@ this.dynamicShape = p_60452_.dynamicShape; this.requiredFeatures = p_60452_.requiredFeatures; this.properties = p_60452_; -+ final ResourceLocation lootTableCache = p_60452_.drops; ++ final ResourceKey lootTableCache = p_60452_.drops; + if (lootTableCache != null) { + this.lootTableSupplier = () -> lootTableCache; + } else if (p_60452_.lootTableSupplier != null) { + this.lootTableSupplier = p_60452_.lootTableSupplier; + } else { + this.lootTableSupplier = () -> { -+ ResourceLocation registryName = BuiltInRegistries.BLOCK.getKey((Block) this); -+ return new ResourceLocation(registryName.getNamespace(), "blocks/" + registryName.getPath()); ++ ResourceLocation resourcelocation = BuiltInRegistries.BLOCK.getKey(this.asBlock()); ++ return ResourceKey.create(Registries.LOOT_TABLE, resourcelocation.withPrefix("blocks/")); + }; + } } public BlockBehaviour.Properties properties() { -@@ -165,7 +_,7 @@ +@@ -160,7 +_,7 @@ + } - @Deprecated - public void onRemove(BlockState p_60515_, Level p_60516_, BlockPos p_60517_, BlockState p_60518_, boolean p_60519_) { + protected void onRemove(BlockState p_60515_, Level p_60516_, BlockPos p_60517_, BlockState p_60518_, boolean p_60519_) { - if (p_60515_.hasBlockEntity() && !p_60515_.is(p_60518_.getBlock())) { + if (p_60515_.hasBlockEntity() && (!p_60515_.is(p_60518_.getBlock()) || !p_60518_.hasBlockEntity())) { p_60516_.removeBlockEntity(p_60517_); } } -@@ -175,7 +_,7 @@ +@@ -169,7 +_,7 @@ if (!p_311951_.isAir() && p_312925_.getBlockInteraction() != Explosion.BlockInteraction.TRIGGER_BLOCK) { Block block = p_311951_.getBlock(); boolean flag = p_312925_.getIndirectSourceEntity() instanceof Player; @@ -36,7 +36,7 @@ BlockEntity blockentity = p_311951_.hasBlockEntity() ? p_312820_.getBlockEntity(p_312489_) : null; LootParams.Builder lootparams$builder = new LootParams.Builder(serverlevel) .withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(p_312489_)) -@@ -190,8 +_,7 @@ +@@ -184,8 +_,7 @@ p_311951_.getDrops(lootparams$builder).forEach(p_311752_ -> p_312073_.accept(p_311752_, p_312489_)); } @@ -46,7 +46,7 @@ } } -@@ -365,13 +_,14 @@ +@@ -336,12 +_,13 @@ if (f == -1.0F) { return 0.0F; } else { @@ -57,23 +57,30 @@ } } - @Deprecated - public void spawnAfterBreak(BlockState p_222949_, ServerLevel p_222950_, BlockPos p_222951_, ItemStack p_222952_, boolean p_222953_) { + protected void spawnAfterBreak(BlockState p_222949_, ServerLevel p_222950_, BlockPos p_222951_, ItemStack p_222952_, boolean p_222953_) { + if (p_222953_) net.neoforged.neoforge.common.CommonHooks.dropXpForBlock(p_222949_, p_222950_, p_222951_, p_222952_); } - @Deprecated -@@ -394,8 +_,7 @@ + protected void attack(BlockState p_60499_, Level p_60500_, BlockPos p_60501_, Player p_60502_) { +@@ -360,8 +_,7 @@ - public final ResourceLocation getLootTable() { + public final ResourceKey getLootTable() { if (this.drops == null) { - ResourceLocation resourcelocation = BuiltInRegistries.BLOCK.getKey(this.asBlock()); -- this.drops = resourcelocation.withPrefix("blocks/"); +- this.drops = ResourceKey.create(Registries.LOOT_TABLE, resourcelocation.withPrefix("blocks/")); + this.drops = this.lootTableSupplier.get(); } return this.drops; -@@ -417,6 +_,14 @@ +@@ -378,6 +_,7 @@ + return this.isRandomlyTicking; + } + ++ @Deprecated //Forge: Use more sensitive version {@link IForgeBlockState#getSoundType(IWorldReader, BlockPos, Entity) } + protected SoundType getSoundType(BlockState p_320941_) { + return this.soundType; + } +@@ -394,6 +_,14 @@ return this.properties.destroyTime; } @@ -82,13 +89,13 @@ + } + + /* ======================================== FORGE START ===================================== */ -+ private final java.util.function.Supplier lootTableSupplier; ++ private final java.util.function.Supplier> lootTableSupplier; + /* ========================================= FORGE END ====================================== */ + public abstract static class BlockStateBase extends StateHolder { private final int lightEmission; private final boolean useShapeForLightOcclusion; -@@ -550,12 +_,14 @@ +@@ -523,12 +_,14 @@ return this.useShapeForLightOcclusion; } @@ -104,7 +111,7 @@ } public boolean ignitedByLava() { -@@ -568,9 +_,11 @@ +@@ -541,9 +_,11 @@ } public MapColor getMapColor(BlockGetter p_285002_, BlockPos p_285293_) { @@ -117,7 +124,7 @@ public BlockState rotate(Rotation p_60718_) { return this.getBlock().rotate(this.asState(), p_60718_); } -@@ -624,6 +_,8 @@ +@@ -597,6 +_,8 @@ } public PushReaction getPistonPushReaction() { @@ -126,21 +133,29 @@ return this.pushReaction; } -@@ -751,6 +_,9 @@ +@@ -723,6 +_,9 @@ } - public InteractionResult use(Level p_60665_, Player p_60666_, InteractionHand p_60667_, BlockHitResult p_60668_) { -+ var useOnContext = new net.minecraft.world.item.context.UseOnContext(p_60665_, p_60666_, p_60667_, p_60666_.getItemInHand(p_60667_).copy(), p_60668_); + public ItemInteractionResult useItemOn(ItemStack p_316374_, Level p_316651_, Player p_316623_, InteractionHand p_316469_, BlockHitResult p_316877_) { ++ var useOnContext = new net.minecraft.world.item.context.UseOnContext(p_316651_, p_316623_, p_316469_, p_316623_.getItemInHand(p_316469_).copy(), p_316877_); + var e = net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.entity.player.UseItemOnBlockEvent(useOnContext, net.neoforged.neoforge.event.entity.player.UseItemOnBlockEvent.UsePhase.BLOCK)); + if (e.isCanceled()) return e.getCancellationResult(); - return this.getBlock().use(this.asState(), p_60665_, p_60668_.getBlockPos(), p_60666_, p_60667_, p_60668_); + return this.getBlock().useItemOn(p_316374_, this.asState(), p_316651_, p_316877_.getBlockPos(), p_316623_, p_316469_, p_316877_); } -@@ -982,11 +_,12 @@ +@@ -824,6 +_,7 @@ + return this.getBlock().getSeed(this.asState(), p_60727_); + } + ++ @Deprecated //Forge: Use more sensitive version {@link IForgeBlockState#getSoundType(IWorldReader, BlockPos, Entity) } + public SoundType getSoundType() { + return this.getBlock().getSoundType(this.asState()); + } +@@ -958,11 +_,12 @@ PushReaction pushReaction = PushReaction.NORMAL; boolean spawnTerrainParticles = true; NoteBlockInstrument instrument = NoteBlockInstrument.HARP; -+ private java.util.function.Supplier lootTableSupplier; ++ private java.util.function.Supplier> lootTableSupplier; boolean replaceable; BlockBehaviour.StateArgumentPredicate> isValidSpawn = (p_284893_, p_284894_, p_284895_, p_284896_) -> p_284893_.isFaceSturdy( p_284894_, p_284895_, Direction.UP @@ -150,7 +165,7 @@ BlockBehaviour.StatePredicate isRedstoneConductor = (p_284888_, p_284889_, p_284890_) -> p_284888_.isCollisionShapeFullBlock(p_284889_, p_284890_); BlockBehaviour.StatePredicate isSuffocating = (p_284885_, p_284886_, p_284887_) -> p_284885_.blocksMotion() && p_284885_.isCollisionShapeFullBlock(p_284886_, p_284887_); -@@ -1127,9 +_,15 @@ +@@ -1103,9 +_,15 @@ return this; } diff --git a/patches/net/minecraft/world/level/block/state/BlockState.java.patch b/patches/net/minecraft/world/level/block/state/BlockState.java.patch index e121d76daab..bbfe37b02e7 100644 --- a/patches/net/minecraft/world/level/block/state/BlockState.java.patch +++ b/patches/net/minecraft/world/level/block/state/BlockState.java.patch @@ -8,4 +8,4 @@ +public class BlockState extends BlockBehaviour.BlockStateBase implements net.neoforged.neoforge.common.extensions.IBlockStateExtension { public static final Codec CODEC = codec(BuiltInRegistries.BLOCK.byNameCodec(), Block::defaultBlockState).stable(); - public BlockState(Block p_61042_, ImmutableMap, Comparable> p_61043_, MapCodec p_61044_) { + public BlockState(Block p_61042_, Reference2ObjectArrayMap, Comparable> p_326238_, MapCodec p_61044_) { diff --git a/patches/net/minecraft/world/level/chunk/ChunkAccess.java.patch b/patches/net/minecraft/world/level/chunk/ChunkAccess.java.patch index 58545111275..4326496ed3c 100644 --- a/patches/net/minecraft/world/level/chunk/ChunkAccess.java.patch +++ b/patches/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 -@@ -54,7 +_,7 @@ +@@ -57,7 +_,7 @@ import net.minecraft.world.ticks.TickContainerAccess; import org.slf4j.Logger; @@ -9,40 +9,40 @@ public static final int NO_FILLED_SECTION = -1; private static final Logger LOGGER = LogUtils.getLogger(); private static final LongSet EMPTY_REFERENCE_SET = new LongOpenHashSet(); -@@ -308,23 +_,28 @@ +@@ -311,10 +_,19 @@ @Override public final void findBlockLightSources(BiConsumer p_285269_) { - this.findBlocks(p_284897_ -> p_284897_.getLightEmission() != 0, p_285269_); -+ this.findBlocks((p_284897_, pos) -> p_284897_.getLightEmission(this, pos) != 0, p_285269_); ++ this.findBlocks(p_284897_ -> p_284897_.hasDynamicLightEmission() || p_284897_.getLightEmission(net.minecraft.world.level.EmptyBlockGetter.INSTANCE, BlockPos.ZERO) != 0, (p_284897_, pos) -> p_284897_.getLightEmission(this, pos) != 0, p_285269_); } public void findBlocks(Predicate p_285343_, BiConsumer p_285030_) { -+ findBlocks((state, pos) -> p_285343_.test(state), p_285030_); ++ findBlocks(p_285343_, (state, pos) -> p_285343_.test(state), p_285030_); + } + ++ @Deprecated(forRemoval = true) + public void findBlocks(java.util.function.BiPredicate p_285343_, BiConsumer p_285030_) { ++ findBlocks(state -> p_285343_.test(state, BlockPos.ZERO), p_285343_, p_285030_); ++ } ++ ++ public void findBlocks(Predicate p_285343_, java.util.function.BiPredicate fineFilter, BiConsumer p_285030_) { BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); - for(int i = this.getMinSection(); i < this.getMaxSection(); ++i) { - LevelChunkSection levelchunksection = this.getSection(this.getSectionIndexFromSectionY(i)); -- if (levelchunksection.maybeHas(p_285343_)) { -+ if (levelchunksection.maybeHas((state) -> p_285343_.test(state, BlockPos.ZERO))) { - BlockPos blockpos = SectionPos.of(this.chunkPos, i).origin(); - - for(int j = 0; j < 16; ++j) { - for(int k = 0; k < 16; ++k) { - for(int l = 0; l < 16; ++l) { + for (int i = this.getMinSection(); i < this.getMaxSection(); i++) { +@@ -326,8 +_,9 @@ + for (int k = 0; k < 16; k++) { + for (int l = 0; l < 16; l++) { BlockState blockstate = levelchunksection.getBlockState(l, j, k); - if (p_285343_.test(blockstate)) { - p_285030_.accept(blockpos$mutableblockpos.setWithOffset(blockpos, l, j, k), blockstate); + blockpos$mutableblockpos.setWithOffset(blockpos, l, j, k); -+ if (p_285343_.test(blockstate, blockpos$mutableblockpos.immutable())) { ++ if (fineFilter.test(blockstate, blockpos$mutableblockpos)) { + p_285030_.accept(blockpos$mutableblockpos, blockstate); } } } -@@ -469,4 +_,70 @@ +@@ -472,4 +_,70 @@ public static record TicksToSave(SerializableTickContainer blocks, SerializableTickContainer fluids) { } @@ -91,8 +91,8 @@ + */ + @org.jetbrains.annotations.ApiStatus.Internal + @Nullable -+ public final CompoundTag writeAttachmentsToNBT() { -+ return getAttachmentHolder().serializeAttachments(); ++ public final CompoundTag writeAttachmentsToNBT(HolderLookup.Provider provider) { ++ return getAttachmentHolder().serializeAttachments(provider); + } + + /** @@ -102,8 +102,8 @@ + * + */ + @org.jetbrains.annotations.ApiStatus.Internal -+ public final void readAttachmentsFromNBT(CompoundTag tag) { -+ getAttachmentHolder().deserializeInternal(tag); ++ public final void readAttachmentsFromNBT(HolderLookup.Provider provider, CompoundTag tag) { ++ getAttachmentHolder().deserializeInternal(provider, tag); + } + + @org.jetbrains.annotations.ApiStatus.Internal @@ -111,5 +111,5 @@ + return attachmentHolder; + } + @Nullable -+ public net.minecraft.world.level.LevelAccessor getWorldForge() { return null; } ++ public net.minecraft.world.level.Level getLevel() { return null; } } diff --git a/patches/net/minecraft/world/level/chunk/ImposterProtoChunk.java.patch b/patches/net/minecraft/world/level/chunk/ImposterProtoChunk.java.patch index 080e6c208fc..827439587dc 100644 --- a/patches/net/minecraft/world/level/chunk/ImposterProtoChunk.java.patch +++ b/patches/net/minecraft/world/level/chunk/ImposterProtoChunk.java.patch @@ -1,17 +1,22 @@ --- a/net/minecraft/world/level/chunk/ImposterProtoChunk.java +++ b/net/minecraft/world/level/chunk/ImposterProtoChunk.java -@@ -217,6 +_,10 @@ +@@ -219,6 +_,15 @@ } @Override -+ public void findBlocks(java.util.function.BiPredicate p_285343_, BiConsumer p_285030_) { -+ this.wrapped.findBlocks(p_285343_, p_285030_); ++ public void findBlocks(java.util.function.BiPredicate p_285465_, BiConsumer p_285030_) { ++ this.wrapped.findBlocks(p_285465_, p_285030_); ++ } ++ ++ @Override ++ public void findBlocks(Predicate p_285465_, java.util.function.BiPredicate fineFilter, BiConsumer p_285030_) { ++ this.wrapped.findBlocks(p_285465_, fineFilter, p_285030_); + } + public TickContainerAccess getBlockTicks() { return this.allowWrites ? this.wrapped.getBlockTicks() : BlackholeTickAccess.emptyContainer(); } -@@ -289,5 +_,10 @@ +@@ -291,5 +_,10 @@ @Override public ChunkSkyLightSources getSkyLightSources() { return this.wrapped.getSkyLightSources(); diff --git a/patches/net/minecraft/world/level/chunk/LevelChunk.java.patch b/patches/net/minecraft/world/level/chunk/LevelChunk.java.patch index 9abba042193..084beaed3dd 100644 --- a/patches/net/minecraft/world/level/chunk/LevelChunk.java.patch +++ b/patches/net/minecraft/world/level/chunk/LevelChunk.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -48,7 +_,7 @@ +@@ -50,7 +_,7 @@ import net.minecraft.world.ticks.TickContainerAccess; import org.slf4j.Logger; @@ -9,15 +9,15 @@ static final Logger LOGGER = LogUtils.getLogger(); private static final TickingBlockEntity NULL_TICKER = new TickingBlockEntity() { @Override -@@ -137,6 +_,7 @@ +@@ -139,6 +_,7 @@ this.setAllStarts(p_196851_.getAllStarts()); this.setAllReferences(p_196851_.getAllReferences()); -+ net.neoforged.neoforge.attachment.AttachmentUtils.copyChunkAttachmentsOnPromotion(p_196851_.getAttachmentHolder(), this.getAttachmentHolder()); - for(Entry entry : p_196851_.getHeightmaps()) { ++ net.neoforged.neoforge.attachment.AttachmentInternals.copyChunkAttachmentsOnPromotion(p_196850_.registryAccess(), p_196851_.getAttachmentHolder(), this.getAttachmentHolder()); + for (Entry entry : p_196851_.getHeightmaps()) { if (ChunkStatus.FULL.heightmapsAfter().contains(entry.getKey())) { this.setHeightmap(entry.getKey(), entry.getValue().getRawData()); -@@ -270,14 +_,14 @@ +@@ -271,14 +_,14 @@ boolean flag2 = blockstate.hasBlockEntity(); if (!this.level.isClientSide) { blockstate.onRemove(this.level, p_62865_, p_62866_, p_62867_); @@ -34,7 +34,7 @@ p_62866_.onPlace(this.level, p_62865_, blockstate, p_62867_); } -@@ -321,6 +_,10 @@ +@@ -322,6 +_,10 @@ @Nullable public BlockEntity getBlockEntity(BlockPos p_62868_, LevelChunk.EntityCreationType p_62869_) { BlockEntity blockentity = this.blockEntities.get(p_62868_); @@ -45,7 +45,7 @@ if (blockentity == null) { CompoundTag compoundtag = this.pendingBlockEntities.remove(p_62868_); if (compoundtag != null) { -@@ -338,9 +_,6 @@ +@@ -339,9 +_,6 @@ this.addAndRegisterBlockEntity(blockentity); } } @@ -63,7 +63,7 @@ } } -@@ -385,6 +_,7 @@ +@@ -381,6 +_,7 @@ BlockEntity blockentity = this.blockEntities.put(blockpos.immutable(), p_156374_); if (blockentity != null && blockentity != p_156374_) { blockentity.setRemoved(); @@ -71,12 +71,12 @@ } } } -@@ -394,9 +_,14 @@ - public CompoundTag getBlockEntityNbtForSaving(BlockPos p_62932_) { +@@ -390,9 +_,14 @@ + public CompoundTag getBlockEntityNbtForSaving(BlockPos p_62932_, HolderLookup.Provider p_323699_) { BlockEntity blockentity = this.getBlockEntity(p_62932_); if (blockentity != null && !blockentity.isRemoved()) { + try { - CompoundTag compoundtag1 = blockentity.saveWithFullMetadata(); + CompoundTag compoundtag1 = blockentity.saveWithFullMetadata(this.level.registryAccess()); compoundtag1.putBoolean("keepPacked", false); return compoundtag1; + } catch (Exception e) { @@ -86,7 +86,7 @@ } else { CompoundTag compoundtag = this.pendingBlockEntities.get(p_62932_); if (compoundtag != null) { -@@ -419,6 +_,7 @@ +@@ -414,6 +_,7 @@ } blockentity.setRemoved(); @@ -94,16 +94,16 @@ } } -@@ -479,7 +_,7 @@ - p_187974_.accept((p_187968_, p_187969_, p_187970_) -> { - BlockEntity blockentity = this.getBlockEntity(p_187968_, LevelChunk.EntityCreationType.IMMEDIATE); - if (blockentity != null && p_187970_ != null && blockentity.getType() == p_187969_) { -- blockentity.load(p_187970_); -+ blockentity.handleUpdateTag(p_187970_); +@@ -474,7 +_,7 @@ + p_187974_.accept((p_338077_, p_338078_, p_338079_) -> { + BlockEntity blockentity = this.getBlockEntity(p_338077_, LevelChunk.EntityCreationType.IMMEDIATE); + if (blockentity != null && p_338079_ != null && blockentity.getType() == p_338078_) { +- blockentity.loadWithComponents(p_338079_, this.level.registryAccess()); ++ blockentity.handleUpdateTag(p_338079_, this.level.registryAccess()); } }); } -@@ -587,6 +_,7 @@ +@@ -582,6 +_,7 @@ } public void clearAllBlockEntities() { @@ -111,15 +111,15 @@ this.blockEntities.values().forEach(BlockEntity::setRemoved); this.blockEntities.clear(); this.tickersInLevel.values().forEach(p_187966_ -> p_187966_.rebind(NULL_TICKER)); -@@ -594,6 +_,7 @@ +@@ -589,6 +_,7 @@ } public void registerAllBlockEntitiesAfterLevelLoad() { + this.level.addFreshBlockEntities(this.blockEntities.values()); this.blockEntities.values().forEach(p_187988_ -> { - Level level = this.level; - if (level instanceof ServerLevel serverlevel) { -@@ -646,6 +_,15 @@ + if (this.level instanceof ServerLevel serverlevel) { + this.addGameEventListener(p_187988_, serverlevel); +@@ -640,6 +_,15 @@ return new LevelChunk.BoundTickingBlockEntity<>(p_156376_, p_156377_); } @@ -135,7 +135,7 @@ class BoundTickingBlockEntity implements TickingBlockEntity { private final T blockEntity; private final BlockEntityTicker ticker; -@@ -663,6 +_,7 @@ +@@ -657,6 +_,7 @@ if (LevelChunk.this.isTicking(blockpos)) { try { ProfilerFiller profilerfiller = LevelChunk.this.level.getProfiler(); @@ -143,7 +143,7 @@ profilerfiller.push(this::getType); BlockState blockstate = LevelChunk.this.getBlockState(blockpos); if (this.blockEntity.getType().isValid(blockstate)) { -@@ -684,6 +_,12 @@ +@@ -678,6 +_,12 @@ CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking block entity"); CrashReportCategory crashreportcategory = crashreport.addCategory("Block entity being ticked"); this.blockEntity.fillCrashReportCategory(crashreportcategory); @@ -156,15 +156,3 @@ throw new ReportedException(crashreport); } } -@@ -715,6 +_,11 @@ - IMMEDIATE, - QUEUED, - CHECK; -+ } -+ -+ @Override -+ public Level getWorldForge() { -+ return getLevel(); - } - - @FunctionalInterface diff --git a/patches/net/minecraft/world/level/chunk/LevelChunkSection.java.patch b/patches/net/minecraft/world/level/chunk/LevelChunkSection.java.patch index 382d1bc3474..42b524a34a0 100644 --- a/patches/net/minecraft/world/level/chunk/LevelChunkSection.java.patch +++ b/patches/net/minecraft/world/level/chunk/LevelChunkSection.java.patch @@ -6,18 +6,18 @@ FluidState fluidstate1 = p_62995_.getFluidState(); - if (!blockstate.isAir()) { + if (!blockstate.isEmpty()) { // Neo: Fix MC-232360 for modded blocks (Makes modded isAir blocks not be replaced with Blocks.AIR in all-air chunk sections) - --this.nonEmptyBlockCount; + this.nonEmptyBlockCount--; if (blockstate.isRandomlyTicking()) { - --this.tickingBlockCount; + this.tickingBlockCount--; @@ -76,7 +_,7 @@ - --this.tickingFluidCount; + this.tickingFluidCount--; } - if (!p_62995_.isAir()) { + if (!p_62995_.isEmpty()) { // Neo: Fix MC-232360 for modded blocks (Makes modded isAir blocks not be replaced with Blocks.AIR in all-air chunk sections) - ++this.nonEmptyBlockCount; + this.nonEmptyBlockCount++; if (p_62995_.isRandomlyTicking()) { - ++this.tickingBlockCount; + this.tickingBlockCount++; @@ -114,7 +_,7 @@ public void accept(BlockState p_204444_, int p_204445_) { diff --git a/patches/net/minecraft/world/level/chunk/PalettedContainer.java.patch b/patches/net/minecraft/world/level/chunk/PalettedContainer.java.patch index b345d9673c6..23ac00f2cc3 100644 --- a/patches/net/minecraft/world/level/chunk/PalettedContainer.java.patch +++ b/patches/net/minecraft/world/level/chunk/PalettedContainer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -28,6 +_,7 @@ +@@ -27,6 +_,7 @@ import net.minecraft.util.ZeroBitStorage; public class PalettedContainer implements PaletteResize, PalettedContainerRO { diff --git a/patches/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch b/patches/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch index 25032c8d6a3..bcd2e8662e8 100644 --- a/patches/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch +++ b/patches/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch @@ -1,36 +1,36 @@ --- a/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -180,6 +_,8 @@ +@@ -182,6 +_,8 @@ postLoadChunk(p_188231_, p_188234_), blendingdata ); + if (p_188234_.contains(net.neoforged.neoforge.common.world.LevelChunkAuxiliaryLightManager.LIGHT_NBT_KEY, net.minecraft.nbt.Tag.TAG_LIST)) -+ Objects.requireNonNull(((LevelChunk)chunkaccess).getAuxLightManager(p_188233_)).deserializeNBT(p_188234_.getList(net.neoforged.neoforge.common.world.LevelChunkAuxiliaryLightManager.LIGHT_NBT_KEY, net.minecraft.nbt.Tag.TAG_COMPOUND)); ++ Objects.requireNonNull(((LevelChunk)chunkaccess).getAuxLightManager(p_188233_)).deserializeNBT(p_188231_.registryAccess(), p_188234_.getList(net.neoforged.neoforge.common.world.LevelChunkAuxiliaryLightManager.LIGHT_NBT_KEY, net.minecraft.nbt.Tag.TAG_COMPOUND)); } else { ProtoChunkTicks protochunkticks = ProtoChunkTicks.load( p_188234_.getList("block_ticks", 10), p_258992_ -> BuiltInRegistries.BLOCK.getOptional(ResourceLocation.tryParse(p_258992_)), p_188233_ -@@ -206,6 +_,8 @@ +@@ -208,6 +_,8 @@ } } + if (p_188234_.contains(net.neoforged.neoforge.attachment.AttachmentHolder.ATTACHMENTS_NBT_KEY, net.minecraft.nbt.Tag.TAG_COMPOUND)) -+ chunkaccess.readAttachmentsFromNBT(p_188234_.getCompound(net.neoforged.neoforge.attachment.AttachmentHolder.ATTACHMENTS_NBT_KEY)); ++ chunkaccess.readAttachmentsFromNBT(p_188231_.registryAccess(), p_188234_.getCompound(net.neoforged.neoforge.attachment.AttachmentHolder.ATTACHMENTS_NBT_KEY)); chunkaccess.setLightCorrect(flag); CompoundTag compoundtag2 = p_188234_.getCompound("Heightmaps"); EnumSet enumset = EnumSet.noneOf(Heightmap.Types.class); -@@ -238,6 +_,7 @@ +@@ -240,6 +_,7 @@ } - if (chunkstatus$chunktype == ChunkStatus.ChunkType.LEVELCHUNK) { -+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkDataEvent.Load(chunkaccess, p_188234_, chunkstatus$chunktype)); + if (chunktype == ChunkType.LEVELCHUNK) { ++ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkDataEvent.Load(chunkaccess, p_188234_, chunktype)); return new ImposterProtoChunk((LevelChunk)chunkaccess, false); } else { ProtoChunk protochunk1 = (ProtoChunk)chunkaccess; -@@ -261,6 +_,7 @@ +@@ -263,6 +_,7 @@ protochunk1.setCarvingMask(generationstep$carving, new CarvingMask(compoundtag4.getLongArray(s1), chunkaccess.getMinBuildHeight())); } -+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkDataEvent.Load(chunkaccess, p_188234_, chunkstatus$chunktype)); ++ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.ChunkDataEvent.Load(chunkaccess, p_188234_, chunktype)); return protochunk1; } } @@ -40,7 +40,7 @@ } + else if (p_63456_ instanceof LevelChunk levelChunk){ + -+ Tag lightTag = levelChunk.getAuxLightManager(chunkpos).serializeNBT(); ++ Tag lightTag = levelChunk.getAuxLightManager(chunkpos).serializeNBT(p_63455_.registryAccess()); + if (lightTag != null) compoundtag.put(net.neoforged.neoforge.common.world.LevelChunkAuxiliaryLightManager.LIGHT_NBT_KEY, lightTag); + } @@ -51,7 +51,7 @@ } + try { -+ final CompoundTag capTag = p_63456_.writeAttachmentsToNBT(); ++ final CompoundTag capTag = p_63456_.writeAttachmentsToNBT(p_63455_.registryAccess()); + if (capTag != null) compoundtag.put(net.neoforged.neoforge.attachment.AttachmentHolder.ATTACHMENTS_NBT_KEY, capTag); + } catch (Exception exception) { + LOGGER.error("Failed to write chunk attachments. An attachment has likely thrown an exception trying to write state. It will not persist. Report this to the mod author", exception); diff --git a/patches/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch b/patches/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch index 5983bcd7bca..0dab340c369 100644 --- a/patches/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch +++ b/patches/net/minecraft/world/level/chunk/storage/EntityStorage.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/chunk/storage/EntityStorage.java +++ b/net/minecraft/world/level/chunk/storage/EntityStorage.java -@@ -93,8 +_,12 @@ +@@ -88,8 +_,12 @@ ListTag listtag = new ListTag(); p_156559_.getEntities().forEach(p_156567_ -> { CompoundTag compoundtag1 = new CompoundTag(); diff --git a/patches/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch b/patches/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch index 00d964f6ea6..3ad91c2b4d1 100644 --- a/patches/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch +++ b/patches/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch @@ -21,7 +21,7 @@ } public void addLegacyChunkEntities(Stream p_157553_) { -- p_157553_.forEach(p_157607_ -> this.addEntity(p_157607_, true)); +- p_157553_.forEach(p_157607_ -> this.addEntity((T)p_157607_, true)); + p_157553_.forEach(p_157607_ -> { + this.addEntity(p_157607_, true); + if (p_157607_ instanceof Entity entity) entity.onAddedToWorld(); @@ -29,7 +29,7 @@ } public void addWorldGenChunkEntities(Stream p_157560_) { -- p_157560_.forEach(p_157605_ -> this.addEntity(p_157605_, false)); +- p_157560_.forEach(p_157605_ -> this.addEntity((T)p_157605_, false)); + p_157560_.forEach(p_157605_ -> { + this.addEntity(p_157605_, false); + if (p_157605_ instanceof Entity entity) entity.onAddedToWorld(); @@ -40,8 +40,8 @@ @@ -228,7 +_,10 @@ private void processPendingLoads() { ChunkEntities chunkentities; - while((chunkentities = this.loadingInbox.poll()) != null) { -- chunkentities.getEntities().forEach(p_157593_ -> this.addEntity(p_157593_, true)); + while ((chunkentities = this.loadingInbox.poll()) != null) { +- chunkentities.getEntities().forEach(p_157593_ -> this.addEntity((T)p_157593_, true)); + chunkentities.getEntities().forEach(p_157593_ -> { + this.addEntity(p_157593_, true); + if (p_157593_ instanceof Entity entity) entity.onAddedToWorld(); diff --git a/patches/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java.patch b/patches/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java.patch index 8f8467945b6..5f7807cc05f 100644 --- a/patches/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java.patch +++ b/patches/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java.patch @@ -1,22 +1,27 @@ --- a/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java +++ b/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java -@@ -48,6 +_,8 @@ - GameEvent.RESONATE_14, - GameEvent.RESONATE_15 - }; +@@ -52,6 +_,8 @@ + GameEvent.RESONATE_15.key() + ); + int DEFAULT_VIBRATION_FREQUENCY = 0; + /** @deprecated Neo: use the {@link net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps#VIBRATION_FREQUENCIES data map} instead. */ + @Deprecated - ToIntFunction VIBRATION_FREQUENCY_FOR_EVENT = Util.make(new Object2IntOpenHashMap<>(), p_297981_ -> { - p_297981_.defaultReturnValue(0); - p_297981_.put(GameEvent.STEP, 1); -@@ -101,7 +_,9 @@ + ToIntFunction> VIBRATION_FREQUENCY_FOR_EVENT = Util.make(new Reference2IntOpenHashMap<>(), p_316653_ -> { + p_316653_.defaultReturnValue(0); + p_316653_.put(GameEvent.STEP.key(), 1); +@@ -105,11 +_,13 @@ VibrationSystem.User getVibrationUser(); - static int getGameEventFrequency(GameEvent p_281355_) { -- return VIBRATION_FREQUENCY_FOR_EVENT.applyAsInt(p_281355_); -+ var data = p_281355_.builtInRegistryHolder().getData(net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps.VIBRATION_FREQUENCIES); -+ // TODO 1.20.5 - remove fallback -+ return data == null ? VIBRATION_FREQUENCY_FOR_EVENT.applyAsInt(p_281355_) : data.frequency(); + static int getGameEventFrequency(Holder p_316300_) { +- return p_316300_.unwrapKey().map(VibrationSystem::getGameEventFrequency).orElse(0); ++ var data = p_316300_.getData(net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps.VIBRATION_FREQUENCIES); ++ return data != null ? data.frequency() : 0; } - static GameEvent getResonanceEventByFrequency(int p_282105_) { + static int getGameEventFrequency(ResourceKey p_316800_) { +- return VIBRATION_FREQUENCY_FOR_EVENT.applyAsInt(p_316800_); ++ var holder = net.minecraft.core.registries.BuiltInRegistries.GAME_EVENT.getHolder(p_316800_); ++ return holder.isPresent() ? getGameEventFrequency(holder.get()) : VIBRATION_FREQUENCY_FOR_EVENT.applyAsInt(p_316800_); + } + + static ResourceKey getResonanceEventByFrequency(int p_282105_) { diff --git a/patches/net/minecraft/world/level/levelgen/Beardifier.java.patch b/patches/net/minecraft/world/level/levelgen/Beardifier.java.patch index a2355b9561b..31397b465a4 100644 --- a/patches/net/minecraft/world/level/levelgen/Beardifier.java.patch +++ b/patches/net/minecraft/world/level/levelgen/Beardifier.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/level/levelgen/Beardifier.java +++ b/net/minecraft/world/level/levelgen/Beardifier.java @@ -44,6 +_,11 @@ - - for(StructurePiece structurepiece : p_223936_.getPieces()) { + + for (StructurePiece structurepiece : p_223936_.getPieces()) { if (structurepiece.isCloseToChunk(p_223939_, 12)) { + if (structurepiece instanceof net.neoforged.neoforge.common.world.PieceBeardifierModifier pieceBeardifierModifier) { + if (pieceBeardifierModifier.getTerrainAdjustment() != TerrainAdjustment.NONE) { + objectlist.add(new Beardifier.Rigid(pieceBeardifierModifier.getBeardifierBox(), pieceBeardifierModifier.getTerrainAdjustment(), pieceBeardifierModifier.getGroundLevelDelta())); + } + } else - if (structurepiece instanceof PoolElementStructurePiece poolelementstructurepiece) { + if (structurepiece instanceof PoolElementStructurePiece) { + PoolElementStructurePiece poolelementstructurepiece = (PoolElementStructurePiece)structurepiece; StructureTemplatePool.Projection structuretemplatepool$projection = poolelementstructurepiece.getElement().getProjection(); - if (structuretemplatepool$projection == StructureTemplatePool.Projection.RIGID) { diff --git a/patches/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch b/patches/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch index 6835059524b..a2a669ba51c 100644 --- a/patches/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch +++ b/patches/net/minecraft/world/level/levelgen/PhantomSpawner.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/levelgen/PhantomSpawner.java +++ b/net/minecraft/world/level/levelgen/PhantomSpawner.java @@ -42,13 +_,15 @@ - for(ServerPlayer serverplayer : p_64576_.players()) { + for (ServerPlayer serverplayer : p_64576_.players()) { if (!serverplayer.isSpectator()) { BlockPos blockpos = serverplayer.blockPosition(); - if (!p_64576_.dimensionType().hasSkyLight() || blockpos.getY() >= p_64576_.getSeaLevel() && p_64576_.canSeeSky(blockpos)) { @@ -26,5 +26,5 @@ - int l = 1 + randomsource.nextInt(difficultyinstance.getDifficulty().getId() + 1); + int l = event.getPhantomsToSpawn(); - for(int i1 = 0; i1 < l; ++i1) { + for (int i1 = 0; i1 < l; i1++) { Phantom phantom = EntityType.PHANTOM.create(p_64576_); diff --git a/patches/net/minecraft/world/level/levelgen/WorldDimensions.java.patch b/patches/net/minecraft/world/level/levelgen/WorldDimensions.java.patch new file mode 100644 index 00000000000..33276ce2141 --- /dev/null +++ b/patches/net/minecraft/world/level/levelgen/WorldDimensions.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/world/level/levelgen/WorldDimensions.java ++++ b/net/minecraft/world/level/levelgen/WorldDimensions.java +@@ -36,7 +_,8 @@ + public record WorldDimensions(Map, LevelStem> dimensions) { + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + p_325905_ -> p_325905_.group( +- Codec.unboundedMap(ResourceKey.codec(Registries.LEVEL_STEM), LevelStem.CODEC).fieldOf("dimensions").forGetter(WorldDimensions::dimensions) ++ // FORGE: Fix MC-197860 ++ new net.neoforged.neoforge.common.LenientUnboundedMapCodec<>(ResourceKey.codec(Registries.LEVEL_STEM), LevelStem.CODEC).fieldOf("dimensions").forGetter(WorldDimensions::dimensions) + ) + .apply(p_325905_, p_325905_.stable(WorldDimensions::new)) + ); diff --git a/patches/net/minecraft/world/level/levelgen/feature/Feature.java.patch b/patches/net/minecraft/world/level/levelgen/feature/Feature.java.patch deleted file mode 100644 index 79eec5ad824..00000000000 --- a/patches/net/minecraft/world/level/levelgen/feature/Feature.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/feature/Feature.java -+++ b/net/minecraft/world/level/levelgen/feature/Feature.java -@@ -191,7 +_,7 @@ - } - - protected static boolean isStone(BlockState p_159748_) { -- return p_159748_.is(BlockTags.BASE_STONE_OVERWORLD); -+ return p_159748_.is(net.neoforged.neoforge.common.Tags.Blocks.STONE); - } - - public static boolean isDirt(BlockState p_159760_) { diff --git a/patches/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch b/patches/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch index 3bdca5000f9..73b5d90114b 100644 --- a/patches/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch +++ b/patches/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java +++ b/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java -@@ -133,6 +_,6 @@ +@@ -131,6 +_,6 @@ } private EntityType randomEntityId(RandomSource p_225154_) { diff --git a/patches/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java.patch b/patches/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java.patch index 347c9c5735b..3e097518cf7 100644 --- a/patches/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java.patch +++ b/patches/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java +++ b/net/minecraft/world/level/levelgen/feature/treedecorators/AlterGroundDecorator.java -@@ -38,19 +_,20 @@ +@@ -37,19 +_,20 @@ } if (!list.isEmpty()) { @@ -16,7 +16,7 @@ + this.placeCircle(p_225969_, p_225978_.west().south(2), eventProvider); + this.placeCircle(p_225969_, p_225978_.east(2).south(2), eventProvider); - for(int j = 0; j < 5; ++j) { + for (int j = 0; j < 5; j++) { int k = p_225969_.random().nextInt(64); int l = k % 8; int i1 = k / 8; @@ -26,7 +26,7 @@ } } }); -@@ -58,20 +_,28 @@ +@@ -57,20 +_,28 @@ } private void placeCircle(TreeDecorator.Context p_225971_, BlockPos p_225972_) { @@ -34,8 +34,8 @@ + } + + private void placeCircle(TreeDecorator.Context p_225971_, BlockPos p_225972_, net.neoforged.neoforge.event.level.AlterGroundEvent.StateProvider eventProvider) { - for(int i = -2; i <= 2; ++i) { - for(int j = -2; j <= 2; ++j) { + for (int i = -2; i <= 2; i++) { + for (int j = -2; j <= 2; j++) { if (Math.abs(i) != 2 || Math.abs(j) != 2) { - this.placeBlockAt(p_225971_, p_225972_.offset(i, 0, j)); + this.placeBlockAt(p_225971_, p_225972_.offset(i, 0, j), eventProvider); @@ -49,7 +49,7 @@ + } + + private void placeBlockAt(TreeDecorator.Context p_225974_, BlockPos p_225975_, net.neoforged.neoforge.event.level.AlterGroundEvent.StateProvider eventProvider) { - for(int i = 2; i >= -3; --i) { + for (int i = 2; i >= -3; i--) { BlockPos blockpos = p_225975_.above(i); if (Feature.isGrassOrDirt(p_225974_.level(), blockpos)) { - p_225974_.setBlock(blockpos, this.provider.getState(p_225974_.random(), p_225975_)); diff --git a/patches/net/minecraft/world/level/levelgen/placement/EnvironmentScanPlacement.java.patch b/patches/net/minecraft/world/level/levelgen/placement/EnvironmentScanPlacement.java.patch index b91f11f7be0..8cf2c5bd6d2 100644 --- a/patches/net/minecraft/world/level/levelgen/placement/EnvironmentScanPlacement.java.patch +++ b/patches/net/minecraft/world/level/levelgen/placement/EnvironmentScanPlacement.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/level/levelgen/placement/EnvironmentScanPlacement.java +++ b/net/minecraft/world/level/levelgen/placement/EnvironmentScanPlacement.java -@@ -17,7 +_,8 @@ +@@ -18,7 +_,8 @@ private final int maxSteps; - public static final Codec CODEC = RecordCodecBuilder.create( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( p_191650_ -> p_191650_.group( - Direction.VERTICAL_CODEC.fieldOf("direction_of_search").forGetter(p_191672_ -> p_191672_.directionOfSearch), + // NeoForge: Allow any direction, not just vertical. The code already handles it fine. diff --git a/patches/net/minecraft/world/level/levelgen/structure/Structure.java.patch b/patches/net/minecraft/world/level/levelgen/structure/Structure.java.patch index 776216f9e6b..207e90d94ab 100644 --- a/patches/net/minecraft/world/level/levelgen/structure/Structure.java.patch +++ b/patches/net/minecraft/world/level/levelgen/structure/Structure.java.patch @@ -13,7 +13,7 @@ + return Structure.StructureSettings.CODEC.forGetter(p_226595_ -> p_226595_.modifiableStructureInfo().getOriginalStructureInfo().structureSettings()); // FORGE: Patch codec to ignore field redirect coremods. } - public static Codec simpleCodec(Function p_226608_) { + public static MapCodec simpleCodec(Function p_226608_) { @@ -54,6 +_,7 @@ protected Structure(Structure.StructureSettings p_226558_) { @@ -22,7 +22,7 @@ } public HolderSet biomes() { -@@ -191,6 +_,29 @@ +@@ -196,6 +_,29 @@ } public abstract StructureType type(); diff --git a/patches/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch b/patches/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch index 1b2ac4b713f..63803d46c03 100644 --- a/patches/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch +++ b/patches/net/minecraft/world/level/levelgen/structure/StructurePiece.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/structure/StructurePiece.java +++ b/net/minecraft/world/level/levelgen/structure/StructurePiece.java -@@ -91,6 +_,9 @@ +@@ -92,6 +_,9 @@ } public final CompoundTag createTag(StructurePieceSerializationContext p_192645_) { diff --git a/patches/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch b/patches/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch index 5e64baec2f3..dfa077d7f4f 100644 --- a/patches/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch +++ b/patches/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -@@ -217,6 +_,10 @@ +@@ -219,6 +_,10 @@ return transform(p_74565_, p_74564_.getMirror(), p_74564_.getRotation(), p_74564_.getRotationPivot()); } @@ -11,16 +11,16 @@ public boolean placeInWorld( ServerLevelAccessor p_230329_, BlockPos p_230330_, BlockPos p_230331_, StructurePlaceSettings p_230332_, RandomSource p_230333_, int p_230334_ ) { -@@ -240,7 +_,7 @@ +@@ -242,7 +_,7 @@ int j1 = Integer.MIN_VALUE; - for(StructureTemplate.StructureBlockInfo structuretemplate$structureblockinfo : processBlockInfos( + for (StructureTemplate.StructureBlockInfo structuretemplate$structureblockinfo : processBlockInfos( - p_230329_, p_230330_, p_230331_, p_230332_, list + p_230329_, p_230330_, p_230331_, p_230332_, list, this )) { BlockPos blockpos = structuretemplate$structureblockinfo.pos; if (boundingbox == null || boundingbox.isInside(blockpos)) { -@@ -353,15 +_,7 @@ +@@ -355,15 +_,7 @@ } if (!p_230332_.isIgnoreEntities()) { @@ -37,7 +37,7 @@ } return true; -@@ -390,12 +_,20 @@ +@@ -402,12 +_,20 @@ } public static List processBlockInfos( @@ -58,16 +58,16 @@ List list = new ArrayList<>(); List list1 = new ArrayList<>(); -@@ -410,7 +_,7 @@ +@@ -422,7 +_,7 @@ - while(structuretemplate$structureblockinfo1 != null && iterator.hasNext()) { + while (structuretemplate$structureblockinfo1 != null && iterator.hasNext()) { structuretemplate$structureblockinfo1 = iterator.next() - .processBlock(p_278297_, p_74519_, p_74520_, structuretemplate$structureblockinfo, structuretemplate$structureblockinfo1, p_74521_); + .process(p_278297_, p_74519_, p_74520_, structuretemplate$structureblockinfo, structuretemplate$structureblockinfo1, p_74521_, template); } if (structuretemplate$structureblockinfo1 != null) { -@@ -426,21 +_,29 @@ +@@ -438,21 +_,29 @@ return list1; } @@ -80,7 +80,7 @@ - @Nullable BoundingBox p_74529_, - boolean p_74530_ - ) { -- for(StructureTemplate.StructureEntityInfo structuretemplate$structureentityinfo : this.entityInfoList) { +- for (StructureTemplate.StructureEntityInfo structuretemplate$structureentityinfo : this.entityInfoList) { - BlockPos blockpos = transform(structuretemplate$structureentityinfo.blockPos, p_74526_, p_74527_, p_74528_).offset(p_74525_); - if (p_74529_ == null || p_74529_.isInside(blockpos)) { + public static List processEntityInfos(@Nullable StructureTemplate template, LevelAccessor p_215387_0_, BlockPos p_215387_1_, StructurePlaceSettings p_215387_2_, List p_215387_3_) { @@ -111,17 +111,17 @@ ListTag listtag = new ListTag(); listtag.add(DoubleTag.valueOf(vec31.x)); listtag.add(DoubleTag.valueOf(vec31.y)); -@@ -450,10 +_,10 @@ - createEntityIgnoreException(p_74524_, compoundtag) - .ifPresent( - p_275190_ -> { -- float f = p_275190_.rotate(p_74527_); -- f += p_275190_.mirror(p_74526_) - p_275190_.getYRot(); -+ float f = p_275190_.rotate(placementIn.getRotation()); -+ f += p_275190_.mirror(placementIn.getMirror()) - p_275190_.getYRot(); - p_275190_.moveTo(vec31.x, vec31.y, vec31.z, f, p_275190_.getXRot()); -- if (p_74530_ && p_275190_ instanceof Mob) { -+ if (placementIn.shouldFinalizeEntities() && p_275190_ instanceof Mob) { - ((Mob)p_275190_) - .finalizeSpawn( - p_74524_, p_74524_.getCurrentDifficultyAt(BlockPos.containing(vec31)), MobSpawnType.STRUCTURE, null, compoundtag +@@ -460,10 +_,10 @@ + compoundtag.put("Pos", listtag); + compoundtag.remove("UUID"); + createEntityIgnoreException(p_74524_, compoundtag).ifPresent(p_275190_ -> { +- float f = p_275190_.rotate(p_74527_); +- f += p_275190_.mirror(p_74526_) - p_275190_.getYRot(); ++ float f = p_275190_.rotate(placementIn.getRotation()); ++ f += p_275190_.mirror(placementIn.getMirror()) - p_275190_.getYRot(); + p_275190_.moveTo(vec31.x, vec31.y, vec31.z, f, p_275190_.getXRot()); +- if (p_74530_ && p_275190_ instanceof Mob) { ++ if (placementIn.shouldFinalizeEntities() && p_275190_ instanceof Mob) { + ((Mob)p_275190_).finalizeSpawn(p_74524_, p_74524_.getCurrentDifficultyAt(BlockPos.containing(vec31)), MobSpawnType.STRUCTURE, null); + } + diff --git a/patches/net/minecraft/world/level/lighting/LightEngine.java.patch b/patches/net/minecraft/world/level/lighting/LightEngine.java.patch index f87408b9339..63adb6e17d8 100644 --- a/patches/net/minecraft/world/level/lighting/LightEngine.java.patch +++ b/patches/net/minecraft/world/level/lighting/LightEngine.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/lighting/LightEngine.java +++ b/net/minecraft/world/level/lighting/LightEngine.java -@@ -45,7 +_,7 @@ - return false; - } else { - return p_285372_.getLightBlock(p_285159_, p_284985_) != p_285110_.getLightBlock(p_285159_, p_284985_) +@@ -44,7 +_,7 @@ + return p_285372_ == p_285110_ + ? false + : p_285372_.getLightBlock(p_285159_, p_284985_) != p_285110_.getLightBlock(p_285159_, p_284985_) - || p_285372_.getLightEmission() != p_285110_.getLightEmission() + || p_285372_.getLightEmission(p_285159_, p_284985_) != p_285110_.getLightEmission(p_285159_, p_284985_) || p_285372_.useShapeForLightOcclusion() || p_285110_.useShapeForLightOcclusion(); - } + } diff --git a/patches/net/minecraft/world/level/material/FlowingFluid.java.patch b/patches/net/minecraft/world/level/material/FlowingFluid.java.patch index 209d33fca85..291782510b7 100644 --- a/patches/net/minecraft/world/level/material/FlowingFluid.java.patch +++ b/patches/net/minecraft/world/level/material/FlowingFluid.java.patch @@ -6,7 +6,7 @@ if (fluidstate.getType().isSame(this) && this.canPassThroughWall(direction, p_256464_, p_76037_, p_76038_, blockpos, blockstate)) { - if (fluidstate.isSource()) { + if (fluidstate.isSource() && net.neoforged.neoforge.event.EventHooks.canCreateFluidSource(p_256464_, blockpos, blockstate, fluidstate.canConvertToSource(p_256464_, blockpos))) { - ++j; + j++; } @@ -172,7 +_,7 @@ diff --git a/patches/net/minecraft/world/level/material/LavaFluid.java.patch b/patches/net/minecraft/world/level/material/LavaFluid.java.patch index d6d69b06ad9..22bbfb96e8e 100644 --- a/patches/net/minecraft/world/level/material/LavaFluid.java.patch +++ b/patches/net/minecraft/world/level/material/LavaFluid.java.patch @@ -5,7 +5,7 @@ if (blockstate.isAir()) { if (this.hasFlammableNeighbours(p_230572_, blockpos)) { - p_230572_.setBlockAndUpdate(blockpos, BaseFireBlock.getState(p_230572_, blockpos)); -+ p_230572_.setBlockAndUpdate(blockpos, net.neoforged.neoforge.event.EventHooks.fireFluidPlaceBlockEvent(p_230572_, blockpos, p_230573_, Blocks.FIRE.defaultBlockState())); ++ p_230572_.setBlockAndUpdate(blockpos, net.neoforged.neoforge.event.EventHooks.fireFluidPlaceBlockEvent(p_230572_, blockpos, p_230573_, BaseFireBlock.getState(p_230572_, blockpos))); return; } } else if (blockstate.blocksMotion()) { @@ -16,14 +16,14 @@ - if (p_230572_.isEmptyBlock(blockpos1.above()) && this.isFlammable(p_230572_, blockpos1)) { - p_230572_.setBlockAndUpdate(blockpos1.above(), BaseFireBlock.getState(p_230572_, blockpos1)); + if (p_230572_.isEmptyBlock(blockpos1.above()) && this.isFlammable(p_230572_, blockpos1, Direction.UP)) { -+ p_230572_.setBlockAndUpdate(blockpos1.above(), net.neoforged.neoforge.event.EventHooks.fireFluidPlaceBlockEvent(p_230572_, blockpos1.above(), p_230573_, Blocks.FIRE.defaultBlockState())); ++ p_230572_.setBlockAndUpdate(blockpos1.above(), net.neoforged.neoforge.event.EventHooks.fireFluidPlaceBlockEvent(p_230572_, blockpos1.above(), p_230573_, BaseFireBlock.getState(p_230572_, blockpos1))); } } } @@ -111,7 +_,7 @@ private boolean hasFlammableNeighbours(LevelReader p_76228_, BlockPos p_76229_) { - for(Direction direction : Direction.values()) { + for (Direction direction : Direction.values()) { - if (this.isFlammable(p_76228_, p_76229_.relative(direction))) { + if (this.isFlammable(p_76228_, p_76229_.relative(direction), direction.getOpposite())) { return true; diff --git a/patches/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java.patch b/patches/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java.patch deleted file mode 100644 index 5dba9b0dcc7..00000000000 --- a/patches/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java -+++ b/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java -@@ -57,7 +_,7 @@ - BlockPathTypes blockpathtypes1 = this.getCachedBlockType(this.mob, p_164677_.x, p_164677_.y, p_164677_.z); - int j; - if (this.mob.getPathfindingMalus(blockpathtypes) >= 0.0F && blockpathtypes1 != BlockPathTypes.STICKY_HONEY) { -- j = Mth.floor(Math.max(1.0F, this.mob.maxUpStep())); -+ j = Mth.floor(Math.max(1.0F, this.mob.getStepHeight())); - } else { - j = 0; - } diff --git a/patches/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch b/patches/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch deleted file mode 100644 index d7d0b8e25f2..00000000000 --- a/patches/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/net/minecraft/world/level/pathfinder/BlockPathTypes.java -+++ b/net/minecraft/world/level/pathfinder/BlockPathTypes.java -@@ -1,6 +_,6 @@ - package net.minecraft.world.level.pathfinder; - --public enum BlockPathTypes { -+public enum BlockPathTypes implements net.neoforged.neoforge.common.IExtensibleEnum { - BLOCKED(-1.0F), - OPEN(0.0F), - WALKABLE(0.0F), -@@ -36,5 +_,17 @@ - - public float getMalus() { - return this.malus; -+ } -+ -+ @org.jetbrains.annotations.Nullable -+ public BlockPathTypes getDanger() { -+ return (this == DAMAGE_FIRE || this == DANGER_FIRE ) ? DANGER_FIRE : -+ (this == DAMAGE_OTHER || this == DANGER_OTHER ) ? DANGER_OTHER : -+ (this == LAVA) ? DAMAGE_FIRE : -+ null; -+ } -+ -+ public static BlockPathTypes create(String name, float malus) { -+ throw new IllegalArgumentException("Enum not extended"); - } - } diff --git a/patches/net/minecraft/world/level/pathfinder/PathfindingContext.java.patch b/patches/net/minecraft/world/level/pathfinder/PathfindingContext.java.patch new file mode 100644 index 00000000000..42c87e81c83 --- /dev/null +++ b/patches/net/minecraft/world/level/pathfinder/PathfindingContext.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/level/pathfinder/PathfindingContext.java ++++ b/net/minecraft/world/level/pathfinder/PathfindingContext.java +@@ -41,4 +_,8 @@ + public BlockPos mobPosition() { + return this.mobPosition; + } ++ ++ BlockPos currentEvalPos() { ++ return this.mutablePos; ++ } + } diff --git a/patches/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch b/patches/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch index deea9f87200..65153f5d5ea 100644 --- a/patches/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch +++ b/patches/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch @@ -1,59 +1,42 @@ --- a/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +++ b/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -@@ -126,7 +_,7 @@ - BlockPathTypes blockpathtypes = this.getCachedBlockType(this.mob, p_77641_.x, p_77641_.y + 1, p_77641_.z); - BlockPathTypes blockpathtypes1 = this.getCachedBlockType(this.mob, p_77641_.x, p_77641_.y, p_77641_.z); - if (this.mob.getPathfindingMalus(blockpathtypes) >= 0.0F && blockpathtypes1 != BlockPathTypes.STICKY_HONEY) { -- j = Mth.floor(Math.max(1.0F, this.mob.maxUpStep())); -+ j = Mth.floor(Math.max(1.0F, this.mob.getStepHeight())); - } - - double d0 = this.getFloorLevel(new BlockPos(p_77641_.x, p_77641_.y, p_77641_.z)); -@@ -338,7 +_,7 @@ - } - - private double getMobJumpHeight() { -- return Math.max(1.125, (double)this.mob.maxUpStep()); -+ return Math.max(1.125, (double)this.mob.getStepHeight()); - } - - private Node getNodeAndUpdateCostToMax(int p_230620_, int p_230621_, int p_230622_, BlockPathTypes p_230623_, float p_230624_) { -@@ -477,6 +_,11 @@ - if (l != 0 || j1 != 0) { - p_77609_.set(i + l, j + i1, k + j1); - BlockState blockstate = p_77608_.getBlockState(p_77609_); -+ BlockPathTypes blockPathType = blockstate.getAdjacentBlockPathType(p_77608_, p_77609_, null, p_77610_); +@@ -471,6 +_,12 @@ + for (int k = -1; k <= 1; k++) { + if (i != 0 || k != 0) { + PathType pathtype = p_331893_.getPathTypeFromState(p_332169_ + i, p_330433_ + j, p_331506_ + k); ++ BlockState blockState = p_331893_.level().getBlockState(p_331893_.currentEvalPos()); ++ PathType blockPathType = blockState.getAdjacentBlockPathType(p_331893_.level(), p_331893_.currentEvalPos(), null, pathtype); + if (blockPathType != null) return blockPathType; -+ FluidState fluidState = blockstate.getFluidState(); -+ BlockPathTypes fluidPathType = fluidState.getAdjacentBlockPathType(p_77608_, p_77609_, null, p_77610_); ++ net.minecraft.world.level.material.FluidState fluidState = blockState.getFluidState(); ++ PathType fluidPathType = fluidState.getAdjacentBlockPathType(p_331893_.level(), p_331893_.currentEvalPos(), null, pathtype); + if (fluidPathType != null) return fluidPathType; - if (blockstate.is(Blocks.CACTUS) || blockstate.is(Blocks.SWEET_BERRY_BUSH)) { - return BlockPathTypes.DANGER_OTHER; + if (pathtype == PathType.DAMAGE_OTHER) { + return PathType.DANGER_OTHER; } -@@ -502,6 +_,8 @@ +@@ -496,6 +_,8 @@ - protected static BlockPathTypes getBlockPathTypeRaw(BlockGetter p_77644_, BlockPos p_77645_) { + protected static PathType getPathTypeFromState(BlockGetter p_77644_, BlockPos p_77645_) { BlockState blockstate = p_77644_.getBlockState(p_77645_); -+ BlockPathTypes type = blockstate.getBlockPathType(p_77644_, p_77645_, null); ++ PathType type = blockstate.getBlockPathType(p_77644_, p_77645_, null); + if (type != null) return type; Block block = blockstate.getBlock(); if (blockstate.isAir()) { - return BlockPathTypes.OPEN; -@@ -517,6 +_,8 @@ - return BlockPathTypes.COCOA; + return PathType.OPEN; +@@ -511,6 +_,8 @@ + return PathType.COCOA; } else if (!blockstate.is(Blocks.WITHER_ROSE) && !blockstate.is(Blocks.POINTED_DRIPSTONE)) { - FluidState fluidstate = p_77644_.getFluidState(p_77645_); -+ BlockPathTypes nonLoggableFluidPathType = fluidstate.getBlockPathType(p_77644_, p_77645_, null, false); + FluidState fluidstate = blockstate.getFluidState(); ++ PathType nonLoggableFluidPathType = fluidstate.getBlockPathType(p_77644_, p_77645_, null, false); + if (nonLoggableFluidPathType != null) return nonLoggableFluidPathType; if (fluidstate.is(FluidTags.LAVA)) { - return BlockPathTypes.LAVA; + return PathType.LAVA; } else if (isBurningBlock(blockstate)) { -@@ -537,6 +_,8 @@ - if (!blockstate.isPathfindable(p_77644_, p_77645_, PathComputationType.LAND)) { - return BlockPathTypes.BLOCKED; +@@ -531,6 +_,8 @@ + if (!blockstate.isPathfindable(PathComputationType.LAND)) { + return PathType.BLOCKED; } else { -+ BlockPathTypes loggableFluidPathType = fluidstate.getBlockPathType(p_77644_, p_77645_, null, true); ++ PathType loggableFluidPathType = fluidstate.getBlockPathType(p_77644_, p_77645_, null, true); + if (loggableFluidPathType != null) return loggableFluidPathType; - return fluidstate.is(FluidTags.WATER) ? BlockPathTypes.WATER : BlockPathTypes.OPEN; + return fluidstate.is(FluidTags.WATER) ? PathType.WATER : PathType.OPEN; } } else { diff --git a/patches/net/minecraft/world/level/portal/PortalForcer.java.patch b/patches/net/minecraft/world/level/portal/PortalForcer.java.patch index 9a25948b327..159d3aefba9 100644 --- a/patches/net/minecraft/world/level/portal/PortalForcer.java.patch +++ b/patches/net/minecraft/world/level/portal/PortalForcer.java.patch @@ -6,6 +6,6 @@ -public class PortalForcer { +public class PortalForcer implements net.neoforged.neoforge.common.util.ITeleporter { - private static final int TICKET_RADIUS = 3; + public static final int TICKET_RADIUS = 3; private static final int SEARCH_RADIUS = 128; private static final int CREATE_RADIUS = 16; diff --git a/patches/net/minecraft/world/level/saveddata/SavedData.java.patch b/patches/net/minecraft/world/level/saveddata/SavedData.java.patch index 2e74ecdae84..b8779d52d89 100644 --- a/patches/net/minecraft/world/level/saveddata/SavedData.java.patch +++ b/patches/net/minecraft/world/level/saveddata/SavedData.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/world/level/saveddata/SavedData.java +++ b/net/minecraft/world/level/saveddata/SavedData.java -@@ -45,6 +_,10 @@ - } +@@ -47,7 +_,10 @@ } -- public static record Factory(Supplier constructor, Function deserializer, DataFixTypes type) { -+ public static record Factory(Supplier constructor, Function deserializer, @javax.annotation.Nullable DataFixTypes type) { // Neo: We do not have update logic compatible with DFU, several downstream patches from this record are made to support a nullable type. -+ -+ public Factory(Supplier constructor, Function deserializer) { + public static record Factory( +- Supplier constructor, BiFunction deserializer, DataFixTypes type ++ Supplier constructor, BiFunction deserializer, @javax.annotation.Nullable DataFixTypes type // Neo: We do not have update logic compatible with DFU, several downstream patches from this record are made to support a nullable type. + ) { ++ public Factory(Supplier constructor, BiFunction deserializer) { + this(constructor, deserializer, null); + } } diff --git a/patches/net/minecraft/world/level/saveddata/maps/MapDecoration.java.patch b/patches/net/minecraft/world/level/saveddata/maps/MapDecoration.java.patch index c1858be9209..b194cb2a8d7 100644 --- a/patches/net/minecraft/world/level/saveddata/maps/MapDecoration.java.patch +++ b/patches/net/minecraft/world/level/saveddata/maps/MapDecoration.java.patch @@ -1,31 +1,11 @@ --- a/net/minecraft/world/level/saveddata/maps/MapDecoration.java +++ b/net/minecraft/world/level/saveddata/maps/MapDecoration.java -@@ -7,13 +_,27 @@ - import net.minecraft.util.StringRepresentable; - import net.minecraft.world.level.material.MapColor; +@@ -9,7 +_,7 @@ + import net.minecraft.network.codec.StreamCodec; + import net.minecraft.resources.ResourceLocation; --public record MapDecoration(MapDecoration.Type type, byte x, byte y, byte rot, @Nullable Component name) { -+public record MapDecoration(MapDecoration.Type type, byte x, byte y, byte rot, @Nullable Component name, it.unimi.dsi.fastutil.ints.Int2BooleanFunction shouldRenderForIndex) { -+ -+ public MapDecoration(Type type, byte x, byte y, byte rot, @Nullable Component name) { -+ this(type, x, y, rot, name, (i) -> false); -+ } -+ - public byte getImage() { - return this.type.getIcon(); - } - - public boolean renderOnFrame() { - return this.type.isRenderedOnFrame(); -+ } -+ -+ /** -+ * Renders this decoration, useful for custom sprite sheets. -+ * @param index The index of this icon in the MapData's list. Used by vanilla to offset the Z-coordinate to prevent Z-fighting -+ * @return false to run vanilla logic for this decoration, true to skip it -+ */ -+ public boolean render(int index) { -+ return shouldRenderForIndex().get(index); - } - - public static enum Type implements StringRepresentable { +-public record MapDecoration(Holder type, byte x, byte y, byte rot, Optional name) { ++public record MapDecoration(Holder type, byte x, byte y, byte rot, Optional name) { // Porting 1.20.5 this is synced now reevaluate shouldRenderForIndex + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + MapDecorationType.STREAM_CODEC, + MapDecoration::type, diff --git a/patches/net/minecraft/world/level/storage/DimensionDataStorage.java.patch b/patches/net/minecraft/world/level/storage/DimensionDataStorage.java.patch index 5f8c1c126ea..2ecb5333a0e 100644 --- a/patches/net/minecraft/world/level/storage/DimensionDataStorage.java.patch +++ b/patches/net/minecraft/world/level/storage/DimensionDataStorage.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/DimensionDataStorage.java +++ b/net/minecraft/world/level/storage/DimensionDataStorage.java -@@ -49,16 +_,20 @@ +@@ -54,16 +_,20 @@ @Nullable public T get(SavedData.Factory p_295091_, String p_164860_) { SavedData saveddata = this.cache.get(p_164860_); @@ -17,12 +17,12 @@ } @Nullable -- private T readSavedData(Function p_164869_, DataFixTypes p_295832_, String p_164870_) { -+ private T readSavedData(Function p_164869_, @Nullable DataFixTypes p_295832_, String p_164870_) { +- private T readSavedData(BiFunction p_324609_, DataFixTypes p_295832_, String p_164870_) { ++ private T readSavedData(BiFunction p_324609_, @Nullable DataFixTypes p_295832_, String p_164870_) { try { File file1 = this.getDataFile(p_164870_); if (file1.exists()) { -@@ -76,7 +_,7 @@ +@@ -81,7 +_,7 @@ this.cache.put(p_164856_, p_164857_); } @@ -31,7 +31,7 @@ File file1 = this.getDataFile(p_78159_); CompoundTag compoundtag1; -@@ -93,8 +_,12 @@ +@@ -98,8 +_,12 @@ } } diff --git a/patches/net/minecraft/world/level/storage/LevelStorageSource.java.patch b/patches/net/minecraft/world/level/storage/LevelStorageSource.java.patch index 9bdbcd1977f..f119c517b6b 100644 --- a/patches/net/minecraft/world/level/storage/LevelStorageSource.java.patch +++ b/patches/net/minecraft/world/level/storage/LevelStorageSource.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/LevelStorageSource.java +++ b/net/minecraft/world/level/storage/LevelStorageSource.java -@@ -475,6 +_,18 @@ +@@ -463,6 +_,18 @@ } } @@ -19,7 +19,7 @@ public PlayerDataStorage createPlayerStorage() { this.checkLock(); return new PlayerDataStorage(this, LevelStorageSource.this.fixerUpper); -@@ -508,6 +_,7 @@ +@@ -496,6 +_,7 @@ CompoundTag compoundtag = p_78292_.createTag(p_78291_, p_78293_); CompoundTag compoundtag1 = new CompoundTag(); compoundtag1.put("Data", compoundtag); @@ -27,7 +27,7 @@ this.saveLevelData(compoundtag1); } -@@ -527,6 +_,10 @@ +@@ -515,6 +_,10 @@ public Optional getIconFile() { return !this.lock.isValid() ? Optional.empty() : Optional.of(this.levelDirectory.iconFile()); diff --git a/patches/net/minecraft/world/level/storage/LevelSummary.java.patch b/patches/net/minecraft/world/level/storage/LevelSummary.java.patch deleted file mode 100644 index 588306c2b21..00000000000 --- a/patches/net/minecraft/world/level/storage/LevelSummary.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/net/minecraft/world/level/storage/LevelSummary.java -+++ b/net/minecraft/world/level/storage/LevelSummary.java -@@ -270,6 +_,10 @@ - } - } - -+ public boolean isLifecycleExperimental() { -+ return this.settings.getLifecycle().equals(com.mojang.serialization.Lifecycle.experimental()); -+ } -+ - public static class SymlinkLevelSummary extends LevelSummary { - private static final Component MORE_INFO_BUTTON = Component.translatable("symlink_warning.more_info"); - private static final Component INFO = Component.translatable("symlink_warning.title").withColor(-65536); diff --git a/patches/net/minecraft/world/level/storage/PlayerDataStorage.java.patch b/patches/net/minecraft/world/level/storage/PlayerDataStorage.java.patch index ac914d890d3..ebd731efaac 100644 --- a/patches/net/minecraft/world/level/storage/PlayerDataStorage.java.patch +++ b/patches/net/minecraft/world/level/storage/PlayerDataStorage.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/PlayerDataStorage.java +++ b/net/minecraft/world/level/storage/PlayerDataStorage.java -@@ -35,6 +_,7 @@ +@@ -39,6 +_,7 @@ Path path2 = path.resolve(p_78434_.getStringUUID() + ".dat"); Path path3 = path.resolve(p_78434_.getStringUUID() + ".dat_old"); Util.safeReplaceFile(path2, path1, path3); @@ -8,21 +8,16 @@ } catch (Exception exception) { LOGGER.warn("Failed to save player data for {}", p_78434_.getName().getString()); } -@@ -58,6 +_,7 @@ - compoundtag = DataFixTypes.PLAYER.updateToCurrentVersion(this.fixerUpper, compoundtag, i); - p_78436_.load(compoundtag); - } -+ net.neoforged.neoforge.event.EventHooks.firePlayerLoadingEvent(p_78436_, playerDir, p_78436_.getStringUUID()); - - return compoundtag; - } -@@ -75,5 +_,9 @@ - } - - return astring; +@@ -80,7 +_,12 @@ + int i = NbtUtils.getDataVersion(p_316252_, -1); + p_316252_ = DataFixTypes.PLAYER.updateToCurrentVersion(this.fixerUpper, p_316252_, i); + p_78436_.load(p_316252_); ++ net.neoforged.neoforge.event.EventHooks.firePlayerLoadingEvent(p_78436_, playerDir, p_78436_.getStringUUID()); + return p_316252_; + }); + } + -+ public File getPlayerDataFolder() { ++ public File getPlayerDir() { + return playerDir; } } diff --git a/patches/net/minecraft/world/level/storage/PrimaryLevelData.java.patch b/patches/net/minecraft/world/level/storage/PrimaryLevelData.java.patch index 3e34c45ee28..e864d040041 100644 --- a/patches/net/minecraft/world/level/storage/PrimaryLevelData.java.patch +++ b/patches/net/minecraft/world/level/storage/PrimaryLevelData.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/PrimaryLevelData.java +++ b/net/minecraft/world/level/storage/PrimaryLevelData.java -@@ -78,6 +_,7 @@ +@@ -74,6 +_,7 @@ private boolean wasModded; private final Set removedFeatureFlags; private final TimerQueue scheduledEvents; @@ -8,7 +8,7 @@ private PrimaryLevelData( @Nullable CompoundTag p_277888_, -@@ -212,7 +_,7 @@ +@@ -200,7 +_,7 @@ p_251864_, p_250651_, p_78538_ @@ -17,7 +17,7 @@ } @Override -@@ -287,6 +_,8 @@ +@@ -273,6 +_,8 @@ if (this.wanderingTraderId != null) { p_78547_.putUUID("WanderingTraderId", this.wanderingTraderId); } @@ -26,7 +26,7 @@ } private static ListTag stringCollectionToTag(Set p_277880_) { -@@ -616,6 +_,15 @@ +@@ -570,6 +_,15 @@ @Override public LevelSettings getLevelSettings() { return this.settings.copy(); diff --git a/patches/net/minecraft/world/level/storage/loot/LootContext.java.patch b/patches/net/minecraft/world/level/storage/loot/LootContext.java.patch index 4b580b813ec..82dfa71a9ef 100644 --- a/patches/net/minecraft/world/level/storage/loot/LootContext.java.patch +++ b/patches/net/minecraft/world/level/storage/loot/LootContext.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/loot/LootContext.java +++ b/net/minecraft/world/level/storage/loot/LootContext.java -@@ -86,15 +_,43 @@ +@@ -87,15 +_,43 @@ return new LootContext.VisitedEntry<>(LootDataType.MODIFIER, p_279163_); } @@ -11,7 +11,7 @@ + + private ResourceLocation queriedLootTableId; + -+ private LootContext(LootParams p_287722_, RandomSource p_287702_, LootDataResolver p_287619_, ResourceLocation queriedLootTableId) { ++ private LootContext(LootParams p_287722_, RandomSource p_287702_, HolderGetter.Provider p_287619_, ResourceLocation queriedLootTableId) { + this(p_287722_, p_287702_, p_287619_); + this.queriedLootTableId = queriedLootTableId; + } @@ -44,7 +44,7 @@ public LootContext.Builder withOptionalRandomSeed(long p_78966_) { if (p_78966_ != 0L) { this.random = RandomSource.create(p_78966_); -@@ -103,6 +_,11 @@ +@@ -104,6 +_,11 @@ return this; } @@ -56,16 +56,16 @@ public ServerLevel getLevel() { return this.params.getLevel(); } -@@ -113,7 +_,7 @@ +@@ -114,7 +_,7 @@ RandomSource randomsource = Optional.ofNullable(this.random) .or(() -> p_298622_.map(serverlevel::getRandomSequence)) .orElseGet(serverlevel::getRandom); -- return new LootContext(this.params, randomsource, minecraftserver.getLootData()); -+ return new LootContext(this.params, randomsource, minecraftserver.getLootData(), queriedLootTableId); +- return new LootContext(this.params, randomsource, minecraftserver.reloadableRegistries().lookup()); ++ return new LootContext(this.params, randomsource, minecraftserver.reloadableRegistries().lookup(), queriedLootTableId); } } -@@ -134,6 +_,11 @@ +@@ -135,6 +_,11 @@ public LootContextParam getParam() { return this.param; diff --git a/patches/net/minecraft/world/level/storage/loot/LootDataManager.java.patch b/patches/net/minecraft/world/level/storage/loot/LootDataManager.java.patch deleted file mode 100644 index 526806d442a..00000000000 --- a/patches/net/minecraft/world/level/storage/loot/LootDataManager.java.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- a/net/minecraft/world/level/storage/loot/LootDataManager.java -+++ b/net/minecraft/world/level/storage/loot/LootDataManager.java -@@ -23,7 +_,7 @@ - import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; - import org.slf4j.Logger; - --public class LootDataManager implements PreparableReloadListener, LootDataResolver { -+public class LootDataManager extends net.neoforged.neoforge.resource.ContextAwareReloadListener implements PreparableReloadListener, LootDataResolver { - private static final Logger LOGGER = LogUtils.getLogger(); - private static final Gson GSON = new GsonBuilder().create(); - public static final LootDataId EMPTY_LOOT_TABLE_KEY = new LootDataId<>(LootDataType.TABLE, BuiltInLootTables.EMPTY); -@@ -39,22 +_,33 @@ - Executor p_279148_, - Executor p_279169_ - ) { -+ var ops = this.makeConditionalOps(); - Map, Map> map = new HashMap<>(); - CompletableFuture[] completablefuture = LootDataType.values() -- .map(p_279242_ -> scheduleElementParse(p_279242_, p_279377_, p_279148_, map)) -+ .map(p_279242_ -> scheduleElementParse(p_279242_, p_279377_, p_279148_, map, ops)) - .toArray(p_279126_ -> new CompletableFuture[p_279126_]); - return CompletableFuture.allOf(completablefuture).thenCompose(p_279240_::wait).thenAcceptAsync(p_279096_ -> this.apply(map), p_279169_); - } - -+ /** -+ * @deprecated Neo: use the variant with a custom codec ops -+ */ -+ @Deprecated - private static CompletableFuture scheduleElementParse( - LootDataType p_279205_, ResourceManager p_279441_, Executor p_279233_, Map, Map> p_279241_ - ) { -+ return scheduleElementParse(p_279205_, p_279441_, p_279233_, p_279241_, com.mojang.serialization.JsonOps.INSTANCE); -+ } -+ private static CompletableFuture scheduleElementParse( -+ LootDataType p_279205_, ResourceManager p_279441_, Executor p_279233_, Map, Map> p_279241_, -+ com.mojang.serialization.DynamicOps decodeOps -+ ) { - Map map = new HashMap<>(); - p_279241_.put(p_279205_, map); - return CompletableFuture.runAsync(() -> { - Map map1 = new HashMap<>(); - SimpleJsonResourceReloadListener.scanDirectory(p_279441_, p_279205_.directory(), GSON, map1); -- map1.forEach((p_279416_, p_279151_) -> p_279205_.deserialize(p_279416_, p_279151_).ifPresent(p_279295_ -> map.put(p_279416_, p_279295_))); -+ map1.forEach((p_279416_, p_279151_) -> p_279205_.deserializeOrDefault(p_279416_, decodeOps, p_279151_).ifPresent(p_279295_ -> map.put(p_279416_, p_279295_))); - }, p_279233_); - } - diff --git a/patches/net/minecraft/world/level/storage/loot/LootDataType.java.patch b/patches/net/minecraft/world/level/storage/loot/LootDataType.java.patch index 7a49b8ff9e8..cad72480b4b 100644 --- a/patches/net/minecraft/world/level/storage/loot/LootDataType.java.patch +++ b/patches/net/minecraft/world/level/storage/loot/LootDataType.java.patch @@ -1,73 +1,60 @@ --- a/net/minecraft/world/level/storage/loot/LootDataType.java +++ b/net/minecraft/world/level/storage/loot/LootDataType.java -@@ -15,19 +_,36 @@ +@@ -17,7 +_,7 @@ import net.minecraft.world.level.storage.loot.predicates.LootItemConditions; import org.slf4j.Logger; -+ -+//PATCH 1.20.2: This whole class has to be revalidated. It previously used a very uggly patch with a hack. -+//This might need to be refactored into a codec. But currently this is reverted to a clean state. - public class LootDataType { +-public record LootDataType(ResourceKey> registryKey, Codec codec, String directory, LootDataType.Validator validator) { ++public record LootDataType(ResourceKey> registryKey, Codec codec, String directory, LootDataType.Validator validator, @org.jetbrains.annotations.Nullable T defaultValue, Codec> conditionalCodec, java.util.function.BiConsumer idSetter) { private static final Logger LOGGER = LogUtils.getLogger(); - public static final LootDataType PREDICATE = new LootDataType<>(LootItemConditions.CODEC, "predicates", createSimpleValidator()); - public static final LootDataType MODIFIER = new LootDataType<>(LootItemFunctions.CODEC, "item_modifiers", createSimpleValidator()); -- public static final LootDataType TABLE = new LootDataType<>(LootTable.CODEC, "loot_tables", createLootTableValidator()); -+ public static final LootDataType TABLE = new LootDataType<>(LootTable.CODEC, "loot_tables", createLootTableValidator(), LootTable.EMPTY, LootTable::setLootTableId); - private final Codec codec; - private final String directory; - private final LootDataType.Validator validator; -+ @org.jetbrains.annotations.Nullable -+ private final T defaultValue; -+ private final Codec> conditionalCodec; -+ private final java.util.function.BiConsumer idSetter; - + public static final LootDataType PREDICATE = new LootDataType<>( + Registries.PREDICATE, LootItemConditions.DIRECT_CODEC, "predicates", createSimpleValidator() +@@ -26,17 +_,32 @@ + Registries.ITEM_MODIFIER, LootItemFunctions.ROOT_CODEC, "item_modifiers", createSimpleValidator() + ); + public static final LootDataType TABLE = new LootDataType<>( +- Registries.LOOT_TABLE, LootTable.DIRECT_CODEC, "loot_tables", createLootTableValidator() ++ Registries.LOOT_TABLE, LootTable.DIRECT_CODEC, "loot_tables", createLootTableValidator(), LootTable.EMPTY, LootTable::setLootTableId + ); ++ + /** -+ * @deprecated Neo: use the constructor {@link #LootDataType(Codec, String, Validator, T, java.util.function.BiConsumer) with a default value and id setter} to support conditions ++ * @deprecated Neo: use the constructor {@link #LootDataType(ResourceKey, Codec, String, Validator, T, java.util.function.BiConsumer) with a default value and id setter} to support conditions + */ + @Deprecated - private LootDataType(Codec p_298773_, String p_279433_, LootDataType.Validator p_279363_) { -+ this(p_298773_, p_279433_, p_279363_, null, (it, id) -> {}); ++ private LootDataType(ResourceKey> registryKey, Codec codec, String directory, LootDataType.Validator validator) { ++ this(registryKey, codec, directory, validator, null, (it, id) -> {}); ++ } ++ ++ private LootDataType(ResourceKey> registryKey, Codec codec, String directory, LootDataType.Validator validator, @org.jetbrains.annotations.Nullable T defaultValue, java.util.function.BiConsumer idSetter) { ++ this(registryKey, codec, directory, validator, defaultValue, net.neoforged.neoforge.common.conditions.ConditionalOps.createConditionalCodec(codec), idSetter); + } -+ private LootDataType(Codec p_298773_, String p_279433_, LootDataType.Validator p_279363_, @org.jetbrains.annotations.Nullable T defaultValue, java.util.function.BiConsumer idSetter) { - this.codec = p_298773_; - this.directory = p_279433_; - this.validator = p_279363_; -+ this.defaultValue = defaultValue; -+ this.idSetter = idSetter; -+ this.conditionalCodec = net.neoforged.neoforge.common.conditions.ConditionalOps.createConditionalCodec(codec); - } - public String directory() { -@@ -39,9 +_,16 @@ + public void runValidation(ValidationContext p_279366_, ResourceKey p_336149_, T p_279124_) { + this.validator.run(p_279366_, p_336149_, p_279124_); } - public Optional deserialize(ResourceLocation p_279253_, JsonElement p_279330_) { -- DataResult dataresult = this.codec.parse(JsonOps.INSTANCE, p_279330_); -- dataresult.error().ifPresent(p_297991_ -> LOGGER.error("Couldn't parse element {}:{} - {}", this.directory, p_279253_, p_297991_.message())); + public Optional deserialize(ResourceLocation p_279253_, DynamicOps p_324006_, V p_324329_) { +- DataResult dataresult = this.codec.parse(p_324006_, p_324329_); ++ var dataresult = this.conditionalCodec.parse(p_324006_, p_324329_); + dataresult.error().ifPresent(p_338121_ -> LOGGER.error("Couldn't parse element {}:{} - {}", this.directory, p_279253_, p_338121_.message())); - return dataresult.result(); -+ return deserializeOrDefault(p_279253_, JsonOps.INSTANCE, p_279330_); -+ } -+ -+ public Optional deserializeOrDefault(ResourceLocation location, com.mojang.serialization.DynamicOps ops, C object) { -+ var dataresult = this.conditionalCodec.parse(ops, object); -+ dataresult.error().ifPresent(p_297991_ -> LOGGER.error("Couldn't parse element {}:{} - {}", this.directory, location, p_297991_.message())); + return dataresult.result().map(it -> { -+ it.ifPresent(val -> idSetter.accept(val, location)); ++ it.ifPresent(val -> idSetter.accept(val, p_279253_)); + return it.orElse(defaultValue); + }); } public static Stream> values() { -@@ -55,9 +_,12 @@ +@@ -50,9 +_,12 @@ } private static LootDataType.Validator createLootTableValidator() { -- return (p_279333_, p_279227_, p_279406_) -> p_279406_.validate( -- p_279333_.setParams(p_279406_.getParamSet()).enterElement("{" + p_279227_.type().directory + ":" + p_279227_.location() + "}", p_279227_) +- return (p_339557_, p_339558_, p_339559_) -> p_339559_.validate( +- p_339557_.setParams(p_339559_.getParamSet()).enterElement("{" + p_339558_.registry() + "/" + p_339558_.location() + "}", p_339558_) + return (p_279333_, p_279227_, p_279406_) -> { + p_279406_ = net.neoforged.neoforge.event.EventHooks.loadLootTable(p_279406_.getLootTableId(), p_279406_); + p_279406_.validate( -+ p_279333_.setParams(p_279406_.getParamSet()).enterElement("{" + p_279227_.type().directory + ":" + p_279227_.location() + "}", p_279227_) ++ p_279333_.setParams(p_279406_.getParamSet()).enterElement("{" + p_279227_.registry() + ":" + p_279227_.location() + "}", p_279227_) ); + }; } diff --git a/patches/net/minecraft/world/level/storage/loot/LootPool.java.patch b/patches/net/minecraft/world/level/storage/loot/LootPool.java.patch index 815b56069d7..16780faf295 100644 --- a/patches/net/minecraft/world/level/storage/loot/LootPool.java.patch +++ b/patches/net/minecraft/world/level/storage/loot/LootPool.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/level/storage/loot/LootPool.java +++ b/net/minecraft/world/level/storage/loot/LootPool.java @@ -34,7 +_,8 @@ - ExtraCodecs.strictOptionalField(LootItemConditions.CODEC.listOf(), "conditions", List.of()).forGetter(p_297992_ -> p_297992_.conditions), - ExtraCodecs.strictOptionalField(LootItemFunctions.CODEC.listOf(), "functions", List.of()).forGetter(p_297994_ -> p_297994_.functions), + LootItemConditions.DIRECT_CODEC.listOf().optionalFieldOf("conditions", List.of()).forGetter(p_297992_ -> p_297992_.conditions), + LootItemFunctions.ROOT_CODEC.listOf().optionalFieldOf("functions", List.of()).forGetter(p_297994_ -> p_297994_.functions), NumberProviders.CODEC.fieldOf("rolls").forGetter(p_297993_ -> p_297993_.rolls), - NumberProviders.CODEC.fieldOf("bonus_rolls").orElse(ConstantValue.exactly(0.0F)).forGetter(p_297997_ -> p_297997_.bonusRolls) + NumberProviders.CODEC.fieldOf("bonus_rolls").orElse(ConstantValue.exactly(0.0F)).forGetter(p_297997_ -> p_297997_.bonusRolls), + Codec.STRING.optionalFieldOf("name").forGetter(pool -> java.util.Optional.ofNullable(pool.name).filter(name -> !name.startsWith("custom#"))) ) - .apply(p_297996_, LootPool::new) + .apply(p_338122_, LootPool::new) ); @@ -51,7 +_,8 @@ List p_299316_, diff --git a/patches/net/minecraft/world/level/storage/loot/LootTable.java.patch b/patches/net/minecraft/world/level/storage/loot/LootTable.java.patch index e4d8e7d2769..540e4e7c850 100644 --- a/patches/net/minecraft/world/level/storage/loot/LootTable.java.patch +++ b/patches/net/minecraft/world/level/storage/loot/LootTable.java.patch @@ -1,17 +1,17 @@ --- a/net/minecraft/world/level/storage/loot/LootTable.java +++ b/net/minecraft/world/level/storage/loot/LootTable.java -@@ -35,8 +_,8 @@ - p_297999_ -> p_297999_.group( - LootContextParamSets.CODEC.optionalFieldOf("type", DEFAULT_PARAM_SET).forGetter(p_298001_ -> p_298001_.paramSet), - ExtraCodecs.strictOptionalField(ResourceLocation.CODEC, "random_sequence").forGetter(p_297998_ -> p_297998_.randomSequence), -- ExtraCodecs.strictOptionalField(LootPool.CODEC.listOf(), "pools", List.of()).forGetter(p_298002_ -> p_298002_.pools), -- ExtraCodecs.strictOptionalField(LootItemFunctions.CODEC.listOf(), "functions", List.of()).forGetter(p_298000_ -> p_298000_.functions) -+ ExtraCodecs.strictOptionalField(net.neoforged.neoforge.common.CommonHooks.lootPoolsCodec(LootPool::setName), "pools", List.of()).forGetter(p_298002_ -> p_298002_.pools), -+ ExtraCodecs.strictOptionalField(net.neoforged.neoforge.common.conditions.ConditionalOps.decodeListWithElementConditions(LootItemFunctions.CODEC), "functions", List.of()).forGetter(p_298000_ -> p_298000_.functions) +@@ -38,8 +_,8 @@ + p_338123_ -> p_338123_.group( + LootContextParamSets.CODEC.lenientOptionalFieldOf("type", DEFAULT_PARAM_SET).forGetter(p_298001_ -> p_298001_.paramSet), + ResourceLocation.CODEC.optionalFieldOf("random_sequence").forGetter(p_297998_ -> p_297998_.randomSequence), +- LootPool.CODEC.listOf().optionalFieldOf("pools", List.of()).forGetter(p_298002_ -> p_298002_.pools), +- LootItemFunctions.ROOT_CODEC.listOf().optionalFieldOf("functions", List.of()).forGetter(p_298000_ -> p_298000_.functions) ++ net.neoforged.neoforge.common.CommonHooks.lootPoolsCodec(LootPool::setName).optionalFieldOf("pools", List.of()).forGetter(p_298002_ -> p_298002_.pools), ++ net.neoforged.neoforge.common.conditions.ConditionalOps.decodeListWithElementConditions(LootItemFunctions.ROOT_CODEC).optionalFieldOf("functions", List.of()).forGetter(p_298000_ -> p_298000_.functions) ) - .apply(p_297999_, LootTable::new) + .apply(p_338123_, LootTable::new) ); -@@ -49,7 +_,7 @@ +@@ -53,7 +_,7 @@ LootTable(LootContextParamSet p_287716_, Optional p_299055_, List p_298390_, List p_298775_) { this.paramSet = p_287716_; this.randomSequence = p_299055_; @@ -20,7 +20,7 @@ this.functions = p_298775_; this.compositeFunction = LootItemFunctions.compose(p_298775_); } -@@ -72,10 +_,12 @@ +@@ -76,10 +_,12 @@ }; } @@ -33,7 +33,7 @@ public void getRandomItemsRaw(LootContext p_79132_, Consumer p_79133_) { LootContext.VisitedEntry visitedentry = LootContext.createVisitedEntry(this); if (p_79132_.pushVisitedElement(visitedentry)) { -@@ -92,18 +_,15 @@ +@@ -96,18 +_,15 @@ } public void getRandomItems(LootParams p_287748_, long p_287729_, Consumer p_287583_) { @@ -55,7 +55,7 @@ } public ObjectArrayList getRandomItems(LootParams p_287574_, long p_287773_) { -@@ -116,7 +_,8 @@ +@@ -120,7 +_,8 @@ private ObjectArrayList getRandomItems(LootContext p_230923_) { ObjectArrayList objectarraylist = new ObjectArrayList<>(); @@ -65,7 +65,7 @@ return objectarraylist; } -@@ -206,6 +_,50 @@ +@@ -210,6 +_,50 @@ public static LootTable.Builder lootTable() { return new LootTable.Builder(); } diff --git a/patches/net/minecraft/world/level/storage/loot/parameters/LootContextParamSets.java.patch b/patches/net/minecraft/world/level/storage/loot/parameters/LootContextParamSets.java.patch index ef882c48ae9..a89b35fe0cd 100644 --- a/patches/net/minecraft/world/level/storage/loot/parameters/LootContextParamSets.java.patch +++ b/patches/net/minecraft/world/level/storage/loot/parameters/LootContextParamSets.java.patch @@ -4,11 +4,11 @@ public static final LootContextParamSet EMPTY = register("empty", p_81454_ -> { }); public static final LootContextParamSet CHEST = register( -- "chest", p_81452_ -> p_81452_.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY) +- "chest", p_323464_ -> p_323464_.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY) + "chest", p_81452_ -> p_81452_.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY).optional(LootContextParams.KILLER_ENTITY) //Forge: Chest minecarts can have killer entities ); public static final LootContextParamSet COMMAND = register( - "command", p_81450_ -> p_81450_.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY) + "command", p_330195_ -> p_330195_.required(LootContextParams.ORIGIN).optional(LootContextParams.THIS_ENTITY) @@ -29,7 +_,7 @@ "selector", p_81442_ -> p_81442_.required(LootContextParams.ORIGIN).required(LootContextParams.THIS_ENTITY) ); diff --git a/patches/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithLootingCondition.java.patch b/patches/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithLootingCondition.java.patch index fa782ec1144..08fd78e1e71 100644 --- a/patches/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithLootingCondition.java.patch +++ b/patches/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithLootingCondition.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithLootingCondition.java +++ b/net/minecraft/world/level/storage/loot/predicates/LootItemRandomChanceWithLootingCondition.java -@@ -32,12 +_,7 @@ +@@ -33,12 +_,7 @@ } public boolean test(LootContext p_81967_) { diff --git a/patches/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java.patch b/patches/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java.patch index 69771175ba0..c00e7262536 100644 --- a/patches/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java.patch +++ b/patches/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java +++ b/net/minecraft/world/level/storage/loot/providers/nbt/ContextNbtProvider.java -@@ -59,7 +_,7 @@ +@@ -60,7 +_,7 @@ @Override public String getId() { diff --git a/projects/neoforge/build.gradle b/projects/neoforge/build.gradle index 5ce6f2106ec..5ec242055b9 100644 --- a/projects/neoforge/build.gradle +++ b/projects/neoforge/build.gradle @@ -61,7 +61,6 @@ dependencies { installer "org.ow2.asm:asm-analysis:${project.asm_version}" installer "net.neoforged:accesstransformers:${project.accesstransformers_version}" installer "net.neoforged:bus:${project.eventbus_version}" - installer "net.neoforged.fancymodloader:spi:${project.fancy_mod_loader_version}" installer "net.neoforged:coremods:${project.coremods_version}" installer "cpw.mods:modlauncher:${project.modlauncher_version}" installer "net.minecraftforge:unsafe:${project.unsafe_version}" @@ -81,6 +80,9 @@ dependencies { installer ("net.neoforged:JarJarMetadata:${project.jarjar_version}") { exclude group: 'org.slf4j' } + // Manually override log4j since the version coming from other `installer` dependencies is outdated + installer "org.apache.logging.log4j:log4j-api:${project.log4j_version}" + installer "org.apache.logging.log4j:log4j-core:${project.log4j_version}" compileOnly "org.jetbrains:annotations:${project.jetbrains_annotations_version}" @@ -245,7 +247,10 @@ publishing { } } - changelog.publish(it) + if (!rootProject.isPreReleaseVersion) { + // Only publish a changelog for releases + changelog.publish(it) + } versionMapping { usage('java-api') { diff --git a/settings.gradle b/settings.gradle index 6e543e461d9..2e5194886d7 100644 --- a/settings.gradle +++ b/settings.gradle @@ -7,7 +7,7 @@ pluginManagement { } plugins { - id 'net.neoforged.gradle.platform' version '7.0.95' + id 'net.neoforged.gradle.platform' version '7.0.104' } rootProject.name = rootDir.name diff --git a/src/generated/resources/assets/c/lang/en_us.json b/src/generated/resources/assets/c/lang/en_us.json new file mode 100644 index 00000000000..29b01435531 --- /dev/null +++ b/src/generated/resources/assets/c/lang/en_us.json @@ -0,0 +1,417 @@ +{ + "tag.block.c.barrels": "Barrels", + "tag.block.c.barrels.wooden": "Wooden Barrels", + "tag.block.c.bookshelves": "Bookshelves", + "tag.block.c.budding_blocks": "Budding Blocks", + "tag.block.c.buds": "Buds", + "tag.block.c.chains": "Chains", + "tag.block.c.chests": "Chests", + "tag.block.c.chests.ender": "Ender Chests", + "tag.block.c.chests.trapped": "Trapped Chests", + "tag.block.c.chests.wooden": "Wooden Chests", + "tag.block.c.clusters": "Clusters", + "tag.block.c.cobblestones": "Cobblestones", + "tag.block.c.cobblestones.deepslate": "Deepslate Cobblestones", + "tag.block.c.cobblestones.infested": "Infested Cobblestones", + "tag.block.c.cobblestones.mossy": "Mossy Cobblestones", + "tag.block.c.cobblestones.normal": "Normal Cobblestones", + "tag.block.c.dyed": "Dyed Blocks", + "tag.block.c.dyed.black": "Black Dyed Blocks", + "tag.block.c.dyed.blue": "Blue Dyed Blocks", + "tag.block.c.dyed.brown": "Brown Dyed Blocks", + "tag.block.c.dyed.cyan": "Cyan Dyed Blocks", + "tag.block.c.dyed.gray": "Gray Dyed Blocks", + "tag.block.c.dyed.green": "Green Dyed Blocks", + "tag.block.c.dyed.light_blue": "Light_blue Dyed Blocks", + "tag.block.c.dyed.light_gray": "Light_gray Dyed Blocks", + "tag.block.c.dyed.lime": "Lime Dyed Blocks", + "tag.block.c.dyed.magenta": "Magenta Dyed Blocks", + "tag.block.c.dyed.orange": "Orange Dyed Blocks", + "tag.block.c.dyed.pink": "Pink Dyed Blocks", + "tag.block.c.dyed.purple": "Purple Dyed Blocks", + "tag.block.c.dyed.red": "Red Dyed Blocks", + "tag.block.c.dyed.white": "White Dyed Blocks", + "tag.block.c.dyed.yellow": "Yellow Dyed Blocks", + "tag.block.c.end_stones": "End Stones", + "tag.block.c.fence_gates": "Fence Gates", + "tag.block.c.fence_gates.wooden": "Wooden Fence Gates", + "tag.block.c.fences": "Fences", + "tag.block.c.fences.nether_brick": "Fences Nether Brick", + "tag.block.c.fences.wooden": "Wooden Fences", + "tag.block.c.glass_blocks": "Glass Blocks", + "tag.block.c.glass_blocks.cheap": "Silica Glass Blocks", + "tag.block.c.glass_blocks.colorless": "Colorless Glass Blocks", + "tag.block.c.glass_blocks.tinted": "Tinted Glass Blocks", + "tag.block.c.glass_panes": "Glass Panes", + "tag.block.c.glass_panes.colorless": "Colorless Glass Panes", + "tag.block.c.gravel": "Gravels", + "tag.block.c.hidden_from_recipe_viewers": "Hidden From Recipe Viewers", + "tag.block.c.netherrack": "Netherracks", + "tag.block.c.obsidians": "Obsidians", + "tag.block.c.ore_bearing_ground.deepslate": "Deepslate Ore Bearing Ground", + "tag.block.c.ore_bearing_ground.netherrack": "Netherrack Ore Bearing Ground", + "tag.block.c.ore_bearing_ground.stone": "Stone Ore Bearing Ground", + "tag.block.c.ore_rates.dense": "Dense Ore Rates", + "tag.block.c.ore_rates.singular": "Singular Ore Rates", + "tag.block.c.ore_rates.sparse": "Sparse Ore Rates", + "tag.block.c.ores": "Ores", + "tag.block.c.ores.coal": "Coal Ores", + "tag.block.c.ores.copper": "Copper Ores", + "tag.block.c.ores.diamond": "Diamond Ores", + "tag.block.c.ores.emerald": "Emerald Ores", + "tag.block.c.ores.gold": "Gold Ores", + "tag.block.c.ores.iron": "Iron Ores", + "tag.block.c.ores.lapis": "Lapis Ores", + "tag.block.c.ores.netherite_scrap": "Netherite Scrap Ores", + "tag.block.c.ores.quartz": "Quartz Ores", + "tag.block.c.ores.redstone": "Redstone Ores", + "tag.block.c.ores_in_ground.deepslate": "Deepslate Ores In Ground", + "tag.block.c.ores_in_ground.netherrack": "Netherrack Ores In Ground", + "tag.block.c.ores_in_ground.stone": "Stone Ores In Ground", + "tag.block.c.player_workstations.crafting_tables": "Crafting Tables", + "tag.block.c.player_workstations.furnaces": "Furnaces", + "tag.block.c.relocation_not_supported": "Relocation Not Supported", + "tag.block.c.ropes": "Ropes", + "tag.block.c.sands": "Sands", + "tag.block.c.sands.colorless": "Colorless Sands", + "tag.block.c.sands.red": "Red Sands", + "tag.block.c.sandstone.blocks": "Sandstone Blocks", + "tag.block.c.sandstone.red_blocks": "Red Sandstone Blocks", + "tag.block.c.sandstone.red_slabs": "Red Sandstone Slabs", + "tag.block.c.sandstone.red_stairs": "Red Sandstone Stairs", + "tag.block.c.sandstone.slabs": "Sandstone Slabs", + "tag.block.c.sandstone.stairs": "Sandstone Stairs", + "tag.block.c.sandstone.uncolored_blocks": "Uncolored Sandstone Blocks", + "tag.block.c.sandstone.uncolored_slabs": "Uncolored Sandstone Slabs", + "tag.block.c.sandstone.uncolored_stairs": "Uncolored Sandstone Stairs", + "tag.block.c.skulls": "Skulls", + "tag.block.c.stones": "Stones", + "tag.block.c.storage_blocks": "Storage Blocks", + "tag.block.c.storage_blocks.bone_meal": "Bone Meal Storage Blocks", + "tag.block.c.storage_blocks.coal": "Coal Storage Blocks", + "tag.block.c.storage_blocks.copper": "Copper Storage Blocks", + "tag.block.c.storage_blocks.diamond": "Diamond Storage Blocks", + "tag.block.c.storage_blocks.dried_kelp": "Dried Kelp Storage Blocks", + "tag.block.c.storage_blocks.emerald": "Emerald Storage Blocks", + "tag.block.c.storage_blocks.gold": "Gold Storage Blocks", + "tag.block.c.storage_blocks.iron": "Iron Storage Blocks", + "tag.block.c.storage_blocks.lapis": "Lapis Storage Blocks", + "tag.block.c.storage_blocks.netherite": "Netherite Storage Blocks", + "tag.block.c.storage_blocks.raw_copper": "Raw Copper Storage Blocks", + "tag.block.c.storage_blocks.raw_gold": "Raw Gold Storage Blocks", + "tag.block.c.storage_blocks.raw_iron": "Raw Iron Storage Blocks", + "tag.block.c.storage_blocks.redstone": "Redstone Storage Blocks", + "tag.block.c.storage_blocks.slime": "Slime Storage Blocks", + "tag.block.c.storage_blocks.wheat": "Wheat Storage Blocks", + "tag.block.c.villager_job_sites": "Villager Job Sites", + "tag.block.neoforge.enderman_place_on_blacklist": "Enderman Place On Blacklist", + "tag.block.neoforge.needs_gold_tool": "Needs Gold Tools", + "tag.block.neoforge.needs_netherite_tool": "Needs Netherite Tools", + "tag.block.neoforge.needs_wood_tool": "Needs Wooden Tools", + "tag.enchantment.c.entity_auxiliary_movement_enhancements": "Entity Auxiliary Movement Enhancements", + "tag.enchantment.c.entity_defense_enhancements": "Entity Defense Enhancements", + "tag.enchantment.c.entity_speed_enhancements": "Entity Speed Enhancements", + "tag.enchantment.c.increase_block_drops": "Increase Block Drops", + "tag.enchantment.c.increase_entity_drops": "Increase Entity Drops", + "tag.enchantment.c.weapon_damage_enhancements": "Weapon Damage Enhancements", + "tag.entity_type.c.boats": "Boats", + "tag.entity_type.c.bosses": "Bosses", + "tag.entity_type.c.capturing_not_supported": "Capturing Not Supported", + "tag.entity_type.c.minecarts": "Minecarts", + "tag.entity_type.c.teleporting_not_supported": "Teleporting Not Supported", + "tag.fluid.c.beetroot_soup": "Beetroot Soup", + "tag.fluid.c.gaseous": "Gaseous", + "tag.fluid.c.hidden_from_recipe_viewers": "Hidden From Recipe Viewers", + "tag.fluid.c.honey": "Honey", + "tag.fluid.c.lava": "Lava", + "tag.fluid.c.milk": "Milk", + "tag.fluid.c.mushroom_stew": "Mushroom Stew", + "tag.fluid.c.potion": "Potion", + "tag.fluid.c.rabbit_stew": "Rabbit Stew", + "tag.fluid.c.suspicious_stew": "Suspicious Stew", + "tag.fluid.c.water": "Water", + "tag.item.c.armors": "Armors", + "tag.item.c.barrels": "Barrels", + "tag.item.c.barrels.wooden": "Wooden Barrels", + "tag.item.c.bones": "Bones", + "tag.item.c.bookshelves": "Bookshelves", + "tag.item.c.bricks": "Bricks", + "tag.item.c.bricks.nether": "Nether Bricks", + "tag.item.c.bricks.normal": "Normal Bricks", + "tag.item.c.buckets": "Buckets", + "tag.item.c.buckets.empty": "Empty Buckets", + "tag.item.c.buckets.entity_water": "Water Entity Buckets", + "tag.item.c.buckets.lava": "Lava Buckets", + "tag.item.c.buckets.milk": "Milk Buckets", + "tag.item.c.buckets.powder_snow": "Powder Snow Buckets", + "tag.item.c.buckets.water": "Water Buckets", + "tag.item.c.budding_blocks": "Budding Blocks", + "tag.item.c.buds": "Buds", + "tag.item.c.chains": "Chains", + "tag.item.c.chests": "Chests", + "tag.item.c.chests.ender": "Ender Chests", + "tag.item.c.chests.trapped": "Trapped Chests", + "tag.item.c.chests.wooden": "Wooden Chests", + "tag.item.c.clusters": "Clusters", + "tag.item.c.cobblestones": "Cobblestones", + "tag.item.c.cobblestones.deepslate": "Deepslate Cobblestones", + "tag.item.c.cobblestones.infested": "Infested Cobblestones", + "tag.item.c.cobblestones.mossy": "Mossy Cobblestones", + "tag.item.c.cobblestones.normal": "Normal Cobblestones", + "tag.item.c.crops": "Crops", + "tag.item.c.crops.beetroot": "Beetroot Crops", + "tag.item.c.crops.carrot": "Carrot Crops", + "tag.item.c.crops.nether_wart": "Nether Wart Crops", + "tag.item.c.crops.potato": "Potato Crops", + "tag.item.c.crops.wheat": "Wheat Crops", + "tag.item.c.dusts": "Dusts", + "tag.item.c.dusts.glowstone": "Glowstone Dusts", + "tag.item.c.dusts.redstone": "Redstone Dusts", + "tag.item.c.dyed": "Dyed Items", + "tag.item.c.dyed.black": "Black Dyed Items", + "tag.item.c.dyed.blue": "Blue Dyed Items", + "tag.item.c.dyed.brown": "Brown Dyed Items", + "tag.item.c.dyed.cyan": "Cyan Dyed Items", + "tag.item.c.dyed.gray": "Gray Dyed Items", + "tag.item.c.dyed.green": "Green Dyed Items", + "tag.item.c.dyed.light_blue": "Light_blue Dyed Items", + "tag.item.c.dyed.light_gray": "Light_gray Dyed Items", + "tag.item.c.dyed.lime": "Lime Dyed Items", + "tag.item.c.dyed.magenta": "Magenta Dyed Items", + "tag.item.c.dyed.orange": "Orange Dyed Items", + "tag.item.c.dyed.pink": "Pink Dyed Items", + "tag.item.c.dyed.purple": "Purple Dyed Items", + "tag.item.c.dyed.red": "Red Dyed Items", + "tag.item.c.dyed.white": "White Dyed Items", + "tag.item.c.dyed.yellow": "Yellow Dyed Items", + "tag.item.c.dyes": "Dyes", + "tag.item.c.dyes.black": "Black Dyes", + "tag.item.c.dyes.blue": "Blue Dyes", + "tag.item.c.dyes.brown": "Brown Dyes", + "tag.item.c.dyes.cyan": "Cyan Dyes", + "tag.item.c.dyes.gray": "Gray Dyes", + "tag.item.c.dyes.green": "Green Dyes", + "tag.item.c.dyes.light_blue": "Light Blue Dyes", + "tag.item.c.dyes.light_gray": "Light Gray Dyes", + "tag.item.c.dyes.lime": "Lime Dyes", + "tag.item.c.dyes.magenta": "Magenta Dyes", + "tag.item.c.dyes.orange": "Orange Dyes", + "tag.item.c.dyes.pink": "Pink Dyes", + "tag.item.c.dyes.purple": "Purple Dyes", + "tag.item.c.dyes.red": "Red Dyes", + "tag.item.c.dyes.white": "White Dyes", + "tag.item.c.dyes.yellow": "Yellow Dyes", + "tag.item.c.eggs": "Eggs", + "tag.item.c.enchantables": "Enchantables", + "tag.item.c.end_stones": "End Stones", + "tag.item.c.ender_pearls": "Ender Pearls", + "tag.item.c.feathers": "Feathers", + "tag.item.c.fence_gates": "Fence Gates", + "tag.item.c.fence_gates.wooden": "Wooden Fence Gates", + "tag.item.c.fences": "Fences", + "tag.item.c.fences.nether_brick": "Nether Brick Fences", + "tag.item.c.fences.wooden": "Wooden Fences", + "tag.item.c.foods": "Foods", + "tag.item.c.foods.berries": "Berries", + "tag.item.c.foods.breads": "Breads", + "tag.item.c.foods.candies": "Candies", + "tag.item.c.foods.cooked_fishes": "Cooked Fishes", + "tag.item.c.foods.cooked_meats": "Cooked Meats", + "tag.item.c.foods.cookies": "Cookies", + "tag.item.c.foods.edible_when_placed": "Edible When Placed", + "tag.item.c.foods.food_poisoning": "Food Poisoning Foods", + "tag.item.c.foods.fruits": "Fruits", + "tag.item.c.foods.raw_fishes": "Raw Fishes", + "tag.item.c.foods.raw_meats": "Raw Meats", + "tag.item.c.foods.soups": "Soups", + "tag.item.c.foods.vegetables": "Vegetables", + "tag.item.c.gems": "Gems", + "tag.item.c.gems.amethyst": "Amethyst Gems", + "tag.item.c.gems.diamond": "Diamond Gems", + "tag.item.c.gems.emerald": "Emerald Gems", + "tag.item.c.gems.lapis": "Lapis Gems", + "tag.item.c.gems.prismarine": "Prismarine Gems", + "tag.item.c.gems.quartz": "Quartz Gems", + "tag.item.c.glass_blocks": "Glass Blocks", + "tag.item.c.glass_blocks.cheap": "Cheap Glass Blocks", + "tag.item.c.glass_blocks.colorless": "Colorless Glass Blocks", + "tag.item.c.glass_blocks.tinted": "Tinted Glass Blocks", + "tag.item.c.glass_panes": "Glass Panes", + "tag.item.c.glass_panes.colorless": "Colorless Glass Panes", + "tag.item.c.gravel": "Gravels", + "tag.item.c.gunpowder": "Gunpowders", + "tag.item.c.hidden_from_recipe_viewers": "Hidden From Recipe Viewers", + "tag.item.c.ingots": "Ingots", + "tag.item.c.ingots.copper": "Copper Ingots", + "tag.item.c.ingots.gold": "Gold Ingots", + "tag.item.c.ingots.iron": "Iron Ingots", + "tag.item.c.ingots.netherite": "Netherite Ingots", + "tag.item.c.leather": "Leathers", + "tag.item.c.mushrooms": "Mushrooms", + "tag.item.c.nether_stars": "Nether Stars", + "tag.item.c.netherrack": "Netherracks", + "tag.item.c.nuggets": "Nuggets", + "tag.item.c.nuggets.gold": "Gold Nuggets", + "tag.item.c.nuggets.iron": "Iron Nuggets", + "tag.item.c.obsidians": "Obsidians", + "tag.item.c.ore_bearing_ground.deepslate": "Deepslate Ore Bearing Ground", + "tag.item.c.ore_bearing_ground.netherrack": "Netherrack Ore Bearing Ground", + "tag.item.c.ore_bearing_ground.stone": "Stone Ore Bearing Ground", + "tag.item.c.ore_rates.dense": "Dense Ore Rates", + "tag.item.c.ore_rates.singular": "Singular Ore Rates", + "tag.item.c.ore_rates.sparse": "Sparse Ore Rates", + "tag.item.c.ores": "Ores", + "tag.item.c.ores.coal": "Coal Ores", + "tag.item.c.ores.copper": "Copper Ores", + "tag.item.c.ores.diamond": "Diamond Ores", + "tag.item.c.ores.emerald": "Emerald Ores", + "tag.item.c.ores.gold": "Gold Ores", + "tag.item.c.ores.iron": "Iron Ores", + "tag.item.c.ores.lapis": "Lapis Ores", + "tag.item.c.ores.netherite_scrap": "Netherite Scrap Ores", + "tag.item.c.ores.quartz": "Quartz Ores", + "tag.item.c.ores.redstone": "Redstone Ores", + "tag.item.c.ores_in_ground.deepslate": "Deepslate Ores In Ground", + "tag.item.c.ores_in_ground.netherrack": "Netherrack Ores In Ground", + "tag.item.c.ores_in_ground.stone": "Stone Ores In Ground", + "tag.item.c.player_workstations.crafting_tables": "Crafting Tables", + "tag.item.c.player_workstations.furnaces": "Furnaces", + "tag.item.c.raw_blocks": "Raw Blocks", + "tag.item.c.raw_blocks.copper": "Copper Raw Blocks", + "tag.item.c.raw_blocks.gold": "Gold Raw Blocks", + "tag.item.c.raw_blocks.iron": "Iron Raw Blocks", + "tag.item.c.raw_materials": "Raw Materials", + "tag.item.c.raw_materials.copper": "Copper Raw Materials", + "tag.item.c.raw_materials.gold": "Gold Raw Materials", + "tag.item.c.raw_materials.iron": "Iron Raw Materials", + "tag.item.c.rods": "Rods", + "tag.item.c.rods.blaze": "Blaze Rods", + "tag.item.c.rods.breeze": "Breeze Rods", + "tag.item.c.rods.wooden": "Wooden Rods", + "tag.item.c.ropes": "Ropes", + "tag.item.c.sands": "Sands", + "tag.item.c.sands.colorless": "Colorless Sands", + "tag.item.c.sands.red": "Red Sands", + "tag.item.c.sandstone.blocks": "Sandstone Blocks", + "tag.item.c.sandstone.red_blocks": "Red Sandstone Blocks", + "tag.item.c.sandstone.red_slabs": "Red Sandstone Slabs", + "tag.item.c.sandstone.red_stairs": "Red Sandstone Stairs", + "tag.item.c.sandstone.slabs": "Sandstone Slabs", + "tag.item.c.sandstone.stairs": "Sandstone Stairs", + "tag.item.c.sandstone.uncolored_blocks": "Uncolored Sandstone Blocks", + "tag.item.c.sandstone.uncolored_slabs": "Uncolored Sandstone Slabs", + "tag.item.c.sandstone.uncolored_stairs": "Uncolored Sandstone Stairs", + "tag.item.c.seeds": "Seeds", + "tag.item.c.seeds.beetroot": "Beetroot Seeds", + "tag.item.c.seeds.melon": "Melon Seeds", + "tag.item.c.seeds.pumpkin": "Pumpkin Seeds", + "tag.item.c.seeds.wheat": "Wheat Seeds", + "tag.item.c.slimeballs": "Slimeballs", + "tag.item.c.stones": "Stones", + "tag.item.c.storage_blocks": "Storage Blocks", + "tag.item.c.storage_blocks.bone_meal": "Bone Meal Storage Blocks", + "tag.item.c.storage_blocks.coal": "Coal Storage Blocks", + "tag.item.c.storage_blocks.copper": "Copper Storage Blocks", + "tag.item.c.storage_blocks.diamond": "Diamond Storage Blocks", + "tag.item.c.storage_blocks.dried_kelp": "Dried Kelp Storage Blocks", + "tag.item.c.storage_blocks.emerald": "Emerald Storage Blocks", + "tag.item.c.storage_blocks.gold": "Gold Storage Blocks", + "tag.item.c.storage_blocks.iron": "Iron Storage Blocks", + "tag.item.c.storage_blocks.lapis": "Lapis Storage Blocks", + "tag.item.c.storage_blocks.netherite": "Netherite Storage Blocks", + "tag.item.c.storage_blocks.raw_copper": "Raw Copper Storage Blocks", + "tag.item.c.storage_blocks.raw_gold": "Raw Gold Storage Blocks", + "tag.item.c.storage_blocks.raw_iron": "Raw Iron Storage Blocks", + "tag.item.c.storage_blocks.redstone": "Redstone Storage Blocks", + "tag.item.c.storage_blocks.slime": "Slime Storage Blocks", + "tag.item.c.storage_blocks.wheat": "Wheat Storage Blocks", + "tag.item.c.strings": "Strings", + "tag.item.c.tools": "Tools", + "tag.item.c.tools.bows": "Bows", + "tag.item.c.tools.brushes": "Brushes", + "tag.item.c.tools.crossbows": "Crossbows", + "tag.item.c.tools.fishing_rods": "Fishing Rods", + "tag.item.c.tools.shears": "Shears", + "tag.item.c.tools.shields": "Shields", + "tag.item.c.tools.spears": "Spears", + "tag.item.c.villager_job_sites": "Villager Job Sites", + "tag.item.neoforge.enchanting_fuels": "Enchanting Fuels", + "tag.worldgen.biome.c.hidden_from_locator_selection": "Hidden From Locator's Selection", + "tag.worldgen.biome.c.is_aquatic": "Aquatic", + "tag.worldgen.biome.c.is_aquatic_icy": "Aquatic Icy", + "tag.worldgen.biome.c.is_badlands": "Badlands", + "tag.worldgen.biome.c.is_beach": "Beach", + "tag.worldgen.biome.c.is_birch_forest": "Birch Forest", + "tag.worldgen.biome.c.is_cave": "Caves", + "tag.worldgen.biome.c.is_cold": "Cold", + "tag.worldgen.biome.c.is_cold.end": "Cold End", + "tag.worldgen.biome.c.is_cold.nether": "Cold Nether", + "tag.worldgen.biome.c.is_cold.overworld": "Cold Overworld", + "tag.worldgen.biome.c.is_dead": "Dead", + "tag.worldgen.biome.c.is_deep_ocean": "Deep Ocean", + "tag.worldgen.biome.c.is_dense_vegetation": "Dense Vegetation", + "tag.worldgen.biome.c.is_dense_vegetation.end": "Dense End Vegetation", + "tag.worldgen.biome.c.is_dense_vegetation.nether": "Dense Nether Vegetation", + "tag.worldgen.biome.c.is_dense_vegetation.overworld": "Dense Overworld Vegetation", + "tag.worldgen.biome.c.is_desert": "Deserts", + "tag.worldgen.biome.c.is_dry": "Dry", + "tag.worldgen.biome.c.is_dry.end": "Dry End", + "tag.worldgen.biome.c.is_dry.nether": "Dry Nether", + "tag.worldgen.biome.c.is_dry.overworld": "Dry Overworld", + "tag.worldgen.biome.c.is_end": "Is End", + "tag.worldgen.biome.c.is_floral": "Floral", + "tag.worldgen.biome.c.is_flower_forest": "Flower Forest", + "tag.worldgen.biome.c.is_forest": "Forest", + "tag.worldgen.biome.c.is_hill": "Hills", + "tag.worldgen.biome.c.is_hot": "Hot", + "tag.worldgen.biome.c.is_hot.end": "Hot End", + "tag.worldgen.biome.c.is_hot.nether": "Hot Nether", + "tag.worldgen.biome.c.is_hot.overworld": "Hot Overworld", + "tag.worldgen.biome.c.is_icy": "Icy", + "tag.worldgen.biome.c.is_jungle": "Jungle", + "tag.worldgen.biome.c.is_lush": "Lush", + "tag.worldgen.biome.c.is_magical": "Magical", + "tag.worldgen.biome.c.is_modified": "Modified", + "tag.worldgen.biome.c.is_mountain": "Mountains", + "tag.worldgen.biome.c.is_mountain.peak": "Peaks", + "tag.worldgen.biome.c.is_mountain.slope": "Slopes", + "tag.worldgen.biome.c.is_mushroom": "Mushrooms", + "tag.worldgen.biome.c.is_nether": "Is Nether", + "tag.worldgen.biome.c.is_nether_forest": "Nether Forest", + "tag.worldgen.biome.c.is_ocean": "Ocean", + "tag.worldgen.biome.c.is_old_growth": "Old Growth", + "tag.worldgen.biome.c.is_outer_end_island": "Outer End Island", + "tag.worldgen.biome.c.is_overworld": "Is Overworld", + "tag.worldgen.biome.c.is_plains": "Plains", + "tag.worldgen.biome.c.is_plateau": "Plateaus", + "tag.worldgen.biome.c.is_rare": "Rare", + "tag.worldgen.biome.c.is_river": "River", + "tag.worldgen.biome.c.is_sandy": "Sandy", + "tag.worldgen.biome.c.is_savanna": "Savanna", + "tag.worldgen.biome.c.is_shallow_ocean": "Shallow Ocean", + "tag.worldgen.biome.c.is_snowy": "Snowy", + "tag.worldgen.biome.c.is_snowy_plains": "Snowy Plains", + "tag.worldgen.biome.c.is_sparse_vegetation": "Sparse Vegetation", + "tag.worldgen.biome.c.is_sparse_vegetation.end": "Sparse End Vegetation", + "tag.worldgen.biome.c.is_sparse_vegetation.nether": "Sparse Nether Vegetation", + "tag.worldgen.biome.c.is_sparse_vegetation.overworld": "Sparse Overworld Vegetation", + "tag.worldgen.biome.c.is_spooky": "Spooky", + "tag.worldgen.biome.c.is_stony_shores": "Stony Shores", + "tag.worldgen.biome.c.is_swamp": "Swamps", + "tag.worldgen.biome.c.is_taiga": "Taiga", + "tag.worldgen.biome.c.is_tree.coniferous": "Coniferous Trees", + "tag.worldgen.biome.c.is_tree.deciduous": "Deciduous Trees", + "tag.worldgen.biome.c.is_tree.jungle": "Jungle Trees", + "tag.worldgen.biome.c.is_tree.savanna": "Savanna Trees", + "tag.worldgen.biome.c.is_underground": "Underground", + "tag.worldgen.biome.c.is_void": "Voids", + "tag.worldgen.biome.c.is_wasteland": "Wastelands", + "tag.worldgen.biome.c.is_wet": "Wet", + "tag.worldgen.biome.c.is_wet.end": "Wet End", + "tag.worldgen.biome.c.is_wet.nether": "Wet Nether", + "tag.worldgen.biome.c.is_wet.overworld": "Wet Overworld", + "tag.worldgen.biome.c.is_windswept": "Windswept", + "tag.worldgen.biome.c.no_default_monsters": "No Default Monsters", + "tag.worldgen.structure.c.hidden_from_displayers": "Hidden From Displayers", + "tag.worldgen.structure.c.hidden_from_locator_selection": "Hidden From Locator's Selection" +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/barrels.json b/src/generated/resources/data/c/tags/blocks/barrels.json new file mode 100644 index 00000000000..94bded15d86 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/barrels.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#c:barrels/wooden", + { + "id": "#forge:barrels", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/barrels/wooden.json b/src/generated/resources/data/c/tags/blocks/barrels/wooden.json new file mode 100644 index 00000000000..fedbc8ac53d --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/barrels/wooden.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:barrel", + { + "id": "#forge:barrels/wooden", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/bookshelves.json b/src/generated/resources/data/c/tags/blocks/bookshelves.json new file mode 100644 index 00000000000..68f756dba9b --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/bookshelves.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:bookshelf", + { + "id": "#forge:bookshelves", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/budding_blocks.json b/src/generated/resources/data/c/tags/blocks/budding_blocks.json new file mode 100644 index 00000000000..86257651e5e --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/budding_blocks.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:budding_amethyst" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/buds.json b/src/generated/resources/data/c/tags/blocks/buds.json new file mode 100644 index 00000000000..708568317eb --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/buds.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:small_amethyst_bud", + "minecraft:medium_amethyst_bud", + "minecraft:large_amethyst_bud" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/chains.json b/src/generated/resources/data/c/tags/blocks/chains.json new file mode 100644 index 00000000000..63bbe5b4274 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/chains.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:chain" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/chests.json b/src/generated/resources/data/c/tags/blocks/chests.json new file mode 100644 index 00000000000..b6a2b0d0fad --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/chests.json @@ -0,0 +1,11 @@ +{ + "values": [ + "#c:chests/ender", + "#c:chests/trapped", + "#c:chests/wooden", + { + "id": "#forge:chests", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/chests/ender.json b/src/generated/resources/data/c/tags/blocks/chests/ender.json new file mode 100644 index 00000000000..1e652bcf24f --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/chests/ender.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:ender_chest", + { + "id": "#forge:chests/ender", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/chests/trapped.json b/src/generated/resources/data/c/tags/blocks/chests/trapped.json new file mode 100644 index 00000000000..d0d8da248bf --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/chests/trapped.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:trapped_chest", + { + "id": "#forge:chests/trapped", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/chests/wooden.json b/src/generated/resources/data/c/tags/blocks/chests/wooden.json new file mode 100644 index 00000000000..0659e860e6b --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/chests/wooden.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:chest", + "minecraft:trapped_chest", + { + "id": "#forge:chests/wooden", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/clusters.json b/src/generated/resources/data/c/tags/blocks/clusters.json new file mode 100644 index 00000000000..bf57e5f90d0 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/clusters.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:amethyst_cluster" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/cobblestones.json b/src/generated/resources/data/c/tags/blocks/cobblestones.json new file mode 100644 index 00000000000..b3c480393cc --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/cobblestones.json @@ -0,0 +1,12 @@ +{ + "values": [ + "#c:cobblestones/normal", + "#c:cobblestones/infested", + "#c:cobblestones/mossy", + "#c:cobblestones/deepslate", + { + "id": "#forge:cobblestone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/cobblestones/deepslate.json b/src/generated/resources/data/c/tags/blocks/cobblestones/deepslate.json new file mode 100644 index 00000000000..34e7d23b82f --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/cobblestones/deepslate.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:cobbled_deepslate", + { + "id": "#forge:cobblestone/deepslate", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/cobblestones/infested.json b/src/generated/resources/data/c/tags/blocks/cobblestones/infested.json new file mode 100644 index 00000000000..2752247f3ad --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/cobblestones/infested.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:infested_cobblestone", + { + "id": "#forge:cobblestone/infested", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/cobblestones/mossy.json b/src/generated/resources/data/c/tags/blocks/cobblestones/mossy.json new file mode 100644 index 00000000000..9a2e19c5694 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/cobblestones/mossy.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:mossy_cobblestone", + { + "id": "#forge:cobblestone/mossy", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/cobblestones/normal.json b/src/generated/resources/data/c/tags/blocks/cobblestones/normal.json new file mode 100644 index 00000000000..6cebee9d29f --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/cobblestones/normal.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:cobblestone", + { + "id": "#forge:cobblestone/normal", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed.json b/src/generated/resources/data/c/tags/blocks/dyed.json new file mode 100644 index 00000000000..ad4584578df --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed.json @@ -0,0 +1,20 @@ +{ + "values": [ + "#c:dyed/white", + "#c:dyed/orange", + "#c:dyed/magenta", + "#c:dyed/light_blue", + "#c:dyed/yellow", + "#c:dyed/lime", + "#c:dyed/pink", + "#c:dyed/gray", + "#c:dyed/light_gray", + "#c:dyed/cyan", + "#c:dyed/purple", + "#c:dyed/blue", + "#c:dyed/brown", + "#c:dyed/green", + "#c:dyed/red", + "#c:dyed/black" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/black.json b/src/generated/resources/data/c/tags/blocks/dyed/black.json new file mode 100644 index 00000000000..52e29dcd466 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/black.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:black_banner", + "minecraft:black_bed", + "minecraft:black_candle", + "minecraft:black_carpet", + "minecraft:black_concrete", + "minecraft:black_concrete_powder", + "minecraft:black_glazed_terracotta", + "minecraft:black_shulker_box", + "minecraft:black_stained_glass", + "minecraft:black_stained_glass_pane", + "minecraft:black_terracotta", + "minecraft:black_wall_banner", + "minecraft:black_wool", + { + "id": "#forge:glass/black", + "required": false + }, + { + "id": "#forge:stained_glass/black", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/blue.json b/src/generated/resources/data/c/tags/blocks/dyed/blue.json new file mode 100644 index 00000000000..aa6f32d07c2 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/blue.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:blue_banner", + "minecraft:blue_bed", + "minecraft:blue_candle", + "minecraft:blue_carpet", + "minecraft:blue_concrete", + "minecraft:blue_concrete_powder", + "minecraft:blue_glazed_terracotta", + "minecraft:blue_shulker_box", + "minecraft:blue_stained_glass", + "minecraft:blue_stained_glass_pane", + "minecraft:blue_terracotta", + "minecraft:blue_wall_banner", + "minecraft:blue_wool", + { + "id": "#forge:glass/blue", + "required": false + }, + { + "id": "#forge:stained_glass/blue", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/brown.json b/src/generated/resources/data/c/tags/blocks/dyed/brown.json new file mode 100644 index 00000000000..94d1d0a7c7f --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/brown.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:brown_banner", + "minecraft:brown_bed", + "minecraft:brown_candle", + "minecraft:brown_carpet", + "minecraft:brown_concrete", + "minecraft:brown_concrete_powder", + "minecraft:brown_glazed_terracotta", + "minecraft:brown_shulker_box", + "minecraft:brown_stained_glass", + "minecraft:brown_stained_glass_pane", + "minecraft:brown_terracotta", + "minecraft:brown_wall_banner", + "minecraft:brown_wool", + { + "id": "#forge:glass/brown", + "required": false + }, + { + "id": "#forge:stained_glass/brown", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/cyan.json b/src/generated/resources/data/c/tags/blocks/dyed/cyan.json new file mode 100644 index 00000000000..b67187d66dd --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/cyan.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:cyan_banner", + "minecraft:cyan_bed", + "minecraft:cyan_candle", + "minecraft:cyan_carpet", + "minecraft:cyan_concrete", + "minecraft:cyan_concrete_powder", + "minecraft:cyan_glazed_terracotta", + "minecraft:cyan_shulker_box", + "minecraft:cyan_stained_glass", + "minecraft:cyan_stained_glass_pane", + "minecraft:cyan_terracotta", + "minecraft:cyan_wall_banner", + "minecraft:cyan_wool", + { + "id": "#forge:glass/cyan", + "required": false + }, + { + "id": "#forge:stained_glass/cyan", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/gray.json b/src/generated/resources/data/c/tags/blocks/dyed/gray.json new file mode 100644 index 00000000000..172655a1a57 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/gray.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:gray_banner", + "minecraft:gray_bed", + "minecraft:gray_candle", + "minecraft:gray_carpet", + "minecraft:gray_concrete", + "minecraft:gray_concrete_powder", + "minecraft:gray_glazed_terracotta", + "minecraft:gray_shulker_box", + "minecraft:gray_stained_glass", + "minecraft:gray_stained_glass_pane", + "minecraft:gray_terracotta", + "minecraft:gray_wall_banner", + "minecraft:gray_wool", + { + "id": "#forge:glass/gray", + "required": false + }, + { + "id": "#forge:stained_glass/gray", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/green.json b/src/generated/resources/data/c/tags/blocks/dyed/green.json new file mode 100644 index 00000000000..12dd3904fc5 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/green.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:green_banner", + "minecraft:green_bed", + "minecraft:green_candle", + "minecraft:green_carpet", + "minecraft:green_concrete", + "minecraft:green_concrete_powder", + "minecraft:green_glazed_terracotta", + "minecraft:green_shulker_box", + "minecraft:green_stained_glass", + "minecraft:green_stained_glass_pane", + "minecraft:green_terracotta", + "minecraft:green_wall_banner", + "minecraft:green_wool", + { + "id": "#forge:glass/green", + "required": false + }, + { + "id": "#forge:stained_glass/green", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/light_blue.json b/src/generated/resources/data/c/tags/blocks/dyed/light_blue.json new file mode 100644 index 00000000000..ce884b573da --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/light_blue.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:light_blue_banner", + "minecraft:light_blue_bed", + "minecraft:light_blue_candle", + "minecraft:light_blue_carpet", + "minecraft:light_blue_concrete", + "minecraft:light_blue_concrete_powder", + "minecraft:light_blue_glazed_terracotta", + "minecraft:light_blue_shulker_box", + "minecraft:light_blue_stained_glass", + "minecraft:light_blue_stained_glass_pane", + "minecraft:light_blue_terracotta", + "minecraft:light_blue_wall_banner", + "minecraft:light_blue_wool", + { + "id": "#forge:glass/light_blue", + "required": false + }, + { + "id": "#forge:stained_glass/light_blue", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/light_gray.json b/src/generated/resources/data/c/tags/blocks/dyed/light_gray.json new file mode 100644 index 00000000000..439c12aec8d --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/light_gray.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:light_gray_banner", + "minecraft:light_gray_bed", + "minecraft:light_gray_candle", + "minecraft:light_gray_carpet", + "minecraft:light_gray_concrete", + "minecraft:light_gray_concrete_powder", + "minecraft:light_gray_glazed_terracotta", + "minecraft:light_gray_shulker_box", + "minecraft:light_gray_stained_glass", + "minecraft:light_gray_stained_glass_pane", + "minecraft:light_gray_terracotta", + "minecraft:light_gray_wall_banner", + "minecraft:light_gray_wool", + { + "id": "#forge:glass/light_gray", + "required": false + }, + { + "id": "#forge:stained_glass/light_gray", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/lime.json b/src/generated/resources/data/c/tags/blocks/dyed/lime.json new file mode 100644 index 00000000000..17e5b7ddf58 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/lime.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:lime_banner", + "minecraft:lime_bed", + "minecraft:lime_candle", + "minecraft:lime_carpet", + "minecraft:lime_concrete", + "minecraft:lime_concrete_powder", + "minecraft:lime_glazed_terracotta", + "minecraft:lime_shulker_box", + "minecraft:lime_stained_glass", + "minecraft:lime_stained_glass_pane", + "minecraft:lime_terracotta", + "minecraft:lime_wall_banner", + "minecraft:lime_wool", + { + "id": "#forge:glass/lime", + "required": false + }, + { + "id": "#forge:stained_glass/lime", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/magenta.json b/src/generated/resources/data/c/tags/blocks/dyed/magenta.json new file mode 100644 index 00000000000..f833d1210ae --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/magenta.json @@ -0,0 +1,33 @@ +{ + "values": [ + "minecraft:magenta_banner", + "minecraft:magenta_bed", + "minecraft:magenta_candle", + "minecraft:magenta_carpet", + "minecraft:magenta_concrete", + "minecraft:magenta_concrete_powder", + "minecraft:magenta_glazed_terracotta", + "minecraft:magenta_shulker_box", + "minecraft:magenta_stained_glass", + "minecraft:magenta_stained_glass_pane", + "minecraft:magenta_terracotta", + "minecraft:magenta_wall_banner", + "minecraft:magenta_wool", + { + "id": "#forge:glass/magenta", + "required": false + }, + { + "id": "#forge:stained_glass/magenta", + "required": false + }, + { + "id": "#forge:glass/magenta", + "required": false + }, + { + "id": "#forge:stained_glass/magenta", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/orange.json b/src/generated/resources/data/c/tags/blocks/dyed/orange.json new file mode 100644 index 00000000000..20076162d78 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/orange.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:orange_banner", + "minecraft:orange_bed", + "minecraft:orange_candle", + "minecraft:orange_carpet", + "minecraft:orange_concrete", + "minecraft:orange_concrete_powder", + "minecraft:orange_glazed_terracotta", + "minecraft:orange_shulker_box", + "minecraft:orange_stained_glass", + "minecraft:orange_stained_glass_pane", + "minecraft:orange_terracotta", + "minecraft:orange_wall_banner", + "minecraft:orange_wool", + { + "id": "#forge:glass/orange", + "required": false + }, + { + "id": "#forge:stained_glass/orange", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/pink.json b/src/generated/resources/data/c/tags/blocks/dyed/pink.json new file mode 100644 index 00000000000..f9bdfe6c028 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/pink.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:pink_banner", + "minecraft:pink_bed", + "minecraft:pink_candle", + "minecraft:pink_carpet", + "minecraft:pink_concrete", + "minecraft:pink_concrete_powder", + "minecraft:pink_glazed_terracotta", + "minecraft:pink_shulker_box", + "minecraft:pink_stained_glass", + "minecraft:pink_stained_glass_pane", + "minecraft:pink_terracotta", + "minecraft:pink_wall_banner", + "minecraft:pink_wool", + { + "id": "#forge:glass/pink", + "required": false + }, + { + "id": "#forge:stained_glass/pink", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/purple.json b/src/generated/resources/data/c/tags/blocks/dyed/purple.json new file mode 100644 index 00000000000..8d443e3a8b2 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/purple.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:purple_banner", + "minecraft:purple_bed", + "minecraft:purple_candle", + "minecraft:purple_carpet", + "minecraft:purple_concrete", + "minecraft:purple_concrete_powder", + "minecraft:purple_glazed_terracotta", + "minecraft:purple_shulker_box", + "minecraft:purple_stained_glass", + "minecraft:purple_stained_glass_pane", + "minecraft:purple_terracotta", + "minecraft:purple_wall_banner", + "minecraft:purple_wool", + { + "id": "#forge:glass/purple", + "required": false + }, + { + "id": "#forge:stained_glass/purple", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/red.json b/src/generated/resources/data/c/tags/blocks/dyed/red.json new file mode 100644 index 00000000000..88ae73f6774 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/red.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:red_banner", + "minecraft:red_bed", + "minecraft:red_candle", + "minecraft:red_carpet", + "minecraft:red_concrete", + "minecraft:red_concrete_powder", + "minecraft:red_glazed_terracotta", + "minecraft:red_shulker_box", + "minecraft:red_stained_glass", + "minecraft:red_stained_glass_pane", + "minecraft:red_terracotta", + "minecraft:red_wall_banner", + "minecraft:red_wool", + { + "id": "#forge:glass/red", + "required": false + }, + { + "id": "#forge:stained_glass/red", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/white.json b/src/generated/resources/data/c/tags/blocks/dyed/white.json new file mode 100644 index 00000000000..86c2a017891 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/white.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:white_banner", + "minecraft:white_bed", + "minecraft:white_candle", + "minecraft:white_carpet", + "minecraft:white_concrete", + "minecraft:white_concrete_powder", + "minecraft:white_glazed_terracotta", + "minecraft:white_shulker_box", + "minecraft:white_stained_glass", + "minecraft:white_stained_glass_pane", + "minecraft:white_terracotta", + "minecraft:white_wall_banner", + "minecraft:white_wool", + { + "id": "#forge:glass/white", + "required": false + }, + { + "id": "#forge:stained_glass/white", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/dyed/yellow.json b/src/generated/resources/data/c/tags/blocks/dyed/yellow.json new file mode 100644 index 00000000000..31711d54590 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/dyed/yellow.json @@ -0,0 +1,25 @@ +{ + "values": [ + "minecraft:yellow_banner", + "minecraft:yellow_bed", + "minecraft:yellow_candle", + "minecraft:yellow_carpet", + "minecraft:yellow_concrete", + "minecraft:yellow_concrete_powder", + "minecraft:yellow_glazed_terracotta", + "minecraft:yellow_shulker_box", + "minecraft:yellow_stained_glass", + "minecraft:yellow_stained_glass_pane", + "minecraft:yellow_terracotta", + "minecraft:yellow_wall_banner", + "minecraft:yellow_wool", + { + "id": "#forge:glass/yellow", + "required": false + }, + { + "id": "#forge:stained_glass/yellow", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/end_stones.json b/src/generated/resources/data/c/tags/blocks/end_stones.json new file mode 100644 index 00000000000..aa227f8a3b9 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/end_stones.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:end_stone", + { + "id": "#forge:end_stones", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/fence_gates.json b/src/generated/resources/data/c/tags/blocks/fence_gates.json new file mode 100644 index 00000000000..56c90931ccb --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/fence_gates.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#c:fence_gates/wooden", + { + "id": "#forge:fence_gates", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/fence_gates/wooden.json b/src/generated/resources/data/c/tags/blocks/fence_gates/wooden.json new file mode 100644 index 00000000000..db55cb84ed4 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/fence_gates/wooden.json @@ -0,0 +1,19 @@ +{ + "values": [ + "minecraft:oak_fence_gate", + "minecraft:spruce_fence_gate", + "minecraft:birch_fence_gate", + "minecraft:jungle_fence_gate", + "minecraft:acacia_fence_gate", + "minecraft:dark_oak_fence_gate", + "minecraft:crimson_fence_gate", + "minecraft:warped_fence_gate", + "minecraft:mangrove_fence_gate", + "minecraft:bamboo_fence_gate", + "minecraft:cherry_fence_gate", + { + "id": "#forge:fence_gates/wooden", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/fences.json b/src/generated/resources/data/c/tags/blocks/fences.json new file mode 100644 index 00000000000..1e79564adee --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/fences.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:fences/nether_brick", + "#c:fences/wooden", + { + "id": "#forge:fences", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/fences/nether_brick.json b/src/generated/resources/data/c/tags/blocks/fences/nether_brick.json new file mode 100644 index 00000000000..30a88aea365 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/fences/nether_brick.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:nether_brick_fence", + { + "id": "#forge:fences/nether_brick", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/fences/wooden.json b/src/generated/resources/data/c/tags/blocks/fences/wooden.json new file mode 100644 index 00000000000..bf67fa132ef --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/fences/wooden.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:wooden_fences", + { + "id": "#forge:fences/wooden", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/glass_blocks.json b/src/generated/resources/data/c/tags/blocks/glass_blocks.json new file mode 100644 index 00000000000..311aa195ce2 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/glass_blocks.json @@ -0,0 +1,27 @@ +{ + "values": [ + "#c:glass_blocks/colorless", + "#c:glass_blocks/cheap", + "#c:glass_blocks/tinted", + "minecraft:white_stained_glass", + "minecraft:orange_stained_glass", + "minecraft:magenta_stained_glass", + "minecraft:light_blue_stained_glass", + "minecraft:yellow_stained_glass", + "minecraft:lime_stained_glass", + "minecraft:pink_stained_glass", + "minecraft:gray_stained_glass", + "minecraft:light_gray_stained_glass", + "minecraft:cyan_stained_glass", + "minecraft:purple_stained_glass", + "minecraft:blue_stained_glass", + "minecraft:brown_stained_glass", + "minecraft:green_stained_glass", + "minecraft:red_stained_glass", + "minecraft:black_stained_glass", + { + "id": "#forge:glass", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/glass_blocks/cheap.json b/src/generated/resources/data/c/tags/blocks/glass_blocks/cheap.json new file mode 100644 index 00000000000..016e4315ef8 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/glass_blocks/cheap.json @@ -0,0 +1,26 @@ +{ + "values": [ + "minecraft:glass", + "minecraft:white_stained_glass", + "minecraft:orange_stained_glass", + "minecraft:magenta_stained_glass", + "minecraft:light_blue_stained_glass", + "minecraft:yellow_stained_glass", + "minecraft:lime_stained_glass", + "minecraft:pink_stained_glass", + "minecraft:gray_stained_glass", + "minecraft:light_gray_stained_glass", + "minecraft:cyan_stained_glass", + "minecraft:purple_stained_glass", + "minecraft:blue_stained_glass", + "minecraft:brown_stained_glass", + "minecraft:green_stained_glass", + "minecraft:green_stained_glass", + "minecraft:red_stained_glass", + "minecraft:black_stained_glass", + { + "id": "#forge:glass_silica", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/glass_blocks/colorless.json b/src/generated/resources/data/c/tags/blocks/glass_blocks/colorless.json new file mode 100644 index 00000000000..7d2e81b6c44 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/glass_blocks/colorless.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:glass", + { + "id": "#forge:glass_colorless", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/glass_blocks/tinted.json b/src/generated/resources/data/c/tags/blocks/glass_blocks/tinted.json new file mode 100644 index 00000000000..0a7d0f3f00d --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/glass_blocks/tinted.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:tinted_glass", + { + "id": "#forge:glass_tinted", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/glass_panes.json b/src/generated/resources/data/c/tags/blocks/glass_panes.json new file mode 100644 index 00000000000..c4bdf8ea3f2 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/glass_panes.json @@ -0,0 +1,21 @@ +{ + "values": [ + "#c:glass_panes/colorless", + "minecraft:white_stained_glass_pane", + "minecraft:orange_stained_glass_pane", + "minecraft:magenta_stained_glass_pane", + "minecraft:light_blue_stained_glass_pane", + "minecraft:yellow_stained_glass_pane", + "minecraft:lime_stained_glass_pane", + "minecraft:pink_stained_glass_pane", + "minecraft:gray_stained_glass_pane", + "minecraft:light_gray_stained_glass_pane", + "minecraft:cyan_stained_glass_pane", + "minecraft:purple_stained_glass_pane", + "minecraft:blue_stained_glass_pane", + "minecraft:brown_stained_glass_pane", + "minecraft:green_stained_glass_pane", + "minecraft:red_stained_glass_pane", + "minecraft:black_stained_glass_pane" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/glass_panes/colorless.json b/src/generated/resources/data/c/tags/blocks/glass_panes/colorless.json new file mode 100644 index 00000000000..b7d7245a6aa --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/glass_panes/colorless.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:glass_pane", + { + "id": "#forge:glass_panes_colorless", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/gravel.json b/src/generated/resources/data/c/tags/blocks/gravel.json new file mode 100644 index 00000000000..80440dd1d45 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/gravel.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:gravel", + { + "id": "#forge:gravel", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/enderman_place_on_blacklist.json b/src/generated/resources/data/c/tags/blocks/hidden_from_recipe_viewers.json similarity index 100% rename from src/generated/resources/data/forge/tags/blocks/enderman_place_on_blacklist.json rename to src/generated/resources/data/c/tags/blocks/hidden_from_recipe_viewers.json diff --git a/src/generated/resources/data/c/tags/blocks/netherrack.json b/src/generated/resources/data/c/tags/blocks/netherrack.json new file mode 100644 index 00000000000..21c1554741f --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/netherrack.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:netherrack", + { + "id": "#forge:netherrack", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/obsidians.json b/src/generated/resources/data/c/tags/blocks/obsidians.json new file mode 100644 index 00000000000..aa3315f6bf6 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/obsidians.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:obsidian", + { + "id": "#forge:obsidian", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ore_bearing_ground/deepslate.json b/src/generated/resources/data/c/tags/blocks/ore_bearing_ground/deepslate.json new file mode 100644 index 00000000000..e3a93227979 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ore_bearing_ground/deepslate.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:deepslate", + { + "id": "#forge:ore_bearing_ground/deepslate", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ore_bearing_ground/netherrack.json b/src/generated/resources/data/c/tags/blocks/ore_bearing_ground/netherrack.json new file mode 100644 index 00000000000..d8156115518 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ore_bearing_ground/netherrack.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:netherrack", + { + "id": "#forge:ore_bearing_ground/netherrack", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ore_bearing_ground/stone.json b/src/generated/resources/data/c/tags/blocks/ore_bearing_ground/stone.json new file mode 100644 index 00000000000..08d0efdfe57 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ore_bearing_ground/stone.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:stone", + { + "id": "#forge:ore_bearing_ground/stone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ore_rates/dense.json b/src/generated/resources/data/c/tags/blocks/ore_rates/dense.json new file mode 100644 index 00000000000..ded4e6606a3 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ore_rates/dense.json @@ -0,0 +1,14 @@ +{ + "values": [ + "minecraft:copper_ore", + "minecraft:deepslate_copper_ore", + "minecraft:deepslate_lapis_ore", + "minecraft:deepslate_redstone_ore", + "minecraft:lapis_ore", + "minecraft:redstone_ore", + { + "id": "#forge:ore_rates/dense", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ore_rates/singular.json b/src/generated/resources/data/c/tags/blocks/ore_rates/singular.json new file mode 100644 index 00000000000..3a2f12d573f --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ore_rates/singular.json @@ -0,0 +1,20 @@ +{ + "values": [ + "minecraft:ancient_debris", + "minecraft:coal_ore", + "minecraft:deepslate_coal_ore", + "minecraft:deepslate_diamond_ore", + "minecraft:deepslate_emerald_ore", + "minecraft:deepslate_gold_ore", + "minecraft:deepslate_iron_ore", + "minecraft:diamond_ore", + "minecraft:emerald_ore", + "minecraft:gold_ore", + "minecraft:iron_ore", + "minecraft:nether_quartz_ore", + { + "id": "#forge:ore_rates/singular", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ore_rates/sparse.json b/src/generated/resources/data/c/tags/blocks/ore_rates/sparse.json new file mode 100644 index 00000000000..349b1e3d4be --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ore_rates/sparse.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:nether_gold_ore", + { + "id": "#forge:ore_rates/sparse", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores.json b/src/generated/resources/data/c/tags/blocks/ores.json new file mode 100644 index 00000000000..ffce3487bec --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores.json @@ -0,0 +1,18 @@ +{ + "values": [ + "#c:ores/coal", + "#c:ores/copper", + "#c:ores/diamond", + "#c:ores/emerald", + "#c:ores/gold", + "#c:ores/iron", + "#c:ores/lapis", + "#c:ores/netherite_scrap", + "#c:ores/redstone", + "#c:ores/quartz", + { + "id": "#forge:ores", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/coal.json b/src/generated/resources/data/c/tags/blocks/ores/coal.json new file mode 100644 index 00000000000..2e088c72415 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/coal.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:coal_ores", + { + "id": "#forge:ores/coal", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/copper.json b/src/generated/resources/data/c/tags/blocks/ores/copper.json new file mode 100644 index 00000000000..f51e56171f2 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/copper.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:copper_ores", + { + "id": "#forge:ores/copper", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/diamond.json b/src/generated/resources/data/c/tags/blocks/ores/diamond.json new file mode 100644 index 00000000000..3a595fe6482 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/diamond.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:diamond_ores", + { + "id": "#forge:ores/diamond", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/emerald.json b/src/generated/resources/data/c/tags/blocks/ores/emerald.json new file mode 100644 index 00000000000..25ec90670f7 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/emerald.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:emerald_ores", + { + "id": "#forge:ores/emerald", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/gold.json b/src/generated/resources/data/c/tags/blocks/ores/gold.json new file mode 100644 index 00000000000..ab8f217a24d --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/gold.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:gold_ores", + { + "id": "#forge:ores/gold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/iron.json b/src/generated/resources/data/c/tags/blocks/ores/iron.json new file mode 100644 index 00000000000..12fed97a891 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/iron.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:iron_ores", + { + "id": "#forge:ores/iron", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/lapis.json b/src/generated/resources/data/c/tags/blocks/ores/lapis.json new file mode 100644 index 00000000000..4609a406dcf --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/lapis.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:lapis_ores", + { + "id": "#forge:ores/lapis", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/netherite_scrap.json b/src/generated/resources/data/c/tags/blocks/ores/netherite_scrap.json new file mode 100644 index 00000000000..6cc208db8e5 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/netherite_scrap.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:ancient_debris", + { + "id": "#forge:ores/netherite_scrap", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/quartz.json b/src/generated/resources/data/c/tags/blocks/ores/quartz.json new file mode 100644 index 00000000000..5433b2ed6fa --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/quartz.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:nether_quartz_ore", + { + "id": "#forge:ores/quartz", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores/redstone.json b/src/generated/resources/data/c/tags/blocks/ores/redstone.json new file mode 100644 index 00000000000..42cb0fd1ee4 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores/redstone.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:redstone_ores", + { + "id": "#forge:ores/redstone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores_in_ground/deepslate.json b/src/generated/resources/data/c/tags/blocks/ores_in_ground/deepslate.json new file mode 100644 index 00000000000..6b172a1533b --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores_in_ground/deepslate.json @@ -0,0 +1,16 @@ +{ + "values": [ + "minecraft:deepslate_coal_ore", + "minecraft:deepslate_copper_ore", + "minecraft:deepslate_diamond_ore", + "minecraft:deepslate_emerald_ore", + "minecraft:deepslate_gold_ore", + "minecraft:deepslate_iron_ore", + "minecraft:deepslate_lapis_ore", + "minecraft:deepslate_redstone_ore", + { + "id": "#forge:ores_in_ground/deepslate", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores_in_ground/netherrack.json b/src/generated/resources/data/c/tags/blocks/ores_in_ground/netherrack.json new file mode 100644 index 00000000000..83b110ef9e5 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores_in_ground/netherrack.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:nether_gold_ore", + "minecraft:nether_quartz_ore", + { + "id": "#forge:ores_in_ground/netherrack", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ores_in_ground/stone.json b/src/generated/resources/data/c/tags/blocks/ores_in_ground/stone.json new file mode 100644 index 00000000000..97b26721aeb --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ores_in_ground/stone.json @@ -0,0 +1,16 @@ +{ + "values": [ + "minecraft:coal_ore", + "minecraft:copper_ore", + "minecraft:diamond_ore", + "minecraft:emerald_ore", + "minecraft:gold_ore", + "minecraft:iron_ore", + "minecraft:lapis_ore", + "minecraft:redstone_ore", + { + "id": "#forge:ores_in_ground/stone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/player_workstations/crafting_tables.json b/src/generated/resources/data/c/tags/blocks/player_workstations/crafting_tables.json new file mode 100644 index 00000000000..3be1c8e22ed --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/player_workstations/crafting_tables.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:crafting_table" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/player_workstations/furnaces.json b/src/generated/resources/data/c/tags/blocks/player_workstations/furnaces.json new file mode 100644 index 00000000000..25edfef1ca6 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/player_workstations/furnaces.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:furnace" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/relocation_not_supported.json b/src/generated/resources/data/c/tags/blocks/relocation_not_supported.json new file mode 100644 index 00000000000..0c0cf3a08fd --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/relocation_not_supported.json @@ -0,0 +1,12 @@ +{ + "values": [ + { + "id": "#forge:relocation_not_supported", + "required": false + }, + { + "id": "#forge:immovable", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/ropes.json b/src/generated/resources/data/c/tags/blocks/ropes.json new file mode 100644 index 00000000000..f72d209df78 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/ropes.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sands.json b/src/generated/resources/data/c/tags/blocks/sands.json new file mode 100644 index 00000000000..43eaac83ae7 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sands.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:sands/colorless", + "#c:sands/red", + { + "id": "#forge:sand", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sands/colorless.json b/src/generated/resources/data/c/tags/blocks/sands/colorless.json new file mode 100644 index 00000000000..93cdef191bc --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sands/colorless.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:sand", + { + "id": "#forge:sand/colorless", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sands/red.json b/src/generated/resources/data/c/tags/blocks/sands/red.json new file mode 100644 index 00000000000..03eba73b127 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sands/red.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:red_sand", + { + "id": "#forge:sand/red", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sandstone/blocks.json b/src/generated/resources/data/c/tags/blocks/sandstone/blocks.json new file mode 100644 index 00000000000..5684db6caf7 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sandstone/blocks.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:sandstone/red_blocks", + "#c:sandstone/uncolored_blocks", + { + "id": "#forge:sandstone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sandstone/red_blocks.json b/src/generated/resources/data/c/tags/blocks/sandstone/red_blocks.json new file mode 100644 index 00000000000..4e72ad44cdb --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sandstone/red_blocks.json @@ -0,0 +1,8 @@ +{ + "values": [ + "minecraft:red_sandstone", + "minecraft:cut_red_sandstone", + "minecraft:chiseled_red_sandstone", + "minecraft:smooth_red_sandstone" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sandstone/red_slabs.json b/src/generated/resources/data/c/tags/blocks/sandstone/red_slabs.json new file mode 100644 index 00000000000..a586c49087e --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sandstone/red_slabs.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:red_sandstone_slab", + "minecraft:cut_red_sandstone_slab", + "minecraft:smooth_red_sandstone_slab" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sandstone/red_stairs.json b/src/generated/resources/data/c/tags/blocks/sandstone/red_stairs.json new file mode 100644 index 00000000000..8778d5dbbd2 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sandstone/red_stairs.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:red_sandstone_stairs", + "minecraft:smooth_red_sandstone_stairs" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sandstone/slabs.json b/src/generated/resources/data/c/tags/blocks/sandstone/slabs.json new file mode 100644 index 00000000000..92bc3f3ed94 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sandstone/slabs.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#c:sandstone/red_slabs", + "#c:sandstone/uncolored_slabs" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sandstone/stairs.json b/src/generated/resources/data/c/tags/blocks/sandstone/stairs.json new file mode 100644 index 00000000000..673f168ddf7 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sandstone/stairs.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#c:sandstone/red_stairs", + "#c:sandstone/uncolored_stairs" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sandstone/uncolored_blocks.json b/src/generated/resources/data/c/tags/blocks/sandstone/uncolored_blocks.json new file mode 100644 index 00000000000..4e32539b4e5 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sandstone/uncolored_blocks.json @@ -0,0 +1,8 @@ +{ + "values": [ + "minecraft:sandstone", + "minecraft:cut_sandstone", + "minecraft:chiseled_sandstone", + "minecraft:smooth_sandstone" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sandstone/uncolored_slabs.json b/src/generated/resources/data/c/tags/blocks/sandstone/uncolored_slabs.json new file mode 100644 index 00000000000..d830f1dc1ea --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sandstone/uncolored_slabs.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:sandstone_slab", + "minecraft:cut_sandstone_slab", + "minecraft:smooth_sandstone_slab" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/sandstone/uncolored_stairs.json b/src/generated/resources/data/c/tags/blocks/sandstone/uncolored_stairs.json new file mode 100644 index 00000000000..ddb4a27f874 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/sandstone/uncolored_stairs.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:sandstone_stairs", + "minecraft:smooth_sandstone_stairs" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/skulls.json b/src/generated/resources/data/c/tags/blocks/skulls.json new file mode 100644 index 00000000000..a9820b074f5 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/skulls.json @@ -0,0 +1,18 @@ +{ + "values": [ + "minecraft:skeleton_skull", + "minecraft:skeleton_wall_skull", + "minecraft:wither_skeleton_skull", + "minecraft:wither_skeleton_wall_skull", + "minecraft:player_head", + "minecraft:player_wall_head", + "minecraft:zombie_head", + "minecraft:zombie_wall_head", + "minecraft:creeper_head", + "minecraft:creeper_wall_head", + "minecraft:piglin_head", + "minecraft:piglin_wall_head", + "minecraft:dragon_head", + "minecraft:dragon_wall_head" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/stones.json b/src/generated/resources/data/c/tags/blocks/stones.json new file mode 100644 index 00000000000..820387926d4 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/stones.json @@ -0,0 +1,14 @@ +{ + "values": [ + "minecraft:andesite", + "minecraft:diorite", + "minecraft:granite", + "minecraft:stone", + "minecraft:deepslate", + "minecraft:tuff", + { + "id": "#forge:stones", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks.json b/src/generated/resources/data/c/tags/blocks/storage_blocks.json new file mode 100644 index 00000000000..7bf4a38117d --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks.json @@ -0,0 +1,24 @@ +{ + "values": [ + "#c:storage_blocks/bone_meal", + "#c:storage_blocks/coal", + "#c:storage_blocks/copper", + "#c:storage_blocks/diamond", + "#c:storage_blocks/dried_kelp", + "#c:storage_blocks/emerald", + "#c:storage_blocks/gold", + "#c:storage_blocks/iron", + "#c:storage_blocks/lapis", + "#c:storage_blocks/netherite", + "#c:storage_blocks/raw_copper", + "#c:storage_blocks/raw_gold", + "#c:storage_blocks/raw_iron", + "#c:storage_blocks/redstone", + "#c:storage_blocks/slime", + "#c:storage_blocks/wheat", + { + "id": "#forge:storage_blocks", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/bone_meal.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/bone_meal.json new file mode 100644 index 00000000000..98ab24a2133 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/bone_meal.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:bone_block" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/coal.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/coal.json new file mode 100644 index 00000000000..b8479ced38e --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/coal.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:coal_block", + { + "id": "#forge:storage_blocks/coal", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/copper.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/copper.json new file mode 100644 index 00000000000..acd2a6a7a48 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/copper.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:copper_block", + { + "id": "#forge:storage_blocks/copper", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/diamond.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/diamond.json new file mode 100644 index 00000000000..76426ba425f --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/diamond.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:diamond_block", + { + "id": "#forge:storage_blocks/diamond", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/dried_kelp.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/dried_kelp.json new file mode 100644 index 00000000000..26096564292 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/dried_kelp.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:dried_kelp_block" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/emerald.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/emerald.json new file mode 100644 index 00000000000..7a41454d94d --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/emerald.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:emerald_block", + { + "id": "#forge:storage_blocks/emerald", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/gold.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/gold.json new file mode 100644 index 00000000000..a4116fc77fd --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/gold.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:gold_block", + { + "id": "#forge:storage_blocks/gold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/iron.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/iron.json new file mode 100644 index 00000000000..f0e9fcca1fe --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/iron.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:iron_block", + { + "id": "#forge:storage_blocks/iron", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/lapis.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/lapis.json new file mode 100644 index 00000000000..b5f41d8d4e7 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/lapis.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:lapis_block", + { + "id": "#forge:storage_blocks/lapis", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/netherite.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/netherite.json new file mode 100644 index 00000000000..a3dfe0d53c5 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/netherite.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:netherite_block", + { + "id": "#forge:storage_blocks/netherite", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/raw_copper.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/raw_copper.json new file mode 100644 index 00000000000..8f12fb63a74 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/raw_copper.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:raw_copper_block", + { + "id": "#forge:storage_blocks/raw_copper", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/raw_gold.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/raw_gold.json new file mode 100644 index 00000000000..dcee1e225b1 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/raw_gold.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:raw_gold_block", + { + "id": "#forge:storage_blocks/raw_gold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/raw_iron.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/raw_iron.json new file mode 100644 index 00000000000..3f0ecf27ad1 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/raw_iron.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:raw_iron_block", + { + "id": "#forge:storage_blocks/raw_iron", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/redstone.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/redstone.json new file mode 100644 index 00000000000..49fa7a5a26a --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/redstone.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:redstone_block", + { + "id": "#forge:storage_blocks/redstone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/slime.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/slime.json new file mode 100644 index 00000000000..523bdc28354 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/slime.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:slime_block" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/storage_blocks/wheat.json b/src/generated/resources/data/c/tags/blocks/storage_blocks/wheat.json new file mode 100644 index 00000000000..ea92d03cb4d --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/storage_blocks/wheat.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:hay_block" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/blocks/villager_job_sites.json b/src/generated/resources/data/c/tags/blocks/villager_job_sites.json new file mode 100644 index 00000000000..859c128fce8 --- /dev/null +++ b/src/generated/resources/data/c/tags/blocks/villager_job_sites.json @@ -0,0 +1,20 @@ +{ + "values": [ + "minecraft:barrel", + "minecraft:blast_furnace", + "minecraft:brewing_stand", + "minecraft:cartography_table", + "minecraft:cauldron", + "minecraft:water_cauldron", + "minecraft:lava_cauldron", + "minecraft:powder_snow_cauldron", + "minecraft:composter", + "minecraft:fletching_table", + "minecraft:grindstone", + "minecraft:lectern", + "minecraft:loom", + "minecraft:smithing_table", + "minecraft:smoker", + "minecraft:stonecutter" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/enchantment/entity_auxiliary_movement_enhancements.json b/src/generated/resources/data/c/tags/enchantment/entity_auxiliary_movement_enhancements.json new file mode 100644 index 00000000000..18527f1e0f8 --- /dev/null +++ b/src/generated/resources/data/c/tags/enchantment/entity_auxiliary_movement_enhancements.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:feather_falling", + "minecraft:frost_walker" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/enchantment/entity_defense_enhancements.json b/src/generated/resources/data/c/tags/enchantment/entity_defense_enhancements.json new file mode 100644 index 00000000000..2af6d192e60 --- /dev/null +++ b/src/generated/resources/data/c/tags/enchantment/entity_defense_enhancements.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:protection", + "minecraft:blast_protection", + "minecraft:projectile_protection", + "minecraft:fire_protection", + "minecraft:respiration", + "minecraft:feather_falling" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/enchantment/entity_speed_enhancements.json b/src/generated/resources/data/c/tags/enchantment/entity_speed_enhancements.json new file mode 100644 index 00000000000..fee12e5ec30 --- /dev/null +++ b/src/generated/resources/data/c/tags/enchantment/entity_speed_enhancements.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:soul_speed", + "minecraft:swift_sneak", + "minecraft:depth_strider" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/enchantment/increase_block_drops.json b/src/generated/resources/data/c/tags/enchantment/increase_block_drops.json new file mode 100644 index 00000000000..05cde351be0 --- /dev/null +++ b/src/generated/resources/data/c/tags/enchantment/increase_block_drops.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:fortune" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/enchantment/increase_entity_drops.json b/src/generated/resources/data/c/tags/enchantment/increase_entity_drops.json new file mode 100644 index 00000000000..4e9fde05881 --- /dev/null +++ b/src/generated/resources/data/c/tags/enchantment/increase_entity_drops.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:looting" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/enchantment/weapon_damage_enhancements.json b/src/generated/resources/data/c/tags/enchantment/weapon_damage_enhancements.json new file mode 100644 index 00000000000..c60666e3899 --- /dev/null +++ b/src/generated/resources/data/c/tags/enchantment/weapon_damage_enhancements.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:sharpness", + "minecraft:smite", + "minecraft:bane_of_arthropods", + "minecraft:power", + "minecraft:impaling" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/entity_types/boats.json b/src/generated/resources/data/c/tags/entity_types/boats.json new file mode 100644 index 00000000000..58e89216d1a --- /dev/null +++ b/src/generated/resources/data/c/tags/entity_types/boats.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:boat", + "minecraft:chest_boat", + { + "id": "#forge:boats", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/entity_types/bosses.json b/src/generated/resources/data/c/tags/entity_types/bosses.json new file mode 100644 index 00000000000..5b52cfe527e --- /dev/null +++ b/src/generated/resources/data/c/tags/entity_types/bosses.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:ender_dragon", + "minecraft:wither", + { + "id": "#forge:bosses", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/entity_types/capturing_not_supported.json b/src/generated/resources/data/c/tags/entity_types/capturing_not_supported.json new file mode 100644 index 00000000000..f72d209df78 --- /dev/null +++ b/src/generated/resources/data/c/tags/entity_types/capturing_not_supported.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/entity_types/minecarts.json b/src/generated/resources/data/c/tags/entity_types/minecarts.json new file mode 100644 index 00000000000..6b7fe052ea9 --- /dev/null +++ b/src/generated/resources/data/c/tags/entity_types/minecarts.json @@ -0,0 +1,15 @@ +{ + "values": [ + "minecraft:minecart", + "minecraft:chest_minecart", + "minecraft:furnace_minecart", + "minecraft:hopper_minecart", + "minecraft:spawner_minecart", + "minecraft:tnt_minecart", + "minecraft:command_block_minecart", + { + "id": "#forge:minecarts", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/entity_types/teleporting_not_supported.json b/src/generated/resources/data/c/tags/entity_types/teleporting_not_supported.json new file mode 100644 index 00000000000..f72d209df78 --- /dev/null +++ b/src/generated/resources/data/c/tags/entity_types/teleporting_not_supported.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/beetroot_soup.json b/src/generated/resources/data/c/tags/fluids/beetroot_soup.json new file mode 100644 index 00000000000..df5cf202597 --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/beetroot_soup.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:beetroot_soup", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/gaseous.json b/src/generated/resources/data/c/tags/fluids/gaseous.json new file mode 100644 index 00000000000..37a9047e11a --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/gaseous.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:gaseous", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/hidden_from_recipe_viewers.json b/src/generated/resources/data/c/tags/fluids/hidden_from_recipe_viewers.json new file mode 100644 index 00000000000..f72d209df78 --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/hidden_from_recipe_viewers.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/honey.json b/src/generated/resources/data/c/tags/fluids/honey.json new file mode 100644 index 00000000000..5b2fe217e25 --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/honey.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:honey", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/lava.json b/src/generated/resources/data/c/tags/fluids/lava.json new file mode 100644 index 00000000000..c4953e87f10 --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/lava.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:lava", + "minecraft:flowing_lava" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/milk.json b/src/generated/resources/data/c/tags/fluids/milk.json new file mode 100644 index 00000000000..5e27201a7ec --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/milk.json @@ -0,0 +1,16 @@ +{ + "values": [ + { + "id": "minecraft:milk", + "required": false + }, + { + "id": "minecraft:flowing_milk", + "required": false + }, + { + "id": "#forge:milk", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/mushroom_stew.json b/src/generated/resources/data/c/tags/fluids/mushroom_stew.json new file mode 100644 index 00000000000..7f40246aadb --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/mushroom_stew.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:mushroom_stew", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/potion.json b/src/generated/resources/data/c/tags/fluids/potion.json new file mode 100644 index 00000000000..3c851413d48 --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/potion.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:potion", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/rabbit_stew.json b/src/generated/resources/data/c/tags/fluids/rabbit_stew.json new file mode 100644 index 00000000000..fb82b6b59c5 --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/rabbit_stew.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:rabbit_stew", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/suspicious_stew.json b/src/generated/resources/data/c/tags/fluids/suspicious_stew.json new file mode 100644 index 00000000000..3069b778c79 --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/suspicious_stew.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:suspicious_stew", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluids/water.json b/src/generated/resources/data/c/tags/fluids/water.json new file mode 100644 index 00000000000..dbfbaa80910 --- /dev/null +++ b/src/generated/resources/data/c/tags/fluids/water.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:water", + "minecraft:flowing_water" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/armors.json b/src/generated/resources/data/c/tags/items/armors.json new file mode 100644 index 00000000000..a1f3ac1ce17 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/armors.json @@ -0,0 +1,12 @@ +{ + "values": [ + "#minecraft:head_armor", + "#minecraft:chest_armor", + "#minecraft:leg_armor", + "#minecraft:foot_armor", + { + "id": "#forge:armors", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/barrels.json b/src/generated/resources/data/c/tags/items/barrels.json new file mode 100644 index 00000000000..94bded15d86 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/barrels.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#c:barrels/wooden", + { + "id": "#forge:barrels", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/barrels/wooden.json b/src/generated/resources/data/c/tags/items/barrels/wooden.json new file mode 100644 index 00000000000..fedbc8ac53d --- /dev/null +++ b/src/generated/resources/data/c/tags/items/barrels/wooden.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:barrel", + { + "id": "#forge:barrels/wooden", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/bones.json b/src/generated/resources/data/c/tags/items/bones.json new file mode 100644 index 00000000000..883cdcc2e12 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/bones.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:bone", + { + "id": "#forge:bones", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/bookshelves.json b/src/generated/resources/data/c/tags/items/bookshelves.json new file mode 100644 index 00000000000..68f756dba9b --- /dev/null +++ b/src/generated/resources/data/c/tags/items/bookshelves.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:bookshelf", + { + "id": "#forge:bookshelves", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/bricks.json b/src/generated/resources/data/c/tags/items/bricks.json new file mode 100644 index 00000000000..ba6a10fc026 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/bricks.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#c:bricks/normal", + "#c:bricks/nether" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/bricks/nether.json b/src/generated/resources/data/c/tags/items/bricks/nether.json new file mode 100644 index 00000000000..3f63a414f04 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/bricks/nether.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:nether_brick", + { + "id": "#forge:ingots/nether_brick", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/bricks/normal.json b/src/generated/resources/data/c/tags/items/bricks/normal.json new file mode 100644 index 00000000000..a40223a69ba --- /dev/null +++ b/src/generated/resources/data/c/tags/items/bricks/normal.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:brick", + { + "id": "#forge:ingots/brick", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/buckets.json b/src/generated/resources/data/c/tags/items/buckets.json new file mode 100644 index 00000000000..4733f3b1e39 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/buckets.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:buckets/empty", + "#c:buckets/water", + "#c:buckets/lava", + "#c:buckets/milk", + "#c:buckets/powder_snow", + "#c:buckets/entity_water" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/buckets/empty.json b/src/generated/resources/data/c/tags/items/buckets/empty.json new file mode 100644 index 00000000000..67b2045bb72 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/buckets/empty.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:bucket" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/buckets/entity_water.json b/src/generated/resources/data/c/tags/items/buckets/entity_water.json new file mode 100644 index 00000000000..4803076188e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/buckets/entity_water.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:axolotl_bucket", + "minecraft:cod_bucket", + "minecraft:pufferfish_bucket", + "minecraft:tadpole_bucket", + "minecraft:tropical_fish_bucket", + "minecraft:salmon_bucket" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/buckets/lava.json b/src/generated/resources/data/c/tags/items/buckets/lava.json new file mode 100644 index 00000000000..fec09c77143 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/buckets/lava.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:lava_bucket" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/buckets/milk.json b/src/generated/resources/data/c/tags/items/buckets/milk.json new file mode 100644 index 00000000000..899451cb249 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/buckets/milk.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:milk_bucket" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/buckets/powder_snow.json b/src/generated/resources/data/c/tags/items/buckets/powder_snow.json new file mode 100644 index 00000000000..399a04e712e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/buckets/powder_snow.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:powder_snow_bucket" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/buckets/water.json b/src/generated/resources/data/c/tags/items/buckets/water.json new file mode 100644 index 00000000000..6486764e599 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/buckets/water.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:water_bucket" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/budding_blocks.json b/src/generated/resources/data/c/tags/items/budding_blocks.json new file mode 100644 index 00000000000..86257651e5e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/budding_blocks.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:budding_amethyst" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/buds.json b/src/generated/resources/data/c/tags/items/buds.json new file mode 100644 index 00000000000..708568317eb --- /dev/null +++ b/src/generated/resources/data/c/tags/items/buds.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:small_amethyst_bud", + "minecraft:medium_amethyst_bud", + "minecraft:large_amethyst_bud" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/chains.json b/src/generated/resources/data/c/tags/items/chains.json new file mode 100644 index 00000000000..63bbe5b4274 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/chains.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:chain" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/chests.json b/src/generated/resources/data/c/tags/items/chests.json new file mode 100644 index 00000000000..b6a2b0d0fad --- /dev/null +++ b/src/generated/resources/data/c/tags/items/chests.json @@ -0,0 +1,11 @@ +{ + "values": [ + "#c:chests/ender", + "#c:chests/trapped", + "#c:chests/wooden", + { + "id": "#forge:chests", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/chests/ender.json b/src/generated/resources/data/c/tags/items/chests/ender.json new file mode 100644 index 00000000000..1e652bcf24f --- /dev/null +++ b/src/generated/resources/data/c/tags/items/chests/ender.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:ender_chest", + { + "id": "#forge:chests/ender", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/chests/trapped.json b/src/generated/resources/data/c/tags/items/chests/trapped.json new file mode 100644 index 00000000000..d0d8da248bf --- /dev/null +++ b/src/generated/resources/data/c/tags/items/chests/trapped.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:trapped_chest", + { + "id": "#forge:chests/trapped", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/chests/wooden.json b/src/generated/resources/data/c/tags/items/chests/wooden.json new file mode 100644 index 00000000000..0659e860e6b --- /dev/null +++ b/src/generated/resources/data/c/tags/items/chests/wooden.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:chest", + "minecraft:trapped_chest", + { + "id": "#forge:chests/wooden", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/clusters.json b/src/generated/resources/data/c/tags/items/clusters.json new file mode 100644 index 00000000000..bf57e5f90d0 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/clusters.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:amethyst_cluster" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/cobblestones.json b/src/generated/resources/data/c/tags/items/cobblestones.json new file mode 100644 index 00000000000..b3c480393cc --- /dev/null +++ b/src/generated/resources/data/c/tags/items/cobblestones.json @@ -0,0 +1,12 @@ +{ + "values": [ + "#c:cobblestones/normal", + "#c:cobblestones/infested", + "#c:cobblestones/mossy", + "#c:cobblestones/deepslate", + { + "id": "#forge:cobblestone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/cobblestones/deepslate.json b/src/generated/resources/data/c/tags/items/cobblestones/deepslate.json new file mode 100644 index 00000000000..34e7d23b82f --- /dev/null +++ b/src/generated/resources/data/c/tags/items/cobblestones/deepslate.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:cobbled_deepslate", + { + "id": "#forge:cobblestone/deepslate", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/cobblestones/infested.json b/src/generated/resources/data/c/tags/items/cobblestones/infested.json new file mode 100644 index 00000000000..2752247f3ad --- /dev/null +++ b/src/generated/resources/data/c/tags/items/cobblestones/infested.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:infested_cobblestone", + { + "id": "#forge:cobblestone/infested", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/cobblestones/mossy.json b/src/generated/resources/data/c/tags/items/cobblestones/mossy.json new file mode 100644 index 00000000000..9a2e19c5694 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/cobblestones/mossy.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:mossy_cobblestone", + { + "id": "#forge:cobblestone/mossy", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/cobblestones/normal.json b/src/generated/resources/data/c/tags/items/cobblestones/normal.json new file mode 100644 index 00000000000..6cebee9d29f --- /dev/null +++ b/src/generated/resources/data/c/tags/items/cobblestones/normal.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:cobblestone", + { + "id": "#forge:cobblestone/normal", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/crops.json b/src/generated/resources/data/c/tags/items/crops.json new file mode 100644 index 00000000000..eb4402976e1 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/crops.json @@ -0,0 +1,13 @@ +{ + "values": [ + "#c:crops/beetroot", + "#c:crops/carrot", + "#c:crops/nether_wart", + "#c:crops/potato", + "#c:crops/wheat", + { + "id": "#forge:crops", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/crops/beetroot.json b/src/generated/resources/data/c/tags/items/crops/beetroot.json new file mode 100644 index 00000000000..cc56242351e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/crops/beetroot.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:beetroot", + { + "id": "#forge:crops/beetroot", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/crops/carrot.json b/src/generated/resources/data/c/tags/items/crops/carrot.json new file mode 100644 index 00000000000..9a637ed3cc2 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/crops/carrot.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:carrot", + { + "id": "#forge:crops/carrot", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/crops/nether_wart.json b/src/generated/resources/data/c/tags/items/crops/nether_wart.json new file mode 100644 index 00000000000..9e8eb9e0369 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/crops/nether_wart.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:nether_wart", + { + "id": "#forge:crops/nether_wart", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/crops/potato.json b/src/generated/resources/data/c/tags/items/crops/potato.json new file mode 100644 index 00000000000..fca8ec880c9 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/crops/potato.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:potato", + { + "id": "#forge:crops/potato", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/crops/wheat.json b/src/generated/resources/data/c/tags/items/crops/wheat.json new file mode 100644 index 00000000000..05dac35cc15 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/crops/wheat.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:wheat", + { + "id": "#forge:crops/wheat", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dusts.json b/src/generated/resources/data/c/tags/items/dusts.json new file mode 100644 index 00000000000..45f697f1b07 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dusts.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:dusts/glowstone", + "#c:dusts/redstone", + { + "id": "#forge:dusts", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dusts/glowstone.json b/src/generated/resources/data/c/tags/items/dusts/glowstone.json new file mode 100644 index 00000000000..b7bd60b0267 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dusts/glowstone.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:glowstone_dust", + { + "id": "#forge:dusts/glowstone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dusts/redstone.json b/src/generated/resources/data/c/tags/items/dusts/redstone.json new file mode 100644 index 00000000000..ec7a3ceb0a5 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dusts/redstone.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:redstone", + { + "id": "#forge:dusts/redstone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed.json b/src/generated/resources/data/c/tags/items/dyed.json new file mode 100644 index 00000000000..ad4584578df --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed.json @@ -0,0 +1,20 @@ +{ + "values": [ + "#c:dyed/white", + "#c:dyed/orange", + "#c:dyed/magenta", + "#c:dyed/light_blue", + "#c:dyed/yellow", + "#c:dyed/lime", + "#c:dyed/pink", + "#c:dyed/gray", + "#c:dyed/light_gray", + "#c:dyed/cyan", + "#c:dyed/purple", + "#c:dyed/blue", + "#c:dyed/brown", + "#c:dyed/green", + "#c:dyed/red", + "#c:dyed/black" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/black.json b/src/generated/resources/data/c/tags/items/dyed/black.json new file mode 100644 index 00000000000..493e96b6c0b --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/black.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:black_banner", + "minecraft:black_bed", + "minecraft:black_candle", + "minecraft:black_carpet", + "minecraft:black_concrete", + "minecraft:black_concrete_powder", + "minecraft:black_glazed_terracotta", + "minecraft:black_shulker_box", + "minecraft:black_stained_glass", + "minecraft:black_stained_glass_pane", + "minecraft:black_terracotta", + "minecraft:black_wool", + { + "id": "#forge:glass/black", + "required": false + }, + { + "id": "#forge:stained_glass/black", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/blue.json b/src/generated/resources/data/c/tags/items/dyed/blue.json new file mode 100644 index 00000000000..0704821f98e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/blue.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:blue_banner", + "minecraft:blue_bed", + "minecraft:blue_candle", + "minecraft:blue_carpet", + "minecraft:blue_concrete", + "minecraft:blue_concrete_powder", + "minecraft:blue_glazed_terracotta", + "minecraft:blue_shulker_box", + "minecraft:blue_stained_glass", + "minecraft:blue_stained_glass_pane", + "minecraft:blue_terracotta", + "minecraft:blue_wool", + { + "id": "#forge:glass/blue", + "required": false + }, + { + "id": "#forge:stained_glass/blue", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/brown.json b/src/generated/resources/data/c/tags/items/dyed/brown.json new file mode 100644 index 00000000000..41b1bc3f6f3 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/brown.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:brown_banner", + "minecraft:brown_bed", + "minecraft:brown_candle", + "minecraft:brown_carpet", + "minecraft:brown_concrete", + "minecraft:brown_concrete_powder", + "minecraft:brown_glazed_terracotta", + "minecraft:brown_shulker_box", + "minecraft:brown_stained_glass", + "minecraft:brown_stained_glass_pane", + "minecraft:brown_terracotta", + "minecraft:brown_wool", + { + "id": "#forge:glass/brown", + "required": false + }, + { + "id": "#forge:stained_glass/brown", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/cyan.json b/src/generated/resources/data/c/tags/items/dyed/cyan.json new file mode 100644 index 00000000000..a09984e0633 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/cyan.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:cyan_banner", + "minecraft:cyan_bed", + "minecraft:cyan_candle", + "minecraft:cyan_carpet", + "minecraft:cyan_concrete", + "minecraft:cyan_concrete_powder", + "minecraft:cyan_glazed_terracotta", + "minecraft:cyan_shulker_box", + "minecraft:cyan_stained_glass", + "minecraft:cyan_stained_glass_pane", + "minecraft:cyan_terracotta", + "minecraft:cyan_wool", + { + "id": "#forge:glass/cyan", + "required": false + }, + { + "id": "#forge:stained_glass/cyan", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/gray.json b/src/generated/resources/data/c/tags/items/dyed/gray.json new file mode 100644 index 00000000000..191db19733e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/gray.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:gray_banner", + "minecraft:gray_bed", + "minecraft:gray_candle", + "minecraft:gray_carpet", + "minecraft:gray_concrete", + "minecraft:gray_concrete_powder", + "minecraft:gray_glazed_terracotta", + "minecraft:gray_shulker_box", + "minecraft:gray_stained_glass", + "minecraft:gray_stained_glass_pane", + "minecraft:gray_terracotta", + "minecraft:gray_wool", + { + "id": "#forge:glass/gray", + "required": false + }, + { + "id": "#forge:stained_glass/gray", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/green.json b/src/generated/resources/data/c/tags/items/dyed/green.json new file mode 100644 index 00000000000..80e3b0bcd12 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/green.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:green_banner", + "minecraft:green_bed", + "minecraft:green_candle", + "minecraft:green_carpet", + "minecraft:green_concrete", + "minecraft:green_concrete_powder", + "minecraft:green_glazed_terracotta", + "minecraft:green_shulker_box", + "minecraft:green_stained_glass", + "minecraft:green_stained_glass_pane", + "minecraft:green_terracotta", + "minecraft:green_wool", + { + "id": "#forge:glass/green", + "required": false + }, + { + "id": "#forge:stained_glass/green", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/light_blue.json b/src/generated/resources/data/c/tags/items/dyed/light_blue.json new file mode 100644 index 00000000000..73525eab12e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/light_blue.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:light_blue_banner", + "minecraft:light_blue_bed", + "minecraft:light_blue_candle", + "minecraft:light_blue_carpet", + "minecraft:light_blue_concrete", + "minecraft:light_blue_concrete_powder", + "minecraft:light_blue_glazed_terracotta", + "minecraft:light_blue_shulker_box", + "minecraft:light_blue_stained_glass", + "minecraft:light_blue_stained_glass_pane", + "minecraft:light_blue_terracotta", + "minecraft:light_blue_wool", + { + "id": "#forge:glass/light_blue", + "required": false + }, + { + "id": "#forge:stained_glass/light_blue", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/light_gray.json b/src/generated/resources/data/c/tags/items/dyed/light_gray.json new file mode 100644 index 00000000000..ddfb3e54ad8 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/light_gray.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:light_gray_banner", + "minecraft:light_gray_bed", + "minecraft:light_gray_candle", + "minecraft:light_gray_carpet", + "minecraft:light_gray_concrete", + "minecraft:light_gray_concrete_powder", + "minecraft:light_gray_glazed_terracotta", + "minecraft:light_gray_shulker_box", + "minecraft:light_gray_stained_glass", + "minecraft:light_gray_stained_glass_pane", + "minecraft:light_gray_terracotta", + "minecraft:light_gray_wool", + { + "id": "#forge:glass/light_gray", + "required": false + }, + { + "id": "#forge:stained_glass/light_gray", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/lime.json b/src/generated/resources/data/c/tags/items/dyed/lime.json new file mode 100644 index 00000000000..aa463406081 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/lime.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:lime_banner", + "minecraft:lime_bed", + "minecraft:lime_candle", + "minecraft:lime_carpet", + "minecraft:lime_concrete", + "minecraft:lime_concrete_powder", + "minecraft:lime_glazed_terracotta", + "minecraft:lime_shulker_box", + "minecraft:lime_stained_glass", + "minecraft:lime_stained_glass_pane", + "minecraft:lime_terracotta", + "minecraft:lime_wool", + { + "id": "#forge:glass/lime", + "required": false + }, + { + "id": "#forge:stained_glass/lime", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/magenta.json b/src/generated/resources/data/c/tags/items/dyed/magenta.json new file mode 100644 index 00000000000..fe71a097ba4 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/magenta.json @@ -0,0 +1,32 @@ +{ + "values": [ + "minecraft:magenta_banner", + "minecraft:magenta_bed", + "minecraft:magenta_candle", + "minecraft:magenta_carpet", + "minecraft:magenta_concrete", + "minecraft:magenta_concrete_powder", + "minecraft:magenta_glazed_terracotta", + "minecraft:magenta_shulker_box", + "minecraft:magenta_stained_glass", + "minecraft:magenta_stained_glass_pane", + "minecraft:magenta_terracotta", + "minecraft:magenta_wool", + { + "id": "#forge:glass/magenta", + "required": false + }, + { + "id": "#forge:stained_glass/magenta", + "required": false + }, + { + "id": "#forge:glass/magenta", + "required": false + }, + { + "id": "#forge:stained_glass/magenta", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/orange.json b/src/generated/resources/data/c/tags/items/dyed/orange.json new file mode 100644 index 00000000000..6641433e65d --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/orange.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:orange_banner", + "minecraft:orange_bed", + "minecraft:orange_candle", + "minecraft:orange_carpet", + "minecraft:orange_concrete", + "minecraft:orange_concrete_powder", + "minecraft:orange_glazed_terracotta", + "minecraft:orange_shulker_box", + "minecraft:orange_stained_glass", + "minecraft:orange_stained_glass_pane", + "minecraft:orange_terracotta", + "minecraft:orange_wool", + { + "id": "#forge:glass/orange", + "required": false + }, + { + "id": "#forge:stained_glass/orange", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/pink.json b/src/generated/resources/data/c/tags/items/dyed/pink.json new file mode 100644 index 00000000000..edca352827a --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/pink.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:pink_banner", + "minecraft:pink_bed", + "minecraft:pink_candle", + "minecraft:pink_carpet", + "minecraft:pink_concrete", + "minecraft:pink_concrete_powder", + "minecraft:pink_glazed_terracotta", + "minecraft:pink_shulker_box", + "minecraft:pink_stained_glass", + "minecraft:pink_stained_glass_pane", + "minecraft:pink_terracotta", + "minecraft:pink_wool", + { + "id": "#forge:glass/pink", + "required": false + }, + { + "id": "#forge:stained_glass/pink", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/purple.json b/src/generated/resources/data/c/tags/items/dyed/purple.json new file mode 100644 index 00000000000..3be40b64c6e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/purple.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:purple_banner", + "minecraft:purple_bed", + "minecraft:purple_candle", + "minecraft:purple_carpet", + "minecraft:purple_concrete", + "minecraft:purple_concrete_powder", + "minecraft:purple_glazed_terracotta", + "minecraft:purple_shulker_box", + "minecraft:purple_stained_glass", + "minecraft:purple_stained_glass_pane", + "minecraft:purple_terracotta", + "minecraft:purple_wool", + { + "id": "#forge:glass/purple", + "required": false + }, + { + "id": "#forge:stained_glass/purple", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/red.json b/src/generated/resources/data/c/tags/items/dyed/red.json new file mode 100644 index 00000000000..7dea013276c --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/red.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:red_banner", + "minecraft:red_bed", + "minecraft:red_candle", + "minecraft:red_carpet", + "minecraft:red_concrete", + "minecraft:red_concrete_powder", + "minecraft:red_glazed_terracotta", + "minecraft:red_shulker_box", + "minecraft:red_stained_glass", + "minecraft:red_stained_glass_pane", + "minecraft:red_terracotta", + "minecraft:red_wool", + { + "id": "#forge:glass/red", + "required": false + }, + { + "id": "#forge:stained_glass/red", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/white.json b/src/generated/resources/data/c/tags/items/dyed/white.json new file mode 100644 index 00000000000..9edbf324cc0 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/white.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:white_banner", + "minecraft:white_bed", + "minecraft:white_candle", + "minecraft:white_carpet", + "minecraft:white_concrete", + "minecraft:white_concrete_powder", + "minecraft:white_glazed_terracotta", + "minecraft:white_shulker_box", + "minecraft:white_stained_glass", + "minecraft:white_stained_glass_pane", + "minecraft:white_terracotta", + "minecraft:white_wool", + { + "id": "#forge:glass/white", + "required": false + }, + { + "id": "#forge:stained_glass/white", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyed/yellow.json b/src/generated/resources/data/c/tags/items/dyed/yellow.json new file mode 100644 index 00000000000..57aeacb16f8 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyed/yellow.json @@ -0,0 +1,24 @@ +{ + "values": [ + "minecraft:yellow_banner", + "minecraft:yellow_bed", + "minecraft:yellow_candle", + "minecraft:yellow_carpet", + "minecraft:yellow_concrete", + "minecraft:yellow_concrete_powder", + "minecraft:yellow_glazed_terracotta", + "minecraft:yellow_shulker_box", + "minecraft:yellow_stained_glass", + "minecraft:yellow_stained_glass_pane", + "minecraft:yellow_terracotta", + "minecraft:yellow_wool", + { + "id": "#forge:glass/yellow", + "required": false + }, + { + "id": "#forge:stained_glass/yellow", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes.json b/src/generated/resources/data/c/tags/items/dyes.json new file mode 100644 index 00000000000..24f74989486 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes.json @@ -0,0 +1,20 @@ +{ + "values": [ + "#c:dyes/white", + "#c:dyes/orange", + "#c:dyes/magenta", + "#c:dyes/light_blue", + "#c:dyes/yellow", + "#c:dyes/lime", + "#c:dyes/pink", + "#c:dyes/gray", + "#c:dyes/light_gray", + "#c:dyes/cyan", + "#c:dyes/purple", + "#c:dyes/blue", + "#c:dyes/brown", + "#c:dyes/green", + "#c:dyes/red", + "#c:dyes/black" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/black.json b/src/generated/resources/data/c/tags/items/dyes/black.json new file mode 100644 index 00000000000..516aeff755f --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/black.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:black_dye", + { + "id": "#forge:dyes/black", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/blue.json b/src/generated/resources/data/c/tags/items/dyes/blue.json new file mode 100644 index 00000000000..d64a97e464d --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/blue.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:blue_dye", + { + "id": "#forge:dyes/blue", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/brown.json b/src/generated/resources/data/c/tags/items/dyes/brown.json new file mode 100644 index 00000000000..220ece0dfe0 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/brown.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:brown_dye", + { + "id": "#forge:dyes/brown", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/cyan.json b/src/generated/resources/data/c/tags/items/dyes/cyan.json new file mode 100644 index 00000000000..275830210e9 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/cyan.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:cyan_dye", + { + "id": "#forge:dyes/cyan", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/gray.json b/src/generated/resources/data/c/tags/items/dyes/gray.json new file mode 100644 index 00000000000..56f595ede51 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/gray.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:gray_dye", + { + "id": "#forge:dyes/gray", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/green.json b/src/generated/resources/data/c/tags/items/dyes/green.json new file mode 100644 index 00000000000..9f9a8311cfd --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/green.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:green_dye", + { + "id": "#forge:dyes/green", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/light_blue.json b/src/generated/resources/data/c/tags/items/dyes/light_blue.json new file mode 100644 index 00000000000..e5a48d1fedf --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/light_blue.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:light_blue_dye", + { + "id": "#forge:dyes/light_blue", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/light_gray.json b/src/generated/resources/data/c/tags/items/dyes/light_gray.json new file mode 100644 index 00000000000..6627597c69a --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/light_gray.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:light_gray_dye", + { + "id": "#forge:dyes/light_gray", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/lime.json b/src/generated/resources/data/c/tags/items/dyes/lime.json new file mode 100644 index 00000000000..fc0af1757b6 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/lime.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:lime_dye", + { + "id": "#forge:dyes/lime", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/magenta.json b/src/generated/resources/data/c/tags/items/dyes/magenta.json new file mode 100644 index 00000000000..d2032d3de2a --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/magenta.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:magenta_dye", + { + "id": "#forge:dyes/magenta", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/orange.json b/src/generated/resources/data/c/tags/items/dyes/orange.json new file mode 100644 index 00000000000..3534947be33 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/orange.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:orange_dye", + { + "id": "#forge:dyes/orange", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/pink.json b/src/generated/resources/data/c/tags/items/dyes/pink.json new file mode 100644 index 00000000000..f7ffc037f00 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/pink.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:pink_dye", + { + "id": "#forge:dyes/pink", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/purple.json b/src/generated/resources/data/c/tags/items/dyes/purple.json new file mode 100644 index 00000000000..38a9a298683 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/purple.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:purple_dye", + { + "id": "#forge:dyes/purple", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/red.json b/src/generated/resources/data/c/tags/items/dyes/red.json new file mode 100644 index 00000000000..f36b684e011 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/red.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:red_dye", + { + "id": "#forge:dyes/red", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/white.json b/src/generated/resources/data/c/tags/items/dyes/white.json new file mode 100644 index 00000000000..217dfda5c37 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/white.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:white_dye", + { + "id": "#forge:dyes/white", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/dyes/yellow.json b/src/generated/resources/data/c/tags/items/dyes/yellow.json new file mode 100644 index 00000000000..8f469111bf8 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/dyes/yellow.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:yellow_dye", + { + "id": "#forge:dyes/yellow", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/eggs.json b/src/generated/resources/data/c/tags/items/eggs.json similarity index 100% rename from src/generated/resources/data/forge/tags/items/eggs.json rename to src/generated/resources/data/c/tags/items/eggs.json diff --git a/src/generated/resources/data/c/tags/items/enchantables.json b/src/generated/resources/data/c/tags/items/enchantables.json new file mode 100644 index 00000000000..71d26a252bd --- /dev/null +++ b/src/generated/resources/data/c/tags/items/enchantables.json @@ -0,0 +1,20 @@ +{ + "values": [ + "#minecraft:enchantable/armor", + "#minecraft:enchantable/equippable", + "#minecraft:enchantable/weapon", + "#minecraft:enchantable/sword", + "#minecraft:enchantable/mining", + "#minecraft:enchantable/mining_loot", + "#minecraft:enchantable/fishing", + "#minecraft:enchantable/trident", + "#minecraft:enchantable/bow", + "#minecraft:enchantable/crossbow", + "#minecraft:enchantable/fire_aspect", + "#minecraft:enchantable/durability", + { + "id": "#minecraft:enchantable/mace", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/end_stones.json b/src/generated/resources/data/c/tags/items/end_stones.json new file mode 100644 index 00000000000..aa227f8a3b9 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/end_stones.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:end_stone", + { + "id": "#forge:end_stones", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ender_pearls.json b/src/generated/resources/data/c/tags/items/ender_pearls.json new file mode 100644 index 00000000000..bd8b93cf850 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ender_pearls.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:ender_pearl", + { + "id": "#forge:ender_pearls", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/feathers.json b/src/generated/resources/data/c/tags/items/feathers.json new file mode 100644 index 00000000000..84f3dedf59c --- /dev/null +++ b/src/generated/resources/data/c/tags/items/feathers.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:feather", + { + "id": "#forge:feathers", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/fence_gates.json b/src/generated/resources/data/c/tags/items/fence_gates.json new file mode 100644 index 00000000000..56c90931ccb --- /dev/null +++ b/src/generated/resources/data/c/tags/items/fence_gates.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#c:fence_gates/wooden", + { + "id": "#forge:fence_gates", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/fence_gates/wooden.json b/src/generated/resources/data/c/tags/items/fence_gates/wooden.json new file mode 100644 index 00000000000..db55cb84ed4 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/fence_gates/wooden.json @@ -0,0 +1,19 @@ +{ + "values": [ + "minecraft:oak_fence_gate", + "minecraft:spruce_fence_gate", + "minecraft:birch_fence_gate", + "minecraft:jungle_fence_gate", + "minecraft:acacia_fence_gate", + "minecraft:dark_oak_fence_gate", + "minecraft:crimson_fence_gate", + "minecraft:warped_fence_gate", + "minecraft:mangrove_fence_gate", + "minecraft:bamboo_fence_gate", + "minecraft:cherry_fence_gate", + { + "id": "#forge:fence_gates/wooden", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/fences.json b/src/generated/resources/data/c/tags/items/fences.json new file mode 100644 index 00000000000..1e79564adee --- /dev/null +++ b/src/generated/resources/data/c/tags/items/fences.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:fences/nether_brick", + "#c:fences/wooden", + { + "id": "#forge:fences", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/fences/nether_brick.json b/src/generated/resources/data/c/tags/items/fences/nether_brick.json new file mode 100644 index 00000000000..30a88aea365 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/fences/nether_brick.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:nether_brick_fence", + { + "id": "#forge:fences/nether_brick", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/fences/wooden.json b/src/generated/resources/data/c/tags/items/fences/wooden.json new file mode 100644 index 00000000000..bf67fa132ef --- /dev/null +++ b/src/generated/resources/data/c/tags/items/fences/wooden.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:wooden_fences", + { + "id": "#forge:fences/wooden", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods.json b/src/generated/resources/data/c/tags/items/foods.json new file mode 100644 index 00000000000..92dec0d3863 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods.json @@ -0,0 +1,22 @@ +{ + "values": [ + "minecraft:baked_potato", + "minecraft:pumpkin_pie", + "minecraft:honey_bottle", + "minecraft:ominous_bottle", + "minecraft:dried_kelp", + "#c:foods/fruits", + "#c:foods/vegetables", + "#c:foods/berries", + "#c:foods/breads", + "#c:foods/cookies", + "#c:foods/raw_meats", + "#c:foods/raw_fishes", + "#c:foods/cooked_meats", + "#c:foods/cooked_fishes", + "#c:foods/soups", + "#c:foods/candies", + "#c:foods/edible_when_placed", + "#c:foods/food_poisoning" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/berries.json b/src/generated/resources/data/c/tags/items/foods/berries.json new file mode 100644 index 00000000000..500bd9432cb --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/berries.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:sweet_berries", + "minecraft:glow_berries" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/breads.json b/src/generated/resources/data/c/tags/items/foods/breads.json new file mode 100644 index 00000000000..7873bb3c3f8 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/breads.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:bread" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/candies.json b/src/generated/resources/data/c/tags/items/foods/candies.json new file mode 100644 index 00000000000..f72d209df78 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/candies.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/cooked_fishes.json b/src/generated/resources/data/c/tags/items/foods/cooked_fishes.json new file mode 100644 index 00000000000..4e459bea9e5 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/cooked_fishes.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:cooked_cod", + "minecraft:cooked_salmon" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/cooked_meats.json b/src/generated/resources/data/c/tags/items/foods/cooked_meats.json new file mode 100644 index 00000000000..ffd78dc19ad --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/cooked_meats.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:cooked_beef", + "minecraft:cooked_porkchop", + "minecraft:cooked_chicken", + "minecraft:cooked_rabbit", + "minecraft:cooked_mutton" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/cookies.json b/src/generated/resources/data/c/tags/items/foods/cookies.json new file mode 100644 index 00000000000..a7c0dc91d8a --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/cookies.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:cookie" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/edible_when_placed.json b/src/generated/resources/data/c/tags/items/foods/edible_when_placed.json new file mode 100644 index 00000000000..d1a45a92222 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/edible_when_placed.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:cake" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/food_poisoning.json b/src/generated/resources/data/c/tags/items/foods/food_poisoning.json new file mode 100644 index 00000000000..6b59df70e42 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/food_poisoning.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:poisonous_potato", + "minecraft:pufferfish", + "minecraft:spider_eye", + "minecraft:chicken", + "minecraft:rotten_flesh" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/fruits.json b/src/generated/resources/data/c/tags/items/foods/fruits.json new file mode 100644 index 00000000000..895ad4a310a --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/fruits.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:apple", + "minecraft:golden_apple", + "minecraft:enchanted_golden_apple" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/raw_fishes.json b/src/generated/resources/data/c/tags/items/foods/raw_fishes.json new file mode 100644 index 00000000000..83d056aa447 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/raw_fishes.json @@ -0,0 +1,8 @@ +{ + "values": [ + "minecraft:cod", + "minecraft:salmon", + "minecraft:tropical_fish", + "minecraft:pufferfish" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/raw_meats.json b/src/generated/resources/data/c/tags/items/foods/raw_meats.json new file mode 100644 index 00000000000..c548b57f3a8 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/raw_meats.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:beef", + "minecraft:porkchop", + "minecraft:chicken", + "minecraft:rabbit", + "minecraft:mutton" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/soups.json b/src/generated/resources/data/c/tags/items/foods/soups.json new file mode 100644 index 00000000000..5a1a3392494 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/soups.json @@ -0,0 +1,8 @@ +{ + "values": [ + "minecraft:beetroot_soup", + "minecraft:mushroom_stew", + "minecraft:rabbit_stew", + "minecraft:suspicious_stew" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/foods/vegetables.json b/src/generated/resources/data/c/tags/items/foods/vegetables.json new file mode 100644 index 00000000000..0476304c8ad --- /dev/null +++ b/src/generated/resources/data/c/tags/items/foods/vegetables.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:carrot", + "minecraft:golden_carrot", + "minecraft:potato", + "minecraft:melon_slice", + "minecraft:beetroot" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/gems.json b/src/generated/resources/data/c/tags/items/gems.json new file mode 100644 index 00000000000..6f340c553c9 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/gems.json @@ -0,0 +1,14 @@ +{ + "values": [ + "#c:gems/amethyst", + "#c:gems/diamond", + "#c:gems/emerald", + "#c:gems/lapis", + "#c:gems/prismarine", + "#c:gems/quartz", + { + "id": "#forge:gems", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/gems/amethyst.json b/src/generated/resources/data/c/tags/items/gems/amethyst.json new file mode 100644 index 00000000000..d222353687d --- /dev/null +++ b/src/generated/resources/data/c/tags/items/gems/amethyst.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:amethyst_shard", + { + "id": "#forge:gems/amethyst", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/gems/diamond.json b/src/generated/resources/data/c/tags/items/gems/diamond.json new file mode 100644 index 00000000000..1ca2673f215 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/gems/diamond.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:diamond", + { + "id": "#forge:gems/diamond", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/gems/emerald.json b/src/generated/resources/data/c/tags/items/gems/emerald.json new file mode 100644 index 00000000000..de1e12af1b8 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/gems/emerald.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:emerald", + { + "id": "#forge:gems/emerald", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/gems/lapis.json b/src/generated/resources/data/c/tags/items/gems/lapis.json new file mode 100644 index 00000000000..0e926125485 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/gems/lapis.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:lapis_lazuli", + { + "id": "#forge:gems/lapis", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/gems/prismarine.json b/src/generated/resources/data/c/tags/items/gems/prismarine.json new file mode 100644 index 00000000000..df7aa663124 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/gems/prismarine.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:prismarine_crystals", + { + "id": "#forge:gems/prismarine", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/gems/quartz.json b/src/generated/resources/data/c/tags/items/gems/quartz.json new file mode 100644 index 00000000000..d0604485bde --- /dev/null +++ b/src/generated/resources/data/c/tags/items/gems/quartz.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:quartz", + { + "id": "#forge:gems/quartz", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/glass_blocks.json b/src/generated/resources/data/c/tags/items/glass_blocks.json new file mode 100644 index 00000000000..311aa195ce2 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/glass_blocks.json @@ -0,0 +1,27 @@ +{ + "values": [ + "#c:glass_blocks/colorless", + "#c:glass_blocks/cheap", + "#c:glass_blocks/tinted", + "minecraft:white_stained_glass", + "minecraft:orange_stained_glass", + "minecraft:magenta_stained_glass", + "minecraft:light_blue_stained_glass", + "minecraft:yellow_stained_glass", + "minecraft:lime_stained_glass", + "minecraft:pink_stained_glass", + "minecraft:gray_stained_glass", + "minecraft:light_gray_stained_glass", + "minecraft:cyan_stained_glass", + "minecraft:purple_stained_glass", + "minecraft:blue_stained_glass", + "minecraft:brown_stained_glass", + "minecraft:green_stained_glass", + "minecraft:red_stained_glass", + "minecraft:black_stained_glass", + { + "id": "#forge:glass", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/glass_blocks/cheap.json b/src/generated/resources/data/c/tags/items/glass_blocks/cheap.json new file mode 100644 index 00000000000..016e4315ef8 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/glass_blocks/cheap.json @@ -0,0 +1,26 @@ +{ + "values": [ + "minecraft:glass", + "minecraft:white_stained_glass", + "minecraft:orange_stained_glass", + "minecraft:magenta_stained_glass", + "minecraft:light_blue_stained_glass", + "minecraft:yellow_stained_glass", + "minecraft:lime_stained_glass", + "minecraft:pink_stained_glass", + "minecraft:gray_stained_glass", + "minecraft:light_gray_stained_glass", + "minecraft:cyan_stained_glass", + "minecraft:purple_stained_glass", + "minecraft:blue_stained_glass", + "minecraft:brown_stained_glass", + "minecraft:green_stained_glass", + "minecraft:green_stained_glass", + "minecraft:red_stained_glass", + "minecraft:black_stained_glass", + { + "id": "#forge:glass_silica", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/glass_blocks/colorless.json b/src/generated/resources/data/c/tags/items/glass_blocks/colorless.json new file mode 100644 index 00000000000..7d2e81b6c44 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/glass_blocks/colorless.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:glass", + { + "id": "#forge:glass_colorless", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/glass_blocks/tinted.json b/src/generated/resources/data/c/tags/items/glass_blocks/tinted.json new file mode 100644 index 00000000000..0a7d0f3f00d --- /dev/null +++ b/src/generated/resources/data/c/tags/items/glass_blocks/tinted.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:tinted_glass", + { + "id": "#forge:glass_tinted", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/glass_panes.json b/src/generated/resources/data/c/tags/items/glass_panes.json new file mode 100644 index 00000000000..c4bdf8ea3f2 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/glass_panes.json @@ -0,0 +1,21 @@ +{ + "values": [ + "#c:glass_panes/colorless", + "minecraft:white_stained_glass_pane", + "minecraft:orange_stained_glass_pane", + "minecraft:magenta_stained_glass_pane", + "minecraft:light_blue_stained_glass_pane", + "minecraft:yellow_stained_glass_pane", + "minecraft:lime_stained_glass_pane", + "minecraft:pink_stained_glass_pane", + "minecraft:gray_stained_glass_pane", + "minecraft:light_gray_stained_glass_pane", + "minecraft:cyan_stained_glass_pane", + "minecraft:purple_stained_glass_pane", + "minecraft:blue_stained_glass_pane", + "minecraft:brown_stained_glass_pane", + "minecraft:green_stained_glass_pane", + "minecraft:red_stained_glass_pane", + "minecraft:black_stained_glass_pane" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/glass_panes/colorless.json b/src/generated/resources/data/c/tags/items/glass_panes/colorless.json new file mode 100644 index 00000000000..b7d7245a6aa --- /dev/null +++ b/src/generated/resources/data/c/tags/items/glass_panes/colorless.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:glass_pane", + { + "id": "#forge:glass_panes_colorless", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/gravel.json b/src/generated/resources/data/c/tags/items/gravel.json new file mode 100644 index 00000000000..80440dd1d45 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/gravel.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:gravel", + { + "id": "#forge:gravel", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/gunpowder.json b/src/generated/resources/data/c/tags/items/gunpowder.json new file mode 100644 index 00000000000..90ef8c349e2 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/gunpowder.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:gunpowder", + { + "id": "#forge:gunpowder", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/hidden_from_recipe_viewers.json b/src/generated/resources/data/c/tags/items/hidden_from_recipe_viewers.json new file mode 100644 index 00000000000..f72d209df78 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/hidden_from_recipe_viewers.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ingots.json b/src/generated/resources/data/c/tags/items/ingots.json new file mode 100644 index 00000000000..45846683558 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ingots.json @@ -0,0 +1,12 @@ +{ + "values": [ + "#c:ingots/copper", + "#c:ingots/gold", + "#c:ingots/iron", + "#c:ingots/netherite", + { + "id": "#forge:ingots", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ingots/copper.json b/src/generated/resources/data/c/tags/items/ingots/copper.json new file mode 100644 index 00000000000..2043a331d03 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ingots/copper.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:copper_ingot", + { + "id": "#forge:ingots/copper", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ingots/gold.json b/src/generated/resources/data/c/tags/items/ingots/gold.json new file mode 100644 index 00000000000..70299fe3049 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ingots/gold.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:gold_ingot", + { + "id": "#forge:ingots/gold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ingots/iron.json b/src/generated/resources/data/c/tags/items/ingots/iron.json new file mode 100644 index 00000000000..7fa35c33e3d --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ingots/iron.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:iron_ingot", + { + "id": "#forge:ingots/iron", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ingots/netherite.json b/src/generated/resources/data/c/tags/items/ingots/netherite.json new file mode 100644 index 00000000000..61b250abae6 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ingots/netherite.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:netherite_ingot", + { + "id": "#forge:ingots/netherite", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/leather.json b/src/generated/resources/data/c/tags/items/leather.json new file mode 100644 index 00000000000..71f8c03e099 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/leather.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:leather", + { + "id": "#forge:leather", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/mushrooms.json b/src/generated/resources/data/c/tags/items/mushrooms.json new file mode 100644 index 00000000000..0823f66b558 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/mushrooms.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:brown_mushroom", + "minecraft:red_mushroom", + { + "id": "#forge:mushrooms", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/nether_stars.json b/src/generated/resources/data/c/tags/items/nether_stars.json new file mode 100644 index 00000000000..3e02f9a226a --- /dev/null +++ b/src/generated/resources/data/c/tags/items/nether_stars.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:nether_star", + { + "id": "#forge:nether_stars", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/netherrack.json b/src/generated/resources/data/c/tags/items/netherrack.json new file mode 100644 index 00000000000..21c1554741f --- /dev/null +++ b/src/generated/resources/data/c/tags/items/netherrack.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:netherrack", + { + "id": "#forge:netherrack", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/nuggets.json b/src/generated/resources/data/c/tags/items/nuggets.json new file mode 100644 index 00000000000..f7a672879a7 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/nuggets.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:nuggets/gold", + "#c:nuggets/iron", + { + "id": "#forge:nuggets", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/nuggets/gold.json b/src/generated/resources/data/c/tags/items/nuggets/gold.json new file mode 100644 index 00000000000..77eb1519091 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/nuggets/gold.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:gold_nugget", + { + "id": "#forge:nuggets/gold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/nuggets/iron.json b/src/generated/resources/data/c/tags/items/nuggets/iron.json new file mode 100644 index 00000000000..0f529f154f5 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/nuggets/iron.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:iron_nugget", + { + "id": "#forge:nuggets/iron", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/obsidians.json b/src/generated/resources/data/c/tags/items/obsidians.json new file mode 100644 index 00000000000..aa3315f6bf6 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/obsidians.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:obsidian", + { + "id": "#forge:obsidian", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ore_bearing_ground/deepslate.json b/src/generated/resources/data/c/tags/items/ore_bearing_ground/deepslate.json new file mode 100644 index 00000000000..e3a93227979 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ore_bearing_ground/deepslate.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:deepslate", + { + "id": "#forge:ore_bearing_ground/deepslate", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ore_bearing_ground/netherrack.json b/src/generated/resources/data/c/tags/items/ore_bearing_ground/netherrack.json new file mode 100644 index 00000000000..d8156115518 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ore_bearing_ground/netherrack.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:netherrack", + { + "id": "#forge:ore_bearing_ground/netherrack", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ore_bearing_ground/stone.json b/src/generated/resources/data/c/tags/items/ore_bearing_ground/stone.json new file mode 100644 index 00000000000..08d0efdfe57 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ore_bearing_ground/stone.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:stone", + { + "id": "#forge:ore_bearing_ground/stone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ore_rates/dense.json b/src/generated/resources/data/c/tags/items/ore_rates/dense.json new file mode 100644 index 00000000000..ded4e6606a3 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ore_rates/dense.json @@ -0,0 +1,14 @@ +{ + "values": [ + "minecraft:copper_ore", + "minecraft:deepslate_copper_ore", + "minecraft:deepslate_lapis_ore", + "minecraft:deepslate_redstone_ore", + "minecraft:lapis_ore", + "minecraft:redstone_ore", + { + "id": "#forge:ore_rates/dense", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ore_rates/singular.json b/src/generated/resources/data/c/tags/items/ore_rates/singular.json new file mode 100644 index 00000000000..3a2f12d573f --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ore_rates/singular.json @@ -0,0 +1,20 @@ +{ + "values": [ + "minecraft:ancient_debris", + "minecraft:coal_ore", + "minecraft:deepslate_coal_ore", + "minecraft:deepslate_diamond_ore", + "minecraft:deepslate_emerald_ore", + "minecraft:deepslate_gold_ore", + "minecraft:deepslate_iron_ore", + "minecraft:diamond_ore", + "minecraft:emerald_ore", + "minecraft:gold_ore", + "minecraft:iron_ore", + "minecraft:nether_quartz_ore", + { + "id": "#forge:ore_rates/singular", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ore_rates/sparse.json b/src/generated/resources/data/c/tags/items/ore_rates/sparse.json new file mode 100644 index 00000000000..349b1e3d4be --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ore_rates/sparse.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:nether_gold_ore", + { + "id": "#forge:ore_rates/sparse", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores.json b/src/generated/resources/data/c/tags/items/ores.json new file mode 100644 index 00000000000..ffce3487bec --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores.json @@ -0,0 +1,18 @@ +{ + "values": [ + "#c:ores/coal", + "#c:ores/copper", + "#c:ores/diamond", + "#c:ores/emerald", + "#c:ores/gold", + "#c:ores/iron", + "#c:ores/lapis", + "#c:ores/netherite_scrap", + "#c:ores/redstone", + "#c:ores/quartz", + { + "id": "#forge:ores", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/coal.json b/src/generated/resources/data/c/tags/items/ores/coal.json new file mode 100644 index 00000000000..2e088c72415 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/coal.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:coal_ores", + { + "id": "#forge:ores/coal", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/copper.json b/src/generated/resources/data/c/tags/items/ores/copper.json new file mode 100644 index 00000000000..f51e56171f2 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/copper.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:copper_ores", + { + "id": "#forge:ores/copper", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/diamond.json b/src/generated/resources/data/c/tags/items/ores/diamond.json new file mode 100644 index 00000000000..3a595fe6482 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/diamond.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:diamond_ores", + { + "id": "#forge:ores/diamond", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/emerald.json b/src/generated/resources/data/c/tags/items/ores/emerald.json new file mode 100644 index 00000000000..25ec90670f7 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/emerald.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:emerald_ores", + { + "id": "#forge:ores/emerald", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/gold.json b/src/generated/resources/data/c/tags/items/ores/gold.json new file mode 100644 index 00000000000..ab8f217a24d --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/gold.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:gold_ores", + { + "id": "#forge:ores/gold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/iron.json b/src/generated/resources/data/c/tags/items/ores/iron.json new file mode 100644 index 00000000000..12fed97a891 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/iron.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:iron_ores", + { + "id": "#forge:ores/iron", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/lapis.json b/src/generated/resources/data/c/tags/items/ores/lapis.json new file mode 100644 index 00000000000..4609a406dcf --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/lapis.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:lapis_ores", + { + "id": "#forge:ores/lapis", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/netherite_scrap.json b/src/generated/resources/data/c/tags/items/ores/netherite_scrap.json new file mode 100644 index 00000000000..6cc208db8e5 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/netherite_scrap.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:ancient_debris", + { + "id": "#forge:ores/netherite_scrap", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/quartz.json b/src/generated/resources/data/c/tags/items/ores/quartz.json new file mode 100644 index 00000000000..5433b2ed6fa --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/quartz.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:nether_quartz_ore", + { + "id": "#forge:ores/quartz", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores/redstone.json b/src/generated/resources/data/c/tags/items/ores/redstone.json new file mode 100644 index 00000000000..42cb0fd1ee4 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores/redstone.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:redstone_ores", + { + "id": "#forge:ores/redstone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores_in_ground/deepslate.json b/src/generated/resources/data/c/tags/items/ores_in_ground/deepslate.json new file mode 100644 index 00000000000..6b172a1533b --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores_in_ground/deepslate.json @@ -0,0 +1,16 @@ +{ + "values": [ + "minecraft:deepslate_coal_ore", + "minecraft:deepslate_copper_ore", + "minecraft:deepslate_diamond_ore", + "minecraft:deepslate_emerald_ore", + "minecraft:deepslate_gold_ore", + "minecraft:deepslate_iron_ore", + "minecraft:deepslate_lapis_ore", + "minecraft:deepslate_redstone_ore", + { + "id": "#forge:ores_in_ground/deepslate", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores_in_ground/netherrack.json b/src/generated/resources/data/c/tags/items/ores_in_ground/netherrack.json new file mode 100644 index 00000000000..83b110ef9e5 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores_in_ground/netherrack.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:nether_gold_ore", + "minecraft:nether_quartz_ore", + { + "id": "#forge:ores_in_ground/netherrack", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ores_in_ground/stone.json b/src/generated/resources/data/c/tags/items/ores_in_ground/stone.json new file mode 100644 index 00000000000..97b26721aeb --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ores_in_ground/stone.json @@ -0,0 +1,16 @@ +{ + "values": [ + "minecraft:coal_ore", + "minecraft:copper_ore", + "minecraft:diamond_ore", + "minecraft:emerald_ore", + "minecraft:gold_ore", + "minecraft:iron_ore", + "minecraft:lapis_ore", + "minecraft:redstone_ore", + { + "id": "#forge:ores_in_ground/stone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/player_workstations/crafting_tables.json b/src/generated/resources/data/c/tags/items/player_workstations/crafting_tables.json new file mode 100644 index 00000000000..3be1c8e22ed --- /dev/null +++ b/src/generated/resources/data/c/tags/items/player_workstations/crafting_tables.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:crafting_table" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/player_workstations/furnaces.json b/src/generated/resources/data/c/tags/items/player_workstations/furnaces.json new file mode 100644 index 00000000000..25edfef1ca6 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/player_workstations/furnaces.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:furnace" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/raw_blocks.json b/src/generated/resources/data/c/tags/items/raw_blocks.json new file mode 100644 index 00000000000..fef9f55fc6f --- /dev/null +++ b/src/generated/resources/data/c/tags/items/raw_blocks.json @@ -0,0 +1,7 @@ +{ + "values": [ + "#c:raw_blocks/copper", + "#c:raw_blocks/gold", + "#c:raw_blocks/iron" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_copper.json b/src/generated/resources/data/c/tags/items/raw_blocks/copper.json similarity index 100% rename from src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_copper.json rename to src/generated/resources/data/c/tags/items/raw_blocks/copper.json diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_gold.json b/src/generated/resources/data/c/tags/items/raw_blocks/gold.json similarity index 100% rename from src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_gold.json rename to src/generated/resources/data/c/tags/items/raw_blocks/gold.json diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_iron.json b/src/generated/resources/data/c/tags/items/raw_blocks/iron.json similarity index 100% rename from src/generated/resources/data/forge/tags/blocks/storage_blocks/raw_iron.json rename to src/generated/resources/data/c/tags/items/raw_blocks/iron.json diff --git a/src/generated/resources/data/c/tags/items/raw_materials.json b/src/generated/resources/data/c/tags/items/raw_materials.json new file mode 100644 index 00000000000..de258a264bb --- /dev/null +++ b/src/generated/resources/data/c/tags/items/raw_materials.json @@ -0,0 +1,11 @@ +{ + "values": [ + "#c:raw_materials/copper", + "#c:raw_materials/gold", + "#c:raw_materials/iron", + { + "id": "#forge:raw_materials", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/raw_materials/copper.json b/src/generated/resources/data/c/tags/items/raw_materials/copper.json new file mode 100644 index 00000000000..ce2a8c25b9c --- /dev/null +++ b/src/generated/resources/data/c/tags/items/raw_materials/copper.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:raw_copper", + { + "id": "#forge:raw_materials/copper", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/raw_materials/gold.json b/src/generated/resources/data/c/tags/items/raw_materials/gold.json new file mode 100644 index 00000000000..555e2873582 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/raw_materials/gold.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:raw_gold", + { + "id": "#forge:raw_materials/gold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/raw_materials/iron.json b/src/generated/resources/data/c/tags/items/raw_materials/iron.json new file mode 100644 index 00000000000..def08c1dacc --- /dev/null +++ b/src/generated/resources/data/c/tags/items/raw_materials/iron.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:raw_iron", + { + "id": "#forge:raw_materials/iron", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/rods.json b/src/generated/resources/data/c/tags/items/rods.json new file mode 100644 index 00000000000..4bf89f59ff8 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/rods.json @@ -0,0 +1,11 @@ +{ + "values": [ + "#c:rods/wooden", + "#c:rods/blaze", + "#c:rods/breeze", + { + "id": "#forge:rods", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/rods/blaze.json b/src/generated/resources/data/c/tags/items/rods/blaze.json new file mode 100644 index 00000000000..cda6278df87 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/rods/blaze.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:blaze_rod", + { + "id": "#forge:rods/blaze", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/rods/breeze.json b/src/generated/resources/data/c/tags/items/rods/breeze.json new file mode 100644 index 00000000000..8290ef56cf9 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/rods/breeze.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:breeze_rod" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/rods/wooden.json b/src/generated/resources/data/c/tags/items/rods/wooden.json new file mode 100644 index 00000000000..348d18d33d3 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/rods/wooden.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:stick", + { + "id": "#forge:rods/wooden", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/ropes.json b/src/generated/resources/data/c/tags/items/ropes.json new file mode 100644 index 00000000000..f72d209df78 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/ropes.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sands.json b/src/generated/resources/data/c/tags/items/sands.json new file mode 100644 index 00000000000..43eaac83ae7 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sands.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:sands/colorless", + "#c:sands/red", + { + "id": "#forge:sand", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sands/colorless.json b/src/generated/resources/data/c/tags/items/sands/colorless.json new file mode 100644 index 00000000000..93cdef191bc --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sands/colorless.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:sand", + { + "id": "#forge:sand/colorless", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sands/red.json b/src/generated/resources/data/c/tags/items/sands/red.json new file mode 100644 index 00000000000..03eba73b127 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sands/red.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:red_sand", + { + "id": "#forge:sand/red", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sandstone/blocks.json b/src/generated/resources/data/c/tags/items/sandstone/blocks.json new file mode 100644 index 00000000000..5684db6caf7 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sandstone/blocks.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:sandstone/red_blocks", + "#c:sandstone/uncolored_blocks", + { + "id": "#forge:sandstone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sandstone/red_blocks.json b/src/generated/resources/data/c/tags/items/sandstone/red_blocks.json new file mode 100644 index 00000000000..4e72ad44cdb --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sandstone/red_blocks.json @@ -0,0 +1,8 @@ +{ + "values": [ + "minecraft:red_sandstone", + "minecraft:cut_red_sandstone", + "minecraft:chiseled_red_sandstone", + "minecraft:smooth_red_sandstone" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sandstone/red_slabs.json b/src/generated/resources/data/c/tags/items/sandstone/red_slabs.json new file mode 100644 index 00000000000..a586c49087e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sandstone/red_slabs.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:red_sandstone_slab", + "minecraft:cut_red_sandstone_slab", + "minecraft:smooth_red_sandstone_slab" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sandstone/red_stairs.json b/src/generated/resources/data/c/tags/items/sandstone/red_stairs.json new file mode 100644 index 00000000000..8778d5dbbd2 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sandstone/red_stairs.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:red_sandstone_stairs", + "minecraft:smooth_red_sandstone_stairs" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sandstone/slabs.json b/src/generated/resources/data/c/tags/items/sandstone/slabs.json new file mode 100644 index 00000000000..92bc3f3ed94 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sandstone/slabs.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#c:sandstone/red_slabs", + "#c:sandstone/uncolored_slabs" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sandstone/stairs.json b/src/generated/resources/data/c/tags/items/sandstone/stairs.json new file mode 100644 index 00000000000..673f168ddf7 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sandstone/stairs.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#c:sandstone/red_stairs", + "#c:sandstone/uncolored_stairs" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sandstone/uncolored_blocks.json b/src/generated/resources/data/c/tags/items/sandstone/uncolored_blocks.json new file mode 100644 index 00000000000..4e32539b4e5 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sandstone/uncolored_blocks.json @@ -0,0 +1,8 @@ +{ + "values": [ + "minecraft:sandstone", + "minecraft:cut_sandstone", + "minecraft:chiseled_sandstone", + "minecraft:smooth_sandstone" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sandstone/uncolored_slabs.json b/src/generated/resources/data/c/tags/items/sandstone/uncolored_slabs.json new file mode 100644 index 00000000000..d830f1dc1ea --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sandstone/uncolored_slabs.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:sandstone_slab", + "minecraft:cut_sandstone_slab", + "minecraft:smooth_sandstone_slab" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/sandstone/uncolored_stairs.json b/src/generated/resources/data/c/tags/items/sandstone/uncolored_stairs.json new file mode 100644 index 00000000000..ddb4a27f874 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/sandstone/uncolored_stairs.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:sandstone_stairs", + "minecraft:smooth_sandstone_stairs" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/seeds.json b/src/generated/resources/data/c/tags/items/seeds.json new file mode 100644 index 00000000000..350c6d73838 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/seeds.json @@ -0,0 +1,12 @@ +{ + "values": [ + "#c:seeds/beetroot", + "#c:seeds/melon", + "#c:seeds/pumpkin", + "#c:seeds/wheat", + { + "id": "#forge:seeds", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/seeds/beetroot.json b/src/generated/resources/data/c/tags/items/seeds/beetroot.json new file mode 100644 index 00000000000..54ba42f3555 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/seeds/beetroot.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:beetroot_seeds", + { + "id": "#forge:seeds/beetroot", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/seeds/melon.json b/src/generated/resources/data/c/tags/items/seeds/melon.json new file mode 100644 index 00000000000..0def0ae263e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/seeds/melon.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:melon_seeds", + { + "id": "#forge:seeds/melon", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/seeds/pumpkin.json b/src/generated/resources/data/c/tags/items/seeds/pumpkin.json new file mode 100644 index 00000000000..d0ab847b4af --- /dev/null +++ b/src/generated/resources/data/c/tags/items/seeds/pumpkin.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:pumpkin_seeds", + { + "id": "#forge:seeds/pumpkin", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/seeds/wheat.json b/src/generated/resources/data/c/tags/items/seeds/wheat.json new file mode 100644 index 00000000000..68fdea41a21 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/seeds/wheat.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:wheat_seeds", + { + "id": "#forge:seeds/wheat", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/slimeballs.json b/src/generated/resources/data/c/tags/items/slimeballs.json new file mode 100644 index 00000000000..e81d459385b --- /dev/null +++ b/src/generated/resources/data/c/tags/items/slimeballs.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:slime_ball", + { + "id": "#forge:slimeballs", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/stones.json b/src/generated/resources/data/c/tags/items/stones.json new file mode 100644 index 00000000000..820387926d4 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/stones.json @@ -0,0 +1,14 @@ +{ + "values": [ + "minecraft:andesite", + "minecraft:diorite", + "minecraft:granite", + "minecraft:stone", + "minecraft:deepslate", + "minecraft:tuff", + { + "id": "#forge:stones", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks.json b/src/generated/resources/data/c/tags/items/storage_blocks.json new file mode 100644 index 00000000000..7bf4a38117d --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks.json @@ -0,0 +1,24 @@ +{ + "values": [ + "#c:storage_blocks/bone_meal", + "#c:storage_blocks/coal", + "#c:storage_blocks/copper", + "#c:storage_blocks/diamond", + "#c:storage_blocks/dried_kelp", + "#c:storage_blocks/emerald", + "#c:storage_blocks/gold", + "#c:storage_blocks/iron", + "#c:storage_blocks/lapis", + "#c:storage_blocks/netherite", + "#c:storage_blocks/raw_copper", + "#c:storage_blocks/raw_gold", + "#c:storage_blocks/raw_iron", + "#c:storage_blocks/redstone", + "#c:storage_blocks/slime", + "#c:storage_blocks/wheat", + { + "id": "#forge:storage_blocks", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/bone_meal.json b/src/generated/resources/data/c/tags/items/storage_blocks/bone_meal.json new file mode 100644 index 00000000000..98ab24a2133 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/bone_meal.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:bone_block" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/coal.json b/src/generated/resources/data/c/tags/items/storage_blocks/coal.json new file mode 100644 index 00000000000..b8479ced38e --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/coal.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:coal_block", + { + "id": "#forge:storage_blocks/coal", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/copper.json b/src/generated/resources/data/c/tags/items/storage_blocks/copper.json new file mode 100644 index 00000000000..acd2a6a7a48 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/copper.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:copper_block", + { + "id": "#forge:storage_blocks/copper", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/diamond.json b/src/generated/resources/data/c/tags/items/storage_blocks/diamond.json new file mode 100644 index 00000000000..76426ba425f --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/diamond.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:diamond_block", + { + "id": "#forge:storage_blocks/diamond", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/dried_kelp.json b/src/generated/resources/data/c/tags/items/storage_blocks/dried_kelp.json new file mode 100644 index 00000000000..26096564292 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/dried_kelp.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:dried_kelp_block" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/emerald.json b/src/generated/resources/data/c/tags/items/storage_blocks/emerald.json new file mode 100644 index 00000000000..7a41454d94d --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/emerald.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:emerald_block", + { + "id": "#forge:storage_blocks/emerald", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/gold.json b/src/generated/resources/data/c/tags/items/storage_blocks/gold.json new file mode 100644 index 00000000000..a4116fc77fd --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/gold.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:gold_block", + { + "id": "#forge:storage_blocks/gold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/iron.json b/src/generated/resources/data/c/tags/items/storage_blocks/iron.json new file mode 100644 index 00000000000..f0e9fcca1fe --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/iron.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:iron_block", + { + "id": "#forge:storage_blocks/iron", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/lapis.json b/src/generated/resources/data/c/tags/items/storage_blocks/lapis.json new file mode 100644 index 00000000000..b5f41d8d4e7 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/lapis.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:lapis_block", + { + "id": "#forge:storage_blocks/lapis", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/netherite.json b/src/generated/resources/data/c/tags/items/storage_blocks/netherite.json new file mode 100644 index 00000000000..a3dfe0d53c5 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/netherite.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:netherite_block", + { + "id": "#forge:storage_blocks/netherite", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/raw_copper.json b/src/generated/resources/data/c/tags/items/storage_blocks/raw_copper.json new file mode 100644 index 00000000000..8f12fb63a74 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/raw_copper.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:raw_copper_block", + { + "id": "#forge:storage_blocks/raw_copper", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/raw_gold.json b/src/generated/resources/data/c/tags/items/storage_blocks/raw_gold.json new file mode 100644 index 00000000000..dcee1e225b1 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/raw_gold.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:raw_gold_block", + { + "id": "#forge:storage_blocks/raw_gold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/raw_iron.json b/src/generated/resources/data/c/tags/items/storage_blocks/raw_iron.json new file mode 100644 index 00000000000..3f0ecf27ad1 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/raw_iron.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:raw_iron_block", + { + "id": "#forge:storage_blocks/raw_iron", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/redstone.json b/src/generated/resources/data/c/tags/items/storage_blocks/redstone.json new file mode 100644 index 00000000000..49fa7a5a26a --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/redstone.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:redstone_block", + { + "id": "#forge:storage_blocks/redstone", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/slime.json b/src/generated/resources/data/c/tags/items/storage_blocks/slime.json new file mode 100644 index 00000000000..523bdc28354 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/slime.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:slime_block" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/storage_blocks/wheat.json b/src/generated/resources/data/c/tags/items/storage_blocks/wheat.json new file mode 100644 index 00000000000..ea92d03cb4d --- /dev/null +++ b/src/generated/resources/data/c/tags/items/storage_blocks/wheat.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:hay_block" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/strings.json b/src/generated/resources/data/c/tags/items/strings.json new file mode 100644 index 00000000000..89b40c31c5b --- /dev/null +++ b/src/generated/resources/data/c/tags/items/strings.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:string", + { + "id": "#forge:strings", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/tools.json b/src/generated/resources/data/c/tags/items/tools.json new file mode 100644 index 00000000000..8b2c2aae5ea --- /dev/null +++ b/src/generated/resources/data/c/tags/items/tools.json @@ -0,0 +1,20 @@ +{ + "values": [ + "#minecraft:axes", + "#minecraft:hoes", + "#minecraft:pickaxes", + "#minecraft:shovels", + "#minecraft:swords", + "#c:tools/bows", + "#c:tools/brushes", + "#c:tools/crossbows", + "#c:tools/fishing_rods", + "#c:tools/shears", + "#c:tools/shields", + "#c:tools/spears", + { + "id": "#forge:tools", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/tools/bows.json b/src/generated/resources/data/c/tags/items/tools/bows.json new file mode 100644 index 00000000000..e46556b3d21 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/tools/bows.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:bow", + { + "id": "#forge:tools/bows", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/tools/brushes.json b/src/generated/resources/data/c/tags/items/tools/brushes.json new file mode 100644 index 00000000000..8b2fb219eac --- /dev/null +++ b/src/generated/resources/data/c/tags/items/tools/brushes.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:brush" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/tools/crossbows.json b/src/generated/resources/data/c/tags/items/tools/crossbows.json new file mode 100644 index 00000000000..d1e63bc5844 --- /dev/null +++ b/src/generated/resources/data/c/tags/items/tools/crossbows.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:crossbow", + { + "id": "#forge:tools/crossbows", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/tools/fishing_rods.json b/src/generated/resources/data/c/tags/items/tools/fishing_rods.json new file mode 100644 index 00000000000..efafba4845f --- /dev/null +++ b/src/generated/resources/data/c/tags/items/tools/fishing_rods.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:fishing_rod", + { + "id": "#forge:tools/fishing_rods", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/tools/shears.json b/src/generated/resources/data/c/tags/items/tools/shears.json new file mode 100644 index 00000000000..1c2ad36f72d --- /dev/null +++ b/src/generated/resources/data/c/tags/items/tools/shears.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:shears", + { + "id": "#forge:shears", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/tools/shields.json b/src/generated/resources/data/c/tags/items/tools/shields.json new file mode 100644 index 00000000000..f0b441428bf --- /dev/null +++ b/src/generated/resources/data/c/tags/items/tools/shields.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:shield", + { + "id": "#forge:tools/shields", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/tools/spears.json b/src/generated/resources/data/c/tags/items/tools/spears.json new file mode 100644 index 00000000000..c5b8b99af6d --- /dev/null +++ b/src/generated/resources/data/c/tags/items/tools/spears.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:trident", + { + "id": "#forge:tools/tridents", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/items/villager_job_sites.json b/src/generated/resources/data/c/tags/items/villager_job_sites.json new file mode 100644 index 00000000000..6f11b1676ad --- /dev/null +++ b/src/generated/resources/data/c/tags/items/villager_job_sites.json @@ -0,0 +1,17 @@ +{ + "values": [ + "minecraft:barrel", + "minecraft:blast_furnace", + "minecraft:brewing_stand", + "minecraft:cartography_table", + "minecraft:cauldron", + "minecraft:composter", + "minecraft:fletching_table", + "minecraft:grindstone", + "minecraft:lectern", + "minecraft:loom", + "minecraft:smithing_table", + "minecraft:smoker", + "minecraft:stonecutter" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/hidden_from_locator_selection.json b/src/generated/resources/data/c/tags/worldgen/biome/hidden_from_locator_selection.json new file mode 100644 index 00000000000..f72d209df78 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/hidden_from_locator_selection.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_aquatic.json b/src/generated/resources/data/c/tags/worldgen/biome/is_aquatic.json new file mode 100644 index 00000000000..77bf3cac1ae --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_aquatic.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:is_ocean", + "#c:is_river", + { + "id": "#forge:is_water", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_aquatic_icy.json b/src/generated/resources/data/c/tags/worldgen/biome/is_aquatic_icy.json new file mode 100644 index 00000000000..d7feec409a8 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_aquatic_icy.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:frozen_river", + "minecraft:deep_frozen_ocean", + "minecraft:frozen_ocean" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_badlands.json b/src/generated/resources/data/c/tags/worldgen/biome/is_badlands.json new file mode 100644 index 00000000000..161fcc28920 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_badlands.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:is_badlands" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_beach.json b/src/generated/resources/data/c/tags/worldgen/biome/is_beach.json new file mode 100644 index 00000000000..b15673e3d6f --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_beach.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:is_beach" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_birch_forest.json b/src/generated/resources/data/c/tags/worldgen/biome/is_birch_forest.json new file mode 100644 index 00000000000..1d080779b60 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_birch_forest.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:birch_forest", + "minecraft:old_growth_birch_forest" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_cave.json b/src/generated/resources/data/c/tags/worldgen/biome/is_cave.json new file mode 100644 index 00000000000..14acf097edf --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_cave.json @@ -0,0 +1,11 @@ +{ + "values": [ + "minecraft:lush_caves", + "minecraft:dripstone_caves", + "minecraft:deep_dark", + { + "id": "#forge:is_cave", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_cold.json b/src/generated/resources/data/c/tags/worldgen/biome/is_cold.json new file mode 100644 index 00000000000..5d5826f660d --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_cold.json @@ -0,0 +1,14 @@ +{ + "values": [ + "#c:is_cold/overworld", + { + "id": "#c:is_cold/nether", + "required": false + }, + "#c:is_cold/end", + { + "id": "#forge:is_cold", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_cold/end.json b/src/generated/resources/data/c/tags/worldgen/biome/is_cold/end.json new file mode 100644 index 00000000000..5598c65b7f7 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_cold/end.json @@ -0,0 +1,13 @@ +{ + "values": [ + "minecraft:the_end", + "minecraft:small_end_islands", + "minecraft:end_midlands", + "minecraft:end_highlands", + "minecraft:end_barrens", + { + "id": "#forge:is_cold/end", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_cold/nether.json b/src/generated/resources/data/c/tags/worldgen/biome/is_cold/nether.json new file mode 100644 index 00000000000..ba8ac392ff2 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_cold/nether.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:is_cold/nether", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_cold/overworld.json b/src/generated/resources/data/c/tags/worldgen/biome/is_cold/overworld.json new file mode 100644 index 00000000000..8151c7e4706 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_cold/overworld.json @@ -0,0 +1,23 @@ +{ + "values": [ + "minecraft:taiga", + "minecraft:old_growth_pine_taiga", + "minecraft:snowy_plains", + "minecraft:ice_spikes", + "minecraft:grove", + "minecraft:snowy_slopes", + "minecraft:jagged_peaks", + "minecraft:frozen_peaks", + "minecraft:snowy_beach", + "minecraft:snowy_taiga", + "minecraft:frozen_river", + "minecraft:cold_ocean", + "minecraft:frozen_ocean", + "minecraft:deep_cold_ocean", + "minecraft:deep_frozen_ocean", + { + "id": "#forge:is_cold/overworld", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_dead.json b/src/generated/resources/data/c/tags/worldgen/biome/is_dead.json new file mode 100644 index 00000000000..019f7a17c71 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_dead.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:is_dead", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_deep_ocean.json b/src/generated/resources/data/c/tags/worldgen/biome/is_deep_ocean.json new file mode 100644 index 00000000000..0fef9dd36a1 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_deep_ocean.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:is_deep_ocean" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation.json b/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation.json new file mode 100644 index 00000000000..761d530555f --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation.json @@ -0,0 +1,17 @@ +{ + "values": [ + "#c:is_dense_vegetation/overworld", + { + "id": "#c:is_dense_vegetation/nether", + "required": false + }, + { + "id": "#c:is_dense_vegetation/end", + "required": false + }, + { + "id": "#forge:is_dense", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/end.json b/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/end.json new file mode 100644 index 00000000000..644b5739654 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/end.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:is_dense/end", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/nether.json b/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/nether.json new file mode 100644 index 00000000000..732488f87ae --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/nether.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:is_dense/nether", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/overworld.json b/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/overworld.json new file mode 100644 index 00000000000..5518ef9ccb3 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_dense_vegetation/overworld.json @@ -0,0 +1,12 @@ +{ + "values": [ + "minecraft:dark_forest", + "minecraft:old_growth_birch_forest", + "minecraft:old_growth_spruce_taiga", + "minecraft:jungle", + { + "id": "#forge:is_dense/overworld", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_desert.json b/src/generated/resources/data/c/tags/worldgen/biome/is_desert.json new file mode 100644 index 00000000000..7f6b11f3b43 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_desert.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:desert", + { + "id": "#forge:is_desert", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_dry.json b/src/generated/resources/data/c/tags/worldgen/biome/is_dry.json new file mode 100644 index 00000000000..d1e491ae50b --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_dry.json @@ -0,0 +1,11 @@ +{ + "values": [ + "#c:is_dry/overworld", + "#c:is_dry/nether", + "#c:is_dry/end", + { + "id": "#forge:is_dry", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_dry/end.json b/src/generated/resources/data/c/tags/worldgen/biome/is_dry/end.json new file mode 100644 index 00000000000..ce1b28ee591 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_dry/end.json @@ -0,0 +1,13 @@ +{ + "values": [ + "minecraft:the_end", + "minecraft:small_end_islands", + "minecraft:end_midlands", + "minecraft:end_highlands", + "minecraft:end_barrens", + { + "id": "#forge:is_dry/end", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_dry/nether.json b/src/generated/resources/data/c/tags/worldgen/biome/is_dry/nether.json new file mode 100644 index 00000000000..c490dcb1afc --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_dry/nether.json @@ -0,0 +1,13 @@ +{ + "values": [ + "minecraft:nether_wastes", + "minecraft:crimson_forest", + "minecraft:warped_forest", + "minecraft:soul_sand_valley", + "minecraft:basalt_deltas", + { + "id": "#forge:is_dry/nether", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_dry/overworld.json b/src/generated/resources/data/c/tags/worldgen/biome/is_dry/overworld.json new file mode 100644 index 00000000000..66049f89289 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_dry/overworld.json @@ -0,0 +1,15 @@ +{ + "values": [ + "minecraft:desert", + "minecraft:badlands", + "minecraft:wooded_badlands", + "minecraft:eroded_badlands", + "minecraft:savanna", + "minecraft:savanna_plateau", + "minecraft:windswept_savanna", + { + "id": "#forge:is_dry/overworld", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_end.json b/src/generated/resources/data/c/tags/worldgen/biome/is_end.json new file mode 100644 index 00000000000..2e43e7a97ba --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_end.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:is_end", + { + "id": "#forge:is_end", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_floral.json b/src/generated/resources/data/c/tags/worldgen/biome/is_floral.json new file mode 100644 index 00000000000..32cfdbacc28 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_floral.json @@ -0,0 +1,12 @@ +{ + "values": [ + "#c:is_flower_forest", + "minecraft:sunflower_plains", + "minecraft:cherry_grove", + "minecraft:meadow", + { + "id": "#forge:is_floral", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_flower_forest.json b/src/generated/resources/data/c/tags/worldgen/biome/is_flower_forest.json new file mode 100644 index 00000000000..8edd5b8da3e --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_flower_forest.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:flower_forest" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_forest.json b/src/generated/resources/data/c/tags/worldgen/biome/is_forest.json new file mode 100644 index 00000000000..68e29235c8f --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_forest.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:is_forest" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_hill.json b/src/generated/resources/data/c/tags/worldgen/biome/is_hill.json new file mode 100644 index 00000000000..b788d9c5697 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_hill.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:is_hill" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_hot.json b/src/generated/resources/data/c/tags/worldgen/biome/is_hot.json new file mode 100644 index 00000000000..aa9e1588679 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_hot.json @@ -0,0 +1,14 @@ +{ + "values": [ + "#c:is_hot/overworld", + "#c:is_hot/nether", + { + "id": "#c:is_hot/end", + "required": false + }, + { + "id": "#forge:is_hot", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_hot/end.json b/src/generated/resources/data/c/tags/worldgen/biome/is_hot/end.json new file mode 100644 index 00000000000..384c64e8239 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_hot/end.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:is_hot/end", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_hot/nether.json b/src/generated/resources/data/c/tags/worldgen/biome/is_hot/nether.json new file mode 100644 index 00000000000..48cf5e7bec1 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_hot/nether.json @@ -0,0 +1,13 @@ +{ + "values": [ + "minecraft:nether_wastes", + "minecraft:crimson_forest", + "minecraft:warped_forest", + "minecraft:soul_sand_valley", + "minecraft:basalt_deltas", + { + "id": "#forge:is_hot/nether", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_hot/overworld.json b/src/generated/resources/data/c/tags/worldgen/biome/is_hot/overworld.json new file mode 100644 index 00000000000..7cb35fa14a9 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_hot/overworld.json @@ -0,0 +1,20 @@ +{ + "values": [ + "minecraft:swamp", + "minecraft:mangrove_swamp", + "minecraft:jungle", + "minecraft:bamboo_jungle", + "minecraft:sparse_jungle", + "minecraft:desert", + "minecraft:eroded_badlands", + "minecraft:savanna", + "minecraft:savanna_plateau", + "minecraft:windswept_savanna", + "minecraft:stony_peaks", + "minecraft:warm_ocean", + { + "id": "#forge:is_hot/overworld", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_icy.json b/src/generated/resources/data/c/tags/worldgen/biome/is_icy.json new file mode 100644 index 00000000000..46ba2aa139b --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_icy.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:ice_spikes", + "minecraft:frozen_peaks" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_jungle.json b/src/generated/resources/data/c/tags/worldgen/biome/is_jungle.json new file mode 100644 index 00000000000..c1d3c371fea --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_jungle.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:is_jungle" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_lush.json b/src/generated/resources/data/c/tags/worldgen/biome/is_lush.json new file mode 100644 index 00000000000..6d69742b221 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_lush.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:lush_caves", + { + "id": "#forge:is_lush", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_magical.json b/src/generated/resources/data/c/tags/worldgen/biome/is_magical.json new file mode 100644 index 00000000000..790536a079b --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_magical.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:is_magical", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_modified.json b/src/generated/resources/data/c/tags/worldgen/biome/is_modified.json new file mode 100644 index 00000000000..ce7e347ab6b --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_modified.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:is_modified", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_mountain.json b/src/generated/resources/data/c/tags/worldgen/biome/is_mountain.json new file mode 100644 index 00000000000..0ad5197c186 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_mountain.json @@ -0,0 +1,11 @@ +{ + "values": [ + "#minecraft:is_mountain", + "#c:is_mountain/peak", + "#c:is_mountain/slope", + { + "id": "#forge:is_mountain", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_mountain/peak.json b/src/generated/resources/data/c/tags/worldgen/biome/is_mountain/peak.json new file mode 100644 index 00000000000..60454a4666e --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_mountain/peak.json @@ -0,0 +1,11 @@ +{ + "values": [ + "minecraft:jagged_peaks", + "minecraft:frozen_peaks", + "minecraft:stony_peaks", + { + "id": "#forge:is_peak", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_mountain/slope.json b/src/generated/resources/data/c/tags/worldgen/biome/is_mountain/slope.json new file mode 100644 index 00000000000..b5347839575 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_mountain/slope.json @@ -0,0 +1,12 @@ +{ + "values": [ + "minecraft:snowy_slopes", + "minecraft:meadow", + "minecraft:grove", + "minecraft:cherry_grove", + { + "id": "#forge:is_slope", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_mushroom.json b/src/generated/resources/data/c/tags/worldgen/biome/is_mushroom.json new file mode 100644 index 00000000000..e83f4e0c452 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_mushroom.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:mushroom_fields", + { + "id": "#forge:is_mushroom", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_nether.json b/src/generated/resources/data/c/tags/worldgen/biome/is_nether.json new file mode 100644 index 00000000000..8775f39f6f5 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_nether.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:is_nether", + { + "id": "#forge:is_nether", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_nether_forest.json b/src/generated/resources/data/c/tags/worldgen/biome/is_nether_forest.json new file mode 100644 index 00000000000..d79f240db46 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_nether_forest.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:crimson_forest", + "minecraft:warped_forest" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_ocean.json b/src/generated/resources/data/c/tags/worldgen/biome/is_ocean.json new file mode 100644 index 00000000000..f608497e793 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_ocean.json @@ -0,0 +1,7 @@ +{ + "values": [ + "#minecraft:is_ocean", + "#c:is_shallow_ocean", + "#c:is_deep_ocean" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_old_growth.json b/src/generated/resources/data/c/tags/worldgen/biome/is_old_growth.json new file mode 100644 index 00000000000..412f42f3e5f --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_old_growth.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:old_growth_birch_forest", + "minecraft:old_growth_pine_taiga", + "minecraft:old_growth_spruce_taiga" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_outer_end_island.json b/src/generated/resources/data/c/tags/worldgen/biome/is_outer_end_island.json new file mode 100644 index 00000000000..66a8dff71a8 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_outer_end_island.json @@ -0,0 +1,7 @@ +{ + "values": [ + "minecraft:end_highlands", + "minecraft:end_midlands", + "minecraft:end_barrens" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_overworld.json b/src/generated/resources/data/c/tags/worldgen/biome/is_overworld.json new file mode 100644 index 00000000000..e1bd80c7544 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_overworld.json @@ -0,0 +1,9 @@ +{ + "values": [ + "#minecraft:is_overworld", + { + "id": "#forge:is_overworld", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_plains.json b/src/generated/resources/data/c/tags/worldgen/biome/is_plains.json new file mode 100644 index 00000000000..4e23e1e56f1 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_plains.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:plains", + "minecraft:sunflower_plains", + { + "id": "#forge:is_plains", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_plateau.json b/src/generated/resources/data/c/tags/worldgen/biome/is_plateau.json new file mode 100644 index 00000000000..c7120844786 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_plateau.json @@ -0,0 +1,12 @@ +{ + "values": [ + "minecraft:wooded_badlands", + "minecraft:savanna_plateau", + "minecraft:cherry_grove", + "minecraft:meadow", + { + "id": "#forge:is_plateau", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_rare.json b/src/generated/resources/data/c/tags/worldgen/biome/is_rare.json similarity index 82% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_rare.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_rare.json index 490abd43924..4520d941acf 100644 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_rare.json +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_rare.json @@ -1,17 +1,21 @@ { "values": [ - "minecraft:mushroom_fields", - "minecraft:sparse_jungle", - "minecraft:savanna_plateau", "minecraft:sunflower_plains", - "minecraft:windswept_gravelly_hills", "minecraft:flower_forest", - "minecraft:ice_spikes", "minecraft:old_growth_birch_forest", "minecraft:old_growth_spruce_taiga", - "minecraft:windswept_savanna", - "minecraft:eroded_badlands", "minecraft:bamboo_jungle", - "minecraft:deep_dark" + "minecraft:sparse_jungle", + "minecraft:eroded_badlands", + "minecraft:savanna_plateau", + "minecraft:windswept_savanna", + "minecraft:ice_spikes", + "minecraft:windswept_gravelly_hills", + "minecraft:mushroom_fields", + "minecraft:deep_dark", + { + "id": "#forge:is_rare", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_river.json b/src/generated/resources/data/c/tags/worldgen/biome/is_river.json new file mode 100644 index 00000000000..c5435e253ce --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_river.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:is_river" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_sandy.json b/src/generated/resources/data/c/tags/worldgen/biome/is_sandy.json new file mode 100644 index 00000000000..5fad39f73bf --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_sandy.json @@ -0,0 +1,13 @@ +{ + "values": [ + "minecraft:desert", + "minecraft:badlands", + "minecraft:wooded_badlands", + "minecraft:eroded_badlands", + "minecraft:beach", + { + "id": "#forge:is_sandy", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_savanna.json b/src/generated/resources/data/c/tags/worldgen/biome/is_savanna.json new file mode 100644 index 00000000000..966de075ced --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_savanna.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:is_savanna" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_shallow_ocean.json b/src/generated/resources/data/c/tags/worldgen/biome/is_shallow_ocean.json new file mode 100644 index 00000000000..858efda8f15 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_shallow_ocean.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:ocean", + "minecraft:lukewarm_ocean", + "minecraft:warm_ocean", + "minecraft:cold_ocean", + "minecraft:frozen_ocean" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_snowy.json b/src/generated/resources/data/c/tags/worldgen/biome/is_snowy.json new file mode 100644 index 00000000000..8d5168ef6ce --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_snowy.json @@ -0,0 +1,16 @@ +{ + "values": [ + "minecraft:snowy_beach", + "minecraft:snowy_plains", + "minecraft:ice_spikes", + "minecraft:snowy_taiga", + "minecraft:grove", + "minecraft:snowy_slopes", + "minecraft:jagged_peaks", + "minecraft:frozen_peaks", + { + "id": "#forge:is_snowy", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_wasteland.json b/src/generated/resources/data/c/tags/worldgen/biome/is_snowy_plains.json similarity index 100% rename from src/generated/resources/data/forge/tags/worldgen/biome/is_wasteland.json rename to src/generated/resources/data/c/tags/worldgen/biome/is_snowy_plains.json diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation.json b/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation.json new file mode 100644 index 00000000000..f2ce1c179f8 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation.json @@ -0,0 +1,21 @@ +{ + "values": [ + "#c:is_sparse_vegetation/overworld", + { + "id": "#c:is_sparse_vegetation/nether", + "required": false + }, + { + "id": "#c:is_sparse_vegetation/end", + "required": false + }, + { + "id": "#forge:is_sparse_vegetation", + "required": false + }, + { + "id": "#forge:is_sparse", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/end.json b/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/end.json new file mode 100644 index 00000000000..93863ce9c16 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/end.json @@ -0,0 +1,12 @@ +{ + "values": [ + { + "id": "#forge:is_sparse_vegetation/end", + "required": false + }, + { + "id": "#forge:is_sparse/end", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/nether.json b/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/nether.json new file mode 100644 index 00000000000..70f6d7a9a00 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/nether.json @@ -0,0 +1,12 @@ +{ + "values": [ + { + "id": "#forge:is_sparse_vegetation/nether", + "required": false + }, + { + "id": "#forge:is_sparse/nether", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/overworld.json b/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/overworld.json new file mode 100644 index 00000000000..2505597fdec --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_sparse_vegetation/overworld.json @@ -0,0 +1,23 @@ +{ + "values": [ + "minecraft:wooded_badlands", + "minecraft:eroded_badlands", + "minecraft:savanna", + "minecraft:savanna_plateau", + "minecraft:windswept_savanna", + "minecraft:windswept_forest", + "minecraft:windswept_hills", + "minecraft:windswept_gravelly_hills", + "minecraft:snowy_slopes", + "minecraft:jagged_peaks", + "minecraft:frozen_peaks", + { + "id": "#forge:is_sparse_vegetation/overworld", + "required": false + }, + { + "id": "#forge:is_sparse/overworld", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_spooky.json b/src/generated/resources/data/c/tags/worldgen/biome/is_spooky.json new file mode 100644 index 00000000000..61d4740d420 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_spooky.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:dark_forest", + "minecraft:deep_dark", + { + "id": "#forge:is_spooky", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_stony_shores.json b/src/generated/resources/data/c/tags/worldgen/biome/is_stony_shores.json new file mode 100644 index 00000000000..a6db46faf44 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_stony_shores.json @@ -0,0 +1,5 @@ +{ + "values": [ + "minecraft:stony_shore" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_swamp.json b/src/generated/resources/data/c/tags/worldgen/biome/is_swamp.json new file mode 100644 index 00000000000..7f7d1c742b7 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_swamp.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:swamp", + "minecraft:mangrove_swamp", + { + "id": "#forge:is_swamp", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_taiga.json b/src/generated/resources/data/c/tags/worldgen/biome/is_taiga.json new file mode 100644 index 00000000000..1c6ed957184 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_taiga.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:is_taiga" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_tree/coniferous.json b/src/generated/resources/data/c/tags/worldgen/biome/is_tree/coniferous.json new file mode 100644 index 00000000000..62d147cff9e --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_tree/coniferous.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#c:is_taiga", + "minecraft:grove", + { + "id": "#forge:is_tree/coniferous", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_tree/deciduous.json b/src/generated/resources/data/c/tags/worldgen/biome/is_tree/deciduous.json new file mode 100644 index 00000000000..0db7a3e9b66 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_tree/deciduous.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:forest", + "minecraft:flower_forest", + "minecraft:birch_forest", + "minecraft:dark_forest", + "minecraft:old_growth_birch_forest", + "minecraft:windswept_forest" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_tree/jungle.json b/src/generated/resources/data/c/tags/worldgen/biome/is_tree/jungle.json new file mode 100644 index 00000000000..e9d457c5e7f --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_tree/jungle.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#c:is_jungle" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_tree/savanna.json b/src/generated/resources/data/c/tags/worldgen/biome/is_tree/savanna.json new file mode 100644 index 00000000000..3338b8b1ddc --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_tree/savanna.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#c:is_savanna" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_underground.json b/src/generated/resources/data/c/tags/worldgen/biome/is_underground.json new file mode 100644 index 00000000000..4d7c1ff442e --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_underground.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#c:is_cave" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_void.json b/src/generated/resources/data/c/tags/worldgen/biome/is_void.json new file mode 100644 index 00000000000..f6048857ff5 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_void.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:the_void", + { + "id": "#forge:is_void", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_wasteland.json b/src/generated/resources/data/c/tags/worldgen/biome/is_wasteland.json new file mode 100644 index 00000000000..6d11db61bc3 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_wasteland.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:is_wasteland", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_wet.json b/src/generated/resources/data/c/tags/worldgen/biome/is_wet.json new file mode 100644 index 00000000000..5903fbb204d --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_wet.json @@ -0,0 +1,17 @@ +{ + "values": [ + "#c:is_wet/overworld", + { + "id": "#c:is_wet/nether", + "required": false + }, + { + "id": "#c:is_wet/end", + "required": false + }, + { + "id": "#forge:is_wet", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_wet/end.json b/src/generated/resources/data/c/tags/worldgen/biome/is_wet/end.json new file mode 100644 index 00000000000..6f6b6d1480b --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_wet/end.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:is_wet/end", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_wet/nether.json b/src/generated/resources/data/c/tags/worldgen/biome/is_wet/nether.json new file mode 100644 index 00000000000..90601e0731c --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_wet/nether.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:is_wet/nether", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_wet/overworld.json b/src/generated/resources/data/c/tags/worldgen/biome/is_wet/overworld.json new file mode 100644 index 00000000000..6bb610406d9 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_wet/overworld.json @@ -0,0 +1,16 @@ +{ + "values": [ + "minecraft:swamp", + "minecraft:mangrove_swamp", + "minecraft:jungle", + "minecraft:bamboo_jungle", + "minecraft:sparse_jungle", + "minecraft:beach", + "minecraft:lush_caves", + "minecraft:dripstone_caves", + { + "id": "#forge:is_wet/overworld", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/is_windswept.json b/src/generated/resources/data/c/tags/worldgen/biome/is_windswept.json new file mode 100644 index 00000000000..8ee28b84091 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/is_windswept.json @@ -0,0 +1,8 @@ +{ + "values": [ + "minecraft:windswept_hills", + "minecraft:windswept_gravelly_hills", + "minecraft:windswept_forest", + "minecraft:windswept_savanna" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/biome/no_default_monsters.json b/src/generated/resources/data/c/tags/worldgen/biome/no_default_monsters.json new file mode 100644 index 00000000000..2496ccf1e9e --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/biome/no_default_monsters.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:mushroom_fields", + "minecraft:deep_dark" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/structure/hidden_from_displayers.json b/src/generated/resources/data/c/tags/worldgen/structure/hidden_from_displayers.json new file mode 100644 index 00000000000..f72d209df78 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/structure/hidden_from_displayers.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/worldgen/structure/hidden_from_locator_selection.json b/src/generated/resources/data/c/tags/worldgen/structure/hidden_from_locator_selection.json new file mode 100644 index 00000000000..f72d209df78 --- /dev/null +++ b/src/generated/resources/data/c/tags/worldgen/structure/hidden_from_locator_selection.json @@ -0,0 +1,3 @@ +{ + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/barrels.json b/src/generated/resources/data/forge/tags/blocks/barrels.json deleted file mode 100644 index 1cfb5782c57..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/barrels.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#forge:barrels/wooden" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/barrels/wooden.json b/src/generated/resources/data/forge/tags/blocks/barrels/wooden.json deleted file mode 100644 index b07daae1c09..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/barrels/wooden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:barrel" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/bookshelves.json b/src/generated/resources/data/forge/tags/blocks/bookshelves.json deleted file mode 100644 index c09b2185bd1..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/bookshelves.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:bookshelf" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/chests.json b/src/generated/resources/data/forge/tags/blocks/chests.json deleted file mode 100644 index 9afff2b15ab..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/chests.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:chests/ender", - "#forge:chests/trapped", - "#forge:chests/wooden" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/chests/ender.json b/src/generated/resources/data/forge/tags/blocks/chests/ender.json deleted file mode 100644 index 8c0af53136f..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/chests/ender.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:ender_chest" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/chests/trapped.json b/src/generated/resources/data/forge/tags/blocks/chests/trapped.json deleted file mode 100644 index f8924f5a051..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/chests/trapped.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:trapped_chest" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/chests/wooden.json b/src/generated/resources/data/forge/tags/blocks/chests/wooden.json deleted file mode 100644 index 86533f935bf..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/chests/wooden.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:chest", - "minecraft:trapped_chest" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/cobblestone.json b/src/generated/resources/data/forge/tags/blocks/cobblestone.json deleted file mode 100644 index f0ae95b5fcc..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/cobblestone.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "#forge:cobblestone/normal", - "#forge:cobblestone/infested", - "#forge:cobblestone/mossy", - "#forge:cobblestone/deepslate" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/cobblestone/deepslate.json b/src/generated/resources/data/forge/tags/blocks/cobblestone/deepslate.json deleted file mode 100644 index 75f1ba31f44..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/cobblestone/deepslate.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cobbled_deepslate" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/cobblestone/infested.json b/src/generated/resources/data/forge/tags/blocks/cobblestone/infested.json deleted file mode 100644 index a1d276601e6..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/cobblestone/infested.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:infested_cobblestone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/cobblestone/mossy.json b/src/generated/resources/data/forge/tags/blocks/cobblestone/mossy.json deleted file mode 100644 index c32be6c962c..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/cobblestone/mossy.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:mossy_cobblestone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/cobblestone/normal.json b/src/generated/resources/data/forge/tags/blocks/cobblestone/normal.json deleted file mode 100644 index dac674da5d4..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/cobblestone/normal.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cobblestone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/end_stones.json b/src/generated/resources/data/forge/tags/blocks/end_stones.json deleted file mode 100644 index f2d11375bce..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/end_stones.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:end_stone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/fence_gates.json b/src/generated/resources/data/forge/tags/blocks/fence_gates.json deleted file mode 100644 index b9a57ac0ef2..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/fence_gates.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#forge:fence_gates/wooden" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/fence_gates/wooden.json b/src/generated/resources/data/forge/tags/blocks/fence_gates/wooden.json deleted file mode 100644 index 88a130fa504..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/fence_gates/wooden.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "values": [ - "minecraft:oak_fence_gate", - "minecraft:spruce_fence_gate", - "minecraft:birch_fence_gate", - "minecraft:jungle_fence_gate", - "minecraft:acacia_fence_gate", - "minecraft:dark_oak_fence_gate", - "minecraft:crimson_fence_gate", - "minecraft:warped_fence_gate", - "minecraft:mangrove_fence_gate", - "minecraft:bamboo_fence_gate", - "minecraft:cherry_fence_gate" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/fences.json b/src/generated/resources/data/forge/tags/blocks/fences.json deleted file mode 100644 index 44358edb048..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/fences.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:fences/nether_brick", - "#forge:fences/wooden" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/fences/nether_brick.json b/src/generated/resources/data/forge/tags/blocks/fences/nether_brick.json deleted file mode 100644 index 3f1aacfa7ef..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/fences/nether_brick.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_brick_fence" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/fences/wooden.json b/src/generated/resources/data/forge/tags/blocks/fences/wooden.json deleted file mode 100644 index 81202621144..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/fences/wooden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:wooden_fences" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass.json b/src/generated/resources/data/forge/tags/blocks/glass.json deleted file mode 100644 index fec31169ee1..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:glass/colorless", - "#forge:stained_glass", - "#forge:glass/tinted" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/black.json b/src/generated/resources/data/forge/tags/blocks/glass/black.json deleted file mode 100644 index 9965b5e8b4b..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/black.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:black_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/blue.json b/src/generated/resources/data/forge/tags/blocks/glass/blue.json deleted file mode 100644 index f59e58c6bf7..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:blue_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/brown.json b/src/generated/resources/data/forge/tags/blocks/glass/brown.json deleted file mode 100644 index 490015cbb51..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/brown.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:brown_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/colorless.json b/src/generated/resources/data/forge/tags/blocks/glass/colorless.json deleted file mode 100644 index ac8b5e50863..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/colorless.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/cyan.json b/src/generated/resources/data/forge/tags/blocks/glass/cyan.json deleted file mode 100644 index 24d84747fa8..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/cyan.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cyan_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/gray.json b/src/generated/resources/data/forge/tags/blocks/glass/gray.json deleted file mode 100644 index 2f309170cab..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gray_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/green.json b/src/generated/resources/data/forge/tags/blocks/glass/green.json deleted file mode 100644 index d7946c1aca9..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/green.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:green_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/light_blue.json b/src/generated/resources/data/forge/tags/blocks/glass/light_blue.json deleted file mode 100644 index dc8e6b71485..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/light_blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_blue_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/light_gray.json b/src/generated/resources/data/forge/tags/blocks/glass/light_gray.json deleted file mode 100644 index f165a46c904..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/light_gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_gray_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/lime.json b/src/generated/resources/data/forge/tags/blocks/glass/lime.json deleted file mode 100644 index b6bb1d9415e..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/lime.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lime_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/magenta.json b/src/generated/resources/data/forge/tags/blocks/glass/magenta.json deleted file mode 100644 index aa6a4825e82..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/magenta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:magenta_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/orange.json b/src/generated/resources/data/forge/tags/blocks/glass/orange.json deleted file mode 100644 index 9322f51fe4d..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/orange.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:orange_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/pink.json b/src/generated/resources/data/forge/tags/blocks/glass/pink.json deleted file mode 100644 index 58b65891fc5..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/pink.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:pink_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/purple.json b/src/generated/resources/data/forge/tags/blocks/glass/purple.json deleted file mode 100644 index d75a9e7308f..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/purple.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:purple_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/red.json b/src/generated/resources/data/forge/tags/blocks/glass/red.json deleted file mode 100644 index 72af78c0294..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/red.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:red_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/silica.json b/src/generated/resources/data/forge/tags/blocks/glass/silica.json deleted file mode 100644 index 74544c770db..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/silica.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "values": [ - "minecraft:glass", - "minecraft:black_stained_glass", - "minecraft:blue_stained_glass", - "minecraft:brown_stained_glass", - "minecraft:cyan_stained_glass", - "minecraft:gray_stained_glass", - "minecraft:green_stained_glass", - "minecraft:light_blue_stained_glass", - "minecraft:light_gray_stained_glass", - "minecraft:lime_stained_glass", - "minecraft:magenta_stained_glass", - "minecraft:orange_stained_glass", - "minecraft:pink_stained_glass", - "minecraft:purple_stained_glass", - "minecraft:red_stained_glass", - "minecraft:white_stained_glass", - "minecraft:yellow_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/tinted.json b/src/generated/resources/data/forge/tags/blocks/glass/tinted.json deleted file mode 100644 index 4075a1556b3..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/tinted.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:tinted_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/white.json b/src/generated/resources/data/forge/tags/blocks/glass/white.json deleted file mode 100644 index fb180e703e4..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/white.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass/yellow.json b/src/generated/resources/data/forge/tags/blocks/glass/yellow.json deleted file mode 100644 index 0831bea4cca..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass/yellow.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:yellow_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes.json b/src/generated/resources/data/forge/tags/blocks/glass_panes.json deleted file mode 100644 index 4b95330d4f5..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:glass_panes/colorless", - "#forge:stained_glass_panes" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/black.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/black.json deleted file mode 100644 index ebda555dcd4..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/black.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:black_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/blue.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/blue.json deleted file mode 100644 index 2762890aa90..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:blue_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/brown.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/brown.json deleted file mode 100644 index 0b5b7274916..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/brown.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:brown_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/colorless.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/colorless.json deleted file mode 100644 index eb5756f9643..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/colorless.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/cyan.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/cyan.json deleted file mode 100644 index 9913e90a964..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/cyan.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cyan_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/gray.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/gray.json deleted file mode 100644 index 9fe30b26a89..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gray_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/green.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/green.json deleted file mode 100644 index ab913210286..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/green.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:green_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/light_blue.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/light_blue.json deleted file mode 100644 index cd6d399022d..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/light_blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_blue_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/light_gray.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/light_gray.json deleted file mode 100644 index 7be6a4ce81d..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/light_gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_gray_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/lime.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/lime.json deleted file mode 100644 index 46dec64b22e..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/lime.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lime_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/magenta.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/magenta.json deleted file mode 100644 index 7504bc3fa37..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/magenta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:magenta_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/orange.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/orange.json deleted file mode 100644 index 1c47e346166..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/orange.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:orange_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/pink.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/pink.json deleted file mode 100644 index 28e36b973f6..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/pink.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:pink_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/purple.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/purple.json deleted file mode 100644 index a3cff33a142..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/purple.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:purple_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/red.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/red.json deleted file mode 100644 index 5edd855d716..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/red.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:red_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/white.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/white.json deleted file mode 100644 index b514a2839f8..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/white.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/glass_panes/yellow.json b/src/generated/resources/data/forge/tags/blocks/glass_panes/yellow.json deleted file mode 100644 index a293eb9dc88..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/glass_panes/yellow.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:yellow_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/gravel.json b/src/generated/resources/data/forge/tags/blocks/gravel.json deleted file mode 100644 index f6968bff68a..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/gravel.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gravel" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/netherrack.json b/src/generated/resources/data/forge/tags/blocks/netherrack.json deleted file mode 100644 index daa9c66701a..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/netherrack.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:netherrack" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/obsidian.json b/src/generated/resources/data/forge/tags/blocks/obsidian.json deleted file mode 100644 index 170248454b1..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/obsidian.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:obsidian" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/deepslate.json b/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/deepslate.json deleted file mode 100644 index 0012c241a31..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/deepslate.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:deepslate" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/netherrack.json b/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/netherrack.json deleted file mode 100644 index daa9c66701a..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/netherrack.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:netherrack" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/stone.json b/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/stone.json deleted file mode 100644 index c2d7c79f3e7..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ore_bearing_ground/stone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:stone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ore_rates/dense.json b/src/generated/resources/data/forge/tags/blocks/ore_rates/dense.json deleted file mode 100644 index 69cfa783438..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ore_rates/dense.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "minecraft:copper_ore", - "minecraft:deepslate_copper_ore", - "minecraft:deepslate_lapis_ore", - "minecraft:deepslate_redstone_ore", - "minecraft:lapis_ore", - "minecraft:redstone_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ore_rates/singular.json b/src/generated/resources/data/forge/tags/blocks/ore_rates/singular.json deleted file mode 100644 index 79e0f4b9a7c..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ore_rates/singular.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "values": [ - "minecraft:ancient_debris", - "minecraft:coal_ore", - "minecraft:deepslate_coal_ore", - "minecraft:deepslate_diamond_ore", - "minecraft:deepslate_emerald_ore", - "minecraft:deepslate_gold_ore", - "minecraft:deepslate_iron_ore", - "minecraft:diamond_ore", - "minecraft:emerald_ore", - "minecraft:gold_ore", - "minecraft:iron_ore", - "minecraft:nether_quartz_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ore_rates/sparse.json b/src/generated/resources/data/forge/tags/blocks/ore_rates/sparse.json deleted file mode 100644 index 3caf9ffe44e..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ore_rates/sparse.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_gold_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores.json b/src/generated/resources/data/forge/tags/blocks/ores.json deleted file mode 100644 index 2c4beabc55b..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "values": [ - "#forge:ores/coal", - "#forge:ores/copper", - "#forge:ores/diamond", - "#forge:ores/emerald", - "#forge:ores/gold", - "#forge:ores/iron", - "#forge:ores/lapis", - "#forge:ores/redstone", - "#forge:ores/quartz", - "#forge:ores/netherite_scrap" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/coal.json b/src/generated/resources/data/forge/tags/blocks/ores/coal.json deleted file mode 100644 index c1246af5163..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/coal.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:coal_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/copper.json b/src/generated/resources/data/forge/tags/blocks/ores/copper.json deleted file mode 100644 index bfa31f2aed5..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:copper_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/diamond.json b/src/generated/resources/data/forge/tags/blocks/ores/diamond.json deleted file mode 100644 index e0fe2e9d0ff..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/diamond.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:diamond_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/emerald.json b/src/generated/resources/data/forge/tags/blocks/ores/emerald.json deleted file mode 100644 index fe8bed587cd..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/emerald.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:emerald_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/gold.json b/src/generated/resources/data/forge/tags/blocks/ores/gold.json deleted file mode 100644 index 52f7c26ba19..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:gold_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/iron.json b/src/generated/resources/data/forge/tags/blocks/ores/iron.json deleted file mode 100644 index 9b135890e97..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:iron_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/lapis.json b/src/generated/resources/data/forge/tags/blocks/ores/lapis.json deleted file mode 100644 index 901b01187cd..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/lapis.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:lapis_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/netherite_scrap.json b/src/generated/resources/data/forge/tags/blocks/ores/netherite_scrap.json deleted file mode 100644 index 910d1fb8e6a..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/netherite_scrap.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:ancient_debris" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/quartz.json b/src/generated/resources/data/forge/tags/blocks/ores/quartz.json deleted file mode 100644 index f0bc7a4657c..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/quartz.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_quartz_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores/redstone.json b/src/generated/resources/data/forge/tags/blocks/ores/redstone.json deleted file mode 100644 index 252cdcbb38e..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores/redstone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:redstone_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores_in_ground/deepslate.json b/src/generated/resources/data/forge/tags/blocks/ores_in_ground/deepslate.json deleted file mode 100644 index 13e0c38aa16..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores_in_ground/deepslate.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "values": [ - "minecraft:deepslate_coal_ore", - "minecraft:deepslate_copper_ore", - "minecraft:deepslate_diamond_ore", - "minecraft:deepslate_emerald_ore", - "minecraft:deepslate_gold_ore", - "minecraft:deepslate_iron_ore", - "minecraft:deepslate_lapis_ore", - "minecraft:deepslate_redstone_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores_in_ground/netherrack.json b/src/generated/resources/data/forge/tags/blocks/ores_in_ground/netherrack.json deleted file mode 100644 index 090233bd460..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores_in_ground/netherrack.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:nether_gold_ore", - "minecraft:nether_quartz_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/ores_in_ground/stone.json b/src/generated/resources/data/forge/tags/blocks/ores_in_ground/stone.json deleted file mode 100644 index 568fbe7cb67..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/ores_in_ground/stone.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "values": [ - "minecraft:coal_ore", - "minecraft:copper_ore", - "minecraft:diamond_ore", - "minecraft:emerald_ore", - "minecraft:gold_ore", - "minecraft:iron_ore", - "minecraft:lapis_ore", - "minecraft:redstone_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/sand.json b/src/generated/resources/data/forge/tags/blocks/sand.json deleted file mode 100644 index 8b049162834..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/sand.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:sand/colorless", - "#forge:sand/red" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/sand/colorless.json b/src/generated/resources/data/forge/tags/blocks/sand/colorless.json deleted file mode 100644 index af14f42f568..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/sand/colorless.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:sand" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/sand/red.json b/src/generated/resources/data/forge/tags/blocks/sand/red.json deleted file mode 100644 index 9934cb5bbcf..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/sand/red.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:red_sand" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/sandstone.json b/src/generated/resources/data/forge/tags/blocks/sandstone.json deleted file mode 100644 index bb7fb03ee3e..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/sandstone.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "values": [ - "minecraft:sandstone", - "minecraft:cut_sandstone", - "minecraft:chiseled_sandstone", - "minecraft:smooth_sandstone", - "minecraft:red_sandstone", - "minecraft:cut_red_sandstone", - "minecraft:chiseled_red_sandstone", - "minecraft:smooth_red_sandstone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/stained_glass.json b/src/generated/resources/data/forge/tags/blocks/stained_glass.json deleted file mode 100644 index 2db7aef9df4..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/stained_glass.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass", - "minecraft:orange_stained_glass", - "minecraft:magenta_stained_glass", - "minecraft:light_blue_stained_glass", - "minecraft:yellow_stained_glass", - "minecraft:lime_stained_glass", - "minecraft:pink_stained_glass", - "minecraft:gray_stained_glass", - "minecraft:light_gray_stained_glass", - "minecraft:cyan_stained_glass", - "minecraft:purple_stained_glass", - "minecraft:blue_stained_glass", - "minecraft:brown_stained_glass", - "minecraft:green_stained_glass", - "minecraft:red_stained_glass", - "minecraft:black_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/stained_glass_panes.json b/src/generated/resources/data/forge/tags/blocks/stained_glass_panes.json deleted file mode 100644 index 65f2adb8f9e..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/stained_glass_panes.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass_pane", - "minecraft:orange_stained_glass_pane", - "minecraft:magenta_stained_glass_pane", - "minecraft:light_blue_stained_glass_pane", - "minecraft:yellow_stained_glass_pane", - "minecraft:lime_stained_glass_pane", - "minecraft:pink_stained_glass_pane", - "minecraft:gray_stained_glass_pane", - "minecraft:light_gray_stained_glass_pane", - "minecraft:cyan_stained_glass_pane", - "minecraft:purple_stained_glass_pane", - "minecraft:blue_stained_glass_pane", - "minecraft:brown_stained_glass_pane", - "minecraft:green_stained_glass_pane", - "minecraft:red_stained_glass_pane", - "minecraft:black_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/stone.json b/src/generated/resources/data/forge/tags/blocks/stone.json deleted file mode 100644 index 958f6e25c78..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/stone.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "values": [ - "minecraft:andesite", - "minecraft:diorite", - "minecraft:granite", - "minecraft:infested_stone", - "minecraft:stone", - "minecraft:polished_andesite", - "minecraft:polished_diorite", - "minecraft:polished_granite", - "minecraft:deepslate", - "minecraft:polished_deepslate", - "minecraft:infested_deepslate", - "minecraft:tuff" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks.json deleted file mode 100644 index 5f2a7d417e6..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "values": [ - "#forge:storage_blocks/amethyst", - "#forge:storage_blocks/coal", - "#forge:storage_blocks/copper", - "#forge:storage_blocks/diamond", - "#forge:storage_blocks/emerald", - "#forge:storage_blocks/gold", - "#forge:storage_blocks/iron", - "#forge:storage_blocks/lapis", - "#forge:storage_blocks/quartz", - "#forge:storage_blocks/raw_copper", - "#forge:storage_blocks/raw_gold", - "#forge:storage_blocks/raw_iron", - "#forge:storage_blocks/redstone", - "#forge:storage_blocks/netherite" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/amethyst.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/amethyst.json deleted file mode 100644 index 7f66725ab4f..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/amethyst.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:amethyst_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/coal.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/coal.json deleted file mode 100644 index 4b7921705b6..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/coal.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:coal_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/copper.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/copper.json deleted file mode 100644 index 015bec70c31..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:copper_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/diamond.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/diamond.json deleted file mode 100644 index acd7f52de5e..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/diamond.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:diamond_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/emerald.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/emerald.json deleted file mode 100644 index 152063ec6c6..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/emerald.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:emerald_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/gold.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/gold.json deleted file mode 100644 index 546dde03c96..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gold_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/iron.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/iron.json deleted file mode 100644 index 01fb2965f2c..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:iron_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/lapis.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/lapis.json deleted file mode 100644 index f4ca82bbd4d..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/lapis.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lapis_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/netherite.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/netherite.json deleted file mode 100644 index 83433d44eb8..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/netherite.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:netherite_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/quartz.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/quartz.json deleted file mode 100644 index 9d2533c64a9..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/quartz.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:quartz_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/storage_blocks/redstone.json b/src/generated/resources/data/forge/tags/blocks/storage_blocks/redstone.json deleted file mode 100644 index f5fd89c5414..00000000000 --- a/src/generated/resources/data/forge/tags/blocks/storage_blocks/redstone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:redstone_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/damage_type/is_magic.json b/src/generated/resources/data/forge/tags/damage_type/is_magic.json deleted file mode 100644 index e65624cbcb4..00000000000 --- a/src/generated/resources/data/forge/tags/damage_type/is_magic.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "minecraft:magic", - "minecraft:indirect_magic", - "minecraft:thorns", - "minecraft:dragon_breath", - "#forge:is_poison", - "#forge:is_wither" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/damage_type/is_poison.json b/src/generated/resources/data/forge/tags/damage_type/is_poison.json deleted file mode 100644 index f6d6b1ab29b..00000000000 --- a/src/generated/resources/data/forge/tags/damage_type/is_poison.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "neoforge:poison" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/damage_type/is_technical.json b/src/generated/resources/data/forge/tags/damage_type/is_technical.json deleted file mode 100644 index 5d723926e6d..00000000000 --- a/src/generated/resources/data/forge/tags/damage_type/is_technical.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "minecraft:generic_kill", - "minecraft:outside_border", - "minecraft:out_of_world" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/damage_type/is_wither.json b/src/generated/resources/data/forge/tags/damage_type/is_wither.json deleted file mode 100644 index 33f6ff3bd05..00000000000 --- a/src/generated/resources/data/forge/tags/damage_type/is_wither.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:wither", - "minecraft:wither_skull" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/entity_types/bosses.json b/src/generated/resources/data/forge/tags/entity_types/bosses.json deleted file mode 100644 index 4be4cce8312..00000000000 --- a/src/generated/resources/data/forge/tags/entity_types/bosses.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:ender_dragon", - "minecraft:wither" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/fluids/milk.json b/src/generated/resources/data/forge/tags/fluids/milk.json deleted file mode 100644 index 3bab1951b34..00000000000 --- a/src/generated/resources/data/forge/tags/fluids/milk.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "values": [ - { - "id": "minecraft:milk", - "required": false - }, - { - "id": "minecraft:flowing_milk", - "required": false - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/armors.json b/src/generated/resources/data/forge/tags/items/armors.json deleted file mode 100644 index 1f895dcedf3..00000000000 --- a/src/generated/resources/data/forge/tags/items/armors.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "#forge:armors/helmets", - "#forge:armors/chestplates", - "#forge:armors/leggings", - "#forge:armors/boots" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/armors/boots.json b/src/generated/resources/data/forge/tags/items/armors/boots.json deleted file mode 100644 index b68cf3908d3..00000000000 --- a/src/generated/resources/data/forge/tags/items/armors/boots.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "minecraft:leather_boots", - "minecraft:chainmail_boots", - "minecraft:iron_boots", - "minecraft:golden_boots", - "minecraft:diamond_boots", - "minecraft:netherite_boots" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/armors/chestplates.json b/src/generated/resources/data/forge/tags/items/armors/chestplates.json deleted file mode 100644 index 3f17463c564..00000000000 --- a/src/generated/resources/data/forge/tags/items/armors/chestplates.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "minecraft:leather_chestplate", - "minecraft:chainmail_chestplate", - "minecraft:iron_chestplate", - "minecraft:golden_chestplate", - "minecraft:diamond_chestplate", - "minecraft:netherite_chestplate" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/armors/helmets.json b/src/generated/resources/data/forge/tags/items/armors/helmets.json deleted file mode 100644 index 9c9b657c452..00000000000 --- a/src/generated/resources/data/forge/tags/items/armors/helmets.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "values": [ - "minecraft:leather_helmet", - "minecraft:turtle_helmet", - "minecraft:chainmail_helmet", - "minecraft:iron_helmet", - "minecraft:golden_helmet", - "minecraft:diamond_helmet", - "minecraft:netherite_helmet" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/armors/leggings.json b/src/generated/resources/data/forge/tags/items/armors/leggings.json deleted file mode 100644 index 8969323c7cf..00000000000 --- a/src/generated/resources/data/forge/tags/items/armors/leggings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "minecraft:leather_leggings", - "minecraft:chainmail_leggings", - "minecraft:iron_leggings", - "minecraft:golden_leggings", - "minecraft:diamond_leggings", - "minecraft:netherite_leggings" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/barrels.json b/src/generated/resources/data/forge/tags/items/barrels.json deleted file mode 100644 index 1cfb5782c57..00000000000 --- a/src/generated/resources/data/forge/tags/items/barrels.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#forge:barrels/wooden" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/barrels/wooden.json b/src/generated/resources/data/forge/tags/items/barrels/wooden.json deleted file mode 100644 index b07daae1c09..00000000000 --- a/src/generated/resources/data/forge/tags/items/barrels/wooden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:barrel" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/bones.json b/src/generated/resources/data/forge/tags/items/bones.json deleted file mode 100644 index 5af534fcffb..00000000000 --- a/src/generated/resources/data/forge/tags/items/bones.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:bone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/bookshelves.json b/src/generated/resources/data/forge/tags/items/bookshelves.json deleted file mode 100644 index c09b2185bd1..00000000000 --- a/src/generated/resources/data/forge/tags/items/bookshelves.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:bookshelf" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/chests.json b/src/generated/resources/data/forge/tags/items/chests.json deleted file mode 100644 index 9afff2b15ab..00000000000 --- a/src/generated/resources/data/forge/tags/items/chests.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:chests/ender", - "#forge:chests/trapped", - "#forge:chests/wooden" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/chests/ender.json b/src/generated/resources/data/forge/tags/items/chests/ender.json deleted file mode 100644 index 8c0af53136f..00000000000 --- a/src/generated/resources/data/forge/tags/items/chests/ender.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:ender_chest" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/chests/trapped.json b/src/generated/resources/data/forge/tags/items/chests/trapped.json deleted file mode 100644 index f8924f5a051..00000000000 --- a/src/generated/resources/data/forge/tags/items/chests/trapped.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:trapped_chest" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/chests/wooden.json b/src/generated/resources/data/forge/tags/items/chests/wooden.json deleted file mode 100644 index 86533f935bf..00000000000 --- a/src/generated/resources/data/forge/tags/items/chests/wooden.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:chest", - "minecraft:trapped_chest" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/cobblestone.json b/src/generated/resources/data/forge/tags/items/cobblestone.json deleted file mode 100644 index f0ae95b5fcc..00000000000 --- a/src/generated/resources/data/forge/tags/items/cobblestone.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "#forge:cobblestone/normal", - "#forge:cobblestone/infested", - "#forge:cobblestone/mossy", - "#forge:cobblestone/deepslate" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/cobblestone/deepslate.json b/src/generated/resources/data/forge/tags/items/cobblestone/deepslate.json deleted file mode 100644 index 75f1ba31f44..00000000000 --- a/src/generated/resources/data/forge/tags/items/cobblestone/deepslate.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cobbled_deepslate" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/cobblestone/infested.json b/src/generated/resources/data/forge/tags/items/cobblestone/infested.json deleted file mode 100644 index a1d276601e6..00000000000 --- a/src/generated/resources/data/forge/tags/items/cobblestone/infested.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:infested_cobblestone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/cobblestone/mossy.json b/src/generated/resources/data/forge/tags/items/cobblestone/mossy.json deleted file mode 100644 index c32be6c962c..00000000000 --- a/src/generated/resources/data/forge/tags/items/cobblestone/mossy.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:mossy_cobblestone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/cobblestone/normal.json b/src/generated/resources/data/forge/tags/items/cobblestone/normal.json deleted file mode 100644 index dac674da5d4..00000000000 --- a/src/generated/resources/data/forge/tags/items/cobblestone/normal.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cobblestone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/crops.json b/src/generated/resources/data/forge/tags/items/crops.json deleted file mode 100644 index ae5f647fbeb..00000000000 --- a/src/generated/resources/data/forge/tags/items/crops.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "values": [ - "#forge:crops/beetroot", - "#forge:crops/carrot", - "#forge:crops/nether_wart", - "#forge:crops/potato", - "#forge:crops/wheat" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/crops/beetroot.json b/src/generated/resources/data/forge/tags/items/crops/beetroot.json deleted file mode 100644 index b28b723c4b1..00000000000 --- a/src/generated/resources/data/forge/tags/items/crops/beetroot.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:beetroot" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/crops/carrot.json b/src/generated/resources/data/forge/tags/items/crops/carrot.json deleted file mode 100644 index f9630d13474..00000000000 --- a/src/generated/resources/data/forge/tags/items/crops/carrot.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:carrot" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/crops/nether_wart.json b/src/generated/resources/data/forge/tags/items/crops/nether_wart.json deleted file mode 100644 index 5960d80cb92..00000000000 --- a/src/generated/resources/data/forge/tags/items/crops/nether_wart.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_wart" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/crops/potato.json b/src/generated/resources/data/forge/tags/items/crops/potato.json deleted file mode 100644 index 47fc151cd15..00000000000 --- a/src/generated/resources/data/forge/tags/items/crops/potato.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:potato" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/crops/wheat.json b/src/generated/resources/data/forge/tags/items/crops/wheat.json deleted file mode 100644 index 498cb445f6e..00000000000 --- a/src/generated/resources/data/forge/tags/items/crops/wheat.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:wheat" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dusts.json b/src/generated/resources/data/forge/tags/items/dusts.json deleted file mode 100644 index 87f0fee447e..00000000000 --- a/src/generated/resources/data/forge/tags/items/dusts.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:dusts/glowstone", - "#forge:dusts/prismarine", - "#forge:dusts/redstone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dusts/glowstone.json b/src/generated/resources/data/forge/tags/items/dusts/glowstone.json deleted file mode 100644 index 668258c523d..00000000000 --- a/src/generated/resources/data/forge/tags/items/dusts/glowstone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:glowstone_dust" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dusts/prismarine.json b/src/generated/resources/data/forge/tags/items/dusts/prismarine.json deleted file mode 100644 index 3773c1f1160..00000000000 --- a/src/generated/resources/data/forge/tags/items/dusts/prismarine.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:prismarine_shard" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dusts/redstone.json b/src/generated/resources/data/forge/tags/items/dusts/redstone.json deleted file mode 100644 index a096239ec12..00000000000 --- a/src/generated/resources/data/forge/tags/items/dusts/redstone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:redstone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes.json b/src/generated/resources/data/forge/tags/items/dyes.json deleted file mode 100644 index c8f72c5b6ff..00000000000 --- a/src/generated/resources/data/forge/tags/items/dyes.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "values": [ - "#forge:dyes/white", - "#forge:dyes/orange", - "#forge:dyes/magenta", - "#forge:dyes/light_blue", - "#forge:dyes/yellow", - "#forge:dyes/lime", - "#forge:dyes/pink", - "#forge:dyes/gray", - "#forge:dyes/light_gray", - "#forge:dyes/cyan", - "#forge:dyes/purple", - "#forge:dyes/blue", - "#forge:dyes/brown", - "#forge:dyes/green", - "#forge:dyes/red", - "#forge:dyes/black" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/black.json b/src/generated/resources/data/forge/tags/items/dyes/black.json deleted file mode 100644 index a2ecf55c464..00000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/black.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:black_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/blue.json b/src/generated/resources/data/forge/tags/items/dyes/blue.json deleted file mode 100644 index e7b78e12a35..00000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:blue_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/brown.json b/src/generated/resources/data/forge/tags/items/dyes/brown.json deleted file mode 100644 index 8c7249234eb..00000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/brown.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:brown_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/cyan.json b/src/generated/resources/data/forge/tags/items/dyes/cyan.json deleted file mode 100644 index f0c5a44002d..00000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/cyan.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cyan_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/gray.json b/src/generated/resources/data/forge/tags/items/dyes/gray.json deleted file mode 100644 index 6cdbb27a491..00000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gray_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/green.json b/src/generated/resources/data/forge/tags/items/dyes/green.json deleted file mode 100644 index 89fe8ccaf39..00000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/green.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:green_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/light_blue.json b/src/generated/resources/data/forge/tags/items/dyes/light_blue.json deleted file mode 100644 index 76f1a7786cc..00000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/light_blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_blue_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/light_gray.json b/src/generated/resources/data/forge/tags/items/dyes/light_gray.json deleted file mode 100644 index 596b2efb37f..00000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/light_gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_gray_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/lime.json b/src/generated/resources/data/forge/tags/items/dyes/lime.json deleted file mode 100644 index b0ac91f97e4..00000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/lime.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lime_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/magenta.json b/src/generated/resources/data/forge/tags/items/dyes/magenta.json deleted file mode 100644 index f6898d4c9b6..00000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/magenta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:magenta_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/orange.json b/src/generated/resources/data/forge/tags/items/dyes/orange.json deleted file mode 100644 index df54849c593..00000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/orange.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:orange_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/pink.json b/src/generated/resources/data/forge/tags/items/dyes/pink.json deleted file mode 100644 index d9f2898629b..00000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/pink.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:pink_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/purple.json b/src/generated/resources/data/forge/tags/items/dyes/purple.json deleted file mode 100644 index b3ebfe3c262..00000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/purple.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:purple_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/red.json b/src/generated/resources/data/forge/tags/items/dyes/red.json deleted file mode 100644 index 9c6fe34671f..00000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/red.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:red_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/white.json b/src/generated/resources/data/forge/tags/items/dyes/white.json deleted file mode 100644 index 3a30d72b10b..00000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/white.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:white_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/dyes/yellow.json b/src/generated/resources/data/forge/tags/items/dyes/yellow.json deleted file mode 100644 index 43499598369..00000000000 --- a/src/generated/resources/data/forge/tags/items/dyes/yellow.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:yellow_dye" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/enchanting_fuels.json b/src/generated/resources/data/forge/tags/items/enchanting_fuels.json deleted file mode 100644 index 2a4a029cca4..00000000000 --- a/src/generated/resources/data/forge/tags/items/enchanting_fuels.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#forge:gems/lapis" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/end_stones.json b/src/generated/resources/data/forge/tags/items/end_stones.json deleted file mode 100644 index f2d11375bce..00000000000 --- a/src/generated/resources/data/forge/tags/items/end_stones.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:end_stone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ender_pearls.json b/src/generated/resources/data/forge/tags/items/ender_pearls.json deleted file mode 100644 index 135cd1d7761..00000000000 --- a/src/generated/resources/data/forge/tags/items/ender_pearls.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:ender_pearl" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/feathers.json b/src/generated/resources/data/forge/tags/items/feathers.json deleted file mode 100644 index 8086200700e..00000000000 --- a/src/generated/resources/data/forge/tags/items/feathers.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:feather" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/fence_gates.json b/src/generated/resources/data/forge/tags/items/fence_gates.json deleted file mode 100644 index b9a57ac0ef2..00000000000 --- a/src/generated/resources/data/forge/tags/items/fence_gates.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#forge:fence_gates/wooden" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/fence_gates/wooden.json b/src/generated/resources/data/forge/tags/items/fence_gates/wooden.json deleted file mode 100644 index 88a130fa504..00000000000 --- a/src/generated/resources/data/forge/tags/items/fence_gates/wooden.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "values": [ - "minecraft:oak_fence_gate", - "minecraft:spruce_fence_gate", - "minecraft:birch_fence_gate", - "minecraft:jungle_fence_gate", - "minecraft:acacia_fence_gate", - "minecraft:dark_oak_fence_gate", - "minecraft:crimson_fence_gate", - "minecraft:warped_fence_gate", - "minecraft:mangrove_fence_gate", - "minecraft:bamboo_fence_gate", - "minecraft:cherry_fence_gate" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/fences.json b/src/generated/resources/data/forge/tags/items/fences.json deleted file mode 100644 index 44358edb048..00000000000 --- a/src/generated/resources/data/forge/tags/items/fences.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:fences/nether_brick", - "#forge:fences/wooden" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/fences/nether_brick.json b/src/generated/resources/data/forge/tags/items/fences/nether_brick.json deleted file mode 100644 index 3f1aacfa7ef..00000000000 --- a/src/generated/resources/data/forge/tags/items/fences/nether_brick.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_brick_fence" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/fences/wooden.json b/src/generated/resources/data/forge/tags/items/fences/wooden.json deleted file mode 100644 index 81202621144..00000000000 --- a/src/generated/resources/data/forge/tags/items/fences/wooden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:wooden_fences" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/gems.json b/src/generated/resources/data/forge/tags/items/gems.json deleted file mode 100644 index 60af4bab680..00000000000 --- a/src/generated/resources/data/forge/tags/items/gems.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "#forge:gems/amethyst", - "#forge:gems/diamond", - "#forge:gems/emerald", - "#forge:gems/lapis", - "#forge:gems/prismarine", - "#forge:gems/quartz" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/gems/amethyst.json b/src/generated/resources/data/forge/tags/items/gems/amethyst.json deleted file mode 100644 index 742ef896d5b..00000000000 --- a/src/generated/resources/data/forge/tags/items/gems/amethyst.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:amethyst_shard" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/gems/diamond.json b/src/generated/resources/data/forge/tags/items/gems/diamond.json deleted file mode 100644 index f44f30dd550..00000000000 --- a/src/generated/resources/data/forge/tags/items/gems/diamond.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:diamond" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/gems/emerald.json b/src/generated/resources/data/forge/tags/items/gems/emerald.json deleted file mode 100644 index 07a09821180..00000000000 --- a/src/generated/resources/data/forge/tags/items/gems/emerald.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:emerald" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/gems/lapis.json b/src/generated/resources/data/forge/tags/items/gems/lapis.json deleted file mode 100644 index 614441df46c..00000000000 --- a/src/generated/resources/data/forge/tags/items/gems/lapis.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lapis_lazuli" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/gems/prismarine.json b/src/generated/resources/data/forge/tags/items/gems/prismarine.json deleted file mode 100644 index 150e7ff7114..00000000000 --- a/src/generated/resources/data/forge/tags/items/gems/prismarine.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:prismarine_crystals" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/gems/quartz.json b/src/generated/resources/data/forge/tags/items/gems/quartz.json deleted file mode 100644 index aad2eef95bf..00000000000 --- a/src/generated/resources/data/forge/tags/items/gems/quartz.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:quartz" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass.json b/src/generated/resources/data/forge/tags/items/glass.json deleted file mode 100644 index fec31169ee1..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:glass/colorless", - "#forge:stained_glass", - "#forge:glass/tinted" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/black.json b/src/generated/resources/data/forge/tags/items/glass/black.json deleted file mode 100644 index 9965b5e8b4b..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/black.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:black_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/blue.json b/src/generated/resources/data/forge/tags/items/glass/blue.json deleted file mode 100644 index f59e58c6bf7..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:blue_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/brown.json b/src/generated/resources/data/forge/tags/items/glass/brown.json deleted file mode 100644 index 490015cbb51..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/brown.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:brown_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/colorless.json b/src/generated/resources/data/forge/tags/items/glass/colorless.json deleted file mode 100644 index ac8b5e50863..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/colorless.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/cyan.json b/src/generated/resources/data/forge/tags/items/glass/cyan.json deleted file mode 100644 index 24d84747fa8..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/cyan.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cyan_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/gray.json b/src/generated/resources/data/forge/tags/items/glass/gray.json deleted file mode 100644 index 2f309170cab..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gray_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/green.json b/src/generated/resources/data/forge/tags/items/glass/green.json deleted file mode 100644 index d7946c1aca9..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/green.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:green_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/light_blue.json b/src/generated/resources/data/forge/tags/items/glass/light_blue.json deleted file mode 100644 index dc8e6b71485..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/light_blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_blue_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/light_gray.json b/src/generated/resources/data/forge/tags/items/glass/light_gray.json deleted file mode 100644 index f165a46c904..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/light_gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_gray_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/lime.json b/src/generated/resources/data/forge/tags/items/glass/lime.json deleted file mode 100644 index b6bb1d9415e..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/lime.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lime_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/magenta.json b/src/generated/resources/data/forge/tags/items/glass/magenta.json deleted file mode 100644 index aa6a4825e82..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/magenta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:magenta_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/orange.json b/src/generated/resources/data/forge/tags/items/glass/orange.json deleted file mode 100644 index 9322f51fe4d..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/orange.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:orange_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/pink.json b/src/generated/resources/data/forge/tags/items/glass/pink.json deleted file mode 100644 index 58b65891fc5..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/pink.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:pink_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/purple.json b/src/generated/resources/data/forge/tags/items/glass/purple.json deleted file mode 100644 index d75a9e7308f..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/purple.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:purple_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/red.json b/src/generated/resources/data/forge/tags/items/glass/red.json deleted file mode 100644 index 72af78c0294..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/red.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:red_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/silica.json b/src/generated/resources/data/forge/tags/items/glass/silica.json deleted file mode 100644 index 74544c770db..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/silica.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "values": [ - "minecraft:glass", - "minecraft:black_stained_glass", - "minecraft:blue_stained_glass", - "minecraft:brown_stained_glass", - "minecraft:cyan_stained_glass", - "minecraft:gray_stained_glass", - "minecraft:green_stained_glass", - "minecraft:light_blue_stained_glass", - "minecraft:light_gray_stained_glass", - "minecraft:lime_stained_glass", - "minecraft:magenta_stained_glass", - "minecraft:orange_stained_glass", - "minecraft:pink_stained_glass", - "minecraft:purple_stained_glass", - "minecraft:red_stained_glass", - "minecraft:white_stained_glass", - "minecraft:yellow_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/tinted.json b/src/generated/resources/data/forge/tags/items/glass/tinted.json deleted file mode 100644 index 4075a1556b3..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/tinted.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:tinted_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/white.json b/src/generated/resources/data/forge/tags/items/glass/white.json deleted file mode 100644 index fb180e703e4..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/white.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass/yellow.json b/src/generated/resources/data/forge/tags/items/glass/yellow.json deleted file mode 100644 index 0831bea4cca..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass/yellow.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:yellow_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes.json b/src/generated/resources/data/forge/tags/items/glass_panes.json deleted file mode 100644 index 4b95330d4f5..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:glass_panes/colorless", - "#forge:stained_glass_panes" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/black.json b/src/generated/resources/data/forge/tags/items/glass_panes/black.json deleted file mode 100644 index ebda555dcd4..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/black.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:black_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/blue.json b/src/generated/resources/data/forge/tags/items/glass_panes/blue.json deleted file mode 100644 index 2762890aa90..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:blue_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/brown.json b/src/generated/resources/data/forge/tags/items/glass_panes/brown.json deleted file mode 100644 index 0b5b7274916..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/brown.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:brown_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/colorless.json b/src/generated/resources/data/forge/tags/items/glass_panes/colorless.json deleted file mode 100644 index eb5756f9643..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/colorless.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/cyan.json b/src/generated/resources/data/forge/tags/items/glass_panes/cyan.json deleted file mode 100644 index 9913e90a964..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/cyan.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:cyan_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/gray.json b/src/generated/resources/data/forge/tags/items/glass_panes/gray.json deleted file mode 100644 index 9fe30b26a89..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gray_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/green.json b/src/generated/resources/data/forge/tags/items/glass_panes/green.json deleted file mode 100644 index ab913210286..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/green.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:green_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/light_blue.json b/src/generated/resources/data/forge/tags/items/glass_panes/light_blue.json deleted file mode 100644 index cd6d399022d..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/light_blue.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_blue_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/light_gray.json b/src/generated/resources/data/forge/tags/items/glass_panes/light_gray.json deleted file mode 100644 index 7be6a4ce81d..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/light_gray.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:light_gray_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/lime.json b/src/generated/resources/data/forge/tags/items/glass_panes/lime.json deleted file mode 100644 index 46dec64b22e..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/lime.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lime_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/magenta.json b/src/generated/resources/data/forge/tags/items/glass_panes/magenta.json deleted file mode 100644 index 7504bc3fa37..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/magenta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:magenta_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/orange.json b/src/generated/resources/data/forge/tags/items/glass_panes/orange.json deleted file mode 100644 index 1c47e346166..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/orange.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:orange_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/pink.json b/src/generated/resources/data/forge/tags/items/glass_panes/pink.json deleted file mode 100644 index 28e36b973f6..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/pink.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:pink_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/purple.json b/src/generated/resources/data/forge/tags/items/glass_panes/purple.json deleted file mode 100644 index a3cff33a142..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/purple.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:purple_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/red.json b/src/generated/resources/data/forge/tags/items/glass_panes/red.json deleted file mode 100644 index 5edd855d716..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/red.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:red_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/white.json b/src/generated/resources/data/forge/tags/items/glass_panes/white.json deleted file mode 100644 index b514a2839f8..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/white.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/glass_panes/yellow.json b/src/generated/resources/data/forge/tags/items/glass_panes/yellow.json deleted file mode 100644 index a293eb9dc88..00000000000 --- a/src/generated/resources/data/forge/tags/items/glass_panes/yellow.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:yellow_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/gravel.json b/src/generated/resources/data/forge/tags/items/gravel.json deleted file mode 100644 index f6968bff68a..00000000000 --- a/src/generated/resources/data/forge/tags/items/gravel.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gravel" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/gunpowder.json b/src/generated/resources/data/forge/tags/items/gunpowder.json deleted file mode 100644 index d5835ce7f91..00000000000 --- a/src/generated/resources/data/forge/tags/items/gunpowder.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gunpowder" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/heads.json b/src/generated/resources/data/forge/tags/items/heads.json deleted file mode 100644 index 430af37ee54..00000000000 --- a/src/generated/resources/data/forge/tags/items/heads.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "minecraft:creeper_head", - "minecraft:dragon_head", - "minecraft:player_head", - "minecraft:skeleton_skull", - "minecraft:wither_skeleton_skull", - "minecraft:zombie_head" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ingots.json b/src/generated/resources/data/forge/tags/items/ingots.json deleted file mode 100644 index e9756bb39c0..00000000000 --- a/src/generated/resources/data/forge/tags/items/ingots.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "#forge:ingots/brick", - "#forge:ingots/copper", - "#forge:ingots/gold", - "#forge:ingots/iron", - "#forge:ingots/netherite", - "#forge:ingots/nether_brick" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ingots/brick.json b/src/generated/resources/data/forge/tags/items/ingots/brick.json deleted file mode 100644 index 8f632e499a6..00000000000 --- a/src/generated/resources/data/forge/tags/items/ingots/brick.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:brick" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ingots/copper.json b/src/generated/resources/data/forge/tags/items/ingots/copper.json deleted file mode 100644 index 1cc1f065c5f..00000000000 --- a/src/generated/resources/data/forge/tags/items/ingots/copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:copper_ingot" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ingots/gold.json b/src/generated/resources/data/forge/tags/items/ingots/gold.json deleted file mode 100644 index 07e9f66a309..00000000000 --- a/src/generated/resources/data/forge/tags/items/ingots/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gold_ingot" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ingots/iron.json b/src/generated/resources/data/forge/tags/items/ingots/iron.json deleted file mode 100644 index c656021bdbe..00000000000 --- a/src/generated/resources/data/forge/tags/items/ingots/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:iron_ingot" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ingots/nether_brick.json b/src/generated/resources/data/forge/tags/items/ingots/nether_brick.json deleted file mode 100644 index ec7ed3ee9ad..00000000000 --- a/src/generated/resources/data/forge/tags/items/ingots/nether_brick.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_brick" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ingots/netherite.json b/src/generated/resources/data/forge/tags/items/ingots/netherite.json deleted file mode 100644 index bd6929df75c..00000000000 --- a/src/generated/resources/data/forge/tags/items/ingots/netherite.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:netherite_ingot" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/leather.json b/src/generated/resources/data/forge/tags/items/leather.json deleted file mode 100644 index 71b797d35ba..00000000000 --- a/src/generated/resources/data/forge/tags/items/leather.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:leather" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/mushrooms.json b/src/generated/resources/data/forge/tags/items/mushrooms.json deleted file mode 100644 index 471cd77f070..00000000000 --- a/src/generated/resources/data/forge/tags/items/mushrooms.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:brown_mushroom", - "minecraft:red_mushroom" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/nether_stars.json b/src/generated/resources/data/forge/tags/items/nether_stars.json deleted file mode 100644 index 737a95d0833..00000000000 --- a/src/generated/resources/data/forge/tags/items/nether_stars.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_star" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/netherrack.json b/src/generated/resources/data/forge/tags/items/netherrack.json deleted file mode 100644 index daa9c66701a..00000000000 --- a/src/generated/resources/data/forge/tags/items/netherrack.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:netherrack" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/nuggets.json b/src/generated/resources/data/forge/tags/items/nuggets.json deleted file mode 100644 index fb0dc26ecdf..00000000000 --- a/src/generated/resources/data/forge/tags/items/nuggets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:nuggets/iron", - "#forge:nuggets/gold" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/nuggets/gold.json b/src/generated/resources/data/forge/tags/items/nuggets/gold.json deleted file mode 100644 index 4d943459579..00000000000 --- a/src/generated/resources/data/forge/tags/items/nuggets/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gold_nugget" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/nuggets/iron.json b/src/generated/resources/data/forge/tags/items/nuggets/iron.json deleted file mode 100644 index cbd20ac6e4f..00000000000 --- a/src/generated/resources/data/forge/tags/items/nuggets/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:iron_nugget" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/obsidian.json b/src/generated/resources/data/forge/tags/items/obsidian.json deleted file mode 100644 index 170248454b1..00000000000 --- a/src/generated/resources/data/forge/tags/items/obsidian.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:obsidian" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ore_bearing_ground/deepslate.json b/src/generated/resources/data/forge/tags/items/ore_bearing_ground/deepslate.json deleted file mode 100644 index 0012c241a31..00000000000 --- a/src/generated/resources/data/forge/tags/items/ore_bearing_ground/deepslate.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:deepslate" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ore_bearing_ground/netherrack.json b/src/generated/resources/data/forge/tags/items/ore_bearing_ground/netherrack.json deleted file mode 100644 index daa9c66701a..00000000000 --- a/src/generated/resources/data/forge/tags/items/ore_bearing_ground/netherrack.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:netherrack" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ore_bearing_ground/stone.json b/src/generated/resources/data/forge/tags/items/ore_bearing_ground/stone.json deleted file mode 100644 index c2d7c79f3e7..00000000000 --- a/src/generated/resources/data/forge/tags/items/ore_bearing_ground/stone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:stone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ore_rates/dense.json b/src/generated/resources/data/forge/tags/items/ore_rates/dense.json deleted file mode 100644 index 69cfa783438..00000000000 --- a/src/generated/resources/data/forge/tags/items/ore_rates/dense.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "minecraft:copper_ore", - "minecraft:deepslate_copper_ore", - "minecraft:deepslate_lapis_ore", - "minecraft:deepslate_redstone_ore", - "minecraft:lapis_ore", - "minecraft:redstone_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ore_rates/singular.json b/src/generated/resources/data/forge/tags/items/ore_rates/singular.json deleted file mode 100644 index 79e0f4b9a7c..00000000000 --- a/src/generated/resources/data/forge/tags/items/ore_rates/singular.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "values": [ - "minecraft:ancient_debris", - "minecraft:coal_ore", - "minecraft:deepslate_coal_ore", - "minecraft:deepslate_diamond_ore", - "minecraft:deepslate_emerald_ore", - "minecraft:deepslate_gold_ore", - "minecraft:deepslate_iron_ore", - "minecraft:diamond_ore", - "minecraft:emerald_ore", - "minecraft:gold_ore", - "minecraft:iron_ore", - "minecraft:nether_quartz_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ore_rates/sparse.json b/src/generated/resources/data/forge/tags/items/ore_rates/sparse.json deleted file mode 100644 index 3caf9ffe44e..00000000000 --- a/src/generated/resources/data/forge/tags/items/ore_rates/sparse.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_gold_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores.json b/src/generated/resources/data/forge/tags/items/ores.json deleted file mode 100644 index 2c4beabc55b..00000000000 --- a/src/generated/resources/data/forge/tags/items/ores.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "values": [ - "#forge:ores/coal", - "#forge:ores/copper", - "#forge:ores/diamond", - "#forge:ores/emerald", - "#forge:ores/gold", - "#forge:ores/iron", - "#forge:ores/lapis", - "#forge:ores/redstone", - "#forge:ores/quartz", - "#forge:ores/netherite_scrap" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/coal.json b/src/generated/resources/data/forge/tags/items/ores/coal.json deleted file mode 100644 index c1246af5163..00000000000 --- a/src/generated/resources/data/forge/tags/items/ores/coal.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:coal_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/copper.json b/src/generated/resources/data/forge/tags/items/ores/copper.json deleted file mode 100644 index bfa31f2aed5..00000000000 --- a/src/generated/resources/data/forge/tags/items/ores/copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:copper_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/diamond.json b/src/generated/resources/data/forge/tags/items/ores/diamond.json deleted file mode 100644 index e0fe2e9d0ff..00000000000 --- a/src/generated/resources/data/forge/tags/items/ores/diamond.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:diamond_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/emerald.json b/src/generated/resources/data/forge/tags/items/ores/emerald.json deleted file mode 100644 index fe8bed587cd..00000000000 --- a/src/generated/resources/data/forge/tags/items/ores/emerald.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:emerald_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/gold.json b/src/generated/resources/data/forge/tags/items/ores/gold.json deleted file mode 100644 index 52f7c26ba19..00000000000 --- a/src/generated/resources/data/forge/tags/items/ores/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:gold_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/iron.json b/src/generated/resources/data/forge/tags/items/ores/iron.json deleted file mode 100644 index 9b135890e97..00000000000 --- a/src/generated/resources/data/forge/tags/items/ores/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:iron_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/lapis.json b/src/generated/resources/data/forge/tags/items/ores/lapis.json deleted file mode 100644 index 901b01187cd..00000000000 --- a/src/generated/resources/data/forge/tags/items/ores/lapis.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:lapis_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/netherite_scrap.json b/src/generated/resources/data/forge/tags/items/ores/netherite_scrap.json deleted file mode 100644 index 910d1fb8e6a..00000000000 --- a/src/generated/resources/data/forge/tags/items/ores/netherite_scrap.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:ancient_debris" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/quartz.json b/src/generated/resources/data/forge/tags/items/ores/quartz.json deleted file mode 100644 index f0bc7a4657c..00000000000 --- a/src/generated/resources/data/forge/tags/items/ores/quartz.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:nether_quartz_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores/redstone.json b/src/generated/resources/data/forge/tags/items/ores/redstone.json deleted file mode 100644 index 252cdcbb38e..00000000000 --- a/src/generated/resources/data/forge/tags/items/ores/redstone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#minecraft:redstone_ores" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores_in_ground/deepslate.json b/src/generated/resources/data/forge/tags/items/ores_in_ground/deepslate.json deleted file mode 100644 index 13e0c38aa16..00000000000 --- a/src/generated/resources/data/forge/tags/items/ores_in_ground/deepslate.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "values": [ - "minecraft:deepslate_coal_ore", - "minecraft:deepslate_copper_ore", - "minecraft:deepslate_diamond_ore", - "minecraft:deepslate_emerald_ore", - "minecraft:deepslate_gold_ore", - "minecraft:deepslate_iron_ore", - "minecraft:deepslate_lapis_ore", - "minecraft:deepslate_redstone_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores_in_ground/netherrack.json b/src/generated/resources/data/forge/tags/items/ores_in_ground/netherrack.json deleted file mode 100644 index 090233bd460..00000000000 --- a/src/generated/resources/data/forge/tags/items/ores_in_ground/netherrack.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:nether_gold_ore", - "minecraft:nether_quartz_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ores_in_ground/stone.json b/src/generated/resources/data/forge/tags/items/ores_in_ground/stone.json deleted file mode 100644 index 568fbe7cb67..00000000000 --- a/src/generated/resources/data/forge/tags/items/ores_in_ground/stone.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "values": [ - "minecraft:coal_ore", - "minecraft:copper_ore", - "minecraft:diamond_ore", - "minecraft:emerald_ore", - "minecraft:gold_ore", - "minecraft:iron_ore", - "minecraft:lapis_ore", - "minecraft:redstone_ore" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/raw_materials.json b/src/generated/resources/data/forge/tags/items/raw_materials.json deleted file mode 100644 index 35208231e07..00000000000 --- a/src/generated/resources/data/forge/tags/items/raw_materials.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:raw_materials/copper", - "#forge:raw_materials/gold", - "#forge:raw_materials/iron" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/raw_materials/copper.json b/src/generated/resources/data/forge/tags/items/raw_materials/copper.json deleted file mode 100644 index 3e03ab9ca8a..00000000000 --- a/src/generated/resources/data/forge/tags/items/raw_materials/copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_copper" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/raw_materials/gold.json b/src/generated/resources/data/forge/tags/items/raw_materials/gold.json deleted file mode 100644 index 3d1252e5f9d..00000000000 --- a/src/generated/resources/data/forge/tags/items/raw_materials/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_gold" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/raw_materials/iron.json b/src/generated/resources/data/forge/tags/items/raw_materials/iron.json deleted file mode 100644 index 8f9af48d8e1..00000000000 --- a/src/generated/resources/data/forge/tags/items/raw_materials/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_iron" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/rods.json b/src/generated/resources/data/forge/tags/items/rods.json deleted file mode 100644 index 11b8cb38446..00000000000 --- a/src/generated/resources/data/forge/tags/items/rods.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:rods/blaze", - "#forge:rods/wooden" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/rods/blaze.json b/src/generated/resources/data/forge/tags/items/rods/blaze.json deleted file mode 100644 index 5d2eff8311d..00000000000 --- a/src/generated/resources/data/forge/tags/items/rods/blaze.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:blaze_rod" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/rods/wooden.json b/src/generated/resources/data/forge/tags/items/rods/wooden.json deleted file mode 100644 index 019b63dd31d..00000000000 --- a/src/generated/resources/data/forge/tags/items/rods/wooden.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:stick" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/sand.json b/src/generated/resources/data/forge/tags/items/sand.json deleted file mode 100644 index 8b049162834..00000000000 --- a/src/generated/resources/data/forge/tags/items/sand.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:sand/colorless", - "#forge:sand/red" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/sand/colorless.json b/src/generated/resources/data/forge/tags/items/sand/colorless.json deleted file mode 100644 index af14f42f568..00000000000 --- a/src/generated/resources/data/forge/tags/items/sand/colorless.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:sand" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/sand/red.json b/src/generated/resources/data/forge/tags/items/sand/red.json deleted file mode 100644 index 9934cb5bbcf..00000000000 --- a/src/generated/resources/data/forge/tags/items/sand/red.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:red_sand" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/sandstone.json b/src/generated/resources/data/forge/tags/items/sandstone.json deleted file mode 100644 index bb7fb03ee3e..00000000000 --- a/src/generated/resources/data/forge/tags/items/sandstone.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "values": [ - "minecraft:sandstone", - "minecraft:cut_sandstone", - "minecraft:chiseled_sandstone", - "minecraft:smooth_sandstone", - "minecraft:red_sandstone", - "minecraft:cut_red_sandstone", - "minecraft:chiseled_red_sandstone", - "minecraft:smooth_red_sandstone" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/seeds.json b/src/generated/resources/data/forge/tags/items/seeds.json deleted file mode 100644 index 423d5bb52d0..00000000000 --- a/src/generated/resources/data/forge/tags/items/seeds.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "#forge:seeds/beetroot", - "#forge:seeds/melon", - "#forge:seeds/pumpkin", - "#forge:seeds/wheat" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/seeds/beetroot.json b/src/generated/resources/data/forge/tags/items/seeds/beetroot.json deleted file mode 100644 index da5a4ab7eff..00000000000 --- a/src/generated/resources/data/forge/tags/items/seeds/beetroot.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:beetroot_seeds" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/seeds/melon.json b/src/generated/resources/data/forge/tags/items/seeds/melon.json deleted file mode 100644 index 973c52ea124..00000000000 --- a/src/generated/resources/data/forge/tags/items/seeds/melon.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:melon_seeds" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/seeds/pumpkin.json b/src/generated/resources/data/forge/tags/items/seeds/pumpkin.json deleted file mode 100644 index 264c06bf04f..00000000000 --- a/src/generated/resources/data/forge/tags/items/seeds/pumpkin.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:pumpkin_seeds" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/seeds/wheat.json b/src/generated/resources/data/forge/tags/items/seeds/wheat.json deleted file mode 100644 index b90459c2910..00000000000 --- a/src/generated/resources/data/forge/tags/items/seeds/wheat.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:wheat_seeds" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/shears.json b/src/generated/resources/data/forge/tags/items/shears.json deleted file mode 100644 index 24000781662..00000000000 --- a/src/generated/resources/data/forge/tags/items/shears.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:shears" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/slimeballs.json b/src/generated/resources/data/forge/tags/items/slimeballs.json deleted file mode 100644 index 533c25d9163..00000000000 --- a/src/generated/resources/data/forge/tags/items/slimeballs.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:slime_ball" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/stained_glass.json b/src/generated/resources/data/forge/tags/items/stained_glass.json deleted file mode 100644 index 2db7aef9df4..00000000000 --- a/src/generated/resources/data/forge/tags/items/stained_glass.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass", - "minecraft:orange_stained_glass", - "minecraft:magenta_stained_glass", - "minecraft:light_blue_stained_glass", - "minecraft:yellow_stained_glass", - "minecraft:lime_stained_glass", - "minecraft:pink_stained_glass", - "minecraft:gray_stained_glass", - "minecraft:light_gray_stained_glass", - "minecraft:cyan_stained_glass", - "minecraft:purple_stained_glass", - "minecraft:blue_stained_glass", - "minecraft:brown_stained_glass", - "minecraft:green_stained_glass", - "minecraft:red_stained_glass", - "minecraft:black_stained_glass" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/stained_glass_panes.json b/src/generated/resources/data/forge/tags/items/stained_glass_panes.json deleted file mode 100644 index 65f2adb8f9e..00000000000 --- a/src/generated/resources/data/forge/tags/items/stained_glass_panes.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "values": [ - "minecraft:white_stained_glass_pane", - "minecraft:orange_stained_glass_pane", - "minecraft:magenta_stained_glass_pane", - "minecraft:light_blue_stained_glass_pane", - "minecraft:yellow_stained_glass_pane", - "minecraft:lime_stained_glass_pane", - "minecraft:pink_stained_glass_pane", - "minecraft:gray_stained_glass_pane", - "minecraft:light_gray_stained_glass_pane", - "minecraft:cyan_stained_glass_pane", - "minecraft:purple_stained_glass_pane", - "minecraft:blue_stained_glass_pane", - "minecraft:brown_stained_glass_pane", - "minecraft:green_stained_glass_pane", - "minecraft:red_stained_glass_pane", - "minecraft:black_stained_glass_pane" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/stone.json b/src/generated/resources/data/forge/tags/items/stone.json deleted file mode 100644 index 958f6e25c78..00000000000 --- a/src/generated/resources/data/forge/tags/items/stone.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "values": [ - "minecraft:andesite", - "minecraft:diorite", - "minecraft:granite", - "minecraft:infested_stone", - "minecraft:stone", - "minecraft:polished_andesite", - "minecraft:polished_diorite", - "minecraft:polished_granite", - "minecraft:deepslate", - "minecraft:polished_deepslate", - "minecraft:infested_deepslate", - "minecraft:tuff" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks.json b/src/generated/resources/data/forge/tags/items/storage_blocks.json deleted file mode 100644 index 5f2a7d417e6..00000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "values": [ - "#forge:storage_blocks/amethyst", - "#forge:storage_blocks/coal", - "#forge:storage_blocks/copper", - "#forge:storage_blocks/diamond", - "#forge:storage_blocks/emerald", - "#forge:storage_blocks/gold", - "#forge:storage_blocks/iron", - "#forge:storage_blocks/lapis", - "#forge:storage_blocks/quartz", - "#forge:storage_blocks/raw_copper", - "#forge:storage_blocks/raw_gold", - "#forge:storage_blocks/raw_iron", - "#forge:storage_blocks/redstone", - "#forge:storage_blocks/netherite" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/amethyst.json b/src/generated/resources/data/forge/tags/items/storage_blocks/amethyst.json deleted file mode 100644 index 7f66725ab4f..00000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/amethyst.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:amethyst_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/coal.json b/src/generated/resources/data/forge/tags/items/storage_blocks/coal.json deleted file mode 100644 index 4b7921705b6..00000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/coal.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:coal_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/copper.json b/src/generated/resources/data/forge/tags/items/storage_blocks/copper.json deleted file mode 100644 index 015bec70c31..00000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:copper_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/diamond.json b/src/generated/resources/data/forge/tags/items/storage_blocks/diamond.json deleted file mode 100644 index acd7f52de5e..00000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/diamond.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:diamond_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/emerald.json b/src/generated/resources/data/forge/tags/items/storage_blocks/emerald.json deleted file mode 100644 index 152063ec6c6..00000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/emerald.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:emerald_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/gold.json b/src/generated/resources/data/forge/tags/items/storage_blocks/gold.json deleted file mode 100644 index 546dde03c96..00000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:gold_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/iron.json b/src/generated/resources/data/forge/tags/items/storage_blocks/iron.json deleted file mode 100644 index 01fb2965f2c..00000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:iron_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/lapis.json b/src/generated/resources/data/forge/tags/items/storage_blocks/lapis.json deleted file mode 100644 index f4ca82bbd4d..00000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/lapis.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lapis_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/netherite.json b/src/generated/resources/data/forge/tags/items/storage_blocks/netherite.json deleted file mode 100644 index 83433d44eb8..00000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/netherite.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:netherite_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/quartz.json b/src/generated/resources/data/forge/tags/items/storage_blocks/quartz.json deleted file mode 100644 index 9d2533c64a9..00000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/quartz.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:quartz_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/raw_copper.json b/src/generated/resources/data/forge/tags/items/storage_blocks/raw_copper.json deleted file mode 100644 index 1a21e230ef0..00000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/raw_copper.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_copper_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/raw_gold.json b/src/generated/resources/data/forge/tags/items/storage_blocks/raw_gold.json deleted file mode 100644 index 80781ce6675..00000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/raw_gold.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_gold_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/raw_iron.json b/src/generated/resources/data/forge/tags/items/storage_blocks/raw_iron.json deleted file mode 100644 index 13ed9fc651b..00000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/raw_iron.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:raw_iron_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/storage_blocks/redstone.json b/src/generated/resources/data/forge/tags/items/storage_blocks/redstone.json deleted file mode 100644 index f5fd89c5414..00000000000 --- a/src/generated/resources/data/forge/tags/items/storage_blocks/redstone.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:redstone_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/string.json b/src/generated/resources/data/forge/tags/items/string.json deleted file mode 100644 index d018256cf83..00000000000 --- a/src/generated/resources/data/forge/tags/items/string.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:string" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/tools.json b/src/generated/resources/data/forge/tags/items/tools.json deleted file mode 100644 index acbfe2ae9d6..00000000000 --- a/src/generated/resources/data/forge/tags/items/tools.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "values": [ - "#minecraft:swords", - "#minecraft:axes", - "#minecraft:pickaxes", - "#minecraft:shovels", - "#minecraft:hoes", - "#forge:tools/shields", - "#forge:tools/bows", - "#forge:tools/crossbows", - "#forge:tools/fishing_rods", - "#forge:tools/tridents" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/tools/bows.json b/src/generated/resources/data/forge/tags/items/tools/bows.json deleted file mode 100644 index a1c8a443dca..00000000000 --- a/src/generated/resources/data/forge/tags/items/tools/bows.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:bow" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/tools/crossbows.json b/src/generated/resources/data/forge/tags/items/tools/crossbows.json deleted file mode 100644 index 848f97bc22e..00000000000 --- a/src/generated/resources/data/forge/tags/items/tools/crossbows.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:crossbow" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/tools/fishing_rods.json b/src/generated/resources/data/forge/tags/items/tools/fishing_rods.json deleted file mode 100644 index e97941e9dc3..00000000000 --- a/src/generated/resources/data/forge/tags/items/tools/fishing_rods.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:fishing_rod" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/tools/shields.json b/src/generated/resources/data/forge/tags/items/tools/shields.json deleted file mode 100644 index 0f2454ce043..00000000000 --- a/src/generated/resources/data/forge/tags/items/tools/shields.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:shield" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/tools/tridents.json b/src/generated/resources/data/forge/tags/items/tools/tridents.json deleted file mode 100644 index 7a2c450bc74..00000000000 --- a/src/generated/resources/data/forge/tags/items/tools/tridents.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:trident" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_cave.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_cave.json deleted file mode 100644 index 21a70cfeec4..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_cave.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "minecraft:lush_caves", - "minecraft:dripstone_caves", - "minecraft:deep_dark" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_cold.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_cold.json deleted file mode 100644 index 75f9c80b3de..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_cold.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "#forge:is_cold/overworld", - { - "id": "#forge:is_cold/nether", - "required": false - }, - "#forge:is_cold/end" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_cold/end.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_cold/end.json deleted file mode 100644 index 73d3eff3b0e..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_cold/end.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "values": [ - "minecraft:the_end", - "minecraft:small_end_islands", - "minecraft:end_midlands", - "minecraft:end_highlands", - "minecraft:end_barrens" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_cold/overworld.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_cold/overworld.json deleted file mode 100644 index 4d7cf8a9574..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_cold/overworld.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "values": [ - "minecraft:taiga", - "minecraft:frozen_ocean", - "minecraft:frozen_river", - "minecraft:snowy_plains", - "minecraft:snowy_beach", - "minecraft:snowy_taiga", - "minecraft:old_growth_pine_taiga", - "minecraft:grove", - "minecraft:snowy_slopes", - "minecraft:jagged_peaks", - "minecraft:frozen_peaks", - "minecraft:cold_ocean", - "minecraft:deep_cold_ocean", - "minecraft:deep_frozen_ocean", - "minecraft:ice_spikes" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_coniferous.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_coniferous.json deleted file mode 100644 index 6c114dbc656..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_coniferous.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "minecraft:taiga", - "minecraft:snowy_taiga", - "minecraft:old_growth_pine_taiga", - "minecraft:grove" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_dense.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_dense.json deleted file mode 100644 index fa16b4cc6b1..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_dense.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "values": [ - "#forge:is_dense/overworld", - { - "id": "#forge:is_dense/nether", - "required": false - }, - { - "id": "#forge:is_dense/end", - "required": false - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_dense/overworld.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_dense/overworld.json deleted file mode 100644 index 9491a24bc8b..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_dense/overworld.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "minecraft:jungle", - "minecraft:dark_forest", - "minecraft:old_growth_birch_forest", - "minecraft:old_growth_spruce_taiga" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_desert.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_desert.json deleted file mode 100644 index f1a8ccb6429..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_desert.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:desert" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_dry.json deleted file mode 100644 index 28d35de201d..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "#forge:is_dry/overworld", - "#forge:is_dry/nether", - "#forge:is_dry/end" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/end.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/end.json deleted file mode 100644 index 73d3eff3b0e..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/end.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "values": [ - "minecraft:the_end", - "minecraft:small_end_islands", - "minecraft:end_midlands", - "minecraft:end_highlands", - "minecraft:end_barrens" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/nether.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/nether.json deleted file mode 100644 index 340c9d161b2..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/nether.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "values": [ - "minecraft:nether_wastes", - "minecraft:soul_sand_valley", - "minecraft:crimson_forest", - "minecraft:warped_forest", - "minecraft:basalt_deltas" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/overworld.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/overworld.json deleted file mode 100644 index 5f0fa0bfeef..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_dry/overworld.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "values": [ - "minecraft:desert", - "minecraft:badlands", - "minecraft:wooded_badlands", - "minecraft:windswept_savanna", - "minecraft:eroded_badlands" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_hot.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_hot.json deleted file mode 100644 index 6559f017e60..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_hot.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "values": [ - "#forge:is_hot/overworld", - "#forge:is_hot/nether", - { - "id": "#forge:is_hot/end", - "required": false - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_hot/nether.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_hot/nether.json deleted file mode 100644 index 340c9d161b2..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_hot/nether.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "values": [ - "minecraft:nether_wastes", - "minecraft:soul_sand_valley", - "minecraft:crimson_forest", - "minecraft:warped_forest", - "minecraft:basalt_deltas" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_hot/overworld.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_hot/overworld.json deleted file mode 100644 index f283627eb92..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_hot/overworld.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "values": [ - "minecraft:desert", - "minecraft:jungle", - "minecraft:sparse_jungle", - "minecraft:savanna", - "minecraft:savanna_plateau", - "minecraft:stony_peaks", - "minecraft:warm_ocean", - "minecraft:windswept_savanna", - "minecraft:eroded_badlands", - "minecraft:bamboo_jungle", - "minecraft:mangrove_swamp" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_lush.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_lush.json deleted file mode 100644 index 14035f0a54d..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_lush.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:lush_caves" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_mountain.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_mountain.json deleted file mode 100644 index 859b3500796..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_mountain.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#forge:is_peak", - "#forge:is_slope" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_mushroom.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_mushroom.json deleted file mode 100644 index 05d85d951d7..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_mushroom.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:mushroom_fields" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_peak.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_peak.json deleted file mode 100644 index c9597b86d04..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_peak.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "minecraft:jagged_peaks", - "minecraft:frozen_peaks", - "minecraft:stony_peaks" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_plains.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_plains.json deleted file mode 100644 index 9028b691af0..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_plains.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "minecraft:plains", - "minecraft:snowy_plains", - "minecraft:meadow", - "minecraft:sunflower_plains" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_plateau.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_plateau.json deleted file mode 100644 index 2fb321e9b71..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_plateau.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "values": [ - "minecraft:savanna_plateau", - "minecraft:wooded_badlands", - "minecraft:meadow" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_sandy.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_sandy.json deleted file mode 100644 index 1ae7158316d..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_sandy.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "values": [ - "minecraft:desert", - "minecraft:beach", - "minecraft:badlands", - "minecraft:wooded_badlands" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_slope.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_slope.json deleted file mode 100644 index 453f828613d..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_slope.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "values": [ - "minecraft:savanna_plateau", - "minecraft:wooded_badlands", - "minecraft:meadow", - "minecraft:grove", - "minecraft:snowy_slopes" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_snowy.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_snowy.json deleted file mode 100644 index e1310e08ee7..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_snowy.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "values": [ - "minecraft:frozen_ocean", - "minecraft:frozen_river", - "minecraft:snowy_plains", - "minecraft:snowy_beach", - "minecraft:snowy_taiga", - "minecraft:grove", - "minecraft:snowy_slopes", - "minecraft:jagged_peaks", - "minecraft:frozen_peaks", - "minecraft:ice_spikes" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_sparse.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_sparse.json deleted file mode 100644 index 7680132431c..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_sparse.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "values": [ - "#forge:is_sparse/overworld", - { - "id": "#forge:is_sparse/nether", - "required": false - }, - { - "id": "#forge:is_sparse/end", - "required": false - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_sparse/overworld.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_sparse/overworld.json deleted file mode 100644 index e9652824e63..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_sparse/overworld.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "values": [ - "minecraft:windswept_forest", - "minecraft:savanna", - "minecraft:savanna_plateau", - "minecraft:wooded_badlands", - "minecraft:snowy_slopes", - "minecraft:jagged_peaks", - "minecraft:frozen_peaks", - "minecraft:windswept_gravelly_hills", - "minecraft:windswept_savanna", - "minecraft:eroded_badlands", - "minecraft:dripstone_caves" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_spooky.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_spooky.json deleted file mode 100644 index 9255238fa65..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_spooky.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:dark_forest", - "minecraft:deep_dark" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_swamp.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_swamp.json deleted file mode 100644 index 0f5eb22e0c7..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_swamp.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "minecraft:swamp", - "minecraft:mangrove_swamp" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_underground.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_underground.json deleted file mode 100644 index c55f2d526e2..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_underground.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "#forge:is_cave" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_void.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_void.json deleted file mode 100644 index f55aea66711..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_void.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "minecraft:the_void" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_water.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_water.json deleted file mode 100644 index 800c17196b5..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_water.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "values": [ - "#minecraft:is_ocean", - "#minecraft:is_river" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_wet.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_wet.json deleted file mode 100644 index b3552612753..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_wet.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "values": [ - "#forge:is_wet/overworld", - { - "id": "#forge:is_wet/nether", - "required": false - }, - { - "id": "#forge:is_wet/end", - "required": false - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/worldgen/biome/is_wet/overworld.json b/src/generated/resources/data/forge/tags/worldgen/biome/is_wet/overworld.json deleted file mode 100644 index e5e5a885c5e..00000000000 --- a/src/generated/resources/data/forge/tags/worldgen/biome/is_wet/overworld.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "values": [ - "minecraft:swamp", - "minecraft:jungle", - "minecraft:sparse_jungle", - "minecraft:beach", - "minecraft:bamboo_jungle", - "minecraft:lush_caves", - "minecraft:mangrove_swamp" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/advancements/husbandry/wax_off.json b/src/generated/resources/data/minecraft/advancements/husbandry/wax_off.json index 6825cb6c6ad..6b4c17a11d0 100644 --- a/src/generated/resources/data/minecraft/advancements/husbandry/wax_off.json +++ b/src/generated/resources/data/minecraft/advancements/husbandry/wax_off.json @@ -52,8 +52,9 @@ { "condition": "minecraft:match_tool", "predicate": { - "type": "neoforge:tool_action", - "value": "axe_wax_off" + "predicates": { + "neoforge:tool_action": "axe_wax_off" + } } } ] @@ -66,8 +67,8 @@ "translate": "advancements.husbandry.wax_off.description" }, "icon": { - "item": "minecraft:stone_axe", - "nbt": "{Damage:0}" + "count": 1, + "id": "minecraft:stone_axe" }, "title": { "translate": "advancements.husbandry.wax_off.title" diff --git a/src/generated/resources/data/minecraft/advancements/nether/distract_piglin.json b/src/generated/resources/data/minecraft/advancements/nether/distract_piglin.json index 91473c27919..d95c59aea86 100644 --- a/src/generated/resources/data/minecraft/advancements/nether/distract_piglin.json +++ b/src/generated/resources/data/minecraft/advancements/nether/distract_piglin.json @@ -16,7 +16,7 @@ } ], "item": { - "tag": "minecraft:piglin_loved" + "items": "#minecraft:piglin_loved" }, "player": [ { @@ -25,7 +25,9 @@ "condition": "minecraft:entity_properties", "entity": "this", "predicate": { - "type": "neoforge:piglin_neutral_armor" + "type_specific": { + "type": "neoforge:piglin_neutral_armor" + } } } } @@ -48,7 +50,9 @@ } ], "item": { - "type": "neoforge:piglin_currency" + "predicates": { + "neoforge:piglin_currency": {} + } }, "player": [ { @@ -57,7 +61,9 @@ "condition": "minecraft:entity_properties", "entity": "this", "predicate": { - "type": "neoforge:piglin_neutral_armor" + "type_specific": { + "type": "neoforge:piglin_neutral_armor" + } } } } @@ -71,7 +77,8 @@ "translate": "advancements.nether.distract_piglin.description" }, "icon": { - "item": "minecraft:gold_ingot" + "count": 1, + "id": "minecraft:gold_ingot" }, "title": { "translate": "advancements.nether.distract_piglin.title" diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/acacia_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/acacia_leaves.json index 053fad3dfb6..ad62ade7fb6 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/acacia_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/acacia_leaves.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -74,14 +76,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/azalea_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/azalea_leaves.json index dafffa1f1da..84e3c81e0c0 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/azalea_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/azalea_leaves.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -74,14 +76,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/birch_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/birch_leaves.json index 62f284c9106..64b1e362443 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/birch_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/birch_leaves.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -74,14 +76,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/cherry_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/cherry_leaves.json index 2c99b22ab85..b7fbba05683 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/cherry_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/cherry_leaves.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -74,14 +76,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/cobweb.json b/src/generated/resources/data/minecraft/loot_tables/blocks/cobweb.json index 3ca942ab2ae..99726d20d56 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/cobweb.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/cobweb.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/dark_oak_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/dark_oak_leaves.json index 3802bb96e8f..cdb767856aa 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/dark_oak_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/dark_oak_leaves.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -74,14 +76,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -138,14 +142,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/flowering_azalea_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/flowering_azalea_leaves.json index 1a06451836d..9f453208c57 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/flowering_azalea_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/flowering_azalea_leaves.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -74,14 +76,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/jungle_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/jungle_leaves.json index 2588c00aa33..cc5cd2dfdbd 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/jungle_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/jungle_leaves.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -75,14 +77,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/large_fern.json b/src/generated/resources/data/minecraft/loot_tables/blocks/large_fern.json index b91fdd60da1..891c482253d 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/large_fern.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/large_fern.json @@ -16,9 +16,7 @@ "offsetY": 1, "predicate": { "block": { - "blocks": [ - "minecraft:large_fern" - ], + "blocks": "minecraft:large_fern", "state": { "half": "upper" } @@ -80,9 +78,7 @@ "offsetY": -1, "predicate": { "block": { - "blocks": [ - "minecraft:large_fern" - ], + "blocks": "minecraft:large_fern", "state": { "half": "lower" } diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/mangrove_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/mangrove_leaves.json index 1a43c8c7559..24da39e3891 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/mangrove_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/mangrove_leaves.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/oak_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/oak_leaves.json index b34adf03718..363ec89e63e 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/oak_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/oak_leaves.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -74,14 +76,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -138,14 +142,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/spruce_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/spruce_leaves.json index 0de52d806c2..6d8c7e4b075 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/spruce_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/spruce_leaves.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] @@ -74,14 +76,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/tall_grass.json b/src/generated/resources/data/minecraft/loot_tables/blocks/tall_grass.json index db268a78d2b..d71351c438e 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/tall_grass.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/tall_grass.json @@ -16,9 +16,7 @@ "offsetY": 1, "predicate": { "block": { - "blocks": [ - "minecraft:tall_grass" - ], + "blocks": "minecraft:tall_grass", "state": { "half": "upper" } @@ -80,9 +78,7 @@ "offsetY": -1, "predicate": { "block": { - "blocks": [ - "minecraft:tall_grass" - ], + "blocks": "minecraft:tall_grass", "state": { "half": "lower" } diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines.json b/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines.json index e5f5fe4229c..f44704c0c89 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines_plant.json b/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines_plant.json index f39588c95ca..028b00e9e61 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines_plant.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines_plant.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines.json b/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines.json index 38805e18d75..7b05c673746 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines_plant.json b/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines_plant.json index d1a6b33e6e7..2b4ea7b8063 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines_plant.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines_plant.json @@ -20,14 +20,16 @@ { "condition": "minecraft:match_tool", "predicate": { - "enchantments": [ - { - "enchantment": "minecraft:silk_touch", - "levels": { - "min": 1 + "predicates": { + "minecraft:enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } } - } - ] + ] + } } } ] diff --git a/src/generated/resources/data/minecraft/recipes/acacia_chest_boat.json b/src/generated/resources/data/minecraft/recipes/acacia_chest_boat.json index f20818e69a2..c677340129b 100644 --- a/src/generated/resources/data/minecraft/recipes/acacia_chest_boat.json +++ b/src/generated/resources/data/minecraft/recipes/acacia_chest_boat.json @@ -4,13 +4,14 @@ "group": "chest_boat", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:acacia_boat" } ], "result": { - "item": "minecraft:acacia_chest_boat" + "count": 1, + "id": "minecraft:acacia_chest_boat" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/acacia_fence.json b/src/generated/resources/data/minecraft/recipes/acacia_fence.json index d545c439a68..1df661b7b10 100644 --- a/src/generated/resources/data/minecraft/recipes/acacia_fence.json +++ b/src/generated/resources/data/minecraft/recipes/acacia_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:acacia_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:acacia_fence" + "id": "minecraft:acacia_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/acacia_fence_gate.json b/src/generated/resources/data/minecraft/recipes/acacia_fence_gate.json index 027948967b9..01c8f1d4615 100644 --- a/src/generated/resources/data/minecraft/recipes/acacia_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/acacia_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:acacia_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:acacia_fence_gate" + "count": 1, + "id": "minecraft:acacia_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/acacia_sign.json b/src/generated/resources/data/minecraft/recipes/acacia_sign.json index ab7495d12de..8591a10c688 100644 --- a/src/generated/resources/data/minecraft/recipes/acacia_sign.json +++ b/src/generated/resources/data/minecraft/recipes/acacia_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:acacia_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:acacia_sign" + "id": "minecraft:acacia_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/activator_rail.json b/src/generated/resources/data/minecraft/recipes/activator_rail.json index 9f682df7531..f3e8a6d92ab 100644 --- a/src/generated/resources/data/minecraft/recipes/activator_rail.json +++ b/src/generated/resources/data/minecraft/recipes/activator_rail.json @@ -6,10 +6,10 @@ "item": "minecraft:redstone_torch" }, "S": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -19,6 +19,6 @@ ], "result": { "count": 6, - "item": "minecraft:activator_rail" + "id": "minecraft:activator_rail" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/andesite.json b/src/generated/resources/data/minecraft/recipes/andesite.json index 4f70b2cea2c..909e6271f90 100644 --- a/src/generated/resources/data/minecraft/recipes/andesite.json +++ b/src/generated/resources/data/minecraft/recipes/andesite.json @@ -6,11 +6,11 @@ "item": "minecraft:diorite" }, { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" } ], "result": { "count": 2, - "item": "minecraft:andesite" + "id": "minecraft:andesite" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/anvil.json b/src/generated/resources/data/minecraft/recipes/anvil.json index 33203f2d58b..405668a7af6 100644 --- a/src/generated/resources/data/minecraft/recipes/anvil.json +++ b/src/generated/resources/data/minecraft/recipes/anvil.json @@ -6,7 +6,7 @@ "item": "minecraft:iron_block" }, "i": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ "iii" ], "result": { - "item": "minecraft:anvil" + "count": 1, + "id": "minecraft:anvil" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/armor_stand.json b/src/generated/resources/data/minecraft/recipes/armor_stand.json index 54da4b9a02f..55e7dbeaff9 100644 --- a/src/generated/resources/data/minecraft/recipes/armor_stand.json +++ b/src/generated/resources/data/minecraft/recipes/armor_stand.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "/": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "_": { "item": "minecraft:smooth_stone_slab" @@ -15,6 +15,7 @@ "/_/" ], "result": { - "item": "minecraft:armor_stand" + "count": 1, + "id": "minecraft:armor_stand" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/arrow.json b/src/generated/resources/data/minecraft/recipes/arrow.json index c4eba0d814b..5b160e1c5a4 100644 --- a/src/generated/resources/data/minecraft/recipes/arrow.json +++ b/src/generated/resources/data/minecraft/recipes/arrow.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "item": "minecraft:flint" @@ -19,6 +19,6 @@ ], "result": { "count": 4, - "item": "minecraft:arrow" + "id": "minecraft:arrow" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bamboo_chest_raft.json b/src/generated/resources/data/minecraft/recipes/bamboo_chest_raft.json index b602612c1b7..f50400493bb 100644 --- a/src/generated/resources/data/minecraft/recipes/bamboo_chest_raft.json +++ b/src/generated/resources/data/minecraft/recipes/bamboo_chest_raft.json @@ -4,13 +4,14 @@ "group": "chest_boat", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:bamboo_raft" } ], "result": { - "item": "minecraft:bamboo_chest_raft" + "count": 1, + "id": "minecraft:bamboo_chest_raft" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bamboo_fence.json b/src/generated/resources/data/minecraft/recipes/bamboo_fence.json index 94bfe53d33c..190c83b6901 100644 --- a/src/generated/resources/data/minecraft/recipes/bamboo_fence.json +++ b/src/generated/resources/data/minecraft/recipes/bamboo_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:bamboo_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:bamboo_fence" + "id": "minecraft:bamboo_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bamboo_fence_gate.json b/src/generated/resources/data/minecraft/recipes/bamboo_fence_gate.json index 23fdba6fe75..1d2e0f107b4 100644 --- a/src/generated/resources/data/minecraft/recipes/bamboo_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/bamboo_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:bamboo_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:bamboo_fence_gate" + "count": 1, + "id": "minecraft:bamboo_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bamboo_sign.json b/src/generated/resources/data/minecraft/recipes/bamboo_sign.json index 1c78cf6ddb7..2ea528857fe 100644 --- a/src/generated/resources/data/minecraft/recipes/bamboo_sign.json +++ b/src/generated/resources/data/minecraft/recipes/bamboo_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:bamboo_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:bamboo_sign" + "id": "minecraft:bamboo_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/birch_chest_boat.json b/src/generated/resources/data/minecraft/recipes/birch_chest_boat.json index 7fe3c649ab9..6d5286ebbec 100644 --- a/src/generated/resources/data/minecraft/recipes/birch_chest_boat.json +++ b/src/generated/resources/data/minecraft/recipes/birch_chest_boat.json @@ -4,13 +4,14 @@ "group": "chest_boat", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:birch_boat" } ], "result": { - "item": "minecraft:birch_chest_boat" + "count": 1, + "id": "minecraft:birch_chest_boat" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/birch_fence.json b/src/generated/resources/data/minecraft/recipes/birch_fence.json index 170c1c2520b..fef03a747d1 100644 --- a/src/generated/resources/data/minecraft/recipes/birch_fence.json +++ b/src/generated/resources/data/minecraft/recipes/birch_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:birch_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:birch_fence" + "id": "minecraft:birch_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/birch_fence_gate.json b/src/generated/resources/data/minecraft/recipes/birch_fence_gate.json index 325773a2eb7..c0f380a750f 100644 --- a/src/generated/resources/data/minecraft/recipes/birch_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/birch_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:birch_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:birch_fence_gate" + "count": 1, + "id": "minecraft:birch_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/birch_sign.json b/src/generated/resources/data/minecraft/recipes/birch_sign.json index 7a98a35feb0..c7a1c36a779 100644 --- a/src/generated/resources/data/minecraft/recipes/birch_sign.json +++ b/src/generated/resources/data/minecraft/recipes/birch_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:birch_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:birch_sign" + "id": "minecraft:birch_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/black_banner.json b/src/generated/resources/data/minecraft/recipes/black_banner.json index 8f0a69aab44..26cb29a8775 100644 --- a/src/generated/resources/data/minecraft/recipes/black_banner.json +++ b/src/generated/resources/data/minecraft/recipes/black_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:black_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:black_banner" + "count": 1, + "id": "minecraft:black_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/blast_furnace.json b/src/generated/resources/data/minecraft/recipes/blast_furnace.json index 1c34a6149c8..6b73dce3066 100644 --- a/src/generated/resources/data/minecraft/recipes/blast_furnace.json +++ b/src/generated/resources/data/minecraft/recipes/blast_furnace.json @@ -6,7 +6,7 @@ "item": "minecraft:smooth_stone" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "X": { "item": "minecraft:furnace" @@ -18,6 +18,7 @@ "###" ], "result": { - "item": "minecraft:blast_furnace" + "count": 1, + "id": "minecraft:blast_furnace" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/blue_banner.json b/src/generated/resources/data/minecraft/recipes/blue_banner.json index 2270bf926c9..afb3cddb994 100644 --- a/src/generated/resources/data/minecraft/recipes/blue_banner.json +++ b/src/generated/resources/data/minecraft/recipes/blue_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:blue_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:blue_banner" + "count": 1, + "id": "minecraft:blue_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bow.json b/src/generated/resources/data/minecraft/recipes/bow.json index 6148fed74c1..b531f496f44 100644 --- a/src/generated/resources/data/minecraft/recipes/bow.json +++ b/src/generated/resources/data/minecraft/recipes/bow.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -15,6 +15,7 @@ " #X" ], "result": { - "item": "minecraft:bow" + "count": 1, + "id": "minecraft:bow" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/brown_banner.json b/src/generated/resources/data/minecraft/recipes/brown_banner.json index 71bb73f30a4..b3b8c24a198 100644 --- a/src/generated/resources/data/minecraft/recipes/brown_banner.json +++ b/src/generated/resources/data/minecraft/recipes/brown_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:brown_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:brown_banner" + "count": 1, + "id": "minecraft:brown_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/brush.json b/src/generated/resources/data/minecraft/recipes/brush.json index 3c5b69dabed..ff366537c63 100644 --- a/src/generated/resources/data/minecraft/recipes/brush.json +++ b/src/generated/resources/data/minecraft/recipes/brush.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:ingots/copper" + "tag": "c:ingots/copper" }, "I": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "item": "minecraft:feather" @@ -18,6 +18,7 @@ "I" ], "result": { - "item": "minecraft:brush" + "count": 1, + "id": "minecraft:brush" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bucket.json b/src/generated/resources/data/minecraft/recipes/bucket.json index 22912ba1511..6da8ba3ded4 100644 --- a/src/generated/resources/data/minecraft/recipes/bucket.json +++ b/src/generated/resources/data/minecraft/recipes/bucket.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -11,6 +11,7 @@ " # " ], "result": { - "item": "minecraft:bucket" + "count": 1, + "id": "minecraft:bucket" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/calibrated_sculk_sensor.json b/src/generated/resources/data/minecraft/recipes/calibrated_sculk_sensor.json index e71178e1561..5cb919ad6c5 100644 --- a/src/generated/resources/data/minecraft/recipes/calibrated_sculk_sensor.json +++ b/src/generated/resources/data/minecraft/recipes/calibrated_sculk_sensor.json @@ -3,7 +3,7 @@ "category": "redstone", "key": { "#": { - "tag": "forge:gems/amethyst" + "tag": "c:gems/amethyst" }, "X": { "item": "minecraft:sculk_sensor" @@ -14,6 +14,7 @@ "#X#" ], "result": { - "item": "minecraft:calibrated_sculk_sensor" + "count": 1, + "id": "minecraft:calibrated_sculk_sensor" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/campfire.json b/src/generated/resources/data/minecraft/recipes/campfire.json index d329eb47380..de8dffe49ad 100644 --- a/src/generated/resources/data/minecraft/recipes/campfire.json +++ b/src/generated/resources/data/minecraft/recipes/campfire.json @@ -9,7 +9,7 @@ "tag": "minecraft:logs" }, "S": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -18,6 +18,7 @@ "LLL" ], "result": { - "item": "minecraft:campfire" + "count": 1, + "id": "minecraft:campfire" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/candle.json b/src/generated/resources/data/minecraft/recipes/candle.json index add9d35c832..c19d2b0e7be 100644 --- a/src/generated/resources/data/minecraft/recipes/candle.json +++ b/src/generated/resources/data/minecraft/recipes/candle.json @@ -6,7 +6,7 @@ "item": "minecraft:honeycomb" }, "S": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -14,6 +14,7 @@ "H" ], "result": { - "item": "minecraft:candle" + "count": 1, + "id": "minecraft:candle" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/cauldron.json b/src/generated/resources/data/minecraft/recipes/cauldron.json index 982e8e6aa01..9fbb8b5af24 100644 --- a/src/generated/resources/data/minecraft/recipes/cauldron.json +++ b/src/generated/resources/data/minecraft/recipes/cauldron.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -12,6 +12,7 @@ "###" ], "result": { - "item": "minecraft:cauldron" + "count": 1, + "id": "minecraft:cauldron" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/chain.json b/src/generated/resources/data/minecraft/recipes/chain.json index b8dc25358a6..057c9304ced 100644 --- a/src/generated/resources/data/minecraft/recipes/chain.json +++ b/src/generated/resources/data/minecraft/recipes/chain.json @@ -3,10 +3,10 @@ "category": "misc", "key": { "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "N": { - "tag": "forge:nuggets/iron" + "tag": "c:nuggets/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ "N" ], "result": { - "item": "minecraft:chain" + "count": 1, + "id": "minecraft:chain" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/cherry_chest_boat.json b/src/generated/resources/data/minecraft/recipes/cherry_chest_boat.json index c8e78832c65..ee739ec5a20 100644 --- a/src/generated/resources/data/minecraft/recipes/cherry_chest_boat.json +++ b/src/generated/resources/data/minecraft/recipes/cherry_chest_boat.json @@ -4,13 +4,14 @@ "group": "chest_boat", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:cherry_boat" } ], "result": { - "item": "minecraft:cherry_chest_boat" + "count": 1, + "id": "minecraft:cherry_chest_boat" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/cherry_fence.json b/src/generated/resources/data/minecraft/recipes/cherry_fence.json index 7dd13ae3ace..c1993868814 100644 --- a/src/generated/resources/data/minecraft/recipes/cherry_fence.json +++ b/src/generated/resources/data/minecraft/recipes/cherry_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:cherry_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:cherry_fence" + "id": "minecraft:cherry_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/cherry_fence_gate.json b/src/generated/resources/data/minecraft/recipes/cherry_fence_gate.json index 5d4ed45afce..d3f7509557f 100644 --- a/src/generated/resources/data/minecraft/recipes/cherry_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/cherry_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:cherry_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:cherry_fence_gate" + "count": 1, + "id": "minecraft:cherry_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/cherry_sign.json b/src/generated/resources/data/minecraft/recipes/cherry_sign.json index 091031dca49..fbd15b6ef9a 100644 --- a/src/generated/resources/data/minecraft/recipes/cherry_sign.json +++ b/src/generated/resources/data/minecraft/recipes/cherry_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:cherry_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:cherry_sign" + "id": "minecraft:cherry_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/chest_minecart.json b/src/generated/resources/data/minecraft/recipes/chest_minecart.json index 99c77806210..bbf4896a308 100644 --- a/src/generated/resources/data/minecraft/recipes/chest_minecart.json +++ b/src/generated/resources/data/minecraft/recipes/chest_minecart.json @@ -3,13 +3,14 @@ "category": "misc", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:minecart" } ], "result": { - "item": "minecraft:chest_minecart" + "count": 1, + "id": "minecraft:chest_minecart" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/clock.json b/src/generated/resources/data/minecraft/recipes/clock.json index 31e02ad1163..276fe557efa 100644 --- a/src/generated/resources/data/minecraft/recipes/clock.json +++ b/src/generated/resources/data/minecraft/recipes/clock.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "X": { "item": "minecraft:redstone" @@ -15,6 +15,7 @@ " # " ], "result": { - "item": "minecraft:clock" + "count": 1, + "id": "minecraft:clock" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/coast_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/coast_armor_trim_smithing_template.json index 1389c117ea1..b507e536a10 100644 --- a/src/generated/resources/data/minecraft/recipes/coast_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/coast_armor_trim_smithing_template.json @@ -3,10 +3,10 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, "S": { "item": "minecraft:coast_armor_trim_smithing_template" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:coast_armor_trim_smithing_template" + "id": "minecraft:coast_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/compass.json b/src/generated/resources/data/minecraft/recipes/compass.json index f1b62261330..3c7cbcb015a 100644 --- a/src/generated/resources/data/minecraft/recipes/compass.json +++ b/src/generated/resources/data/minecraft/recipes/compass.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "X": { "item": "minecraft:redstone" @@ -15,6 +15,7 @@ " # " ], "result": { - "item": "minecraft:compass" + "count": 1, + "id": "minecraft:compass" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/crimson_fence.json b/src/generated/resources/data/minecraft/recipes/crimson_fence.json index fd4c99174ea..7b9e174282a 100644 --- a/src/generated/resources/data/minecraft/recipes/crimson_fence.json +++ b/src/generated/resources/data/minecraft/recipes/crimson_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:crimson_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:crimson_fence" + "id": "minecraft:crimson_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/crimson_fence_gate.json b/src/generated/resources/data/minecraft/recipes/crimson_fence_gate.json index b8d6cb88ddc..6953799156f 100644 --- a/src/generated/resources/data/minecraft/recipes/crimson_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/crimson_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:crimson_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:crimson_fence_gate" + "count": 1, + "id": "minecraft:crimson_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/crimson_sign.json b/src/generated/resources/data/minecraft/recipes/crimson_sign.json index 2d26330c3d8..3bb6d2cd40a 100644 --- a/src/generated/resources/data/minecraft/recipes/crimson_sign.json +++ b/src/generated/resources/data/minecraft/recipes/crimson_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:crimson_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:crimson_sign" + "id": "minecraft:crimson_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/crossbow.json b/src/generated/resources/data/minecraft/recipes/crossbow.json index bfacf24beb8..87d3fb5bafb 100644 --- a/src/generated/resources/data/minecraft/recipes/crossbow.json +++ b/src/generated/resources/data/minecraft/recipes/crossbow.json @@ -3,16 +3,16 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "$": { "item": "minecraft:tripwire_hook" }, "&": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "~": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -21,6 +21,7 @@ " # " ], "result": { - "item": "minecraft:crossbow" + "count": 1, + "id": "minecraft:crossbow" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/cyan_banner.json b/src/generated/resources/data/minecraft/recipes/cyan_banner.json index 2eae740c437..7c029672c6b 100644 --- a/src/generated/resources/data/minecraft/recipes/cyan_banner.json +++ b/src/generated/resources/data/minecraft/recipes/cyan_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:cyan_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:cyan_banner" + "count": 1, + "id": "minecraft:cyan_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/dark_oak_chest_boat.json b/src/generated/resources/data/minecraft/recipes/dark_oak_chest_boat.json index 783c44a9fc6..aae00295f7a 100644 --- a/src/generated/resources/data/minecraft/recipes/dark_oak_chest_boat.json +++ b/src/generated/resources/data/minecraft/recipes/dark_oak_chest_boat.json @@ -4,13 +4,14 @@ "group": "chest_boat", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:dark_oak_boat" } ], "result": { - "item": "minecraft:dark_oak_chest_boat" + "count": 1, + "id": "minecraft:dark_oak_chest_boat" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/dark_oak_fence.json b/src/generated/resources/data/minecraft/recipes/dark_oak_fence.json index f25b7a205ab..ba37e3f888d 100644 --- a/src/generated/resources/data/minecraft/recipes/dark_oak_fence.json +++ b/src/generated/resources/data/minecraft/recipes/dark_oak_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:dark_oak_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:dark_oak_fence" + "id": "minecraft:dark_oak_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/dark_oak_fence_gate.json b/src/generated/resources/data/minecraft/recipes/dark_oak_fence_gate.json index 53d878a1024..b8365d4a284 100644 --- a/src/generated/resources/data/minecraft/recipes/dark_oak_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/dark_oak_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:dark_oak_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:dark_oak_fence_gate" + "count": 1, + "id": "minecraft:dark_oak_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/dark_oak_sign.json b/src/generated/resources/data/minecraft/recipes/dark_oak_sign.json index 286e2757090..4d53a6d24f7 100644 --- a/src/generated/resources/data/minecraft/recipes/dark_oak_sign.json +++ b/src/generated/resources/data/minecraft/recipes/dark_oak_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:dark_oak_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:dark_oak_sign" + "id": "minecraft:dark_oak_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/detector_rail.json b/src/generated/resources/data/minecraft/recipes/detector_rail.json index ddafa7ab5b9..97238ca6e46 100644 --- a/src/generated/resources/data/minecraft/recipes/detector_rail.json +++ b/src/generated/resources/data/minecraft/recipes/detector_rail.json @@ -9,7 +9,7 @@ "item": "minecraft:redstone" }, "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -19,6 +19,6 @@ ], "result": { "count": 6, - "item": "minecraft:detector_rail" + "id": "minecraft:detector_rail" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diamond_axe.json b/src/generated/resources/data/minecraft/recipes/diamond_axe.json index fa33917a094..118f99e563b 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_axe.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_axe.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:diamond_axe" + "count": 1, + "id": "minecraft:diamond_axe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diamond_boots.json b/src/generated/resources/data/minecraft/recipes/diamond_boots.json index 0ab7eb99fe9..7d6ace85e71 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_boots.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_boots.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -11,6 +11,7 @@ "X X" ], "result": { - "item": "minecraft:diamond_boots" + "count": 1, + "id": "minecraft:diamond_boots" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diamond_chestplate.json b/src/generated/resources/data/minecraft/recipes/diamond_chestplate.json index 1cd18f4c751..46ad865dff4 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_chestplate.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_chestplate.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -12,6 +12,7 @@ "XXX" ], "result": { - "item": "minecraft:diamond_chestplate" + "count": 1, + "id": "minecraft:diamond_chestplate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diamond_helmet.json b/src/generated/resources/data/minecraft/recipes/diamond_helmet.json index 9671c540d3c..50a88a09678 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_helmet.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_helmet.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -11,6 +11,7 @@ "X X" ], "result": { - "item": "minecraft:diamond_helmet" + "count": 1, + "id": "minecraft:diamond_helmet" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diamond_hoe.json b/src/generated/resources/data/minecraft/recipes/diamond_hoe.json index ccd0e487687..b2bf02dd075 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_hoe.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_hoe.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:diamond_hoe" + "count": 1, + "id": "minecraft:diamond_hoe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diamond_leggings.json b/src/generated/resources/data/minecraft/recipes/diamond_leggings.json index f9cbdcd7381..5df56358369 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_leggings.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_leggings.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -12,6 +12,7 @@ "X X" ], "result": { - "item": "minecraft:diamond_leggings" + "count": 1, + "id": "minecraft:diamond_leggings" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diamond_pickaxe.json b/src/generated/resources/data/minecraft/recipes/diamond_pickaxe.json index affd0a30831..3397993a01f 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_pickaxe.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_pickaxe.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -15,6 +15,7 @@ " # " ], "result": { - "item": "minecraft:diamond_pickaxe" + "count": 1, + "id": "minecraft:diamond_pickaxe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diamond_shovel.json b/src/generated/resources/data/minecraft/recipes/diamond_shovel.json index cb8282be2c2..ae4f9eb9852 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_shovel.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_shovel.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:diamond_shovel" + "count": 1, + "id": "minecraft:diamond_shovel" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diamond_sword.json b/src/generated/resources/data/minecraft/recipes/diamond_sword.json index de7b7d161b0..338ca632406 100644 --- a/src/generated/resources/data/minecraft/recipes/diamond_sword.json +++ b/src/generated/resources/data/minecraft/recipes/diamond_sword.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:diamond_sword" + "count": 1, + "id": "minecraft:diamond_sword" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/diorite.json b/src/generated/resources/data/minecraft/recipes/diorite.json index 6dfb532dcff..54714b8f400 100644 --- a/src/generated/resources/data/minecraft/recipes/diorite.json +++ b/src/generated/resources/data/minecraft/recipes/diorite.json @@ -3,7 +3,7 @@ "category": "building", "key": { "C": { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, "Q": { "item": "minecraft:quartz" @@ -15,6 +15,6 @@ ], "result": { "count": 2, - "item": "minecraft:diorite" + "id": "minecraft:diorite" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/dispenser.json b/src/generated/resources/data/minecraft/recipes/dispenser.json index 20076eae314..6ab105c14ca 100644 --- a/src/generated/resources/data/minecraft/recipes/dispenser.json +++ b/src/generated/resources/data/minecraft/recipes/dispenser.json @@ -3,7 +3,7 @@ "category": "redstone", "key": { "#": { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, "R": { "item": "minecraft:redstone" @@ -18,6 +18,7 @@ "#R#" ], "result": { - "item": "minecraft:dispenser" + "count": 1, + "id": "minecraft:dispenser" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/dropper.json b/src/generated/resources/data/minecraft/recipes/dropper.json index 76c51a4fa69..e358894ca70 100644 --- a/src/generated/resources/data/minecraft/recipes/dropper.json +++ b/src/generated/resources/data/minecraft/recipes/dropper.json @@ -3,7 +3,7 @@ "category": "redstone", "key": { "#": { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, "R": { "item": "minecraft:redstone" @@ -15,6 +15,7 @@ "#R#" ], "result": { - "item": "minecraft:dropper" + "count": 1, + "id": "minecraft:dropper" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/dune_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/dune_armor_trim_smithing_template.json index f115d552d8d..905e1f3f0de 100644 --- a/src/generated/resources/data/minecraft/recipes/dune_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/dune_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:sandstone" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:dune_armor_trim_smithing_template" + "id": "minecraft:dune_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/enchanting_table.json b/src/generated/resources/data/minecraft/recipes/enchanting_table.json index a238995fb96..0b202c954e9 100644 --- a/src/generated/resources/data/minecraft/recipes/enchanting_table.json +++ b/src/generated/resources/data/minecraft/recipes/enchanting_table.json @@ -9,7 +9,7 @@ "item": "minecraft:book" }, "D": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -18,6 +18,7 @@ "###" ], "result": { - "item": "minecraft:enchanting_table" + "count": 1, + "id": "minecraft:enchanting_table" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/eye_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/eye_armor_trim_smithing_template.json index 8b4a3fd5152..f4183152ba4 100644 --- a/src/generated/resources/data/minecraft/recipes/eye_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/eye_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:end_stone" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:eye_armor_trim_smithing_template" + "id": "minecraft:eye_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/fishing_rod.json b/src/generated/resources/data/minecraft/recipes/fishing_rod.json index 8d6a5711492..72690672d37 100644 --- a/src/generated/resources/data/minecraft/recipes/fishing_rod.json +++ b/src/generated/resources/data/minecraft/recipes/fishing_rod.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -15,6 +15,7 @@ "# X" ], "result": { - "item": "minecraft:fishing_rod" + "count": 1, + "id": "minecraft:fishing_rod" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/flint_and_steel.json b/src/generated/resources/data/minecraft/recipes/flint_and_steel.json index 7181ac5d081..c1ecbca55f6 100644 --- a/src/generated/resources/data/minecraft/recipes/flint_and_steel.json +++ b/src/generated/resources/data/minecraft/recipes/flint_and_steel.json @@ -3,13 +3,14 @@ "category": "equipment", "ingredients": [ { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, { "item": "minecraft:flint" } ], "result": { - "item": "minecraft:flint_and_steel" + "count": 1, + "id": "minecraft:flint_and_steel" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/glistering_melon_slice.json b/src/generated/resources/data/minecraft/recipes/glistering_melon_slice.json index 26f7685da2d..52c02f8057f 100644 --- a/src/generated/resources/data/minecraft/recipes/glistering_melon_slice.json +++ b/src/generated/resources/data/minecraft/recipes/glistering_melon_slice.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:nuggets/gold" + "tag": "c:nuggets/gold" }, "X": { "item": "minecraft:melon_slice" @@ -15,6 +15,7 @@ "###" ], "result": { - "item": "minecraft:glistering_melon_slice" + "count": 1, + "id": "minecraft:glistering_melon_slice" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/gold_ingot_from_nuggets.json b/src/generated/resources/data/minecraft/recipes/gold_ingot_from_nuggets.json index 7b9dc62ee43..ca6e7b86744 100644 --- a/src/generated/resources/data/minecraft/recipes/gold_ingot_from_nuggets.json +++ b/src/generated/resources/data/minecraft/recipes/gold_ingot_from_nuggets.json @@ -4,7 +4,7 @@ "group": "gold_ingot", "key": { "#": { - "tag": "forge:nuggets/gold" + "tag": "c:nuggets/gold" } }, "pattern": [ @@ -13,6 +13,7 @@ "###" ], "result": { - "item": "minecraft:gold_ingot" + "count": 1, + "id": "minecraft:gold_ingot" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_apple.json b/src/generated/resources/data/minecraft/recipes/golden_apple.json index 674bf883d37..6839d31d1e0 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_apple.json +++ b/src/generated/resources/data/minecraft/recipes/golden_apple.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "X": { "item": "minecraft:apple" @@ -15,6 +15,7 @@ "###" ], "result": { - "item": "minecraft:golden_apple" + "count": 1, + "id": "minecraft:golden_apple" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_axe.json b/src/generated/resources/data/minecraft/recipes/golden_axe.json index 4811c860ad2..ed95ebdd0a2 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_axe.json +++ b/src/generated/resources/data/minecraft/recipes/golden_axe.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:golden_axe" + "count": 1, + "id": "minecraft:golden_axe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_boots.json b/src/generated/resources/data/minecraft/recipes/golden_boots.json index d5e15bc24f9..0b9010aa3c5 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_boots.json +++ b/src/generated/resources/data/minecraft/recipes/golden_boots.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -11,6 +11,7 @@ "X X" ], "result": { - "item": "minecraft:golden_boots" + "count": 1, + "id": "minecraft:golden_boots" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_carrot.json b/src/generated/resources/data/minecraft/recipes/golden_carrot.json index 60200461d9b..444588c03da 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_carrot.json +++ b/src/generated/resources/data/minecraft/recipes/golden_carrot.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:nuggets/gold" + "tag": "c:nuggets/gold" }, "X": { "item": "minecraft:carrot" @@ -15,6 +15,7 @@ "###" ], "result": { - "item": "minecraft:golden_carrot" + "count": 1, + "id": "minecraft:golden_carrot" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_chestplate.json b/src/generated/resources/data/minecraft/recipes/golden_chestplate.json index a06e7c25eb8..edd79c9908d 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_chestplate.json +++ b/src/generated/resources/data/minecraft/recipes/golden_chestplate.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -12,6 +12,7 @@ "XXX" ], "result": { - "item": "minecraft:golden_chestplate" + "count": 1, + "id": "minecraft:golden_chestplate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_helmet.json b/src/generated/resources/data/minecraft/recipes/golden_helmet.json index 2161b20de75..f275fa75144 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_helmet.json +++ b/src/generated/resources/data/minecraft/recipes/golden_helmet.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -11,6 +11,7 @@ "X X" ], "result": { - "item": "minecraft:golden_helmet" + "count": 1, + "id": "minecraft:golden_helmet" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_hoe.json b/src/generated/resources/data/minecraft/recipes/golden_hoe.json index 9626f019d79..6a305f1b186 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_hoe.json +++ b/src/generated/resources/data/minecraft/recipes/golden_hoe.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:golden_hoe" + "count": 1, + "id": "minecraft:golden_hoe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_leggings.json b/src/generated/resources/data/minecraft/recipes/golden_leggings.json index a377fbc9822..54c8ae061e6 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_leggings.json +++ b/src/generated/resources/data/minecraft/recipes/golden_leggings.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -12,6 +12,7 @@ "X X" ], "result": { - "item": "minecraft:golden_leggings" + "count": 1, + "id": "minecraft:golden_leggings" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_pickaxe.json b/src/generated/resources/data/minecraft/recipes/golden_pickaxe.json index b953212ba97..be94e94d06e 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_pickaxe.json +++ b/src/generated/resources/data/minecraft/recipes/golden_pickaxe.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -15,6 +15,7 @@ " # " ], "result": { - "item": "minecraft:golden_pickaxe" + "count": 1, + "id": "minecraft:golden_pickaxe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_shovel.json b/src/generated/resources/data/minecraft/recipes/golden_shovel.json index 5e4bbd536c5..b71a44cb472 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_shovel.json +++ b/src/generated/resources/data/minecraft/recipes/golden_shovel.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:golden_shovel" + "count": 1, + "id": "minecraft:golden_shovel" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/golden_sword.json b/src/generated/resources/data/minecraft/recipes/golden_sword.json index c237f1afa50..fdfc713b40d 100644 --- a/src/generated/resources/data/minecraft/recipes/golden_sword.json +++ b/src/generated/resources/data/minecraft/recipes/golden_sword.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:golden_sword" + "count": 1, + "id": "minecraft:golden_sword" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/gray_banner.json b/src/generated/resources/data/minecraft/recipes/gray_banner.json index 3a0bb04ef4a..9a36e40aed0 100644 --- a/src/generated/resources/data/minecraft/recipes/gray_banner.json +++ b/src/generated/resources/data/minecraft/recipes/gray_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:gray_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:gray_banner" + "count": 1, + "id": "minecraft:gray_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/green_banner.json b/src/generated/resources/data/minecraft/recipes/green_banner.json index 000083bcf5a..3960ffd83ba 100644 --- a/src/generated/resources/data/minecraft/recipes/green_banner.json +++ b/src/generated/resources/data/minecraft/recipes/green_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:green_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:green_banner" + "count": 1, + "id": "minecraft:green_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/grindstone.json b/src/generated/resources/data/minecraft/recipes/grindstone.json index beb54f35ee2..234b5a8e4f0 100644 --- a/src/generated/resources/data/minecraft/recipes/grindstone.json +++ b/src/generated/resources/data/minecraft/recipes/grindstone.json @@ -9,7 +9,7 @@ "item": "minecraft:stone_slab" }, "I": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,7 @@ "# #" ], "result": { - "item": "minecraft:grindstone" + "count": 1, + "id": "minecraft:grindstone" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/heavy_weighted_pressure_plate.json b/src/generated/resources/data/minecraft/recipes/heavy_weighted_pressure_plate.json index 1ffbcccce91..ac9cd700dc9 100644 --- a/src/generated/resources/data/minecraft/recipes/heavy_weighted_pressure_plate.json +++ b/src/generated/resources/data/minecraft/recipes/heavy_weighted_pressure_plate.json @@ -3,13 +3,14 @@ "category": "redstone", "key": { "#": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ "##" ], "result": { - "item": "minecraft:heavy_weighted_pressure_plate" + "count": 1, + "id": "minecraft:heavy_weighted_pressure_plate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/hopper.json b/src/generated/resources/data/minecraft/recipes/hopper.json index 31bff00da61..09424bfd079 100644 --- a/src/generated/resources/data/minecraft/recipes/hopper.json +++ b/src/generated/resources/data/minecraft/recipes/hopper.json @@ -3,10 +3,10 @@ "category": "redstone", "key": { "C": { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ " I " ], "result": { - "item": "minecraft:hopper" + "count": 1, + "id": "minecraft:hopper" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/host_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/host_armor_trim_smithing_template.json index 12343eb0d66..f84de52ad63 100644 --- a/src/generated/resources/data/minecraft/recipes/host_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/host_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:terracotta" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:host_armor_trim_smithing_template" + "id": "minecraft:host_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_axe.json b/src/generated/resources/data/minecraft/recipes/iron_axe.json index 09ad3b86e26..950fa6ac7aa 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_axe.json +++ b/src/generated/resources/data/minecraft/recipes/iron_axe.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:iron_axe" + "count": 1, + "id": "minecraft:iron_axe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_bars.json b/src/generated/resources/data/minecraft/recipes/iron_bars.json index 37a55f1b4d8..28be431fc6d 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_bars.json +++ b/src/generated/resources/data/minecraft/recipes/iron_bars.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -12,6 +12,6 @@ ], "result": { "count": 16, - "item": "minecraft:iron_bars" + "id": "minecraft:iron_bars" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_boots.json b/src/generated/resources/data/minecraft/recipes/iron_boots.json index a5b13c1270c..f489f382e63 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_boots.json +++ b/src/generated/resources/data/minecraft/recipes/iron_boots.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -11,6 +11,7 @@ "X X" ], "result": { - "item": "minecraft:iron_boots" + "count": 1, + "id": "minecraft:iron_boots" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_chestplate.json b/src/generated/resources/data/minecraft/recipes/iron_chestplate.json index c22d896eca8..67f70bc19cd 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_chestplate.json +++ b/src/generated/resources/data/minecraft/recipes/iron_chestplate.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -12,6 +12,7 @@ "XXX" ], "result": { - "item": "minecraft:iron_chestplate" + "count": 1, + "id": "minecraft:iron_chestplate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_door.json b/src/generated/resources/data/minecraft/recipes/iron_door.json index f138c8898a6..be3bbbf4da8 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_door.json +++ b/src/generated/resources/data/minecraft/recipes/iron_door.json @@ -3,7 +3,7 @@ "category": "redstone", "key": { "#": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -13,6 +13,6 @@ ], "result": { "count": 3, - "item": "minecraft:iron_door" + "id": "minecraft:iron_door" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_helmet.json b/src/generated/resources/data/minecraft/recipes/iron_helmet.json index fc376406b60..4b7326c79ff 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_helmet.json +++ b/src/generated/resources/data/minecraft/recipes/iron_helmet.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -11,6 +11,7 @@ "X X" ], "result": { - "item": "minecraft:iron_helmet" + "count": 1, + "id": "minecraft:iron_helmet" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_hoe.json b/src/generated/resources/data/minecraft/recipes/iron_hoe.json index d9ddbbf1a5e..e175c35d0ca 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_hoe.json +++ b/src/generated/resources/data/minecraft/recipes/iron_hoe.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:iron_hoe" + "count": 1, + "id": "minecraft:iron_hoe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_ingot_from_nuggets.json b/src/generated/resources/data/minecraft/recipes/iron_ingot_from_nuggets.json index 8871d95165e..2cf9cdfd88a 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_ingot_from_nuggets.json +++ b/src/generated/resources/data/minecraft/recipes/iron_ingot_from_nuggets.json @@ -4,7 +4,7 @@ "group": "iron_ingot", "key": { "#": { - "tag": "forge:nuggets/iron" + "tag": "c:nuggets/iron" } }, "pattern": [ @@ -13,6 +13,7 @@ "###" ], "result": { - "item": "minecraft:iron_ingot" + "count": 1, + "id": "minecraft:iron_ingot" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_leggings.json b/src/generated/resources/data/minecraft/recipes/iron_leggings.json index 9249dfa36e7..db1ad0850cd 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_leggings.json +++ b/src/generated/resources/data/minecraft/recipes/iron_leggings.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -12,6 +12,7 @@ "X X" ], "result": { - "item": "minecraft:iron_leggings" + "count": 1, + "id": "minecraft:iron_leggings" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_pickaxe.json b/src/generated/resources/data/minecraft/recipes/iron_pickaxe.json index 381e76055b1..f829c9df56d 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_pickaxe.json +++ b/src/generated/resources/data/minecraft/recipes/iron_pickaxe.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ " # " ], "result": { - "item": "minecraft:iron_pickaxe" + "count": 1, + "id": "minecraft:iron_pickaxe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_shovel.json b/src/generated/resources/data/minecraft/recipes/iron_shovel.json index fa186c42f64..5a11203af5c 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_shovel.json +++ b/src/generated/resources/data/minecraft/recipes/iron_shovel.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:iron_shovel" + "count": 1, + "id": "minecraft:iron_shovel" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_sword.json b/src/generated/resources/data/minecraft/recipes/iron_sword.json index d1b1fa9ff45..6f4c0a46cd5 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_sword.json +++ b/src/generated/resources/data/minecraft/recipes/iron_sword.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:iron_sword" + "count": 1, + "id": "minecraft:iron_sword" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/iron_trapdoor.json b/src/generated/resources/data/minecraft/recipes/iron_trapdoor.json index 71777b8ca60..45d3357442f 100644 --- a/src/generated/resources/data/minecraft/recipes/iron_trapdoor.json +++ b/src/generated/resources/data/minecraft/recipes/iron_trapdoor.json @@ -3,7 +3,7 @@ "category": "redstone", "key": { "#": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -11,6 +11,7 @@ "##" ], "result": { - "item": "minecraft:iron_trapdoor" + "count": 1, + "id": "minecraft:iron_trapdoor" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/item_frame.json b/src/generated/resources/data/minecraft/recipes/item_frame.json index 7383dc21acf..f73e86feb58 100644 --- a/src/generated/resources/data/minecraft/recipes/item_frame.json +++ b/src/generated/resources/data/minecraft/recipes/item_frame.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "item": "minecraft:leather" @@ -15,6 +15,7 @@ "###" ], "result": { - "item": "minecraft:item_frame" + "count": 1, + "id": "minecraft:item_frame" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/jukebox.json b/src/generated/resources/data/minecraft/recipes/jukebox.json index 23851e37831..08f3d3b4d3b 100644 --- a/src/generated/resources/data/minecraft/recipes/jukebox.json +++ b/src/generated/resources/data/minecraft/recipes/jukebox.json @@ -6,7 +6,7 @@ "tag": "minecraft:planks" }, "X": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -15,6 +15,7 @@ "###" ], "result": { - "item": "minecraft:jukebox" + "count": 1, + "id": "minecraft:jukebox" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/jungle_chest_boat.json b/src/generated/resources/data/minecraft/recipes/jungle_chest_boat.json index 3d03d82aae2..43b367f49d1 100644 --- a/src/generated/resources/data/minecraft/recipes/jungle_chest_boat.json +++ b/src/generated/resources/data/minecraft/recipes/jungle_chest_boat.json @@ -4,13 +4,14 @@ "group": "chest_boat", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:jungle_boat" } ], "result": { - "item": "minecraft:jungle_chest_boat" + "count": 1, + "id": "minecraft:jungle_chest_boat" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/jungle_fence.json b/src/generated/resources/data/minecraft/recipes/jungle_fence.json index 28ab3e0b5b8..b49a38c19ad 100644 --- a/src/generated/resources/data/minecraft/recipes/jungle_fence.json +++ b/src/generated/resources/data/minecraft/recipes/jungle_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:jungle_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:jungle_fence" + "id": "minecraft:jungle_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/jungle_fence_gate.json b/src/generated/resources/data/minecraft/recipes/jungle_fence_gate.json index eeb195ecbe8..a1dcfbde01a 100644 --- a/src/generated/resources/data/minecraft/recipes/jungle_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/jungle_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:jungle_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:jungle_fence_gate" + "count": 1, + "id": "minecraft:jungle_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/jungle_sign.json b/src/generated/resources/data/minecraft/recipes/jungle_sign.json index 5c14ff95ef1..713c47d1fa8 100644 --- a/src/generated/resources/data/minecraft/recipes/jungle_sign.json +++ b/src/generated/resources/data/minecraft/recipes/jungle_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:jungle_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:jungle_sign" + "id": "minecraft:jungle_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/ladder.json b/src/generated/resources/data/minecraft/recipes/ladder.json index 50326bf0536..8d64f336a84 100644 --- a/src/generated/resources/data/minecraft/recipes/ladder.json +++ b/src/generated/resources/data/minecraft/recipes/ladder.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -13,6 +13,6 @@ ], "result": { "count": 3, - "item": "minecraft:ladder" + "id": "minecraft:ladder" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/lantern.json b/src/generated/resources/data/minecraft/recipes/lantern.json index 8e1fd1395ca..d7435e4ee25 100644 --- a/src/generated/resources/data/minecraft/recipes/lantern.json +++ b/src/generated/resources/data/minecraft/recipes/lantern.json @@ -6,7 +6,7 @@ "item": "minecraft:torch" }, "X": { - "tag": "forge:nuggets/iron" + "tag": "c:nuggets/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ "XXX" ], "result": { - "item": "minecraft:lantern" + "count": 1, + "id": "minecraft:lantern" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/lead.json b/src/generated/resources/data/minecraft/recipes/lead.json index 56fcc01256c..57ca6d0bbc4 100644 --- a/src/generated/resources/data/minecraft/recipes/lead.json +++ b/src/generated/resources/data/minecraft/recipes/lead.json @@ -6,7 +6,7 @@ "item": "minecraft:slime_ball" }, "~": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -16,6 +16,6 @@ ], "result": { "count": 2, - "item": "minecraft:lead" + "id": "minecraft:lead" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/lever.json b/src/generated/resources/data/minecraft/recipes/lever.json index 23666a3173a..a92056e26a4 100644 --- a/src/generated/resources/data/minecraft/recipes/lever.json +++ b/src/generated/resources/data/minecraft/recipes/lever.json @@ -3,10 +3,10 @@ "category": "redstone", "key": { "#": { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -14,6 +14,7 @@ "#" ], "result": { - "item": "minecraft:lever" + "count": 1, + "id": "minecraft:lever" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/light_blue_banner.json b/src/generated/resources/data/minecraft/recipes/light_blue_banner.json index 2f7d401abcf..1fb0a66d806 100644 --- a/src/generated/resources/data/minecraft/recipes/light_blue_banner.json +++ b/src/generated/resources/data/minecraft/recipes/light_blue_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:light_blue_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:light_blue_banner" + "count": 1, + "id": "minecraft:light_blue_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/light_gray_banner.json b/src/generated/resources/data/minecraft/recipes/light_gray_banner.json index 0564f26f74b..35d93c66930 100644 --- a/src/generated/resources/data/minecraft/recipes/light_gray_banner.json +++ b/src/generated/resources/data/minecraft/recipes/light_gray_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:light_gray_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:light_gray_banner" + "count": 1, + "id": "minecraft:light_gray_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/light_weighted_pressure_plate.json b/src/generated/resources/data/minecraft/recipes/light_weighted_pressure_plate.json index 8c0044b28c1..0d6eec2360a 100644 --- a/src/generated/resources/data/minecraft/recipes/light_weighted_pressure_plate.json +++ b/src/generated/resources/data/minecraft/recipes/light_weighted_pressure_plate.json @@ -3,13 +3,14 @@ "category": "redstone", "key": { "#": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ "##" ], "result": { - "item": "minecraft:light_weighted_pressure_plate" + "count": 1, + "id": "minecraft:light_weighted_pressure_plate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/lightning_rod.json b/src/generated/resources/data/minecraft/recipes/lightning_rod.json index 8d1a5eca193..5a2186f659e 100644 --- a/src/generated/resources/data/minecraft/recipes/lightning_rod.json +++ b/src/generated/resources/data/minecraft/recipes/lightning_rod.json @@ -3,7 +3,7 @@ "category": "redstone", "key": { "#": { - "tag": "forge:ingots/copper" + "tag": "c:ingots/copper" } }, "pattern": [ @@ -12,6 +12,7 @@ "#" ], "result": { - "item": "minecraft:lightning_rod" + "count": 1, + "id": "minecraft:lightning_rod" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/lime_banner.json b/src/generated/resources/data/minecraft/recipes/lime_banner.json index 603a2a1ae26..c076add05bd 100644 --- a/src/generated/resources/data/minecraft/recipes/lime_banner.json +++ b/src/generated/resources/data/minecraft/recipes/lime_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:lime_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:lime_banner" + "count": 1, + "id": "minecraft:lime_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/lodestone.json b/src/generated/resources/data/minecraft/recipes/lodestone.json index 8741c3f76ea..5d1bc8a33a4 100644 --- a/src/generated/resources/data/minecraft/recipes/lodestone.json +++ b/src/generated/resources/data/minecraft/recipes/lodestone.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:ingots/netherite" + "tag": "c:ingots/netherite" }, "S": { "item": "minecraft:chiseled_stone_bricks" @@ -15,6 +15,7 @@ "SSS" ], "result": { - "item": "minecraft:lodestone" + "count": 1, + "id": "minecraft:lodestone" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/loom.json b/src/generated/resources/data/minecraft/recipes/loom.json index 2893af442a3..7fbb48dfe95 100644 --- a/src/generated/resources/data/minecraft/recipes/loom.json +++ b/src/generated/resources/data/minecraft/recipes/loom.json @@ -6,7 +6,7 @@ "tag": "minecraft:planks" }, "@": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -14,6 +14,7 @@ "##" ], "result": { - "item": "minecraft:loom" + "count": 1, + "id": "minecraft:loom" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/magenta_banner.json b/src/generated/resources/data/minecraft/recipes/magenta_banner.json index 5b02fea383a..5996580e8d4 100644 --- a/src/generated/resources/data/minecraft/recipes/magenta_banner.json +++ b/src/generated/resources/data/minecraft/recipes/magenta_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:magenta_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:magenta_banner" + "count": 1, + "id": "minecraft:magenta_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/mangrove_chest_boat.json b/src/generated/resources/data/minecraft/recipes/mangrove_chest_boat.json index ef188153078..233473f202e 100644 --- a/src/generated/resources/data/minecraft/recipes/mangrove_chest_boat.json +++ b/src/generated/resources/data/minecraft/recipes/mangrove_chest_boat.json @@ -4,13 +4,14 @@ "group": "chest_boat", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:mangrove_boat" } ], "result": { - "item": "minecraft:mangrove_chest_boat" + "count": 1, + "id": "minecraft:mangrove_chest_boat" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/mangrove_fence.json b/src/generated/resources/data/minecraft/recipes/mangrove_fence.json index a799b071ac7..01d6d241815 100644 --- a/src/generated/resources/data/minecraft/recipes/mangrove_fence.json +++ b/src/generated/resources/data/minecraft/recipes/mangrove_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:mangrove_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:mangrove_fence" + "id": "minecraft:mangrove_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/mangrove_fence_gate.json b/src/generated/resources/data/minecraft/recipes/mangrove_fence_gate.json index a3bcbde9ffb..3a0927be5e4 100644 --- a/src/generated/resources/data/minecraft/recipes/mangrove_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/mangrove_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:mangrove_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:mangrove_fence_gate" + "count": 1, + "id": "minecraft:mangrove_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/mangrove_sign.json b/src/generated/resources/data/minecraft/recipes/mangrove_sign.json index 9fce4bbc44c..a55530fcd87 100644 --- a/src/generated/resources/data/minecraft/recipes/mangrove_sign.json +++ b/src/generated/resources/data/minecraft/recipes/mangrove_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:mangrove_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:mangrove_sign" + "id": "minecraft:mangrove_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/minecart.json b/src/generated/resources/data/minecraft/recipes/minecart.json index aa5a1ea93df..15fdd90d0e9 100644 --- a/src/generated/resources/data/minecraft/recipes/minecart.json +++ b/src/generated/resources/data/minecraft/recipes/minecart.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -11,6 +11,7 @@ "###" ], "result": { - "item": "minecraft:minecart" + "count": 1, + "id": "minecraft:minecart" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/mossy_cobblestone_from_moss_block.json b/src/generated/resources/data/minecraft/recipes/mossy_cobblestone_from_moss_block.json index a59fa3296ad..80acf71a6d2 100644 --- a/src/generated/resources/data/minecraft/recipes/mossy_cobblestone_from_moss_block.json +++ b/src/generated/resources/data/minecraft/recipes/mossy_cobblestone_from_moss_block.json @@ -4,13 +4,14 @@ "group": "mossy_cobblestone", "ingredients": [ { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, { "item": "minecraft:moss_block" } ], "result": { - "item": "minecraft:mossy_cobblestone" + "count": 1, + "id": "minecraft:mossy_cobblestone" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/mossy_cobblestone_from_vine.json b/src/generated/resources/data/minecraft/recipes/mossy_cobblestone_from_vine.json index 79051c2fa15..6980c8b3a23 100644 --- a/src/generated/resources/data/minecraft/recipes/mossy_cobblestone_from_vine.json +++ b/src/generated/resources/data/minecraft/recipes/mossy_cobblestone_from_vine.json @@ -4,13 +4,14 @@ "group": "mossy_cobblestone", "ingredients": [ { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, { "item": "minecraft:vine" } ], "result": { - "item": "minecraft:mossy_cobblestone" + "count": 1, + "id": "minecraft:mossy_cobblestone" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/netherite_ingot.json b/src/generated/resources/data/minecraft/recipes/netherite_ingot.json index 21ffad16503..ffa224998ef 100644 --- a/src/generated/resources/data/minecraft/recipes/netherite_ingot.json +++ b/src/generated/resources/data/minecraft/recipes/netherite_ingot.json @@ -16,19 +16,20 @@ "item": "minecraft:netherite_scrap" }, { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } ], "result": { - "item": "minecraft:netherite_ingot" + "count": 1, + "id": "minecraft:netherite_ingot" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/netherite_upgrade_smithing_template.json b/src/generated/resources/data/minecraft/recipes/netherite_upgrade_smithing_template.json index af5054afbd8..44fc480189d 100644 --- a/src/generated/resources/data/minecraft/recipes/netherite_upgrade_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/netherite_upgrade_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:netherrack" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:netherite_upgrade_smithing_template" + "id": "minecraft:netherite_upgrade_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/oak_chest_boat.json b/src/generated/resources/data/minecraft/recipes/oak_chest_boat.json index 638735a211f..9c1869540b1 100644 --- a/src/generated/resources/data/minecraft/recipes/oak_chest_boat.json +++ b/src/generated/resources/data/minecraft/recipes/oak_chest_boat.json @@ -4,13 +4,14 @@ "group": "chest_boat", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:oak_boat" } ], "result": { - "item": "minecraft:oak_chest_boat" + "count": 1, + "id": "minecraft:oak_chest_boat" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/oak_fence.json b/src/generated/resources/data/minecraft/recipes/oak_fence.json index e3f99615071..3227fa2bc77 100644 --- a/src/generated/resources/data/minecraft/recipes/oak_fence.json +++ b/src/generated/resources/data/minecraft/recipes/oak_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:oak_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:oak_fence" + "id": "minecraft:oak_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/oak_fence_gate.json b/src/generated/resources/data/minecraft/recipes/oak_fence_gate.json index 956d67d1a1b..45923171d80 100644 --- a/src/generated/resources/data/minecraft/recipes/oak_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/oak_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:oak_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:oak_fence_gate" + "count": 1, + "id": "minecraft:oak_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/oak_sign.json b/src/generated/resources/data/minecraft/recipes/oak_sign.json index 13132c63a09..618d6d414a4 100644 --- a/src/generated/resources/data/minecraft/recipes/oak_sign.json +++ b/src/generated/resources/data/minecraft/recipes/oak_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:oak_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:oak_sign" + "id": "minecraft:oak_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/observer.json b/src/generated/resources/data/minecraft/recipes/observer.json index f9304ff07ae..d48ca4adf28 100644 --- a/src/generated/resources/data/minecraft/recipes/observer.json +++ b/src/generated/resources/data/minecraft/recipes/observer.json @@ -3,7 +3,7 @@ "category": "redstone", "key": { "#": { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, "Q": { "item": "minecraft:quartz" @@ -18,6 +18,7 @@ "###" ], "result": { - "item": "minecraft:observer" + "count": 1, + "id": "minecraft:observer" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/orange_banner.json b/src/generated/resources/data/minecraft/recipes/orange_banner.json index c260165899c..f2f3b03d6c3 100644 --- a/src/generated/resources/data/minecraft/recipes/orange_banner.json +++ b/src/generated/resources/data/minecraft/recipes/orange_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:orange_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:orange_banner" + "count": 1, + "id": "minecraft:orange_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/painting.json b/src/generated/resources/data/minecraft/recipes/painting.json index dfe4ad0caaf..df1b6d324db 100644 --- a/src/generated/resources/data/minecraft/recipes/painting.json +++ b/src/generated/resources/data/minecraft/recipes/painting.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:wool" @@ -15,6 +15,7 @@ "###" ], "result": { - "item": "minecraft:painting" + "count": 1, + "id": "minecraft:painting" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/pink_banner.json b/src/generated/resources/data/minecraft/recipes/pink_banner.json index 1965e7dffc5..951e77cedd7 100644 --- a/src/generated/resources/data/minecraft/recipes/pink_banner.json +++ b/src/generated/resources/data/minecraft/recipes/pink_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:pink_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:pink_banner" + "count": 1, + "id": "minecraft:pink_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/piston.json b/src/generated/resources/data/minecraft/recipes/piston.json index 74f40060e54..b57e13cfbc3 100644 --- a/src/generated/resources/data/minecraft/recipes/piston.json +++ b/src/generated/resources/data/minecraft/recipes/piston.json @@ -3,7 +3,7 @@ "category": "redstone", "key": { "#": { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, "R": { "item": "minecraft:redstone" @@ -12,7 +12,7 @@ "tag": "minecraft:planks" }, "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -21,6 +21,7 @@ "#R#" ], "result": { - "item": "minecraft:piston" + "count": 1, + "id": "minecraft:piston" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/polished_deepslate.json b/src/generated/resources/data/minecraft/recipes/polished_deepslate.json index 2163aba74f0..97f277e6b1c 100644 --- a/src/generated/resources/data/minecraft/recipes/polished_deepslate.json +++ b/src/generated/resources/data/minecraft/recipes/polished_deepslate.json @@ -3,7 +3,7 @@ "category": "building", "key": { "S": { - "tag": "forge:cobblestone/deepslate" + "tag": "c:cobblestones/deepslate" } }, "pattern": [ @@ -12,6 +12,6 @@ ], "result": { "count": 4, - "item": "minecraft:polished_deepslate" + "id": "minecraft:polished_deepslate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/powered_rail.json b/src/generated/resources/data/minecraft/recipes/powered_rail.json index c8b5b6e014d..97f3e17964c 100644 --- a/src/generated/resources/data/minecraft/recipes/powered_rail.json +++ b/src/generated/resources/data/minecraft/recipes/powered_rail.json @@ -3,13 +3,13 @@ "category": "misc", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "R": { "item": "minecraft:redstone" }, "X": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -19,6 +19,6 @@ ], "result": { "count": 6, - "item": "minecraft:powered_rail" + "id": "minecraft:powered_rail" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/purple_banner.json b/src/generated/resources/data/minecraft/recipes/purple_banner.json index 9c9baa1d93b..5475bffc702 100644 --- a/src/generated/resources/data/minecraft/recipes/purple_banner.json +++ b/src/generated/resources/data/minecraft/recipes/purple_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:purple_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:purple_banner" + "count": 1, + "id": "minecraft:purple_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/rail.json b/src/generated/resources/data/minecraft/recipes/rail.json index a14f5d7786e..481af10ee34 100644 --- a/src/generated/resources/data/minecraft/recipes/rail.json +++ b/src/generated/resources/data/minecraft/recipes/rail.json @@ -3,10 +3,10 @@ "category": "misc", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -16,6 +16,6 @@ ], "result": { "count": 16, - "item": "minecraft:rail" + "id": "minecraft:rail" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/raiser_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/raiser_armor_trim_smithing_template.json index 579235dae50..97a148d1598 100644 --- a/src/generated/resources/data/minecraft/recipes/raiser_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/raiser_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:terracotta" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:raiser_armor_trim_smithing_template" + "id": "minecraft:raiser_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/red_banner.json b/src/generated/resources/data/minecraft/recipes/red_banner.json index ece467fb8a7..89b92a5470a 100644 --- a/src/generated/resources/data/minecraft/recipes/red_banner.json +++ b/src/generated/resources/data/minecraft/recipes/red_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:red_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:red_banner" + "count": 1, + "id": "minecraft:red_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/redstone_torch.json b/src/generated/resources/data/minecraft/recipes/redstone_torch.json index 3fef11c1ec7..378c0d7b88a 100644 --- a/src/generated/resources/data/minecraft/recipes/redstone_torch.json +++ b/src/generated/resources/data/minecraft/recipes/redstone_torch.json @@ -3,7 +3,7 @@ "category": "redstone", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "item": "minecraft:redstone" @@ -14,6 +14,7 @@ "#" ], "result": { - "item": "minecraft:redstone_torch" + "count": 1, + "id": "minecraft:redstone_torch" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/rib_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/rib_armor_trim_smithing_template.json index d15c589c648..6ec72db0dde 100644 --- a/src/generated/resources/data/minecraft/recipes/rib_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/rib_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:netherrack" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:rib_armor_trim_smithing_template" + "id": "minecraft:rib_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/scaffolding.json b/src/generated/resources/data/minecraft/recipes/scaffolding.json index 9340d3da6dd..c0290aba8cb 100644 --- a/src/generated/resources/data/minecraft/recipes/scaffolding.json +++ b/src/generated/resources/data/minecraft/recipes/scaffolding.json @@ -6,7 +6,7 @@ "item": "minecraft:bamboo" }, "~": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -16,6 +16,6 @@ ], "result": { "count": 6, - "item": "minecraft:scaffolding" + "id": "minecraft:scaffolding" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/sentry_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/sentry_armor_trim_smithing_template.json index bccef0e6f50..8bfac2e3f92 100644 --- a/src/generated/resources/data/minecraft/recipes/sentry_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/sentry_armor_trim_smithing_template.json @@ -3,10 +3,10 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, "S": { "item": "minecraft:sentry_armor_trim_smithing_template" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:sentry_armor_trim_smithing_template" + "id": "minecraft:sentry_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/shaper_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/shaper_armor_trim_smithing_template.json index e08dc1ce55a..980b1d21080 100644 --- a/src/generated/resources/data/minecraft/recipes/shaper_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/shaper_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:terracotta" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:shaper_armor_trim_smithing_template" + "id": "minecraft:shaper_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/shears.json b/src/generated/resources/data/minecraft/recipes/shears.json index 920ff4fd1df..cc526718eb5 100644 --- a/src/generated/resources/data/minecraft/recipes/shears.json +++ b/src/generated/resources/data/minecraft/recipes/shears.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -11,6 +11,7 @@ "# " ], "result": { - "item": "minecraft:shears" + "count": 1, + "id": "minecraft:shears" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/shield.json b/src/generated/resources/data/minecraft/recipes/shield.json index d746ab4ede5..46aa8fbe7d4 100644 --- a/src/generated/resources/data/minecraft/recipes/shield.json +++ b/src/generated/resources/data/minecraft/recipes/shield.json @@ -6,7 +6,7 @@ "tag": "minecraft:planks" }, "o": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ " W " ], "result": { - "item": "minecraft:shield" + "count": 1, + "id": "minecraft:shield" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/shulker_box.json b/src/generated/resources/data/minecraft/recipes/shulker_box.json index 15c67ec58d4..cfa4fed9ead 100644 --- a/src/generated/resources/data/minecraft/recipes/shulker_box.json +++ b/src/generated/resources/data/minecraft/recipes/shulker_box.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, "-": { "item": "minecraft:shulker_shell" @@ -15,6 +15,7 @@ "-" ], "result": { - "item": "minecraft:shulker_box" + "count": 1, + "id": "minecraft:shulker_box" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/silence_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/silence_armor_trim_smithing_template.json index 9fa1c8204d5..4ade3deadd8 100644 --- a/src/generated/resources/data/minecraft/recipes/silence_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/silence_armor_trim_smithing_template.json @@ -3,10 +3,10 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { - "tag": "forge:cobblestone/deepslate" + "tag": "c:cobblestones/deepslate" }, "S": { "item": "minecraft:silence_armor_trim_smithing_template" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:silence_armor_trim_smithing_template" + "id": "minecraft:silence_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/smithing_table.json b/src/generated/resources/data/minecraft/recipes/smithing_table.json index e1ba2b47494..e7dadd831c2 100644 --- a/src/generated/resources/data/minecraft/recipes/smithing_table.json +++ b/src/generated/resources/data/minecraft/recipes/smithing_table.json @@ -6,7 +6,7 @@ "tag": "minecraft:planks" }, "@": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ "##" ], "result": { - "item": "minecraft:smithing_table" + "count": 1, + "id": "minecraft:smithing_table" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/snout_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/snout_armor_trim_smithing_template.json index 5bffa9a875c..8aa0dd55c15 100644 --- a/src/generated/resources/data/minecraft/recipes/snout_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/snout_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:blackstone" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:snout_armor_trim_smithing_template" + "id": "minecraft:snout_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/soul_campfire.json b/src/generated/resources/data/minecraft/recipes/soul_campfire.json index 4e1d80e502e..e7459aa07df 100644 --- a/src/generated/resources/data/minecraft/recipes/soul_campfire.json +++ b/src/generated/resources/data/minecraft/recipes/soul_campfire.json @@ -9,7 +9,7 @@ "tag": "minecraft:logs" }, "S": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -18,6 +18,7 @@ "LLL" ], "result": { - "item": "minecraft:soul_campfire" + "count": 1, + "id": "minecraft:soul_campfire" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/soul_lantern.json b/src/generated/resources/data/minecraft/recipes/soul_lantern.json index 1b401911762..e5f39ad8ece 100644 --- a/src/generated/resources/data/minecraft/recipes/soul_lantern.json +++ b/src/generated/resources/data/minecraft/recipes/soul_lantern.json @@ -6,7 +6,7 @@ "item": "minecraft:soul_torch" }, "X": { - "tag": "forge:nuggets/iron" + "tag": "c:nuggets/iron" } }, "pattern": [ @@ -15,6 +15,7 @@ "XXX" ], "result": { - "item": "minecraft:soul_lantern" + "count": 1, + "id": "minecraft:soul_lantern" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/soul_torch.json b/src/generated/resources/data/minecraft/recipes/soul_torch.json index 55f4104c799..fc57b7b0d32 100644 --- a/src/generated/resources/data/minecraft/recipes/soul_torch.json +++ b/src/generated/resources/data/minecraft/recipes/soul_torch.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "S": { "tag": "minecraft:soul_fire_base_blocks" @@ -24,6 +24,6 @@ ], "result": { "count": 4, - "item": "minecraft:soul_torch" + "id": "minecraft:soul_torch" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/spire_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/spire_armor_trim_smithing_template.json index d77a357eb4b..4cd59d3d038 100644 --- a/src/generated/resources/data/minecraft/recipes/spire_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/spire_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:purpur_block" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:spire_armor_trim_smithing_template" + "id": "minecraft:spire_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/spruce_chest_boat.json b/src/generated/resources/data/minecraft/recipes/spruce_chest_boat.json index 399ef2beab4..f89eeea73e3 100644 --- a/src/generated/resources/data/minecraft/recipes/spruce_chest_boat.json +++ b/src/generated/resources/data/minecraft/recipes/spruce_chest_boat.json @@ -4,13 +4,14 @@ "group": "chest_boat", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:spruce_boat" } ], "result": { - "item": "minecraft:spruce_chest_boat" + "count": 1, + "id": "minecraft:spruce_chest_boat" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/spruce_fence.json b/src/generated/resources/data/minecraft/recipes/spruce_fence.json index b4eab9c13ff..d8790bce045 100644 --- a/src/generated/resources/data/minecraft/recipes/spruce_fence.json +++ b/src/generated/resources/data/minecraft/recipes/spruce_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:spruce_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:spruce_fence" + "id": "minecraft:spruce_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/spruce_fence_gate.json b/src/generated/resources/data/minecraft/recipes/spruce_fence_gate.json index 258057d801e..61815e96062 100644 --- a/src/generated/resources/data/minecraft/recipes/spruce_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/spruce_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:spruce_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:spruce_fence_gate" + "count": 1, + "id": "minecraft:spruce_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/spruce_sign.json b/src/generated/resources/data/minecraft/recipes/spruce_sign.json index fb28d8c03ed..03fb28133e2 100644 --- a/src/generated/resources/data/minecraft/recipes/spruce_sign.json +++ b/src/generated/resources/data/minecraft/recipes/spruce_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:spruce_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:spruce_sign" + "id": "minecraft:spruce_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/spyglass.json b/src/generated/resources/data/minecraft/recipes/spyglass.json index f649bfc44ac..ea680e3fb95 100644 --- a/src/generated/resources/data/minecraft/recipes/spyglass.json +++ b/src/generated/resources/data/minecraft/recipes/spyglass.json @@ -3,10 +3,10 @@ "category": "equipment", "key": { "#": { - "tag": "forge:gems/amethyst" + "tag": "c:gems/amethyst" }, "X": { - "tag": "forge:ingots/copper" + "tag": "c:ingots/copper" } }, "pattern": [ @@ -15,6 +15,7 @@ " X " ], "result": { - "item": "minecraft:spyglass" + "count": 1, + "id": "minecraft:spyglass" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/stone_axe.json b/src/generated/resources/data/minecraft/recipes/stone_axe.json index 58ce1597f63..0bac2f11809 100644 --- a/src/generated/resources/data/minecraft/recipes/stone_axe.json +++ b/src/generated/resources/data/minecraft/recipes/stone_axe.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:stone_tool_materials" @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:stone_axe" + "count": 1, + "id": "minecraft:stone_axe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/stone_hoe.json b/src/generated/resources/data/minecraft/recipes/stone_hoe.json index 2827ae1eab9..8c5b5eceeed 100644 --- a/src/generated/resources/data/minecraft/recipes/stone_hoe.json +++ b/src/generated/resources/data/minecraft/recipes/stone_hoe.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:stone_tool_materials" @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:stone_hoe" + "count": 1, + "id": "minecraft:stone_hoe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/stone_pickaxe.json b/src/generated/resources/data/minecraft/recipes/stone_pickaxe.json index 8d02352c43a..b366ac2065b 100644 --- a/src/generated/resources/data/minecraft/recipes/stone_pickaxe.json +++ b/src/generated/resources/data/minecraft/recipes/stone_pickaxe.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:stone_tool_materials" @@ -15,6 +15,7 @@ " # " ], "result": { - "item": "minecraft:stone_pickaxe" + "count": 1, + "id": "minecraft:stone_pickaxe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/stone_shovel.json b/src/generated/resources/data/minecraft/recipes/stone_shovel.json index 609f6e511ab..d1fbdebd224 100644 --- a/src/generated/resources/data/minecraft/recipes/stone_shovel.json +++ b/src/generated/resources/data/minecraft/recipes/stone_shovel.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:stone_tool_materials" @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:stone_shovel" + "count": 1, + "id": "minecraft:stone_shovel" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/stone_sword.json b/src/generated/resources/data/minecraft/recipes/stone_sword.json index 7afc9ceec6c..559caac73d2 100644 --- a/src/generated/resources/data/minecraft/recipes/stone_sword.json +++ b/src/generated/resources/data/minecraft/recipes/stone_sword.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:stone_tool_materials" @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:stone_sword" + "count": 1, + "id": "minecraft:stone_sword" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/stonecutter.json b/src/generated/resources/data/minecraft/recipes/stonecutter.json index 4fa791814f0..e0820aeedbf 100644 --- a/src/generated/resources/data/minecraft/recipes/stonecutter.json +++ b/src/generated/resources/data/minecraft/recipes/stonecutter.json @@ -6,7 +6,7 @@ "item": "minecraft:stone" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -14,6 +14,7 @@ "###" ], "result": { - "item": "minecraft:stonecutter" + "count": 1, + "id": "minecraft:stonecutter" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/tide_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/tide_armor_trim_smithing_template.json index 7663db553b6..8292dd0993e 100644 --- a/src/generated/resources/data/minecraft/recipes/tide_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/tide_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:prismarine" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:tide_armor_trim_smithing_template" + "id": "minecraft:tide_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/tinted_glass.json b/src/generated/resources/data/minecraft/recipes/tinted_glass.json index 2017014aff9..99d27ab3d32 100644 --- a/src/generated/resources/data/minecraft/recipes/tinted_glass.json +++ b/src/generated/resources/data/minecraft/recipes/tinted_glass.json @@ -6,7 +6,7 @@ "item": "minecraft:glass" }, "S": { - "tag": "forge:gems/amethyst" + "tag": "c:gems/amethyst" } }, "pattern": [ @@ -16,6 +16,6 @@ ], "result": { "count": 2, - "item": "minecraft:tinted_glass" + "id": "minecraft:tinted_glass" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/torch.json b/src/generated/resources/data/minecraft/recipes/torch.json index 71147ae0aa7..031078faf0f 100644 --- a/src/generated/resources/data/minecraft/recipes/torch.json +++ b/src/generated/resources/data/minecraft/recipes/torch.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": [ { @@ -20,6 +20,6 @@ ], "result": { "count": 4, - "item": "minecraft:torch" + "id": "minecraft:torch" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/trapped_chest.json b/src/generated/resources/data/minecraft/recipes/trapped_chest.json index 0ccc058c06e..1cf84155e96 100644 --- a/src/generated/resources/data/minecraft/recipes/trapped_chest.json +++ b/src/generated/resources/data/minecraft/recipes/trapped_chest.json @@ -3,13 +3,14 @@ "category": "redstone", "ingredients": [ { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, { "item": "minecraft:tripwire_hook" } ], "result": { - "item": "minecraft:trapped_chest" + "count": 1, + "id": "minecraft:trapped_chest" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/tripwire_hook.json b/src/generated/resources/data/minecraft/recipes/tripwire_hook.json index a02479f770a..b966ce7a633 100644 --- a/src/generated/resources/data/minecraft/recipes/tripwire_hook.json +++ b/src/generated/resources/data/minecraft/recipes/tripwire_hook.json @@ -6,10 +6,10 @@ "tag": "minecraft:planks" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "S": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:tripwire_hook" + "id": "minecraft:tripwire_hook" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/vex_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/vex_armor_trim_smithing_template.json index 981c13b4035..c4346ef9e42 100644 --- a/src/generated/resources/data/minecraft/recipes/vex_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/vex_armor_trim_smithing_template.json @@ -3,10 +3,10 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { - "tag": "forge:cobblestone/normal" + "tag": "c:cobblestones/normal" }, "S": { "item": "minecraft:vex_armor_trim_smithing_template" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:vex_armor_trim_smithing_template" + "id": "minecraft:vex_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/ward_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/ward_armor_trim_smithing_template.json index b263c2f3563..1e6185aa9d3 100644 --- a/src/generated/resources/data/minecraft/recipes/ward_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/ward_armor_trim_smithing_template.json @@ -3,10 +3,10 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { - "tag": "forge:cobblestone/deepslate" + "tag": "c:cobblestones/deepslate" }, "S": { "item": "minecraft:ward_armor_trim_smithing_template" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:ward_armor_trim_smithing_template" + "id": "minecraft:ward_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/warped_fence.json b/src/generated/resources/data/minecraft/recipes/warped_fence.json index 052fa02e71a..715d558dd66 100644 --- a/src/generated/resources/data/minecraft/recipes/warped_fence.json +++ b/src/generated/resources/data/minecraft/recipes/warped_fence.json @@ -4,7 +4,7 @@ "group": "wooden_fence", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:warped_planks" @@ -16,6 +16,6 @@ ], "result": { "count": 3, - "item": "minecraft:warped_fence" + "id": "minecraft:warped_fence" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/warped_fence_gate.json b/src/generated/resources/data/minecraft/recipes/warped_fence_gate.json index f1768225793..15dcad57d5c 100644 --- a/src/generated/resources/data/minecraft/recipes/warped_fence_gate.json +++ b/src/generated/resources/data/minecraft/recipes/warped_fence_gate.json @@ -4,7 +4,7 @@ "group": "wooden_fence_gate", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "W": { "item": "minecraft:warped_planks" @@ -15,6 +15,7 @@ "#W#" ], "result": { - "item": "minecraft:warped_fence_gate" + "count": 1, + "id": "minecraft:warped_fence_gate" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/warped_sign.json b/src/generated/resources/data/minecraft/recipes/warped_sign.json index cbaa3b7b87e..b0f4112a6d6 100644 --- a/src/generated/resources/data/minecraft/recipes/warped_sign.json +++ b/src/generated/resources/data/minecraft/recipes/warped_sign.json @@ -7,7 +7,7 @@ "item": "minecraft:warped_planks" }, "X": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "minecraft:warped_sign" + "id": "minecraft:warped_sign" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/wayfinder_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/wayfinder_armor_trim_smithing_template.json index a35c9bbf955..563776c2c51 100644 --- a/src/generated/resources/data/minecraft/recipes/wayfinder_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/wayfinder_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:terracotta" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:wayfinder_armor_trim_smithing_template" + "id": "minecraft:wayfinder_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/white_banner.json b/src/generated/resources/data/minecraft/recipes/white_banner.json index 9957dc5b0a4..418906d5b99 100644 --- a/src/generated/resources/data/minecraft/recipes/white_banner.json +++ b/src/generated/resources/data/minecraft/recipes/white_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:white_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:white_banner" + "count": 1, + "id": "minecraft:white_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/wild_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/wild_armor_trim_smithing_template.json index ed91ecb02d0..8eec0dc5e92 100644 --- a/src/generated/resources/data/minecraft/recipes/wild_armor_trim_smithing_template.json +++ b/src/generated/resources/data/minecraft/recipes/wild_armor_trim_smithing_template.json @@ -3,7 +3,7 @@ "category": "misc", "key": { "#": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "C": { "item": "minecraft:mossy_cobblestone" @@ -19,6 +19,6 @@ ], "result": { "count": 2, - "item": "minecraft:wild_armor_trim_smithing_template" + "id": "minecraft:wild_armor_trim_smithing_template" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/wooden_axe.json b/src/generated/resources/data/minecraft/recipes/wooden_axe.json index 1f6cabc9b3b..25cc73c46fa 100644 --- a/src/generated/resources/data/minecraft/recipes/wooden_axe.json +++ b/src/generated/resources/data/minecraft/recipes/wooden_axe.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:planks" @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:wooden_axe" + "count": 1, + "id": "minecraft:wooden_axe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/wooden_hoe.json b/src/generated/resources/data/minecraft/recipes/wooden_hoe.json index 0faec2df654..a068c7fdc57 100644 --- a/src/generated/resources/data/minecraft/recipes/wooden_hoe.json +++ b/src/generated/resources/data/minecraft/recipes/wooden_hoe.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:planks" @@ -15,6 +15,7 @@ " #" ], "result": { - "item": "minecraft:wooden_hoe" + "count": 1, + "id": "minecraft:wooden_hoe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/wooden_pickaxe.json b/src/generated/resources/data/minecraft/recipes/wooden_pickaxe.json index 70c46788bc6..b09f9389ab5 100644 --- a/src/generated/resources/data/minecraft/recipes/wooden_pickaxe.json +++ b/src/generated/resources/data/minecraft/recipes/wooden_pickaxe.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:planks" @@ -15,6 +15,7 @@ " # " ], "result": { - "item": "minecraft:wooden_pickaxe" + "count": 1, + "id": "minecraft:wooden_pickaxe" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/wooden_shovel.json b/src/generated/resources/data/minecraft/recipes/wooden_shovel.json index e5d95dbe8f8..dd2aa5e3637 100644 --- a/src/generated/resources/data/minecraft/recipes/wooden_shovel.json +++ b/src/generated/resources/data/minecraft/recipes/wooden_shovel.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:planks" @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:wooden_shovel" + "count": 1, + "id": "minecraft:wooden_shovel" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/wooden_sword.json b/src/generated/resources/data/minecraft/recipes/wooden_sword.json index f16e2027801..8906ea876f9 100644 --- a/src/generated/resources/data/minecraft/recipes/wooden_sword.json +++ b/src/generated/resources/data/minecraft/recipes/wooden_sword.json @@ -3,7 +3,7 @@ "category": "equipment", "key": { "#": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" }, "X": { "tag": "minecraft:planks" @@ -15,6 +15,7 @@ "#" ], "result": { - "item": "minecraft:wooden_sword" + "count": 1, + "id": "minecraft:wooden_sword" } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/yellow_banner.json b/src/generated/resources/data/minecraft/recipes/yellow_banner.json index 80eb283553f..5c1c07e88bb 100644 --- a/src/generated/resources/data/minecraft/recipes/yellow_banner.json +++ b/src/generated/resources/data/minecraft/recipes/yellow_banner.json @@ -7,7 +7,7 @@ "item": "minecraft:yellow_wool" }, "|": { - "tag": "forge:rods/wooden" + "tag": "c:rods/wooden" } }, "pattern": [ @@ -16,6 +16,7 @@ " | " ], "result": { - "item": "minecraft:yellow_banner" + "count": 1, + "id": "minecraft:yellow_banner" } } \ No newline at end of file diff --git a/src/generated/resources/data/neoforge/data_maps/entity_type/parrot_imitations.json b/src/generated/resources/data/neoforge/data_maps/entity_type/parrot_imitations.json index 34e4ecdd11f..15a39110803 100644 --- a/src/generated/resources/data/neoforge/data_maps/entity_type/parrot_imitations.json +++ b/src/generated/resources/data/neoforge/data_maps/entity_type/parrot_imitations.json @@ -3,6 +3,9 @@ "minecraft:blaze": { "sound": "minecraft:entity.parrot.imitate.blaze" }, + "minecraft:bogged": { + "sound": "minecraft:entity.parrot.imitate.bogged" + }, "minecraft:breeze": { "sound": "minecraft:entity.parrot.imitate.breeze" }, diff --git a/src/generated/resources/data/neoforge/tags/blocks/enderman_place_on_blacklist.json b/src/generated/resources/data/neoforge/tags/blocks/enderman_place_on_blacklist.json new file mode 100644 index 00000000000..fb75bfe2788 --- /dev/null +++ b/src/generated/resources/data/neoforge/tags/blocks/enderman_place_on_blacklist.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:enderman_place_on_blacklist", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/damage_type/is_environment.json b/src/generated/resources/data/neoforge/tags/damage_type/is_environment.json similarity index 83% rename from src/generated/resources/data/forge/tags/damage_type/is_environment.json rename to src/generated/resources/data/neoforge/tags/damage_type/is_environment.json index 77b995dd5e5..e351503a5ca 100644 --- a/src/generated/resources/data/forge/tags/damage_type/is_environment.json +++ b/src/generated/resources/data/neoforge/tags/damage_type/is_environment.json @@ -17,6 +17,10 @@ "minecraft:cramming", "minecraft:fly_into_wall", "minecraft:sweet_berry_bush", - "minecraft:in_wall" + "minecraft:in_wall", + { + "id": "#forge:is_environment", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/neoforge/tags/damage_type/is_magic.json b/src/generated/resources/data/neoforge/tags/damage_type/is_magic.json new file mode 100644 index 00000000000..09c4487b295 --- /dev/null +++ b/src/generated/resources/data/neoforge/tags/damage_type/is_magic.json @@ -0,0 +1,14 @@ +{ + "values": [ + "minecraft:magic", + "minecraft:indirect_magic", + "minecraft:thorns", + "minecraft:dragon_breath", + "#neoforge:is_poison", + "#neoforge:is_wither", + { + "id": "#forge:is_magic", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/damage_type/is_physical.json b/src/generated/resources/data/neoforge/tags/damage_type/is_physical.json similarity index 85% rename from src/generated/resources/data/forge/tags/damage_type/is_physical.json rename to src/generated/resources/data/neoforge/tags/damage_type/is_physical.json index ed7aa2f6e72..3073b3807b7 100644 --- a/src/generated/resources/data/forge/tags/damage_type/is_physical.json +++ b/src/generated/resources/data/neoforge/tags/damage_type/is_physical.json @@ -19,6 +19,10 @@ "minecraft:mob_projectile", "minecraft:sonic_boom", "minecraft:in_wall", - "minecraft:generic" + "minecraft:generic", + { + "id": "#forge:is_physical", + "required": false + } ] } \ No newline at end of file diff --git a/src/generated/resources/data/neoforge/tags/damage_type/is_poison.json b/src/generated/resources/data/neoforge/tags/damage_type/is_poison.json new file mode 100644 index 00000000000..a20ac8c9b0d --- /dev/null +++ b/src/generated/resources/data/neoforge/tags/damage_type/is_poison.json @@ -0,0 +1,9 @@ +{ + "values": [ + "neoforge:poison", + { + "id": "#forge:is_poison", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/neoforge/tags/damage_type/is_technical.json b/src/generated/resources/data/neoforge/tags/damage_type/is_technical.json new file mode 100644 index 00000000000..f14aee1e663 --- /dev/null +++ b/src/generated/resources/data/neoforge/tags/damage_type/is_technical.json @@ -0,0 +1,11 @@ +{ + "values": [ + "minecraft:generic_kill", + "minecraft:outside_border", + "minecraft:out_of_world", + { + "id": "#forge:is_technical", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/neoforge/tags/damage_type/is_wither.json b/src/generated/resources/data/neoforge/tags/damage_type/is_wither.json new file mode 100644 index 00000000000..178bad95f4b --- /dev/null +++ b/src/generated/resources/data/neoforge/tags/damage_type/is_wither.json @@ -0,0 +1,10 @@ +{ + "values": [ + "minecraft:wither", + "minecraft:wither_skull", + { + "id": "#forge:is_wither", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/neoforge/tags/damage_type/no_flinch.json b/src/generated/resources/data/neoforge/tags/damage_type/no_flinch.json new file mode 100644 index 00000000000..cf630670d5e --- /dev/null +++ b/src/generated/resources/data/neoforge/tags/damage_type/no_flinch.json @@ -0,0 +1,8 @@ +{ + "values": [ + { + "id": "#forge:no_flinch", + "required": false + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/neoforge/tags/items/enchanting_fuels.json b/src/generated/resources/data/neoforge/tags/items/enchanting_fuels.json new file mode 100644 index 00000000000..90835868099 --- /dev/null +++ b/src/generated/resources/data/neoforge/tags/items/enchanting_fuels.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#c:gems/lapis" + ] +} \ No newline at end of file diff --git a/src/generated/resources/pack.mcmeta b/src/generated/resources/pack.mcmeta index f556448a7bd..92faf0e7a6a 100644 --- a/src/generated/resources/pack.mcmeta +++ b/src/generated/resources/pack.mcmeta @@ -3,7 +3,7 @@ "description": { "translate": "pack.neoforge.description" }, - "pack_format": 26, + "pack_format": 41, "supported_formats": [ 0, 2147483647 diff --git a/src/generated/resources/reports/registry_order.json b/src/generated/resources/reports/registry_order.json index 9abf7c699dc..07557e0d08d 100644 --- a/src/generated/resources/reports/registry_order.json +++ b/src/generated/resources/reports/registry_order.json @@ -1,6 +1,7 @@ { "order": [ "minecraft:attribute", + "minecraft:data_component_type", "minecraft:game_event", "minecraft:sound_event", "minecraft:fluid", @@ -64,23 +65,24 @@ "minecraft:worldgen/pool_alias_binding", "minecraft:cat_variant", "minecraft:frog_variant", - "minecraft:banner_pattern", "minecraft:instrument", "minecraft:decorated_pot_patterns", "minecraft:creative_mode_tab", "minecraft:trigger_type", "minecraft:number_format_type", + "minecraft:armor_material", + "minecraft:entity_sub_predicate_type", + "minecraft:item_sub_predicate_type", + "minecraft:map_decoration_type", "neoforge:attachment_types", "neoforge:biome_modifier_serializers", "neoforge:condition_codecs", "neoforge:display_contexts", "neoforge:entity_data_serializers", - "neoforge:entity_predicates", "neoforge:fluid_type", "neoforge:global_loot_modifier_serializers", "neoforge:holder_set_type", "neoforge:ingredient_serializer", - "neoforge:item_predicates", "neoforge:structure_modifier_serializers" ] } \ No newline at end of file diff --git a/src/main/java/net/neoforged/neoforge/attachment/AttachmentHolder.java b/src/main/java/net/neoforged/neoforge/attachment/AttachmentHolder.java index 502e9312094..53b2c8bc493 100644 --- a/src/main/java/net/neoforged/neoforge/attachment/AttachmentHolder.java +++ b/src/main/java/net/neoforged/neoforge/attachment/AttachmentHolder.java @@ -10,6 +10,7 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; import net.minecraft.resources.ResourceLocation; @@ -113,7 +114,7 @@ public Optional getExistingData(AttachmentType type) { * Returns {@code null} if there are no serializable attachments. */ @Nullable - public final CompoundTag serializeAttachments() { + public final CompoundTag serializeAttachments(HolderLookup.Provider provider) { if (attachments == null) { return null; } @@ -121,7 +122,7 @@ public final CompoundTag serializeAttachments() { for (var entry : attachments.entrySet()) { var type = entry.getKey(); if (type.serializer != null) { - Tag serialized = ((IAttachmentSerializer) type.serializer).write(entry.getValue()); + Tag serialized = ((IAttachmentSerializer) type.serializer).write(entry.getValue(), provider); if (serialized != null) { if (tag == null) tag = new CompoundTag(); @@ -133,9 +134,9 @@ public final CompoundTag serializeAttachments() { } /** - * Reads serializable attachments from a tag previously created via {@link #serializeAttachments()}. + * Reads serializable attachments from a tag previously created via {@link #serializeAttachments(HolderLookup.Provider)}. */ - protected final void deserializeAttachments(CompoundTag tag) { + protected final void deserializeAttachments(HolderLookup.Provider provider, CompoundTag tag) { for (var key : tag.getAllKeys()) { // Use tryParse to not discard valid attachment type keys, even if there is a malformed key. ResourceLocation keyLocation = ResourceLocation.tryParse(key); @@ -151,51 +152,13 @@ protected final void deserializeAttachments(CompoundTag tag) { } try { - getAttachmentMap().put(type, ((IAttachmentSerializer) type.serializer).read(getExposedHolder(), tag.get(key))); + getAttachmentMap().put(type, ((IAttachmentSerializer) type.serializer).read(getExposedHolder(), tag.get(key), provider)); } catch (Exception exception) { LOGGER.error("Failed to deserialize data attachment {}. Skipping.", key, exception); } } } - /** - * Checks if two attachment holders have compatible attachments, - * i.e. if they have the same serialized form. - * - *

Same as calling {@code Objects.equals(first.serializeAttachments(), second.serializeAttachments())}, - * but implemented more efficiently. - * - * @return {@code true} if the attachments are compatible, {@code false} otherwise - */ - public static boolean areAttachmentsCompatible(H first, H second) { - Map, Object> firstAttachments = first.attachments != null ? first.attachments : Map.of(); - Map, Object> secondAttachments = second.attachments != null ? second.attachments : Map.of(); - - for (var entry : firstAttachments.entrySet()) { - AttachmentType type = (AttachmentType) entry.getKey(); - if (type.serializer != null) { - var otherData = secondAttachments.get(type); - if (otherData == null) - // TODO: cache serialization of default value? - otherData = type.defaultValueSupplier.apply(second.getExposedHolder()); - if (!type.comparator.areCompatible(entry.getValue(), otherData)) - return false; - } - } - for (var entry : secondAttachments.entrySet()) { - AttachmentType type = (AttachmentType) entry.getKey(); - if (type.serializer != null) { - var data = firstAttachments.get(type); - if (data != null) - continue; // already checked in the first loop - data = type.defaultValueSupplier.apply(first.getExposedHolder()); - if (!type.comparator.areCompatible(entry.getValue(), data)) - return false; - } - } - return true; - } - /** * Version of the {@link AttachmentHolder} that is suitable for storing in a field. * To be used when extending {@link AttachmentHolder} is not possible, @@ -213,8 +176,8 @@ IAttachmentHolder getExposedHolder() { return exposedHolder; } - public void deserializeInternal(CompoundTag tag) { - deserializeAttachments(tag); + public void deserializeInternal(HolderLookup.Provider provider, CompoundTag tag) { + deserializeAttachments(provider, tag); } } } diff --git a/src/main/java/net/neoforged/neoforge/attachment/AttachmentInternals.java b/src/main/java/net/neoforged/neoforge/attachment/AttachmentInternals.java index 8043e58f810..b4b33eacca6 100644 --- a/src/main/java/net/neoforged/neoforge/attachment/AttachmentInternals.java +++ b/src/main/java/net/neoforged/neoforge/attachment/AttachmentInternals.java @@ -5,83 +5,62 @@ package net.neoforged.neoforge.attachment; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.Tag; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; +import java.util.function.Predicate; +import net.minecraft.core.HolderLookup; +import net.minecraft.world.entity.Entity; import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.Mod; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.common.extensions.IEntityExtension; import net.neoforged.neoforge.event.entity.living.LivingConversionEvent; import net.neoforged.neoforge.event.entity.player.PlayerEvent; import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.Nullable; @ApiStatus.Internal -@Mod.EventBusSubscriber(modid = NeoForgeVersion.MOD_ID) +@EventBusSubscriber(modid = NeoForgeVersion.MOD_ID) public final class AttachmentInternals { /** - * Marks a stack that has attachments and an empty NBT tag ({}). - * If this marker is absent, we set the tag back to null after reading the attachments. + * Copy some attachments to another holder. */ - private static final String EMPTY_TAG_KEY = "neoforge:empty"; - - @Nullable - public static CompoundTag addAttachmentsToTag(@Nullable CompoundTag tag, ItemStack stack, boolean fullCopy) { - // Store all serializable attachments as an nbt subtag - CompoundTag attachmentsTag = stack.serializeAttachments(); - if (attachmentsTag != null) { - if (tag == null) - tag = new CompoundTag(); - else { - tag = tag.copy(); - if (tag.isEmpty()) // Make sure we can differentiate between null and empty. - tag.putBoolean(EMPTY_TAG_KEY, true); + private static void copyAttachments(HolderLookup.Provider provider, H from, H to, Predicate> filter) { + if (from.attachments == null) { + return; + } + for (var entry : from.attachments.entrySet()) { + AttachmentType type = entry.getKey(); + if (type.serializer == null) { + continue; } - tag.put(AttachmentHolder.ATTACHMENTS_NBT_KEY, attachmentsTag); - } else if (fullCopy && tag != null) - tag = tag.copy(); - return tag; + @SuppressWarnings("unchecked") + var copyHandler = (IAttachmentCopyHandler) type.copyHandler; + if (filter.test(type)) { + Object copy = copyHandler.copy(entry.getValue(), to.getExposedHolder(), provider); + if (copy != null) { + to.getAttachmentMap().put(type, copy); + } + } + } } - /** - * Perform the inverse operation of {@link #addAttachmentsToTag} on stack reception. - */ - public static ItemStack reconstructItemStack(Item item, int count, @Nullable CompoundTag tag) { - ItemStack itemstack; - if (tag != null && tag.contains(AttachmentHolder.ATTACHMENTS_NBT_KEY, Tag.TAG_COMPOUND)) { - // Read serialized caps - itemstack = new ItemStack(item, count, tag.getCompound(AttachmentHolder.ATTACHMENTS_NBT_KEY)); - tag = cleanTag(tag); - } else { - itemstack = new ItemStack(item, count); - } - itemstack.setTag(tag); - return itemstack; + public static void copyChunkAttachmentsOnPromotion(HolderLookup.Provider provider, AttachmentHolder.AsField from, AttachmentHolder.AsField to) { + copyAttachments(provider, from, to, type -> true); } /** - * Clean tag of its contained attachments (as set by {@link #addAttachmentsToTag}). + * Do not call directly, use {@link IEntityExtension#copyAttachmentsFrom(Entity, boolean)}. */ - @Nullable - public static CompoundTag cleanTag(CompoundTag tag) { - tag.remove(AttachmentHolder.ATTACHMENTS_NBT_KEY); - // If the tag is now empty and the empty marker is absent, replace by null. - if (tag.contains(EMPTY_TAG_KEY)) - tag.remove(EMPTY_TAG_KEY); - else if (tag.isEmpty()) - tag = null; - return tag; + public static void copyEntityAttachments(Entity from, Entity to, boolean isDeath) { + copyAttachments(from.registryAccess(), from, to, isDeath ? type -> type.copyOnDeath : type -> true); } @SubscribeEvent public static void onPlayerClone(PlayerEvent.Clone event) { - AttachmentUtils.copyAttachments(event.getOriginal(), event.getEntity(), event.isWasDeath() ? type -> type.copyOnDeath : type -> true); + event.getEntity().copyAttachmentsFrom(event.getOriginal(), event.isWasDeath()); } @SubscribeEvent public static void onLivingConvert(LivingConversionEvent.Post event) { - AttachmentUtils.copyAttachments(event.getEntity(), event.getOutcome(), type -> type.copyOnDeath); + event.getOutcome().copyAttachmentsFrom(event.getEntity(), true); } private AttachmentInternals() {} diff --git a/src/main/java/net/neoforged/neoforge/attachment/AttachmentType.java b/src/main/java/net/neoforged/neoforge/attachment/AttachmentType.java index 25f2a710d89..27a10235717 100644 --- a/src/main/java/net/neoforged/neoforge/attachment/AttachmentType.java +++ b/src/main/java/net/neoforged/neoforge/attachment/AttachmentType.java @@ -11,6 +11,7 @@ import java.util.function.Function; import java.util.function.Predicate; import java.util.function.Supplier; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.Tag; import net.minecraft.world.entity.Entity; @@ -59,36 +60,25 @@ public final class AttachmentType { @Nullable final IAttachmentSerializer serializer; final boolean copyOnDeath; - final IAttachmentComparator comparator; final IAttachmentCopyHandler copyHandler; private AttachmentType(Builder builder) { this.defaultValueSupplier = builder.defaultValueSupplier; this.serializer = builder.serializer; this.copyOnDeath = builder.copyOnDeath; - this.comparator = builder.comparator != null ? builder.comparator : defaultComparator(serializer); this.copyHandler = builder.copyHandler != null ? builder.copyHandler : defaultCopyHandler(serializer); } - private static IAttachmentComparator defaultComparator(@Nullable IAttachmentSerializer serializer) { - if (serializer == null) { - return (first, second) -> { - throw new UnsupportedOperationException("Cannot compare non-serializable attachments"); - }; - } - return (first, second) -> Objects.equals(serializer.write(first), serializer.write(second)); - } - private static IAttachmentCopyHandler defaultCopyHandler(@Nullable IAttachmentSerializer serializer) { if (serializer == null) { - return (holder, attachment) -> { + return (attachment, holder, provider) -> { throw new UnsupportedOperationException("Cannot copy non-serializable attachments"); }; } - return (holder, attachment) -> { - H serialized = serializer.write(attachment); + return (attachment, holder, provider) -> { + H serialized = serializer.write(attachment, provider); if (serialized != null) { - return serializer.read(holder, serialized); + return serializer.read(holder, serialized, provider); } return null; }; @@ -141,16 +131,16 @@ public static > Builder serializ public static > Builder serializable(Function defaultValueConstructor) { return builder(defaultValueConstructor).serialize(new IAttachmentSerializer() { @Override - public T read(IAttachmentHolder holder, S tag) { + public T read(IAttachmentHolder holder, S tag, HolderLookup.Provider provider) { var ret = defaultValueConstructor.apply(holder); - ret.deserializeNBT(tag); + ret.deserializeNBT(provider, tag); return ret; } @Nullable @Override - public S write(T attachment) { - return attachment.serializeNBT(); + public S write(T attachment, HolderLookup.Provider provider) { + return attachment.serializeNBT(provider); } }); } @@ -161,8 +151,6 @@ public static class Builder { private IAttachmentSerializer serializer; private boolean copyOnDeath; @Nullable - private IAttachmentComparator comparator; - @Nullable private IAttachmentCopyHandler copyHandler; private Builder(Function defaultValueSupplier) { @@ -213,13 +201,13 @@ public Builder serialize(Codec codec, Predicate shouldSerialize // TODO: better error handling return serialize(new IAttachmentSerializer<>() { @Override - public T read(IAttachmentHolder holder, Tag tag) { + public T read(IAttachmentHolder holder, Tag tag, HolderLookup.Provider provider) { return codec.parse(NbtOps.INSTANCE, tag).result().get(); } @Nullable @Override - public Tag write(T attachment) { + public Tag write(T attachment, HolderLookup.Provider provider) { return shouldSerialize.test(attachment) ? codec.encodeStart(NbtOps.INSTANCE, attachment).result().get() : null; } }); @@ -235,23 +223,6 @@ public Builder copyOnDeath() { return this; } - /** - * Overrides the comparator for this attachment type. - * - *

The default comparator checks for equality of the serialized NBT tag: - * {@code Objects.equals(serializer.write(first), serializer.write(second))}. - * - *

A comparator can only be provided for serializable attachments. - */ - public Builder comparator(IAttachmentComparator comparator) { - Objects.requireNonNull(comparator); - // Check for serializer because only serializable attachments can be compared. - if (this.serializer == null) - throw new IllegalStateException("comparator requires a serializer"); - this.comparator = comparator; - return this; - } - /** * Overrides the copyHandler for this attachment type. * diff --git a/src/main/java/net/neoforged/neoforge/attachment/AttachmentUtils.java b/src/main/java/net/neoforged/neoforge/attachment/AttachmentUtils.java deleted file mode 100644 index 3f21d262670..00000000000 --- a/src/main/java/net/neoforged/neoforge/attachment/AttachmentUtils.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) NeoForged and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.attachment; - -import java.util.function.Predicate; -import net.minecraft.world.item.ItemStack; - -public final class AttachmentUtils { - private AttachmentUtils() {} - - /** - * Copy some attachments to another holder. - */ - public static void copyAttachments(H from, H to, Predicate> filter) { - if (from.attachments == null) { - return; - } - for (var entry : from.attachments.entrySet()) { - AttachmentType type = entry.getKey(); - if (type.serializer == null) { - continue; - } - @SuppressWarnings("unchecked") - var copyHandler = (IAttachmentCopyHandler) type.copyHandler; - if (filter.test(type)) { - Object copy = copyHandler.copy(to.getExposedHolder(), entry.getValue()); - if (copy != null) { - to.getAttachmentMap().put(type, copy); - } - } - } - } - - public static void copyStackAttachments(ItemStack from, ItemStack to) { - copyAttachments(from, to, type -> true); - } - - public static void copyChunkAttachmentsOnPromotion(AttachmentHolder.AsField from, AttachmentHolder.AsField to) { - copyAttachments(from, to, type -> true); - } -} diff --git a/src/main/java/net/neoforged/neoforge/attachment/IAttachmentComparator.java b/src/main/java/net/neoforged/neoforge/attachment/IAttachmentComparator.java deleted file mode 100644 index acb8810ccb4..00000000000 --- a/src/main/java/net/neoforged/neoforge/attachment/IAttachmentComparator.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) NeoForged and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.attachment; - -/** - * Custom comparator for data attachments, to improve efficiency compared to the default - * {@code Objects.equals(serializer.write(first), serializer.write(second))} implementation. - */ -public interface IAttachmentComparator { - /** - * Checks whether two data attachments are compatible. - * - *

If the attachments are not compatible, - * this will prevent item stacks from being stacked together. - * - *

This function should give the same result as the serialized versions of the attachments - * with {@code Objects.equals(serializer.write(first), serializer.write(second))}, - * but will often be faster and allocate less. - */ - boolean areCompatible(T first, T second); -} diff --git a/src/main/java/net/neoforged/neoforge/attachment/IAttachmentCopyHandler.java b/src/main/java/net/neoforged/neoforge/attachment/IAttachmentCopyHandler.java index d390b45279f..80b47a68420 100644 --- a/src/main/java/net/neoforged/neoforge/attachment/IAttachmentCopyHandler.java +++ b/src/main/java/net/neoforged/neoforge/attachment/IAttachmentCopyHandler.java @@ -5,6 +5,7 @@ package net.neoforged.neoforge.attachment; +import net.minecraft.core.HolderLookup; import org.jetbrains.annotations.Nullable; /** @@ -14,11 +15,11 @@ public interface IAttachmentCopyHandler { /** * creates a copy of the attachment. The copy should be equal to serializing and deserializing the attachment. - * - * @param holder the holder the attachment will be part of after copying + * * @param attachment the attachment to copy + * @param holder the holder the attachment will be part of after copying * @return the copy or null if it shouldn't be copied. */ @Nullable - T copy(IAttachmentHolder holder, T attachment); + T copy(T attachment, IAttachmentHolder holder, HolderLookup.Provider provider); } diff --git a/src/main/java/net/neoforged/neoforge/attachment/IAttachmentSerializer.java b/src/main/java/net/neoforged/neoforge/attachment/IAttachmentSerializer.java index 3afa5a2ac05..c3ac470cea7 100644 --- a/src/main/java/net/neoforged/neoforge/attachment/IAttachmentSerializer.java +++ b/src/main/java/net/neoforged/neoforge/attachment/IAttachmentSerializer.java @@ -5,43 +5,30 @@ package net.neoforged.neoforge.attachment; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.Tag; import org.jetbrains.annotations.Nullable; /** * Serializer for data attachments. * - *

The {@link #read(IAttachmentHolder, Tag)} method must be implemented by subclasses! + *

The {@link #read(IAttachmentHolder, Tag, HolderLookup.Provider)} method must be implemented by subclasses! * * @param A {@link Tag} subclass: the serialized representation. * @param The type of the data attachment. */ public interface IAttachmentSerializer { - /** - * @deprecated Implement {@link #read(IAttachmentHolder, Tag)} instead. - * This method will be removed in a future version. - */ - @Deprecated(forRemoval = true, since = "1.20.4") - default T read(S tag) { - throw new RuntimeException("IAttachmentSerializer must implement the read() that accepts a holder!"); - } - /** * Reads the attachment from NBT. * - *

In a future version, the default implementation will be removed, - * but for now it exists for backwards compatibility with {@link #read(Tag)}. - * * @param holder the holder for the attachment, can be cast if the subtype is known * @param tag the serialized attachment */ - default T read(IAttachmentHolder holder, S tag) { - return read(tag); - } + T read(IAttachmentHolder holder, S tag, HolderLookup.Provider provider); /** * Writes the attachment to NBT, or returns null if it is should not be serialized. */ @Nullable - S write(T attachment); + S write(T attachment, HolderLookup.Provider provider); } diff --git a/src/main/java/net/neoforged/neoforge/attachment/LevelAttachmentsSavedData.java b/src/main/java/net/neoforged/neoforge/attachment/LevelAttachmentsSavedData.java index bba9a565958..a1c14e3ad0f 100644 --- a/src/main/java/net/neoforged/neoforge/attachment/LevelAttachmentsSavedData.java +++ b/src/main/java/net/neoforged/neoforge/attachment/LevelAttachmentsSavedData.java @@ -6,6 +6,7 @@ package net.neoforged.neoforge.attachment; import java.util.Objects; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.saveddata.SavedData; @@ -18,7 +19,7 @@ public class LevelAttachmentsSavedData extends SavedData { public static void init(ServerLevel level) { var factory = new SavedData.Factory<>( () -> new LevelAttachmentsSavedData(level), - tag -> new LevelAttachmentsSavedData(level, tag)); + (tag, prov) -> new LevelAttachmentsSavedData(level, tag)); // Querying the attachment a single time is enough to initialize it, // and make sure it gets saved when the level is saved. level.getDataStorage().computeIfAbsent(factory, NAME); @@ -32,13 +33,13 @@ public LevelAttachmentsSavedData(ServerLevel level) { public LevelAttachmentsSavedData(ServerLevel level, CompoundTag tag) { this.level = level; - level.deserializeAttachments(tag); + level.deserializeAttachments(level.registryAccess(), tag); } @Override - public CompoundTag save(CompoundTag tag) { + public CompoundTag save(CompoundTag tag, HolderLookup.Provider provider) { // Make sure we don't return null - return Objects.requireNonNullElseGet(level.serializeAttachments(), CompoundTag::new); + return Objects.requireNonNullElseGet(level.serializeAttachments(provider), CompoundTag::new); } @Override diff --git a/src/main/java/net/neoforged/neoforge/capabilities/CapabilityHooks.java b/src/main/java/net/neoforged/neoforge/capabilities/CapabilityHooks.java index 2da0f3734c8..7d53bf075cf 100644 --- a/src/main/java/net/neoforged/neoforge/capabilities/CapabilityHooks.java +++ b/src/main/java/net/neoforged/neoforge/capabilities/CapabilityHooks.java @@ -20,8 +20,8 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.neoforged.fml.ModLoader; import net.neoforged.neoforge.common.NeoForgeMod; -import net.neoforged.neoforge.event.TickEvent; import net.neoforged.neoforge.event.level.ChunkEvent; +import net.neoforged.neoforge.event.tick.LevelTickEvent; import net.neoforged.neoforge.fluids.capability.wrappers.FluidBucketWrapper; import net.neoforged.neoforge.items.VanillaHopperItemHandler; import net.neoforged.neoforge.items.wrapper.CombinedInvWrapper; @@ -45,7 +45,7 @@ public static void init() { initialized = true; var event = new RegisterCapabilitiesEvent(); - ModLoader.get().postEventWrapContainerInModOrder(event); + ModLoader.postEventWrapContainerInModOrder(event); initFinished = true; } @@ -152,20 +152,20 @@ else if (entity instanceof LivingEntity livingEntity) } public static void invalidateCapsOnChunkLoad(ChunkEvent.Load event) { - if (!event.getLevel().isClientSide()) { - ((ServerLevel) event.getLevel()).invalidateCapabilities(event.getChunk().getPos()); + if (event.getLevel() instanceof ServerLevel sl) { + sl.invalidateCapabilities(event.getChunk().getPos()); } } public static void invalidateCapsOnChunkUnload(ChunkEvent.Unload event) { - if (!event.getLevel().isClientSide()) { - ((ServerLevel) event.getLevel()).invalidateCapabilities(event.getChunk().getPos()); + if (event.getLevel() instanceof ServerLevel sl) { + sl.invalidateCapabilities(event.getChunk().getPos()); } } - public static void cleanCapabilityListenerReferencesOnTick(TickEvent.LevelTickEvent event) { - if (event.phase == TickEvent.Phase.END && event.side.isServer()) { - ((ServerLevel) event.level).cleanCapabilityListenerReferences(); + public static void cleanCapabilityListenerReferencesOnTick(LevelTickEvent.Post event) { + if (event.getLevel() instanceof ServerLevel sl) { + sl.cleanCapabilityListenerReferences(); } } } diff --git a/src/main/java/net/neoforged/neoforge/client/BlockEntityRenderBoundsDebugRenderer.java b/src/main/java/net/neoforged/neoforge/client/BlockEntityRenderBoundsDebugRenderer.java index 3b61d9a0ff9..a7cef0f09a9 100644 --- a/src/main/java/net/neoforged/neoforge/client/BlockEntityRenderBoundsDebugRenderer.java +++ b/src/main/java/net/neoforged/neoforge/client/BlockEntityRenderBoundsDebugRenderer.java @@ -20,12 +20,12 @@ import net.minecraft.world.phys.Vec3; import net.neoforged.api.distmarker.Dist; import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.Mod; +import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.neoforge.client.event.RegisterClientCommandsEvent; import net.neoforged.neoforge.client.event.RenderLevelStageEvent; import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; -@Mod.EventBusSubscriber(value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.FORGE, modid = NeoForgeVersion.MOD_ID) +@EventBusSubscriber(value = Dist.CLIENT, bus = EventBusSubscriber.Bus.GAME, modid = NeoForgeVersion.MOD_ID) public final class BlockEntityRenderBoundsDebugRenderer { private static boolean enabled = false; diff --git a/src/main/java/net/neoforged/neoforge/client/ClientHooks.java b/src/main/java/net/neoforged/neoforge/client/ClientHooks.java index 7a36c79ec4e..23cfa1d4de4 100644 --- a/src/main/java/net/neoforged/neoforge/client/ClientHooks.java +++ b/src/main/java/net/neoforged/neoforge/client/ClientHooks.java @@ -45,7 +45,6 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.LerpingBossEvent; import net.minecraft.client.gui.components.toasts.Toast; -import net.minecraft.client.gui.screens.ConfirmScreen; import net.minecraft.client.gui.screens.MenuScreens; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.TitleScreen; @@ -92,12 +91,9 @@ import net.minecraft.locale.Language; import net.minecraft.network.Connection; import net.minecraft.network.chat.ChatType; -import net.minecraft.network.chat.ChatTypeDecoration; -import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; import net.minecraft.network.chat.PlayerChatMessage; -import net.minecraft.network.chat.Style; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ReloadableResourceManager; import net.minecraft.util.Mth; @@ -108,9 +104,9 @@ import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.tooltip.TooltipComponent; +import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.RecipeManager; @@ -129,7 +125,7 @@ import net.neoforged.bus.api.Event; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.ModLoader; -import net.neoforged.fml.common.Mod; +import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.neoforge.client.event.AddSectionGeometryEvent; import net.neoforged.neoforge.client.event.CalculateDetachedCameraDistanceEvent; import net.neoforged.neoforge.client.event.CalculatePlayerTurnEvent; @@ -138,6 +134,7 @@ import net.neoforged.neoforge.client.event.ClientPauseUpdatedEvent; import net.neoforged.neoforge.client.event.ClientPlayerChangeGameTypeEvent; import net.neoforged.neoforge.client.event.ClientPlayerNetworkEvent; +import net.neoforged.neoforge.client.event.ClientTickEvent; import net.neoforged.neoforge.client.event.ComputeFovModifierEvent; import net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent; import net.neoforged.neoforge.client.event.EntityRenderersEvent; @@ -153,6 +150,7 @@ import net.neoforged.neoforge.client.event.RegisterSpriteSourceTypesEvent; import net.neoforged.neoforge.client.event.RenderArmEvent; import net.neoforged.neoforge.client.event.RenderBlockScreenEffectEvent; +import net.neoforged.neoforge.client.event.RenderFrameEvent; import net.neoforged.neoforge.client.event.RenderHandEvent; import net.neoforged.neoforge.client.event.RenderHighlightEvent; import net.neoforged.neoforge.client.event.RenderLevelStageEvent; @@ -167,7 +165,6 @@ import net.neoforged.neoforge.client.extensions.common.IClientItemExtensions; import net.neoforged.neoforge.client.extensions.common.IClientMobEffectExtensions; import net.neoforged.neoforge.client.gui.ClientTooltipComponentManager; -import net.neoforged.neoforge.client.gui.overlay.GuiOverlayManager; import net.neoforged.neoforge.client.model.data.ModelData; import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.common.NeoForgeMod; @@ -239,9 +236,9 @@ public static float getGuiFarPlane() { return 11000.0F + 10000.0F * (1 + guiLayers.size()); } - public static String getArmorTexture(Entity entity, ItemStack armor, String _default, EquipmentSlot slot, String type) { - String result = armor.getItem().getArmorTexture(armor, entity, slot, type); - return result != null ? result : _default; + public static ResourceLocation getArmorTexture(Entity entity, ItemStack armor, ArmorMaterial.Layer layer, boolean innerModel, EquipmentSlot slot) { + ResourceLocation result = armor.getItem().getArmorTexture(armor, entity, slot, layer, innerModel); + return result != null ? result : layer.texture(innerModel); } public static void onClientPauseUpdate(boolean paused) { @@ -262,18 +259,18 @@ public static boolean onDrawHighlight(LevelRenderer context, Camera camera, HitR } } - public static void dispatchRenderStage(RenderLevelStageEvent.Stage stage, LevelRenderer levelRenderer, PoseStack poseStack, Matrix4f projectionMatrix, int renderTick, Camera camera, Frustum frustum) { + public static void dispatchRenderStage(RenderLevelStageEvent.Stage stage, LevelRenderer levelRenderer, @Nullable PoseStack poseStack, Matrix4f modelViewMatrix, Matrix4f projectionMatrix, int renderTick, Camera camera, Frustum frustum) { var mc = Minecraft.getInstance(); var profiler = mc.getProfiler(); profiler.push(stage.toString()); - NeoForge.EVENT_BUS.post(new RenderLevelStageEvent(stage, levelRenderer, poseStack, projectionMatrix, renderTick, mc.getPartialTick(), camera, frustum)); + NeoForge.EVENT_BUS.post(new RenderLevelStageEvent(stage, levelRenderer, poseStack, modelViewMatrix, projectionMatrix, renderTick, mc.getPartialTick(), camera, frustum)); profiler.pop(); } - public static void dispatchRenderStage(RenderType renderType, LevelRenderer levelRenderer, PoseStack poseStack, Matrix4f projectionMatrix, int renderTick, Camera camera, Frustum frustum) { + public static void dispatchRenderStage(RenderType renderType, LevelRenderer levelRenderer, Matrix4f modelViewMatrix, Matrix4f projectionMatrix, int renderTick, Camera camera, Frustum frustum) { RenderLevelStageEvent.Stage stage = RenderLevelStageEvent.Stage.fromRenderType(renderType); if (stage != null) - dispatchRenderStage(stage, levelRenderer, poseStack, projectionMatrix, renderTick, camera, frustum); + dispatchRenderStage(stage, levelRenderer, null, modelViewMatrix, projectionMatrix, renderTick, camera, frustum); } public static boolean renderSpecificFirstPersonHand(InteractionHand hand, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, float partialTick, float interpPitch, float swingProgress, float equipProgress, ItemStack stack) { @@ -285,15 +282,15 @@ public static boolean renderSpecificFirstPersonArm(PoseStack poseStack, MultiBuf } public static void onTextureAtlasStitched(TextureAtlas atlas) { - ModLoader.get().postEvent(new TextureAtlasStitchedEvent(atlas)); + ModLoader.postEvent(new TextureAtlasStitchedEvent(atlas)); } public static void onBlockColorsInit(BlockColors blockColors) { - ModLoader.get().postEvent(new RegisterColorHandlersEvent.Block(blockColors)); + ModLoader.postEvent(new RegisterColorHandlersEvent.Block(blockColors)); } public static void onItemColorsInit(ItemColors itemColors, BlockColors blockColors) { - ModLoader.get().postEvent(new RegisterColorHandlersEvent.Item(itemColors, blockColors)); + ModLoader.postEvent(new RegisterColorHandlersEvent.Item(itemColors, blockColors)); } public static Model getArmorModel(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlot slot, HumanoidModel _default) { @@ -348,8 +345,8 @@ public static CalculatePlayerTurnEvent getTurnPlayerValues(double mouseSensitivi return event; } - public static double getDetachedCameraDistance(Camera camera, boolean flipped, double distance) { - var event = new CalculateDetachedCameraDistanceEvent(camera, flipped, distance); + public static double getDetachedCameraDistance(Camera camera, boolean flipped, float entityScale, double distance) { + var event = new CalculateDetachedCameraDistanceEvent(camera, flipped, entityScale, distance); NeoForge.EVENT_BUS.post(event); return event.getDistance(); } @@ -444,11 +441,11 @@ public static void onModifyBakingResult(Map models LOGGER.warn("Failed to retrieve texture '{}' from atlas '{}'", material.texture(), material.atlasLocation(), new Throwable()); return stitchResult.missing(); }; - ModLoader.get().postEvent(new ModelEvent.ModifyBakingResult(models, textureGetter, modelBakery)); + ModLoader.postEvent(new ModelEvent.ModifyBakingResult(models, textureGetter, modelBakery)); } public static void onModelBake(ModelManager modelManager, Map models, ModelBakery modelBakery) { - ModLoader.get().postEvent(new ModelEvent.BakingCompleted(modelManager, Collections.unmodifiableMap(models), modelBakery)); + ModLoader.postEvent(new ModelEvent.BakingCompleted(modelManager, Collections.unmodifiableMap(models), modelBakery)); } public static BakedModel handleCameraTransforms(PoseStack poseStack, BakedModel model, ItemDisplayContext cameraTransformType, boolean applyLeftHandTransform) { @@ -665,10 +662,8 @@ public static InputEvent.InteractionKeyMappingTriggered onClickInput(int button, public static boolean isNameplateInRenderDistance(Entity entity, double squareDistance) { if (entity instanceof LivingEntity) { - final AttributeInstance attribute = ((LivingEntity) entity).getAttribute(NeoForgeMod.NAMETAG_DISTANCE.value()); - if (attribute != null) { - return !(squareDistance > (attribute.getValue() * attribute.getValue())); - } + double value = ((LivingEntity) entity).getAttributeValue(NeoForgeMod.NAMETAG_DISTANCE); + return !(squareDistance > value * value); } return !(squareDistance > 4096.0f); } @@ -710,15 +705,15 @@ public static void firePlayerRespawn(MultiPlayerGameMode pc, LocalPlayer oldPlay } public static void onRegisterParticleProviders(ParticleEngine particleEngine) { - ModLoader.get().postEvent(new RegisterParticleProvidersEvent(particleEngine)); + ModLoader.postEvent(new RegisterParticleProvidersEvent(particleEngine)); } public static void onRegisterKeyMappings(Options options) { - ModLoader.get().postEvent(new RegisterKeyMappingsEvent(options)); + ModLoader.postEvent(new RegisterKeyMappingsEvent(options)); } public static void onRegisterAdditionalModels(Set additionalModels) { - ModLoader.get().postEvent(new ModelEvent.RegisterAdditional(additionalModels)); + ModLoader.postEvent(new ModelEvent.RegisterAdditional(additionalModels)); } @Nullable @@ -733,13 +728,9 @@ public static Component onClientPlayerChat(ChatType.Bound boundChatType, Compone return NeoForge.EVENT_BUS.post(event).isCanceled() ? null : event.getMessage(); } - private static final ChatTypeDecoration SYSTEM_CHAT_TYPE_DECORATION = new ChatTypeDecoration("neoforge.chatType.system", List.of(ChatTypeDecoration.Parameter.CONTENT), Style.EMPTY); - private static final ChatType SYSTEM_CHAT_TYPE = new ChatType(SYSTEM_CHAT_TYPE_DECORATION, SYSTEM_CHAT_TYPE_DECORATION); - private static final ChatType.Bound SYSTEM_CHAT_TYPE_BOUND = SYSTEM_CHAT_TYPE.bind(Component.literal("System")); - @Nullable public static Component onClientSystemChat(Component message, boolean overlay) { - ClientChatReceivedEvent.System event = new ClientChatReceivedEvent.System(SYSTEM_CHAT_TYPE_BOUND, message, overlay); + ClientChatReceivedEvent.System event = new ClientChatReceivedEvent.System(message, overlay); return NeoForge.EVENT_BUS.post(event).isCanceled() ? null : event.getMessage(); } @@ -756,7 +747,7 @@ public static RenderType getEntityRenderType(RenderType chunkRenderType, boolean return RenderTypeHelper.getEntityRenderType(chunkRenderType, cull); } - @Mod.EventBusSubscriber(value = Dist.CLIENT, modid = "neoforge", bus = Mod.EventBusSubscriber.Bus.MOD) + @EventBusSubscriber(value = Dist.CLIENT, modid = "neoforge", bus = EventBusSubscriber.Bus.MOD) public static class ClientEvents { @Nullable private static ShaderInstance rendertypeEntityTranslucentUnlitShader; @@ -884,23 +875,6 @@ public static boolean isBlockInSolidLayer(BlockState state) { return model.getRenderTypes(state, RandomSource.create(), ModelData.EMPTY).contains(RenderType.solid()); } - public static void createWorldConfirmationScreen(Runnable doConfirmedWorldLoad) { - Component title = Component.translatable("selectWorld.backupQuestion.experimental"); - Component msg = Component.translatable("selectWorld.backupWarning.experimental") - .append("\n\n") - .append(Component.translatable("neoforge.selectWorld.backupWarning.experimental.additional")); - - Screen screen = new ConfirmScreen(confirmed -> { - if (confirmed) { - doConfirmedWorldLoad.run(); - } else { - Minecraft.getInstance().setScreen(null); - } - }, title, msg, CommonComponents.GUI_PROCEED, CommonComponents.GUI_CANCEL); - - Minecraft.getInstance().setScreen(screen); - } - public static boolean renderFireOverlay(Player player, PoseStack mat) { return renderBlockOverlay(player, mat, RenderBlockScreenEffectEvent.OverlayType.FIRE, Blocks.FIRE.defaultBlockState(), player.blockPosition()); } @@ -934,7 +908,7 @@ public static BiMap makeSpriteSourceTypesMap @ApiStatus.Internal public static void registerSpriteSourceTypes() { - ModLoader.get().postEvent(new RegisterSpriteSourceTypesEvent(SPRITE_SOURCE_TYPES_MAP)); + ModLoader.postEvent(new RegisterSpriteSourceTypesEvent(SPRITE_SOURCE_TYPES_MAP)); } @ApiStatus.Internal @@ -1017,18 +991,54 @@ public static void initClientHooks(Minecraft mc, ReloadableResourceManager resou GameTestHooks.registerGametests(); registerSpriteSourceTypes(); MenuScreens.init(); - ModLoader.get().postEvent(new RegisterClientReloadListenersEvent(resourceManager)); - ModLoader.get().postEvent(new EntityRenderersEvent.RegisterLayerDefinitions()); - ModLoader.get().postEvent(new EntityRenderersEvent.RegisterRenderers()); + ModLoader.postEvent(new RegisterClientReloadListenersEvent(resourceManager)); + ModLoader.postEvent(new EntityRenderersEvent.RegisterLayerDefinitions()); + ModLoader.postEvent(new EntityRenderersEvent.RegisterRenderers()); ClientTooltipComponentManager.init(); EntitySpectatorShaderManager.init(); ClientHooks.onRegisterKeyMappings(mc.options); RecipeBookManager.init(); - GuiOverlayManager.init(); + mc.gui.initModdedOverlays(); DimensionSpecialEffectsManager.init(); NamedRenderTypeManager.init(); ColorResolverManager.init(); ItemDecoratorHandler.init(); PresetEditorManager.init(); } + + /** + * Fires {@link RenderFrameEvent.Pre}. Called just before {@link GameRenderer#render(float, long, boolean)} in {@link Minecraft#runTick(boolean)}. + *

+ * Fired before the profiler section for "gameRenderer" is started. + * + * @param partialTick The current partial tick + */ + public static void fireRenderFramePre(float partialTick) { + NeoForge.EVENT_BUS.post(new RenderFrameEvent.Pre(partialTick)); + } + + /** + * Fires {@link RenderFrameEvent.Post}. Called just after {@link GameRenderer#render(float, long, boolean)} in {@link Minecraft#runTick(boolean)}. + *

+ * Fired after the profiler section for "gameRenderer" is ended. + * + * @param partialTick The current partial tick + */ + public static void fireRenderFramePost(float partialRick) { + NeoForge.EVENT_BUS.post(new RenderFrameEvent.Post(partialRick)); + } + + /** + * Fires {@link ClientTickEvent.Pre}. Called from the head of {@link Minecraft#tick()}. + */ + public static void fireClientTickPre() { + NeoForge.EVENT_BUS.post(new ClientTickEvent.Pre()); + } + + /** + * Fires {@link ClientTickEvent.Post}. Called from the tail of {@link Minecraft#tick()}. + */ + public static void fireClientTickPost() { + NeoForge.EVENT_BUS.post(new ClientTickEvent.Post()); + } } diff --git a/src/main/java/net/neoforged/neoforge/client/ClientNeoForgeMod.java b/src/main/java/net/neoforged/neoforge/client/ClientNeoForgeMod.java index 3da587fb95b..13a05264d59 100644 --- a/src/main/java/net/neoforged/neoforge/client/ClientNeoForgeMod.java +++ b/src/main/java/net/neoforged/neoforge/client/ClientNeoForgeMod.java @@ -9,7 +9,7 @@ import net.minecraft.resources.ResourceLocation; import net.neoforged.api.distmarker.Dist; import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.Mod; +import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.neoforge.client.event.ModelEvent; import net.neoforged.neoforge.client.event.RegisterClientReloadListenersEvent; import net.neoforged.neoforge.client.event.RegisterNamedRenderTypesEvent; @@ -21,7 +21,7 @@ import net.neoforged.neoforge.client.model.SeparateTransformsModel; import net.neoforged.neoforge.client.model.obj.ObjLoader; -@Mod.EventBusSubscriber(value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD, modid = "neoforge") +@EventBusSubscriber(value = Dist.CLIENT, bus = EventBusSubscriber.Bus.MOD, modid = "neoforge") public class ClientNeoForgeMod { @SubscribeEvent public static void onRegisterGeometryLoaders(ModelEvent.RegisterGeometryLoaders event) { diff --git a/src/main/java/net/neoforged/neoforge/client/ColorResolverManager.java b/src/main/java/net/neoforged/neoforge/client/ColorResolverManager.java index 9f9df339af7..050c07101ef 100644 --- a/src/main/java/net/neoforged/neoforge/client/ColorResolverManager.java +++ b/src/main/java/net/neoforged/neoforge/client/ColorResolverManager.java @@ -23,7 +23,7 @@ public final class ColorResolverManager { @ApiStatus.Internal public static void init() { ImmutableList.Builder builder = ImmutableList.builder(); - ModLoader.get().postEvent(new RegisterColorHandlersEvent.ColorResolvers(builder)); + ModLoader.postEvent(new RegisterColorHandlersEvent.ColorResolvers(builder)); colorResolvers = builder.build(); } diff --git a/src/main/java/net/neoforged/neoforge/client/ConfigScreenHandler.java b/src/main/java/net/neoforged/neoforge/client/ConfigScreenHandler.java deleted file mode 100644 index 99e3ba2eaa5..00000000000 --- a/src/main/java/net/neoforged/neoforge/client/ConfigScreenHandler.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.client; - -import java.util.Optional; -import java.util.function.BiFunction; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screens.Screen; -import net.neoforged.fml.IExtensionPoint; -import net.neoforged.fml.ModList; -import net.neoforged.neoforgespi.language.IModInfo; - -public class ConfigScreenHandler { - public record ConfigScreenFactory(BiFunction screenFunction) implements IExtensionPoint {} - - public static Optional> getScreenFactoryFor(IModInfo selectedMod) { - return ModList.get().getModContainerById(selectedMod.getModId()).flatMap(mc -> mc.getCustomExtension(ConfigScreenFactory.class).map(ConfigScreenFactory::screenFunction)); - } -} diff --git a/src/main/java/net/neoforged/neoforge/client/DimensionSpecialEffectsManager.java b/src/main/java/net/neoforged/neoforge/client/DimensionSpecialEffectsManager.java index 6e5a7734787..ee3c0bc0671 100644 --- a/src/main/java/net/neoforged/neoforge/client/DimensionSpecialEffectsManager.java +++ b/src/main/java/net/neoforged/neoforge/client/DimensionSpecialEffectsManager.java @@ -36,7 +36,7 @@ public static void init() { var effects = new HashMap(); DEFAULT_EFFECTS = preRegisterVanillaEffects(effects); var event = new RegisterDimensionSpecialEffectsEvent(effects); - ModLoader.get().postEventWrapContainerInModOrder(event); + ModLoader.postEventWrapContainerInModOrder(event); EFFECTS = ImmutableMap.copyOf(effects); } diff --git a/src/main/java/net/neoforged/neoforge/client/EntitySpectatorShaderManager.java b/src/main/java/net/neoforged/neoforge/client/EntitySpectatorShaderManager.java index a7284126b0e..3c1f72be1bb 100644 --- a/src/main/java/net/neoforged/neoforge/client/EntitySpectatorShaderManager.java +++ b/src/main/java/net/neoforged/neoforge/client/EntitySpectatorShaderManager.java @@ -35,7 +35,7 @@ public static ResourceLocation get(EntityType entityType) { public static void init() { var shaders = new HashMap, ResourceLocation>(); var event = new RegisterEntitySpectatorShadersEvent(shaders); - ModLoader.get().postEventWrapContainerInModOrder(event); + ModLoader.postEventWrapContainerInModOrder(event); SHADERS = ImmutableMap.copyOf(shaders); } diff --git a/src/main/java/net/neoforged/neoforge/client/FireworkShapeFactoryRegistry.java b/src/main/java/net/neoforged/neoforge/client/FireworkShapeFactoryRegistry.java index 4f984ec036c..76751f27455 100644 --- a/src/main/java/net/neoforged/neoforge/client/FireworkShapeFactoryRegistry.java +++ b/src/main/java/net/neoforged/neoforge/client/FireworkShapeFactoryRegistry.java @@ -8,7 +8,7 @@ import java.util.HashMap; import java.util.Map; import net.minecraft.client.particle.FireworkParticles; -import net.minecraft.world.item.FireworkRocketItem; +import net.minecraft.world.item.component.FireworkExplosion; import org.jetbrains.annotations.Nullable; /** @@ -16,18 +16,18 @@ * So sometime during your client initalization call register. */ public class FireworkShapeFactoryRegistry { - private static final Map factories = new HashMap<>(); + private static final Map factories = new HashMap<>(); public interface Factory { void build(FireworkParticles.Starter starter, boolean trail, boolean flicker, int[] colors, int[] fadeColors); } - public static void register(FireworkRocketItem.Shape shape, Factory factory) { + public static void register(FireworkExplosion.Shape shape, Factory factory) { factories.put(shape, factory); } @Nullable - public static Factory get(FireworkRocketItem.Shape shape) { + public static Factory get(FireworkExplosion.Shape shape) { return factories.get(shape); } } diff --git a/src/main/java/net/neoforged/neoforge/client/ItemDecoratorHandler.java b/src/main/java/net/neoforged/neoforge/client/ItemDecoratorHandler.java index d3d0453363e..5be3ae2574a 100644 --- a/src/main/java/net/neoforged/neoforge/client/ItemDecoratorHandler.java +++ b/src/main/java/net/neoforged/neoforge/client/ItemDecoratorHandler.java @@ -39,7 +39,7 @@ private ItemDecoratorHandler(List itemDecorators) { public static void init() { var decorators = new HashMap>(); var event = new RegisterItemDecorationsEvent(decorators); - ModLoader.get().postEventWrapContainerInModOrder(event); + ModLoader.postEventWrapContainerInModOrder(event); var builder = new ImmutableMap.Builder(); decorators.forEach((item, itemDecorators) -> builder.put(item, new ItemDecoratorHandler(itemDecorators))); DECORATOR_LOOKUP = builder.build(); diff --git a/src/main/java/net/neoforged/neoforge/client/NamedRenderTypeManager.java b/src/main/java/net/neoforged/neoforge/client/NamedRenderTypeManager.java index 19ad533c5b4..cfa4534c816 100644 --- a/src/main/java/net/neoforged/neoforge/client/NamedRenderTypeManager.java +++ b/src/main/java/net/neoforged/neoforge/client/NamedRenderTypeManager.java @@ -34,7 +34,7 @@ public static void init() { var renderTypes = new HashMap(); preRegisterVanillaRenderTypes(renderTypes); var event = new RegisterNamedRenderTypesEvent(renderTypes); - ModLoader.get().postEventWrapContainerInModOrder(event); + ModLoader.postEventWrapContainerInModOrder(event); RENDER_TYPES = ImmutableMap.copyOf(renderTypes); } diff --git a/src/main/java/net/neoforged/neoforge/client/PresetEditorManager.java b/src/main/java/net/neoforged/neoforge/client/PresetEditorManager.java index 47ae648627e..e9fd4a0f7f9 100644 --- a/src/main/java/net/neoforged/neoforge/client/PresetEditorManager.java +++ b/src/main/java/net/neoforged/neoforge/client/PresetEditorManager.java @@ -31,7 +31,7 @@ static void init() { // Gather mods' entries RegisterPresetEditorsEvent event = new RegisterPresetEditorsEvent(gatheredEditors); - ModLoader.get().postEventWrapContainerInModOrder(event); + ModLoader.postEventWrapContainerInModOrder(event); editors = gatheredEditors; } diff --git a/src/main/java/net/neoforged/neoforge/client/RecipeBookManager.java b/src/main/java/net/neoforged/neoforge/client/RecipeBookManager.java index 90b0f0568c2..829d5f27fa3 100644 --- a/src/main/java/net/neoforged/neoforge/client/RecipeBookManager.java +++ b/src/main/java/net/neoforged/neoforge/client/RecipeBookManager.java @@ -65,7 +65,7 @@ public static void init() { var typeCategories = new HashMap>(); var recipeCategoryLookups = new HashMap, Function, RecipeBookCategories>>(); var event = new RegisterRecipeBookCategoriesEvent(aggregateCategories, typeCategories, recipeCategoryLookups); - ModLoader.get().postEventWrapContainerInModOrder(event); + ModLoader.postEventWrapContainerInModOrder(event); AGGREGATE_CATEGORIES.putAll(aggregateCategories); TYPE_CATEGORIES.putAll(typeCategories); RECIPE_CATEGORY_LOOKUPS.putAll(recipeCategoryLookups); diff --git a/src/main/java/net/neoforged/neoforge/client/event/CalculateDetachedCameraDistanceEvent.java b/src/main/java/net/neoforged/neoforge/client/event/CalculateDetachedCameraDistanceEvent.java index eda9ae0060d..8c64bc25f69 100644 --- a/src/main/java/net/neoforged/neoforge/client/event/CalculateDetachedCameraDistanceEvent.java +++ b/src/main/java/net/neoforged/neoforge/client/event/CalculateDetachedCameraDistanceEvent.java @@ -24,13 +24,15 @@ public class CalculateDetachedCameraDistanceEvent extends Event { private final Camera camera; private final boolean cameraFlipped; + private final float entityScale; private double distance; @ApiStatus.Internal - public CalculateDetachedCameraDistanceEvent(Camera camera, boolean cameraFlipped, double distance) { + public CalculateDetachedCameraDistanceEvent(Camera camera, boolean cameraFlipped, float entityScale, double distance) { this.camera = camera; this.cameraFlipped = cameraFlipped; + this.entityScale = entityScale; this.distance = distance; } @@ -49,14 +51,22 @@ public boolean isCameraFlipped() { } /** - * Returns the distance from the camera to the {@linkplain Camera#getEntity() camera entity}. + * Returns the scaling factor that will be applied to the final distance, + * based on the size of the {@link Camera#getEntity() camera entity}. + */ + public float getEntityScalingFactor() { + return entityScale; + } + + /** + * Returns the pre-{@linkplain #getEntityScalingFactor() scaling factor} distance from the camera to the {@linkplain Camera#getEntity() camera entity}. */ public double getDistance() { return distance; } /** - * Sets the distance from the camera to the {@linkplain Camera#getEntity() camera entity}. + * Sets the pre-{@linkplain #getEntityScalingFactor() scaling factor} distance from the camera to the {@linkplain Camera#getEntity() camera entity}. * * @param distance The new distance from the camera to the {@linkplain Camera#getEntity() camera entity} */ diff --git a/src/main/java/net/neoforged/neoforge/client/event/ClientChatReceivedEvent.java b/src/main/java/net/neoforged/neoforge/client/event/ClientChatReceivedEvent.java index 07700a1fe89..de63b372bde 100644 --- a/src/main/java/net/neoforged/neoforge/client/event/ClientChatReceivedEvent.java +++ b/src/main/java/net/neoforged/neoforge/client/event/ClientChatReceivedEvent.java @@ -15,6 +15,7 @@ import net.neoforged.fml.LogicalSide; import net.neoforged.neoforge.common.NeoForge; import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; /** * Fired when a chat message is received on the client. @@ -30,11 +31,12 @@ */ public class ClientChatReceivedEvent extends Event implements ICancellableEvent { private Component message; + @Nullable private final ChatType.Bound boundChatType; private final UUID sender; @ApiStatus.Internal - public ClientChatReceivedEvent(ChatType.Bound boundChatType, Component message, UUID sender) { + public ClientChatReceivedEvent(@Nullable ChatType.Bound boundChatType, Component message, UUID sender) { this.boundChatType = boundChatType; this.message = message; this.sender = sender; @@ -59,7 +61,10 @@ public void setMessage(Component message) { /** * {@return the bound chat type of the chat message}. * This contains the chat type, display name of the sender, and nullable target name depending on the chat type. + *

+ * This may be {@code null} when the message doesn't have a specific source (i.e. for system messages). */ + @Nullable public ChatType.Bound getBoundChatType() { return this.boundChatType; } @@ -121,8 +126,8 @@ public static class System extends ClientChatReceivedEvent { private final boolean overlay; @ApiStatus.Internal - public System(ChatType.Bound boundChatType, Component message, boolean overlay) { - super(boundChatType, message, Util.NIL_UUID); + public System(Component message, boolean overlay) { + super(null, message, Util.NIL_UUID); this.overlay = overlay; } diff --git a/src/main/java/net/neoforged/neoforge/client/event/ClientTickEvent.java b/src/main/java/net/neoforged/neoforge/client/event/ClientTickEvent.java new file mode 100644 index 00000000000..78c33948c09 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/client/event/ClientTickEvent.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.client.event; + +import net.neoforged.bus.api.Event; + +/** + * Base class of the two client tick events. + *

+ * For the event that fires once per frame (instead of per tick), see {@link RenderFrameEvent}. + * + * @see ClientTickEvent.Pre + * @see ClientTickEvent.Post + */ +public abstract class ClientTickEvent extends Event { + /** + * {@link ClientTickEvent.Pre} is fired once per client tick, before the client performs work for the current tick. + *

+ * This event only fires on the physical client. + */ + public static class Pre extends ClientTickEvent { + public Pre() {} + } + + /** + * {@link ClientTickEvent.Post} is fired once per client tick, after the client performs work for the current tick. + *

+ * This event only fires on the physical client. + */ + public static class Post extends ClientTickEvent { + public Post() {} + } +} diff --git a/src/main/java/net/neoforged/neoforge/client/event/RegisterGuiLayersEvent.java b/src/main/java/net/neoforged/neoforge/client/event/RegisterGuiLayersEvent.java new file mode 100644 index 00000000000..15c28c31cde --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/client/event/RegisterGuiLayersEvent.java @@ -0,0 +1,110 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.client.event; + +import com.google.common.base.Preconditions; +import java.util.List; +import java.util.Objects; +import java.util.stream.IntStream; +import net.minecraft.client.gui.LayeredDraw; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.bus.api.Event; +import net.neoforged.bus.api.ICancellableEvent; +import net.neoforged.fml.LogicalSide; +import net.neoforged.fml.event.IModBusEvent; +import net.neoforged.neoforge.client.gui.GuiLayerManager; +import net.neoforged.neoforge.client.gui.VanillaGuiLayers; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; + +/** + * Allows users to register custom {@link LayeredDraw.Layer layers} for GUI rendering. + * + *

See also {@link RenderGuiLayerEvent} to intercept rendering of registered layers. + * + *

This event is not {@linkplain ICancellableEvent cancellable}, and does not {@linkplain HasResult have a result}. + * + *

This event is fired on the mod-specific event bus, only on the {@linkplain LogicalSide#CLIENT logical client}.

+ */ +public class RegisterGuiLayersEvent extends Event implements IModBusEvent { + private final List layers; + + @ApiStatus.Internal + public RegisterGuiLayersEvent(List layers) { + this.layers = layers; + } + + /** + * Registers a layer that renders below all others. + * + * @param id A unique resource id for this layer + * @param layer The layer + */ + public void registerBelowAll(ResourceLocation id, LayeredDraw.Layer layer) { + register(Ordering.BEFORE, null, id, layer); + } + + /** + * Registers a layer that renders below another. + * + * @param other The id of the layer to render below. This must be a layer you have already registered or one of the + * {@link VanillaGuiLayers vanilla layers}. Do not use other mods' layers. + * @param id A unique resource id for this layer + * @param layer The layer + */ + public void registerBelow(ResourceLocation other, ResourceLocation id, LayeredDraw.Layer layer) { + register(Ordering.BEFORE, other, id, layer); + } + + /** + * Registers an layer that renders above another. + * + * @param other The id of the layer to render above. This must be a layer you have already registered or one of the + * {@link VanillaGuiLayers vanilla layers}. Do not use other mods' layers. + * @param id A unique resource id for this layer + * @param layer The layer + */ + public void registerAbove(ResourceLocation other, ResourceLocation id, LayeredDraw.Layer layer) { + register(Ordering.AFTER, other, id, layer); + } + + /** + * Registers a layer that renders above all others. + * + * @param id A unique resource id for this layer + * @param layer The layer + */ + public void registerAboveAll(ResourceLocation id, LayeredDraw.Layer layer) { + register(Ordering.AFTER, null, id, layer); + } + + private void register(Ordering ordering, @Nullable ResourceLocation other, ResourceLocation key, LayeredDraw.Layer layer) { + Objects.requireNonNull(key); + for (var namedLayer : layers) { + Preconditions.checkArgument(!namedLayer.name().equals(key), "Layer already registered: " + key); + } + + int insertPosition; + if (other == null) { + insertPosition = ordering == Ordering.BEFORE ? 0 : layers.size(); + } else { + var otherIndex = IntStream.range(0, layers.size()) + .filter(i -> layers.get(i).name().equals(other)) + .findFirst(); + if (otherIndex.isEmpty()) { + throw new IllegalArgumentException("Attempted to order against an unregistered layer " + other + ". Only order against vanilla's and your own."); + } + + insertPosition = otherIndex.getAsInt() + (ordering == Ordering.BEFORE ? 0 : 1); + } + + layers.add(insertPosition, new GuiLayerManager.NamedLayer(key, layer)); + } + + private enum Ordering { + BEFORE, AFTER + } +} diff --git a/src/main/java/net/neoforged/neoforge/client/event/RegisterGuiOverlaysEvent.java b/src/main/java/net/neoforged/neoforge/client/event/RegisterGuiOverlaysEvent.java deleted file mode 100644 index 050b82337e5..00000000000 --- a/src/main/java/net/neoforged/neoforge/client/event/RegisterGuiOverlaysEvent.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.client.event; - -import com.google.common.base.Preconditions; -import java.util.List; -import java.util.Map; -import net.minecraft.resources.ResourceLocation; -import net.neoforged.bus.api.Event; -import net.neoforged.bus.api.ICancellableEvent; -import net.neoforged.fml.LogicalSide; -import net.neoforged.fml.ModLoadingContext; -import net.neoforged.fml.event.IModBusEvent; -import net.neoforged.neoforge.client.gui.overlay.IGuiOverlay; -import net.neoforged.neoforge.client.gui.overlay.VanillaGuiOverlay; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.Nullable; - -/** - * Allows users to register custom {@link IGuiOverlay GUI overlays}. - * - *

This event is not {@linkplain ICancellableEvent cancellable}, and does not {@linkplain HasResult have a result}. - * - *

This event is fired on the mod-specific event bus, only on the {@linkplain LogicalSide#CLIENT logical client}.

- */ -public class RegisterGuiOverlaysEvent extends Event implements IModBusEvent { - private final Map overlays; - private final List orderedOverlays; - - @ApiStatus.Internal - public RegisterGuiOverlaysEvent(Map overlays, List orderedOverlays) { - this.overlays = overlays; - this.orderedOverlays = orderedOverlays; - } - - /** - * Registers an overlay that renders below all others. - * - * @param id A unique resource id for this overlay - * @param overlay The overlay - * @deprecated Use {@link #registerBelowAll(ResourceLocation, IGuiOverlay) the RL-explicit variant} instead; mod ID inference will be removed in a later update, alongside the move of registration events to the NeoForge main bus - */ - @Deprecated(forRemoval = true, since = "1.20.2") - public void registerBelowAll(String id, IGuiOverlay overlay) { - registerBelowAll(new ResourceLocation(id, ModLoadingContext.get().getActiveNamespace()), overlay); - } - - /** - * Registers an overlay that renders below all others. - * - * @param id A unique resource id for this overlay - * @param overlay The overlay - */ - public void registerBelowAll(ResourceLocation id, IGuiOverlay overlay) { - register(Ordering.BEFORE, null, id, overlay); - } - - /** - * Registers an overlay that renders below another. - * - * @param other The id of the overlay to render below. This must be an overlay you have already registered or a - * {@link VanillaGuiOverlay vanilla overlay}. Do not use other mods' overlays. - * @param id A unique resource id for this overlay - * @param overlay The overlay - * @deprecated Use {@link #registerBelow(ResourceLocation, ResourceLocation, IGuiOverlay) the RL-explicit variant} instead; mod ID inference will be removed in a later update, alongside the move of registration events to the NeoForge main bus - */ - @Deprecated(forRemoval = true, since = "1.20.2") - public void registerBelow(ResourceLocation other, String id, IGuiOverlay overlay) { - registerBelow(other, new ResourceLocation(ModLoadingContext.get().getActiveNamespace(), id), overlay); - } - - /** - * Registers an overlay that renders below another. - * - * @param other The id of the overlay to render below. This must be an overlay you have already registered or a - * {@link VanillaGuiOverlay vanilla overlay}. Do not use other mods' overlays. - * @param id A unique resource id for this overlay - * @param overlay The overlay - */ - public void registerBelow(ResourceLocation other, ResourceLocation id, IGuiOverlay overlay) { - register(Ordering.BEFORE, other, id, overlay); - } - - /** - * Registers an overlay that renders above another. - * - * @param other The id of the overlay to render above. This must be an overlay you have already registered or a - * {@link VanillaGuiOverlay vanilla overlay}. Do not use other mods' overlays. - * @param id A unique resource id for this overlay - * @param overlay The overlay - * @deprecated Use {@link #registerAbove(ResourceLocation, ResourceLocation, IGuiOverlay) the RL-explicit variant} instead; mod ID inference will be removed in a later update, alongside the move of registration events to the NeoForge main bus - */ - @Deprecated(forRemoval = true, since = "1.20.2") - public void registerAbove(ResourceLocation other, String id, IGuiOverlay overlay) { - registerAbove(other, new ResourceLocation(ModLoadingContext.get().getActiveNamespace(), id), overlay); - } - - /** - * Registers an overlay that renders above another. - * - * @param other The id of the overlay to render above. This must be an overlay you have already registered or a - * {@link VanillaGuiOverlay vanilla overlay}. Do not use other mods' overlays. - * @param id A unique resource id for this overlay - * @param overlay The overlay - */ - public void registerAbove(ResourceLocation other, ResourceLocation id, IGuiOverlay overlay) { - register(Ordering.AFTER, other, id, overlay); - } - - /** - * Registers an overlay that renders above all others. - * - * @param id A unique resource id for this overlay - * @param overlay The overlay - * @deprecated Use {@link #registerAboveAll(ResourceLocation, IGuiOverlay) the RL-explicit variant} instead; mod ID inference will be removed in a later update, alongside the move of registration events to the NeoForge main bus - */ - @Deprecated(forRemoval = true, since = "1.20.2") - public void registerAboveAll(String id, IGuiOverlay overlay) { - registerAboveAll(new ResourceLocation(ModLoadingContext.get().getActiveNamespace(), id), overlay); - } - - /** - * Registers an overlay that renders above all others. - * - * @param id A unique resource id for this overlay - * @param overlay The overlay - */ - public void registerAboveAll(ResourceLocation id, IGuiOverlay overlay) { - register(Ordering.AFTER, null, id, overlay); - } - - private void register(Ordering ordering, @Nullable ResourceLocation other, ResourceLocation key, IGuiOverlay overlay) { - Preconditions.checkArgument(!overlays.containsKey(key), "Overlay already registered: " + key); - - int insertPosition; - if (other == null) { - insertPosition = ordering == Ordering.BEFORE ? 0 : overlays.size(); - } else { - int otherIndex = orderedOverlays.indexOf(other); - Preconditions.checkState(otherIndex >= 0, "Attempted to order against an unregistered overlay. Only order against vanilla's and your own."); - insertPosition = otherIndex + (ordering == Ordering.BEFORE ? 0 : 1); - } - - overlays.put(key, overlay); - orderedOverlays.add(insertPosition, key); - } - - private enum Ordering { - BEFORE, AFTER - } -} diff --git a/src/main/java/net/neoforged/neoforge/client/event/RegisterSpriteSourceTypesEvent.java b/src/main/java/net/neoforged/neoforge/client/event/RegisterSpriteSourceTypesEvent.java index 8855eff8de5..dbcfbd9fc36 100644 --- a/src/main/java/net/neoforged/neoforge/client/event/RegisterSpriteSourceTypesEvent.java +++ b/src/main/java/net/neoforged/neoforge/client/event/RegisterSpriteSourceTypesEvent.java @@ -6,7 +6,7 @@ package net.neoforged.neoforge.client.event; import com.google.common.collect.BiMap; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.atlas.SpriteSource; import net.minecraft.client.renderer.texture.atlas.SpriteSourceType; @@ -35,12 +35,12 @@ public RegisterSpriteSourceTypesEvent(BiMap } /** - * Registers the given {@link Codec} as SpriteSourceType under the given id. + * Registers the given {@link MapCodec} as SpriteSourceType under the given id. * * @param id The id to register the {@link SpriteSourceType} under * @param codec The codec for the {@link SpriteSourceType} to register */ - public SpriteSourceType register(ResourceLocation id, Codec codec) { + public SpriteSourceType register(ResourceLocation id, MapCodec codec) { if (this.types.containsKey(id)) { throw new IllegalStateException("Duplicate sprite source type registration " + id); } diff --git a/src/main/java/net/neoforged/neoforge/client/event/RenderFrameEvent.java b/src/main/java/net/neoforged/neoforge/client/event/RenderFrameEvent.java new file mode 100644 index 00000000000..f5451cb8dbe --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/client/event/RenderFrameEvent.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.client.event; + +import net.minecraft.client.renderer.GameRenderer; +import net.neoforged.bus.api.Event; + +/** + * Base class of the two render frame events. + *

+ * These events can be used to setup and teardown global render state that must persist for the current frame. + *

+ * For the event that fires once per client tick (instead of per frame), see {@link ClientTickEvent}. + * + * @see RenderFrameEvent.Pre + * @see RenderFrameEvent.Post + */ +public abstract class RenderFrameEvent extends Event { + protected final float partialTick; + + protected RenderFrameEvent(float partialTick) { + this.partialTick = partialTick; + } + + /** + * {@return the current partial tick, which is either the true partial tick or the pause partial tick, depending on if the game is paused} + */ + public float getPartialTick() { + return this.partialTick; + } + + /** + * {@link RenderFrameEvent.Pre} is fired once per frame, before the current frame is rendered via {@link GameRenderer#render(float, long, boolean)}. + *

+ * This event only fires on the physical client. + */ + public static class Pre extends RenderFrameEvent { + public Pre(float partialTick) { + super(partialTick); + } + } + + /** + * {@link RenderFrameEvent.Post} is fired once per frame, after the current frame is rendered via {@link GameRenderer#render(float, long, boolean)}. + *

+ * This event only fires on the physical client. + */ + public static class Post extends RenderFrameEvent { + public Post(float partialTick) { + super(partialTick); + } + } +} diff --git a/src/main/java/net/neoforged/neoforge/client/event/RenderGuiEvent.java b/src/main/java/net/neoforged/neoforge/client/event/RenderGuiEvent.java index e49e463b6a2..c5bdc1a1697 100644 --- a/src/main/java/net/neoforged/neoforge/client/event/RenderGuiEvent.java +++ b/src/main/java/net/neoforged/neoforge/client/event/RenderGuiEvent.java @@ -5,7 +5,6 @@ package net.neoforged.neoforge.client.event; -import com.mojang.blaze3d.platform.Window; import net.minecraft.client.gui.GuiGraphics; import net.neoforged.bus.api.Event; import net.neoforged.bus.api.ICancellableEvent; @@ -21,21 +20,15 @@ * @see Post */ public abstract class RenderGuiEvent extends Event { - private final Window window; private final GuiGraphics guiGraphics; private final float partialTick; @ApiStatus.Internal - protected RenderGuiEvent(Window window, GuiGraphics guiGraphics, float partialTick) { - this.window = window; + protected RenderGuiEvent(GuiGraphics guiGraphics, float partialTick) { this.guiGraphics = guiGraphics; this.partialTick = partialTick; } - public Window getWindow() { - return window; - } - public GuiGraphics getGuiGraphics() { return guiGraphics; } @@ -58,8 +51,8 @@ public float getPartialTick() { */ public static class Pre extends RenderGuiEvent implements ICancellableEvent { @ApiStatus.Internal - public Pre(Window window, GuiGraphics guiGraphics, float partialTick) { - super(window, guiGraphics, partialTick); + public Pre(GuiGraphics guiGraphics, float partialTick) { + super(guiGraphics, partialTick); } } @@ -73,8 +66,8 @@ public Pre(Window window, GuiGraphics guiGraphics, float partialTick) { */ public static class Post extends RenderGuiEvent { @ApiStatus.Internal - public Post(Window window, GuiGraphics guiGraphics, float partialTick) { - super(window, guiGraphics, partialTick); + public Post(GuiGraphics guiGraphics, float partialTick) { + super(guiGraphics, partialTick); } } } diff --git a/src/main/java/net/neoforged/neoforge/client/event/RenderGuiLayerEvent.java b/src/main/java/net/neoforged/neoforge/client/event/RenderGuiLayerEvent.java new file mode 100644 index 00000000000..d8006c7146e --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/client/event/RenderGuiLayerEvent.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.client.event; + +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.LayeredDraw; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.bus.api.Event; +import net.neoforged.bus.api.ICancellableEvent; +import net.neoforged.fml.LogicalSide; +import net.neoforged.neoforge.common.NeoForge; +import org.jetbrains.annotations.ApiStatus; + +/** + * Fired when a GUI layer is rendered to the screen. + * See the two subclasses for listening to the two possible phases. + * + *

A layer that is not normally active (for example because the player pressed F1) cannot be forced to render. + * In such cases, this event will however still fire. + * + * @see Pre + * @see Post + */ +public abstract class RenderGuiLayerEvent extends Event { + private final GuiGraphics guiGraphics; + private final float partialTick; + private final ResourceLocation name; + private final LayeredDraw.Layer layer; + + @ApiStatus.Internal + protected RenderGuiLayerEvent(GuiGraphics guiGraphics, float partialTick, ResourceLocation name, LayeredDraw.Layer layer) { + this.guiGraphics = guiGraphics; + this.partialTick = partialTick; + this.name = name; + this.layer = layer; + } + + public GuiGraphics getGuiGraphics() { + return guiGraphics; + } + + public float getPartialTick() { + return partialTick; + } + + public ResourceLocation getName() { + return name; + } + + public LayeredDraw.Layer getLayer() { + return layer; + } + + /** + * Fired before a GUI layer is rendered to the screen. + * + *

This event is {@linkplain ICancellableEvent cancellable}, and does not {@linkplain HasResult have a result}. + * If this event is cancelled, then the layer will not be rendered, and the corresponding {@link Post} event will + * not be fired.

+ * + *

This event is fired on the {@linkplain NeoForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ * + * @see Post + */ + public static class Pre extends RenderGuiLayerEvent implements ICancellableEvent { + @ApiStatus.Internal + public Pre(GuiGraphics guiGraphics, float partialTick, ResourceLocation name, LayeredDraw.Layer layer) { + super(guiGraphics, partialTick, name, layer); + } + } + + /** + * Fired after a GUI layer is rendered to the screen, if the corresponding {@link Pre} is not cancelled. + * + *

This event is not {@linkplain ICancellableEvent cancellable}, and does not {@linkplain HasResult have a result}.

+ * + *

This event is fired on the {@linkplain NeoForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}.

+ */ + public static class Post extends RenderGuiLayerEvent { + @ApiStatus.Internal + public Post(GuiGraphics guiGraphics, float partialTick, ResourceLocation name, LayeredDraw.Layer layer) { + super(guiGraphics, partialTick, name, layer); + } + } +} diff --git a/src/main/java/net/neoforged/neoforge/client/event/RenderGuiOverlayEvent.java b/src/main/java/net/neoforged/neoforge/client/event/RenderGuiOverlayEvent.java deleted file mode 100644 index 67da456b2c0..00000000000 --- a/src/main/java/net/neoforged/neoforge/client/event/RenderGuiOverlayEvent.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.client.event; - -import com.mojang.blaze3d.platform.Window; -import net.minecraft.client.gui.GuiGraphics; -import net.neoforged.bus.api.Event; -import net.neoforged.bus.api.ICancellableEvent; -import net.neoforged.fml.LogicalSide; -import net.neoforged.neoforge.client.gui.overlay.NamedGuiOverlay; -import net.neoforged.neoforge.common.NeoForge; -import org.jetbrains.annotations.ApiStatus; - -/** - * Fired when an overlay is rendered to the screen. - * See the two subclasses for listening to the two possible phases. - * - *

An overlay that is not normally active cannot be forced to render. In such cases, this event will not fire.

- * - * @see Pre - * @see Post - */ -public abstract class RenderGuiOverlayEvent extends Event { - private final Window window; - private final GuiGraphics guiGraphics; - private final float partialTick; - private final NamedGuiOverlay overlay; - - @ApiStatus.Internal - protected RenderGuiOverlayEvent(Window window, GuiGraphics guiGraphics, float partialTick, NamedGuiOverlay overlay) { - this.window = window; - this.guiGraphics = guiGraphics; - this.partialTick = partialTick; - this.overlay = overlay; - } - - public Window getWindow() { - return window; - } - - public GuiGraphics getGuiGraphics() { - return guiGraphics; - } - - public float getPartialTick() { - return partialTick; - } - - public NamedGuiOverlay getOverlay() { - return overlay; - } - - /** - * Fired before a GUI overlay is rendered to the screen. - * - *

This event is {@linkplain ICancellableEvent cancellable}, and does not {@linkplain HasResult have a result}. - * If this event is cancelled, then the overlay will not be rendered, and the corresponding {@link Post} event will - * not be fired.

- * - *

This event is fired on the {@linkplain NeoForge#EVENT_BUS main Forge event bus}, - * only on the {@linkplain LogicalSide#CLIENT logical client}.

- * - * @see Post - */ - public static class Pre extends RenderGuiOverlayEvent implements ICancellableEvent { - @ApiStatus.Internal - public Pre(Window window, GuiGraphics guiGraphics, float partialTick, NamedGuiOverlay overlay) { - super(window, guiGraphics, partialTick, overlay); - } - } - - /** - * Fired after an GUI overlay is rendered to the screen, if the corresponding {@link Pre} is not cancelled. - * - *

This event is not {@linkplain ICancellableEvent cancellable}, and does not {@linkplain HasResult have a result}.

- * - *

This event is fired on the {@linkplain NeoForge#EVENT_BUS main Forge event bus}, - * only on the {@linkplain LogicalSide#CLIENT logical client}.

- */ - public static class Post extends RenderGuiOverlayEvent { - @ApiStatus.Internal - public Post(Window window, GuiGraphics guiGraphics, float partialTick, NamedGuiOverlay overlay) { - super(window, guiGraphics, partialTick, overlay); - } - } -} diff --git a/src/main/java/net/neoforged/neoforge/client/event/RenderLevelStageEvent.java b/src/main/java/net/neoforged/neoforge/client/event/RenderLevelStageEvent.java index bb1d37bd2fb..6d8eedfe9fb 100644 --- a/src/main/java/net/neoforged/neoforge/client/event/RenderLevelStageEvent.java +++ b/src/main/java/net/neoforged/neoforge/client/event/RenderLevelStageEvent.java @@ -8,7 +8,6 @@ import com.mojang.blaze3d.vertex.PoseStack; import java.util.HashMap; import java.util.Map; -import javax.annotation.Nullable; import net.minecraft.client.Camera; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LevelRenderer; @@ -22,6 +21,7 @@ import net.neoforged.fml.event.IModBusEvent; import net.neoforged.neoforge.client.NeoForgeRenderTypes; import net.neoforged.neoforge.common.NeoForge; +import org.jetbrains.annotations.Nullable; import org.joml.Matrix4f; /** @@ -37,16 +37,18 @@ public class RenderLevelStageEvent extends Event { private final Stage stage; private final LevelRenderer levelRenderer; private final PoseStack poseStack; + private final Matrix4f modelViewMatrix; private final Matrix4f projectionMatrix; private final int renderTick; private final float partialTick; private final Camera camera; private final Frustum frustum; - public RenderLevelStageEvent(Stage stage, LevelRenderer levelRenderer, PoseStack poseStack, Matrix4f projectionMatrix, int renderTick, float partialTick, Camera camera, Frustum frustum) { + public RenderLevelStageEvent(Stage stage, LevelRenderer levelRenderer, @Nullable PoseStack poseStack, Matrix4f modelViewMatrix, Matrix4f projectionMatrix, int renderTick, float partialTick, Camera camera, Frustum frustum) { this.stage = stage; this.levelRenderer = levelRenderer; - this.poseStack = poseStack; + this.poseStack = poseStack != null ? poseStack : new PoseStack(); + this.modelViewMatrix = modelViewMatrix; this.projectionMatrix = projectionMatrix; this.renderTick = renderTick; this.partialTick = partialTick; @@ -76,6 +78,13 @@ public PoseStack getPoseStack() { return poseStack; } + /** + * {@return the model view matrix used for rendering} + */ + public Matrix4f getModelViewMatrix() { + return modelViewMatrix; + } + /** * {@return the projection matrix} */ @@ -192,7 +201,7 @@ public static class Stage { public static final Stage AFTER_WEATHER = register("after_weather", null); /** * Use this to render after everything in the level has been rendered. - * Called after {@link LevelRenderer#renderLevel(PoseStack, float, long, boolean, Camera, GameRenderer, LightTexture, Matrix4f)} finishes. + * Called after {@link LevelRenderer#renderLevel(float, long, boolean, Camera, GameRenderer, LightTexture, Matrix4f, Matrix4f)} finishes. */ public static final Stage AFTER_LEVEL = register("after_level", null); diff --git a/src/main/java/net/neoforged/neoforge/client/extensions/IBakedModelExtension.java b/src/main/java/net/neoforged/neoforge/client/extensions/IBakedModelExtension.java index 2c5e99895ff..52ffd3c84b8 100644 --- a/src/main/java/net/neoforged/neoforge/client/extensions/IBakedModelExtension.java +++ b/src/main/java/net/neoforged/neoforge/client/extensions/IBakedModelExtension.java @@ -41,22 +41,6 @@ default List getQuads(@Nullable BlockState state, @Nullable Direction return self().getQuads(state, side, rand); } - /** - * @deprecated Use {@link #useAmbientOcclusion(BlockState, ModelData, RenderType)} instead - */ - @Deprecated(forRemoval = true, since = "1.20.4") - default boolean useAmbientOcclusion(BlockState state) { - return self().useAmbientOcclusion(); - } - - /** - * @deprecated Use {@link #useAmbientOcclusion(BlockState, ModelData, RenderType)} instead - */ - @Deprecated(forRemoval = true, since = "1.20.4") - default boolean useAmbientOcclusion(BlockState state, RenderType renderType) { - return self().useAmbientOcclusion(state); - } - /** * Controls the AO behavior for all quads of this model. The default behavior is to use AO unless the block emits light, * {@link TriState#TRUE} and {@link TriState#FALSE} force AO to be enabled and disabled respectively, regardless of @@ -71,7 +55,7 @@ default boolean useAmbientOcclusion(BlockState state, RenderType renderType) { * @return {@link TriState#TRUE} to force-enable AO, {@link TriState#FALSE} to force-disable AO or {@link TriState#DEFAULT} to use vanilla AO behavior */ default TriState useAmbientOcclusion(BlockState state, ModelData data, RenderType renderType) { - return useAmbientOcclusion(state, renderType) ? TriState.DEFAULT : TriState.FALSE; + return self().useAmbientOcclusion() ? TriState.DEFAULT : TriState.FALSE; } /** diff --git a/src/main/java/net/neoforged/neoforge/client/extensions/IDimensionSpecialEffectsExtension.java b/src/main/java/net/neoforged/neoforge/client/extensions/IDimensionSpecialEffectsExtension.java index b448e6fb178..b8253c7ba73 100644 --- a/src/main/java/net/neoforged/neoforge/client/extensions/IDimensionSpecialEffectsExtension.java +++ b/src/main/java/net/neoforged/neoforge/client/extensions/IDimensionSpecialEffectsExtension.java @@ -26,7 +26,7 @@ private DimensionSpecialEffects self() { * * @return true to prevent vanilla cloud rendering */ - default boolean renderClouds(ClientLevel level, int ticks, float partialTick, PoseStack poseStack, double camX, double camY, double camZ, Matrix4f projectionMatrix) { + default boolean renderClouds(ClientLevel level, int ticks, float partialTick, PoseStack poseStack, double camX, double camY, double camZ, Matrix4f modelViewMatrix, Matrix4f projectionMatrix) { return false; } @@ -35,7 +35,7 @@ default boolean renderClouds(ClientLevel level, int ticks, float partialTick, Po * * @return true to prevent vanilla sky rendering */ - default boolean renderSky(ClientLevel level, int ticks, float partialTick, PoseStack poseStack, Camera camera, Matrix4f projectionMatrix, boolean isFoggy, Runnable setupFog) { + default boolean renderSky(ClientLevel level, int ticks, float partialTick, Matrix4f modelViewMatrix, Camera camera, Matrix4f projectionMatrix, boolean isFoggy, Runnable setupFog) { return false; } diff --git a/src/main/java/net/neoforged/neoforge/client/extensions/IGuiGraphicsExtension.java b/src/main/java/net/neoforged/neoforge/client/extensions/IGuiGraphicsExtension.java index e91ebbb8b2b..ff0d2c3cc39 100644 --- a/src/main/java/net/neoforged/neoforge/client/extensions/IGuiGraphicsExtension.java +++ b/src/main/java/net/neoforged/neoforge/client/extensions/IGuiGraphicsExtension.java @@ -5,7 +5,10 @@ package net.neoforged.neoforge.client.extensions; +import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.AbstractWidget; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; /** @@ -30,6 +33,22 @@ default int getColorFromFormattingCharacter(char c, boolean isLighter) { return TEXT_COLOR_CODES[isLighter ? "0123456789abcdef".indexOf(c) : "0123456789abcdef".indexOf(c) + 16]; } + /** + * Draws a left-aligned string, with a scrolling effect if the string is too long. + * + * @return the rendered width of the string, never more than {@code maxX - minX} + */ + default int drawScrollingString(Font font, Component text, int minX, int maxX, int y, int color) { + int maxWidth = maxX - minX; + int textWidth = font.width(text.getVisualOrderText()); + if (textWidth <= maxWidth) { + return self().drawString(font, text, minX, y, color); + } else { + AbstractWidget.renderScrollingString(self(), font, text, minX, y, maxX, y + font.lineHeight, color); + return maxWidth; + } + } + /** * Draws a textured box of any size (smallest size is borderSize * 2 square) * based on a fixed size textured box with continuous borders and filler. diff --git a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java index 1471fa41984..4536df4f8ce 100644 --- a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java +++ b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java @@ -148,6 +148,24 @@ default BlockEntityWithoutLevelRenderer getCustomRenderer() { return Minecraft.getInstance().getItemRenderer().getBlockEntityRenderer(); } + /** + * {@return Whether the item should bob when rendered in the world as an entity} + * + * @param stack The stack being rendered + */ + default boolean shouldBobAsEntity(ItemStack stack) { + return true; + } + + /** + * {@return Whether the item should be spread out when rendered in the world as an entity} + * + * @param stack The stack being rendered + */ + default boolean shouldSpreadAsEntity(ItemStack stack) { + return true; + } + enum FontContext { /** * Used to display the amount of items in the {@link ItemStack}. diff --git a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientMobEffectExtensions.java b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientMobEffectExtensions.java index 0c6c40647ed..ee81708df82 100644 --- a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientMobEffectExtensions.java +++ b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientMobEffectExtensions.java @@ -22,7 +22,7 @@ public interface IClientMobEffectExtensions { IClientMobEffectExtensions DEFAULT = new IClientMobEffectExtensions() {}; static IClientMobEffectExtensions of(MobEffectInstance instance) { - return of(instance.getEffect()); + return of(instance.getEffect().value()); } static IClientMobEffectExtensions of(MobEffect effect) { diff --git a/src/main/java/net/neoforged/neoforge/client/gui/ClientTooltipComponentManager.java b/src/main/java/net/neoforged/neoforge/client/gui/ClientTooltipComponentManager.java index b125527f4b9..4ca0ce7fe43 100644 --- a/src/main/java/net/neoforged/neoforge/client/gui/ClientTooltipComponentManager.java +++ b/src/main/java/net/neoforged/neoforge/client/gui/ClientTooltipComponentManager.java @@ -36,7 +36,7 @@ public static ClientTooltipComponent createClientTooltipComponent(TooltipCompone public static void init() { var factories = new HashMap, Function>(); var event = new RegisterClientTooltipComponentFactoriesEvent(factories); - ModLoader.get().postEventWrapContainerInModOrder(event); + ModLoader.postEventWrapContainerInModOrder(event); FACTORIES = ImmutableMap.copyOf(factories); } diff --git a/src/main/java/net/neoforged/neoforge/client/gui/GuiLayerManager.java b/src/main/java/net/neoforged/neoforge/client/gui/GuiLayerManager.java new file mode 100644 index 00000000000..23479a88ca5 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/client/gui/GuiLayerManager.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.client.gui; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.BooleanSupplier; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.LayeredDraw; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.fml.ModLoader; +import net.neoforged.neoforge.client.event.RegisterGuiLayersEvent; +import net.neoforged.neoforge.client.event.RenderGuiEvent; +import net.neoforged.neoforge.client.event.RenderGuiLayerEvent; +import net.neoforged.neoforge.common.NeoForge; +import org.jetbrains.annotations.ApiStatus; + +/** + * Adaptation of {@link LayeredDraw} that is used for {@link Gui} rendering specifically, + * to give layers a name and fire appropriate events. + * + *

Overlays can be registered using the {@link RegisterGuiLayersEvent} event. + */ +@ApiStatus.Internal +public class GuiLayerManager { + public static final float Z_SEPARATION = LayeredDraw.Z_SEPARATION; + private final List layers = new ArrayList<>(); + private boolean initialized = false; + + public record NamedLayer(ResourceLocation name, LayeredDraw.Layer layer) {} + + public GuiLayerManager add(ResourceLocation name, LayeredDraw.Layer layer) { + this.layers.add(new NamedLayer(name, layer)); + return this; + } + + public GuiLayerManager add(GuiLayerManager child, BooleanSupplier shouldRender) { + // Flatten the layers to allow mods to insert layers between vanilla layers. + for (var entry : child.layers) { + add(entry.name(), (guiGraphics, partialTick) -> { + if (shouldRender.getAsBoolean()) { + entry.layer().render(guiGraphics, partialTick); + } + }); + } + return this; + } + + public void render(GuiGraphics guiGraphics, float partialTick) { + if (NeoForge.EVENT_BUS.post(new RenderGuiEvent.Pre(guiGraphics, partialTick)).isCanceled()) { + return; + } + + renderInner(guiGraphics, partialTick); + + NeoForge.EVENT_BUS.post(new RenderGuiEvent.Post(guiGraphics, partialTick)); + } + + private void renderInner(GuiGraphics guiGraphics, float partialTick) { + guiGraphics.pose().pushPose(); + + for (var layer : this.layers) { + if (!NeoForge.EVENT_BUS.post(new RenderGuiLayerEvent.Pre(guiGraphics, partialTick, layer.name(), layer.layer())).isCanceled()) { + layer.layer().render(guiGraphics, partialTick); + NeoForge.EVENT_BUS.post(new RenderGuiLayerEvent.Post(guiGraphics, partialTick, layer.name(), layer.layer())); + } + + guiGraphics.pose().translate(0.0F, 0.0F, Z_SEPARATION); + } + + guiGraphics.pose().popPose(); + } + + public void initModdedLayers() { + if (initialized) { + throw new IllegalStateException("Duplicate initialization of NamedLayeredDraw"); + } + initialized = true; + ModLoader.postEvent(new RegisterGuiLayersEvent(this.layers)); + } +} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/IConfigScreenFactory.java b/src/main/java/net/neoforged/neoforge/client/gui/IConfigScreenFactory.java new file mode 100644 index 00000000000..82cf506898d --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/client/gui/IConfigScreenFactory.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.client.gui; + +import java.util.Optional; +import java.util.function.Supplier; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; +import net.neoforged.fml.IExtensionPoint; +import net.neoforged.fml.ModContainer; +import net.neoforged.fml.ModList; +import net.neoforged.neoforgespi.language.IModInfo; + +/** + * Register an instance to {@link ModContainer#registerExtensionPoint(Class, Supplier)} + * to supply a config screen for your mod. + * + *

The config screen will be accessible from the mod list menu. + */ +public interface IConfigScreenFactory extends IExtensionPoint { + /** + * Creates a new config screen. The {@code modListScreen} parameter can be used for a "back" button. + */ + Screen createScreen(Minecraft minecraft, Screen modListScreen); + + static Optional getForMod(IModInfo selectedMod) { + return ModList.get().getModContainerById(selectedMod.getModId()).flatMap(m -> m.getCustomExtension(IConfigScreenFactory.class)); + } +} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/LoadingErrorScreen.java b/src/main/java/net/neoforged/neoforge/client/gui/LoadingErrorScreen.java index b38f969f9a8..c9218c497fa 100644 --- a/src/main/java/net/neoforged/neoforge/client/gui/LoadingErrorScreen.java +++ b/src/main/java/net/neoforged/neoforge/client/gui/LoadingErrorScreen.java @@ -29,6 +29,7 @@ import net.neoforged.neoforge.common.I18nExtension; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.Nullable; public class LoadingErrorScreen extends ErrorScreen { private static final Logger LOGGER = LogManager.getLogger(); @@ -36,12 +37,13 @@ public class LoadingErrorScreen extends ErrorScreen { private final Path logFile; private final List modLoadErrors; private final List modLoadWarnings; + @Nullable private final Path dumpedLocation; private LoadingEntryList entryList; private Component errorHeader; private Component warningHeader; - public LoadingErrorScreen(LoadingFailedException loadingException, List warnings, final File dumpedLocation) { + public LoadingErrorScreen(@Nullable LoadingFailedException loadingException, List warnings, @Nullable File dumpedLocation) { super(Component.literal("Loading Error"), null); this.modLoadWarnings = warnings; this.modLoadErrors = loadingException == null ? Collections.emptyList() : loadingException.getErrors(); diff --git a/src/main/java/net/neoforged/neoforge/client/gui/ModListScreen.java b/src/main/java/net/neoforged/neoforge/client/gui/ModListScreen.java index dc604428fb1..3d49638f1c2 100644 --- a/src/main/java/net/neoforged/neoforge/client/gui/ModListScreen.java +++ b/src/main/java/net/neoforged/neoforge/client/gui/ModListScreen.java @@ -15,6 +15,7 @@ import java.util.Comparator; import java.util.List; import java.util.Map.Entry; +import java.util.Optional; import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; @@ -33,17 +34,17 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.PackLocationInfo; import net.minecraft.server.packs.PackResources; import net.minecraft.server.packs.repository.Pack; +import net.minecraft.server.packs.repository.PackSource; import net.minecraft.server.packs.resources.IoSupplier; import net.minecraft.util.FormattedCharSequence; -import net.neoforged.fml.ModContainer; import net.neoforged.fml.ModList; import net.neoforged.fml.VersionChecker; import net.neoforged.fml.loading.FMLPaths; import net.neoforged.fml.loading.StringUtils; import net.neoforged.fml.loading.moddiscovery.ModFileInfo; -import net.neoforged.neoforge.client.ConfigScreenHandler; import net.neoforged.neoforge.client.gui.widget.ModListWidget; import net.neoforged.neoforge.client.gui.widget.ScrollPanel; import net.neoforged.neoforge.common.CommonHooks; @@ -87,8 +88,8 @@ protected int compare(String name1, String name2) { @Override public int compare(IModInfo o1, IModInfo o2) { - String name1 = StringUtils.toLowerCase(stripControlCodes(I18nExtension.getDisplayName(o1))); - String name2 = StringUtils.toLowerCase(stripControlCodes(I18nExtension.getDisplayName(o2))); + String name1 = StringUtils.toLowerCase(stripControlCodes(o1.getDisplayName())); + String name2 = StringUtils.toLowerCase(stripControlCodes(o2.getDisplayName())); return compare(name1, name2); } @@ -247,7 +248,7 @@ public void updateNarration(NarrationElementOutput p_169152_) {} @Override public void init() { for (IModInfo mod : mods) { - listWidth = Math.max(listWidth, getFontRenderer().width(I18nExtension.getDisplayName(mod)) + 10); + listWidth = Math.max(listWidth, getFontRenderer().width(mod.getDisplayName()) + 10); listWidth = Math.max(listWidth, getFontRenderer().width(MavenVersionStringHelper.artifactVersionToString(mod.getVersion())) + 5); } listWidth = Math.max(Math.min(listWidth, width / 3), 100); @@ -294,7 +295,7 @@ public void init() { private void displayModConfig() { if (selected == null) return; try { - ConfigScreenHandler.getScreenFactoryFor(selected.getInfo()).map(f -> f.apply(this.minecraft, this)).ifPresent(newScreen -> this.minecraft.setScreen(newScreen)); + IConfigScreenFactory.getForMod(selected.getInfo()).map(f -> f.createScreen(this.minecraft, this)).ifPresent(newScreen -> this.minecraft.setScreen(newScreen)); } catch (final Exception e) { LOGGER.error("There was a critical issue trying to build the config GUI for {}", selected.getInfo().getModId(), e); } @@ -326,7 +327,7 @@ public > void buildModList(Consumer mo } private void reloadMods() { - this.mods = this.unsortedMods.stream().filter(mi -> StringUtils.toLowerCase(stripControlCodes(I18nExtension.getDisplayName(mi))).contains(StringUtils.toLowerCase(search.getValue()))).collect(Collectors.toList()); + this.mods = this.unsortedMods.stream().filter(mi -> StringUtils.toLowerCase(stripControlCodes(mi.getDisplayName())).contains(StringUtils.toLowerCase(search.getValue()))).collect(Collectors.toList()); lastFilterText = search.getValue(); } @@ -342,14 +343,9 @@ private void resortMods(SortType newSort) { @Override public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - this.modList.render(guiGraphics, mouseX, mouseY, partialTick); - if (this.modInfo != null) - this.modInfo.render(guiGraphics, mouseX, mouseY, partialTick); - + super.render(guiGraphics, mouseX, mouseY, partialTick); Component text = Component.translatable("fml.menu.mods.search"); int x = modList.getX() + ((modList.getRight() - modList.getX()) / 2) - (getFontRenderer().width(text) / 2); - this.search.render(guiGraphics, mouseX, mouseY, partialTick); - super.render(guiGraphics, mouseX, mouseY, partialTick); guiGraphics.drawString(getFontRenderer(), text.getVisualOrderText(), x, search.getY() - getFontRenderer().lineHeight, 0xFFFFFF, false); } @@ -373,7 +369,7 @@ private void updateCache() { return; } IModInfo selectedMod = selected.getInfo(); - this.configButton.active = ConfigScreenHandler.getScreenFactoryFor(selectedMod).isPresent(); + this.configButton.active = IConfigScreenFactory.getForMod(selectedMod).isPresent(); List lines = new ArrayList<>(); VersionChecker.CheckResult vercheck = VersionChecker.getResult(selectedMod); @@ -382,7 +378,7 @@ private void updateCache() { TextureManager tm = this.minecraft.getTextureManager(); final Pack.ResourcesSupplier resourcePack = ResourcePackLoader.getPackFor(selectedMod.getModId()) .orElse(ResourcePackLoader.getPackFor("neoforge").orElseThrow(() -> new RuntimeException("Can't find neoforge, WHAT!"))); - try (PackResources packResources = resourcePack.openPrimary("mod:" + selectedMod.getModId())) { + try (PackResources packResources = resourcePack.openPrimary(new PackLocationInfo("mod:" + selectedMod.getModId(), Component.empty(), PackSource.BUILT_IN, Optional.empty()))) { NativeImage logo = null; IoSupplier logoResource = packResources.getRootResource(logoFile.split("[/\\\\]")); if (logoResource != null) @@ -403,9 +399,9 @@ public void upload() { return Pair.of(null, new Size2i(0, 0)); }).orElse(Pair.of(null, new Size2i(0, 0))); - lines.add(I18nExtension.getDisplayName(selectedMod)); + lines.add(selectedMod.getDisplayName()); lines.add(I18nExtension.parseMessage("fml.menu.mods.info.version", MavenVersionStringHelper.artifactVersionToString(selectedMod.getVersion()))); - lines.add(I18nExtension.parseMessage("fml.menu.mods.info.idstate", selectedMod.getModId(), ModList.get().getModContainerById(selectedMod.getModId()).map(ModContainer::getCurrentState).map(Object::toString).orElse("NONE"))); + lines.add(I18nExtension.parseMessage("fml.menu.mods.info.idstate", selectedMod.getModId(), "LOADED")); // TODO: remove mod loading stages from here too selectedMod.getConfig().getConfigElement("credits").ifPresent(credits -> lines.add(I18nExtension.parseMessage("fml.menu.mods.info.credits", credits))); selectedMod.getConfig().getConfigElement("authors").ifPresent(authors -> lines.add(I18nExtension.parseMessage("fml.menu.mods.info.authors", authors))); @@ -413,7 +409,7 @@ public void upload() { if (selectedMod.getOwningFile() == null || selectedMod.getOwningFile().getMods().size() == 1) lines.add(I18nExtension.parseMessage("fml.menu.mods.info.nochildmods")); else - lines.add(I18nExtension.parseMessage("fml.menu.mods.info.childmods", selectedMod.getOwningFile().getMods().stream().map(I18nExtension::getDisplayName).collect(Collectors.joining(",")))); + lines.add(I18nExtension.parseMessage("fml.menu.mods.info.childmods", selectedMod.getOwningFile().getMods().stream().map(IModInfo::getDisplayName).collect(Collectors.joining(",")))); if (vercheck.status() == VersionChecker.Status.OUTDATED || vercheck.status() == VersionChecker.Status.BETA_OUTDATED) lines.add(I18nExtension.parseMessage("fml.menu.mods.info.updateavailable", vercheck.url() == null ? "" : vercheck.url())); diff --git a/src/main/java/net/neoforged/neoforge/client/gui/TitleScreenModUpdateIndicator.java b/src/main/java/net/neoforged/neoforge/client/gui/TitleScreenModUpdateIndicator.java deleted file mode 100644 index afb3f0e3479..00000000000 --- a/src/main/java/net/neoforged/neoforge/client/gui/TitleScreenModUpdateIndicator.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.client.gui; - -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.components.Button; -import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.gui.screens.TitleScreen; -import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.neoforged.api.distmarker.Dist; -import net.neoforged.api.distmarker.OnlyIn; -import net.neoforged.fml.VersionChecker; -import net.neoforged.fml.loading.FMLConfig; -import net.neoforged.neoforge.client.loading.ClientModLoader; -import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; - -@OnlyIn(Dist.CLIENT) -public class TitleScreenModUpdateIndicator extends Screen { - private static final ResourceLocation VERSION_CHECK_ICONS = new ResourceLocation(NeoForgeVersion.MOD_ID, "textures/gui/version_check_icons.png"); - - private final Button modButton; - private VersionChecker.Status showNotification = null; - private boolean hasCheckedForUpdates = false; - - public TitleScreenModUpdateIndicator(Button modButton) { - super(Component.translatable("neoforge.menu.updatescreen.title")); - this.modButton = modButton; - } - - @Override - public void init() { - if (!hasCheckedForUpdates) { - if (modButton != null) { - showNotification = ClientModLoader.checkForUpdates(); - } - hasCheckedForUpdates = true; - } - } - - @Override - public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - if (showNotification == null || !showNotification.shouldDraw() || !FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.VERSION_CHECK)) { - return; - } - - int x = modButton.getX(); - int y = modButton.getY(); - int w = modButton.getWidth(); - int h = modButton.getHeight(); - - guiGraphics.blit(VERSION_CHECK_ICONS, x + w - (h / 2 + 4), y + (h / 2 - 4), showNotification.getSheetOffset() * 8, (showNotification.isAnimated() && ((System.currentTimeMillis() / 800 & 1) == 1)) ? 8 : 0, 8, 8, 64, 16); - } - - public static TitleScreenModUpdateIndicator init(TitleScreen guiMainMenu, Button modButton) { - TitleScreenModUpdateIndicator titleScreenModUpdateIndicator = new TitleScreenModUpdateIndicator(modButton); - titleScreenModUpdateIndicator.resize(guiMainMenu.getMinecraft(), guiMainMenu.width, guiMainMenu.height); - titleScreenModUpdateIndicator.init(); - return titleScreenModUpdateIndicator; - } -} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/VanillaGuiLayers.java b/src/main/java/net/neoforged/neoforge/client/gui/VanillaGuiLayers.java new file mode 100644 index 00000000000..96dae62ab57 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/client/gui/VanillaGuiLayers.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.client.gui; + +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.LayeredDraw; +import net.minecraft.resources.ResourceLocation; + +/** + * Identifiers for the vanilla {@link LayeredDraw.Layer}, in the order that they render. + * + *

The corresponding rendering code can be found in the source code of {@link Gui}. + */ +public final class VanillaGuiLayers { + public static final ResourceLocation CAMERA_OVERLAYS = new ResourceLocation("camera_overlays"); + public static final ResourceLocation CROSSHAIR = new ResourceLocation("crosshair"); + public static final ResourceLocation HOTBAR = new ResourceLocation("hotbar"); + public static final ResourceLocation JUMP_METER = new ResourceLocation("jump_meter"); + public static final ResourceLocation EXPERIENCE_BAR = new ResourceLocation("experience_bar"); + public static final ResourceLocation PLAYER_HEALTH = new ResourceLocation("player_health"); + public static final ResourceLocation ARMOR_LEVEL = new ResourceLocation("armor_level"); + public static final ResourceLocation FOOD_LEVEL = new ResourceLocation("food_level"); + public static final ResourceLocation VEHICLE_HEALTH = new ResourceLocation("vehicle_health"); + public static final ResourceLocation AIR_LEVEL = new ResourceLocation("air_level"); + public static final ResourceLocation SELECTED_ITEM_NAME = new ResourceLocation("selected_item_name"); + public static final ResourceLocation SPECTATOR_TOOLTIP = new ResourceLocation("spectator_tooltip"); + public static final ResourceLocation EXPERIENCE_LEVEL = new ResourceLocation("experience_level"); + public static final ResourceLocation EFFECTS = new ResourceLocation("effects"); + public static final ResourceLocation BOSS_OVERLAY = new ResourceLocation("boss_overlay"); + public static final ResourceLocation SLEEP_OVERLAY = new ResourceLocation("sleep_overlay"); + public static final ResourceLocation DEMO_OVERLAY = new ResourceLocation("demo_overlay"); + public static final ResourceLocation DEBUG_OVERLAY = new ResourceLocation("debug_overlay"); + public static final ResourceLocation SCOREBOARD_SIDEBAR = new ResourceLocation("scoreboard_sidebar"); + public static final ResourceLocation OVERLAY_MESSAGE = new ResourceLocation("overlay_message"); + public static final ResourceLocation TITLE = new ResourceLocation("title"); + public static final ResourceLocation CHAT = new ResourceLocation("chat"); + public static final ResourceLocation TAB_LIST = new ResourceLocation("tab_list"); + public static final ResourceLocation SUBTITLE_OVERLAY = new ResourceLocation("subtitle_overlay"); + public static final ResourceLocation SAVING_INDICATOR = new ResourceLocation("saving_indicator"); +} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/overlay/ExtendedGui.java b/src/main/java/net/neoforged/neoforge/client/gui/overlay/ExtendedGui.java deleted file mode 100644 index 8c7a1b1e409..00000000000 --- a/src/main/java/net/neoforged/neoforge/client/gui/overlay/ExtendedGui.java +++ /dev/null @@ -1,502 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.client.gui.overlay; - -import com.mojang.blaze3d.platform.Window; -import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.Util; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.multiplayer.ClientPacketListener; -import net.minecraft.client.renderer.GameRenderer; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; -import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.PlayerRideableJumping; -import net.minecraft.world.entity.ai.attributes.AttributeInstance; -import net.minecraft.world.entity.ai.attributes.Attributes; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.food.FoodData; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.scores.DisplaySlot; -import net.minecraft.world.scores.Objective; -import net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent; -import net.neoforged.neoforge.client.event.RenderGuiEvent; -import net.neoforged.neoforge.client.event.RenderGuiOverlayEvent; -import net.neoforged.neoforge.client.extensions.common.IClientItemExtensions; -import net.neoforged.neoforge.common.NeoForge; -import net.neoforged.neoforge.common.NeoForgeMod; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -/** - * NeoForge extension of {@link Gui} to be able to render {@link IGuiOverlay HUD overlays}. - */ -public class ExtendedGui extends Gui { - private static final Logger LOGGER = LogManager.getLogger(); - - private static final int WHITE = 0xFFFFFF; - - /* - * If the Euclidean distance to the moused-over block in meters is less than this value, the "Looking at" text will appear on the debug overlay. - */ - public static double rayTraceDistance = 20.0D; - - public int leftHeight = 39; - public int rightHeight = 39; - - private Font font = null; - - public ExtendedGui(Minecraft mc) { - super(mc, mc.getItemRenderer()); - } - - public Minecraft getMinecraft() { - return minecraft; - } - - public void setupOverlayRenderState(boolean blend, boolean depthTest) { - if (blend) { - RenderSystem.enableBlend(); - RenderSystem.defaultBlendFunc(); - } else { - RenderSystem.disableBlend(); - } - - if (depthTest) { - RenderSystem.enableDepthTest(); - } else { - RenderSystem.disableDepthTest(); - } - - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.setShader(GameRenderer::getPositionTexShader); - } - - @Override - public void render(GuiGraphics guiGraphics, float partialTick) { - this.screenWidth = this.minecraft.getWindow().getGuiScaledWidth(); - this.screenHeight = this.minecraft.getWindow().getGuiScaledHeight(); - - rightHeight = 39; - leftHeight = 39; - - if (NeoForge.EVENT_BUS.post(new RenderGuiEvent.Pre(minecraft.getWindow(), guiGraphics, partialTick)).isCanceled()) { - return; - } - - font = minecraft.font; - - this.random.setSeed(tickCount * 312871L); - - GuiOverlayManager.getOverlays().forEach(entry -> { - try { - IGuiOverlay overlay = entry.overlay(); - if (pre(entry, guiGraphics)) return; - overlay.render(this, guiGraphics, partialTick, screenWidth, screenHeight); - post(entry, guiGraphics); - } catch (Exception e) { - LOGGER.error("Error rendering overlay '{}'", entry.id(), e); - } - }); - - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - - NeoForge.EVENT_BUS.post(new RenderGuiEvent.Post(minecraft.getWindow(), guiGraphics, partialTick)); - } - - public boolean shouldDrawSurvivalElements() { - return minecraft.gameMode.canHurtPlayer() && minecraft.getCameraEntity() instanceof Player; - } - - public boolean shouldDrawPlayerElements() { - return minecraft.getCameraEntity() instanceof Player; - } - - protected void renderSubtitles(GuiGraphics guiGraphics) { - this.subtitleOverlay.render(guiGraphics); - } - - protected void renderBossHealth(GuiGraphics guiGraphics) { - RenderSystem.defaultBlendFunc(); - minecraft.getProfiler().push("bossHealth"); - this.bossOverlay.render(guiGraphics); - minecraft.getProfiler().pop(); - } - - void renderSpyglassOverlay(GuiGraphics guiGraphics) { - float deltaFrame = this.minecraft.getDeltaFrameTime(); - this.scopeScale = Mth.lerp(0.5F * deltaFrame, this.scopeScale, 1.125F); - if (this.minecraft.options.getCameraType().isFirstPerson()) { - if (this.minecraft.player.isScoping()) { - this.renderSpyglassOverlay(guiGraphics, this.scopeScale); - } else { - this.scopeScale = 0.5F; - } - } - } - - void renderHelmet(float partialTick, GuiGraphics guiGraphics) { - ItemStack itemstack = this.minecraft.player.getInventory().getArmor(3); - - if (this.minecraft.options.getCameraType().isFirstPerson() && !itemstack.isEmpty() && !this.minecraft.player.isScoping()) { - Item item = itemstack.getItem(); - if (item == Blocks.CARVED_PUMPKIN.asItem()) { - renderTextureOverlay(guiGraphics, PUMPKIN_BLUR_LOCATION, 1.0F); - } else { - IClientItemExtensions.of(item).renderHelmetOverlay(itemstack, minecraft.player, this.screenWidth, this.screenHeight, partialTick); - } - } - } - - void renderFrostbite(GuiGraphics guiGraphics) { - if (this.minecraft.player.getTicksFrozen() > 0) { - this.renderTextureOverlay(guiGraphics, POWDER_SNOW_OUTLINE_LOCATION, this.minecraft.player.getPercentFrozen()); - } - } - - protected void renderArmor(GuiGraphics guiGraphics, int width, int height) { - minecraft.getProfiler().push("armor"); - - RenderSystem.enableBlend(); - int left = width / 2 - 91; - int top = height - leftHeight; - - int level = minecraft.player.getArmorValue(); - for (int i = 1; level > 0 && i < 20; i += 2) { - if (i < level) { - guiGraphics.blitSprite(ARMOR_FULL_SPRITE, left, top, 9, 9); - } else if (i == level) { - guiGraphics.blitSprite(ARMOR_HALF_SPRITE, left, top, 9, 9); - } else { - guiGraphics.blitSprite(ARMOR_EMPTY_SPRITE, left, top, 9, 9); - } - left += 8; - } - leftHeight += 10; - - RenderSystem.disableBlend(); - minecraft.getProfiler().pop(); - } - - @Override - protected void renderPortalOverlay(GuiGraphics guiGraphics, float alpha) { - if (alpha > 0.0F) { - super.renderPortalOverlay(guiGraphics, alpha); - } - } - - protected void renderAir(int width, int height, GuiGraphics guiGraphics) { - minecraft.getProfiler().push("air"); - Player player = (Player) this.minecraft.getCameraEntity(); - RenderSystem.enableBlend(); - int left = width / 2 + 91; - int top = height - rightHeight; - - int air = player.getAirSupply(); - if (player.isEyeInFluidType(NeoForgeMod.WATER_TYPE.value()) || air < 300) { - int full = Mth.ceil((double) (air - 2) * 10.0D / 300.0D); - int partial = Mth.ceil((double) air * 10.0D / 300.0D) - full; - - for (int i = 0; i < full + partial; ++i) { - guiGraphics.blitSprite(i < full ? AIR_SPRITE : AIR_BURSTING_SPRITE, left - i * 8 - 9, top, 9, 9); - } - rightHeight += 10; - } - - RenderSystem.disableBlend(); - minecraft.getProfiler().pop(); - } - - public void renderHealth(int width, int height, GuiGraphics guiGraphics) { - minecraft.getProfiler().push("health"); - RenderSystem.enableBlend(); - - Player player = (Player) this.minecraft.getCameraEntity(); - int health = Mth.ceil(player.getHealth()); - boolean highlight = healthBlinkTime > (long) tickCount && (healthBlinkTime - (long) tickCount) / 3L % 2L == 1L; - - if (health < this.lastHealth && player.invulnerableTime > 0) { - this.lastHealthTime = Util.getMillis(); - this.healthBlinkTime = (long) (this.tickCount + 20); - } else if (health > this.lastHealth && player.invulnerableTime > 0) { - this.lastHealthTime = Util.getMillis(); - this.healthBlinkTime = (long) (this.tickCount + 10); - } - - if (Util.getMillis() - this.lastHealthTime > 1000L) { - this.lastHealth = health; - this.displayHealth = health; - this.lastHealthTime = Util.getMillis(); - } - - this.lastHealth = health; - int healthLast = this.displayHealth; - - AttributeInstance attrMaxHealth = player.getAttribute(Attributes.MAX_HEALTH); - float healthMax = Math.max((float) attrMaxHealth.getValue(), Math.max(healthLast, health)); - int absorb = Mth.ceil(player.getAbsorptionAmount()); - - int healthRows = Mth.ceil((healthMax + absorb) / 2.0F / 10.0F); - int rowHeight = Math.max(10 - (healthRows - 2), 3); - - this.random.setSeed((long) (tickCount * 312871)); - - int left = width / 2 - 91; - int top = height - leftHeight; - leftHeight += (healthRows * rowHeight); - if (rowHeight != 10) leftHeight += 10 - rowHeight; - - int regen = -1; - if (player.hasEffect(MobEffects.REGENERATION)) { - regen = this.tickCount % Mth.ceil(healthMax + 5.0F); - } - - this.renderHearts(guiGraphics, player, left, top, rowHeight, regen, healthMax, health, healthLast, absorb, highlight); - - RenderSystem.disableBlend(); - minecraft.getProfiler().pop(); - } - - public void renderFood(int width, int height, GuiGraphics guiGraphics) { - minecraft.getProfiler().push("food"); - - Player player = (Player) this.minecraft.getCameraEntity(); - RenderSystem.enableBlend(); - int left = width / 2 + 91; - int top = height - rightHeight; - rightHeight += 10; - boolean unused = false;// Unused flag in vanilla, seems to be part of a 'fade out' mechanic - - FoodData stats = minecraft.player.getFoodData(); - int level = stats.getFoodLevel(); - - for (int i = 0; i < 10; ++i) { - int idx = i * 2 + 1; - int x = left - i * 8 - 9; - int y = top; - - ResourceLocation empty; - ResourceLocation half; - ResourceLocation full; - if (minecraft.player.hasEffect(MobEffects.HUNGER)) { - empty = FOOD_EMPTY_HUNGER_SPRITE; - half = FOOD_HALF_HUNGER_SPRITE; - full = FOOD_FULL_HUNGER_SPRITE; - } else { - empty = FOOD_EMPTY_SPRITE; - half = FOOD_HALF_SPRITE; - full = FOOD_FULL_SPRITE; - } - - if (player.getFoodData().getSaturationLevel() <= 0.0F && tickCount % (level * 3 + 1) == 0) { - y = top + (random.nextInt(3) - 1); - } - - guiGraphics.blitSprite(empty, x, y, 9, 9); - - if (idx < level) - guiGraphics.blitSprite(full, x, y, 9, 9); - else if (idx == level) - guiGraphics.blitSprite(half, x, y, 9, 9); - } - RenderSystem.disableBlend(); - minecraft.getProfiler().pop(); - } - - protected void renderSleepFade(int width, int height, GuiGraphics guiGraphics) { - if (minecraft.player.getSleepTimer() > 0) { - minecraft.getProfiler().push("sleep"); - int sleepTime = minecraft.player.getSleepTimer(); - float opacity = (float) sleepTime / 100.0F; - - if (opacity > 1.0F) { - opacity = 1.0F - (float) (sleepTime - 100) / 10.0F; - } - - int color = (int) (220.0F * opacity) << 24 | 1052704; - guiGraphics.fill(RenderType.guiOverlay(), 0, 0, width, height, color); - minecraft.getProfiler().pop(); - } - } - - protected void renderExperience(int x, GuiGraphics guiGraphics) { - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.disableBlend(); - - if (minecraft.gameMode.hasExperience()) { - super.renderExperienceBar(guiGraphics, x); - } - RenderSystem.enableBlend(); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); - } - - @Override - public void renderJumpMeter(PlayerRideableJumping playerRideableJumping, GuiGraphics guiGraphics, int x) { - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.disableBlend(); - - super.renderJumpMeter(playerRideableJumping, guiGraphics, x); - - RenderSystem.enableBlend(); - minecraft.getProfiler().pop(); - guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); - } - - protected void renderRecordOverlay(int width, int height, float partialTick, GuiGraphics guiGraphics) { - if (overlayMessageTime > 0) { - minecraft.getProfiler().push("overlayMessage"); - float hue = (float) overlayMessageTime - partialTick; - int opacity = (int) (hue * 255.0F / 20.0F); - if (opacity > 255) opacity = 255; - - if (opacity > 8) { - //Include a shift based on the bar height plus the difference between the height that renderSelectedItemName - // renders at (59) and the height that the overlay/status bar renders at (68) by default - int yShift = Math.max(leftHeight, rightHeight) + (68 - 59); - guiGraphics.pose().pushPose(); - //If y shift is smaller less than the default y level, just render it at the base y level - guiGraphics.pose().translate(width / 2D, height - Math.max(yShift, 68), 0.0D); - RenderSystem.enableBlend(); - RenderSystem.defaultBlendFunc(); - int color = (animateOverlayMessageColor ? Mth.hsvToRgb(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE); - int messageWidth = font.width(overlayMessageString); - drawBackdrop(guiGraphics, font, -4, messageWidth, 16777215 | (opacity << 24)); - guiGraphics.drawString(font, overlayMessageString.getVisualOrderText(), -messageWidth / 2, -4, color | (opacity << 24)); - RenderSystem.disableBlend(); - guiGraphics.pose().popPose(); - } - - minecraft.getProfiler().pop(); - } - } - - protected void renderTitle(int width, int height, float partialTick, GuiGraphics guiGraphics) { - if (title != null && titleTime > 0) { - minecraft.getProfiler().push("titleAndSubtitle"); - float age = (float) this.titleTime - partialTick; - int opacity = 255; - - if (titleTime > titleFadeOutTime + titleStayTime) { - float f3 = (float) (titleFadeInTime + titleStayTime + titleFadeOutTime) - age; - opacity = (int) (f3 * 255.0F / (float) titleFadeInTime); - } - if (titleTime <= titleFadeOutTime) opacity = (int) (age * 255.0F / (float) this.titleFadeOutTime); - - opacity = Mth.clamp(opacity, 0, 255); - - if (opacity > 8) { - guiGraphics.pose().pushPose(); - guiGraphics.pose().translate(width / 2D, height / 2D, 0.0D); - RenderSystem.enableBlend(); - RenderSystem.defaultBlendFunc(); - guiGraphics.pose().pushPose(); - guiGraphics.pose().scale(4.0F, 4.0F, 4.0F); - int l = opacity << 24 & -16777216; - guiGraphics.drawString(this.font, this.title.getVisualOrderText(), -this.getFont().width(this.title) / 2, -10, 16777215 | l, true); - guiGraphics.pose().popPose(); - if (this.subtitle != null) { - guiGraphics.pose().pushPose(); - guiGraphics.pose().scale(2.0F, 2.0F, 2.0F); - guiGraphics.drawString(this.font, this.subtitle.getVisualOrderText(), -this.getFont().width(this.subtitle) / 2, 5, 16777215 | l, true); - guiGraphics.pose().popPose(); - } - RenderSystem.disableBlend(); - guiGraphics.pose().popPose(); - } - - this.minecraft.getProfiler().pop(); - } - } - - protected void renderChat(int width, int height, GuiGraphics guiGraphics) { - minecraft.getProfiler().push("chat"); - - Window window = minecraft.getWindow(); - var event = new CustomizeGuiOverlayEvent.Chat(window, guiGraphics, minecraft.getFrameTime(), 0, height - 40); - NeoForge.EVENT_BUS.post(event); - - guiGraphics.pose().pushPose(); - // We give the absolute Y position of the chat component in the event and account for the chat component's own offsetting here. - guiGraphics.pose().translate(event.getPosX(), (event.getPosY() - height + 40) / chat.getScale(), 0.0D); - int mouseX = Mth.floor(minecraft.mouseHandler.xpos() * window.getGuiScaledWidth() / window.getScreenWidth()); - int mouseY = Mth.floor(minecraft.mouseHandler.ypos() * window.getGuiScaledHeight() / window.getScreenHeight()); - chat.render(guiGraphics, tickCount, mouseX, mouseY); - guiGraphics.pose().popPose(); - - minecraft.getProfiler().pop(); - } - - protected void renderPlayerList(int width, int height, GuiGraphics guiGraphics) { - Objective scoreobjective = this.minecraft.level.getScoreboard().getDisplayObjective(DisplaySlot.LIST); - ClientPacketListener handler = minecraft.player.connection; - - if (minecraft.options.keyPlayerList.isDown() && (!minecraft.isLocalServer() || handler.getOnlinePlayers().size() > 1 || scoreobjective != null)) { - this.tabList.setVisible(true); - this.tabList.render(guiGraphics, width, this.minecraft.level.getScoreboard(), scoreobjective); - - } else { - this.tabList.setVisible(false); - } - } - - protected void renderHealthMount(int width, int height, GuiGraphics guiGraphics) { - Player player = (Player) minecraft.getCameraEntity(); - Entity tmp = player.getVehicle(); - if (!(tmp instanceof LivingEntity)) return; - - int left_align = width / 2 + 91; - - minecraft.getProfiler().popPush("mountHealth"); - RenderSystem.enableBlend(); - LivingEntity mount = (LivingEntity) tmp; - int health = (int) Math.ceil((double) mount.getHealth()); - float healthMax = mount.getMaxHealth(); - int hearts = (int) (healthMax + 0.5F) / 2; - - if (hearts > 30) hearts = 30; - - for (int heart = 0; hearts > 0; heart += 20) { - int top = height - rightHeight; - - int rowCount = Math.min(hearts, 10); - hearts -= rowCount; - - for (int i = 0; i < rowCount; ++i) { - int x = left_align - i * 8 - 9; - guiGraphics.blitSprite(HEART_VEHICLE_CONTAINER_SPRITE, x, top, 9, 9); - - if (i * 2 + 1 + heart < health) - guiGraphics.blitSprite(HEART_VEHICLE_FULL_SPRITE, x, top, 9, 9); - else if (i * 2 + 1 + heart == health) - guiGraphics.blitSprite(HEART_VEHICLE_HALF_SPRITE, x, top, 9, 9); - } - - rightHeight += 10; - } - RenderSystem.disableBlend(); - } - - //Helper macros - private boolean pre(NamedGuiOverlay overlay, GuiGraphics guiGraphics) { - return NeoForge.EVENT_BUS.post(new RenderGuiOverlayEvent.Pre(minecraft.getWindow(), guiGraphics, minecraft.getFrameTime(), overlay)).isCanceled(); - } - - private void post(NamedGuiOverlay overlay, GuiGraphics guiGraphics) { - NeoForge.EVENT_BUS.post(new RenderGuiOverlayEvent.Post(minecraft.getWindow(), guiGraphics, minecraft.getFrameTime(), overlay)); - } - - public void renderDebugScreenOverlay(GuiGraphics guiGraphics) { - this.getDebugOverlay().render(guiGraphics); - } -} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/overlay/GuiOverlayManager.java b/src/main/java/net/neoforged/neoforge/client/gui/overlay/GuiOverlayManager.java deleted file mode 100644 index cd86819edb3..00000000000 --- a/src/main/java/net/neoforged/neoforge/client/gui/overlay/GuiOverlayManager.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.client.gui.overlay; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.function.Function; -import net.minecraft.resources.ResourceLocation; -import net.neoforged.fml.ModLoader; -import net.neoforged.neoforge.client.event.RegisterGuiOverlaysEvent; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.Nullable; - -/** - * Manager for {@linkplain IGuiOverlay HUD overlays}. - *

- * Provides a lookup by ID, as well as all registered {@link IGuiOverlay overlays}. - */ -public final class GuiOverlayManager { - private static ImmutableList OVERLAYS; - private static ImmutableMap OVERLAYS_BY_NAME; - - /** - * Retrieves an ordered list of all registered overlays. - */ - public static ImmutableList getOverlays() { - return OVERLAYS; - } - - /** - * Finds the overlay corresponding to a given ID. - * Do not call this before {@link RegisterGuiOverlaysEvent} has finished firing. - */ - @Nullable - public static NamedGuiOverlay findOverlay(ResourceLocation id) { - return OVERLAYS_BY_NAME.get(id); - } - - @ApiStatus.Internal - public static void init() { - var overlays = new HashMap(); - var orderedOverlays = new ArrayList(); - preRegisterVanillaOverlays(overlays, orderedOverlays); - var event = new RegisterGuiOverlaysEvent(overlays, orderedOverlays); - ModLoader.get().postEventWrapContainerInModOrder(event); - OVERLAYS = orderedOverlays.stream() - .map(id -> new NamedGuiOverlay(id, overlays.get(id))) - .collect(ImmutableList.toImmutableList()); - OVERLAYS_BY_NAME = OVERLAYS.stream() - .collect(ImmutableMap.toImmutableMap(NamedGuiOverlay::id, Function.identity())); - assignVanillaOverlayTypes(); - } - - /** - * Pre-registers vanilla overlays so they are available for ordering. - */ - private static void preRegisterVanillaOverlays(HashMap overlays, ArrayList orderedOverlays) { - for (var entry : VanillaGuiOverlay.values()) { - overlays.put(entry.id(), entry.overlay); - orderedOverlays.add(entry.id()); - } - } - - private static void assignVanillaOverlayTypes() { - for (var entry : VanillaGuiOverlay.values()) - entry.type = OVERLAYS_BY_NAME.get(entry.id()); - } - - private GuiOverlayManager() {} -} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/overlay/IGuiOverlay.java b/src/main/java/net/neoforged/neoforge/client/gui/overlay/IGuiOverlay.java deleted file mode 100644 index 7c0f8239127..00000000000 --- a/src/main/java/net/neoforged/neoforge/client/gui/overlay/IGuiOverlay.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.client.gui.overlay; - -import net.minecraft.client.gui.GuiGraphics; -import net.neoforged.neoforge.client.event.RegisterGuiOverlaysEvent; - -/** - * A HUD overlay. - * - * @see RegisterGuiOverlaysEvent - */ -@FunctionalInterface -public interface IGuiOverlay { - void render(ExtendedGui gui, GuiGraphics guiGraphics, float partialTick, int screenWidth, int screenHeight); -} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/overlay/NamedGuiOverlay.java b/src/main/java/net/neoforged/neoforge/client/gui/overlay/NamedGuiOverlay.java deleted file mode 100644 index 4d7dd53718e..00000000000 --- a/src/main/java/net/neoforged/neoforge/client/gui/overlay/NamedGuiOverlay.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.client.gui.overlay; - -import net.minecraft.resources.ResourceLocation; -import net.neoforged.neoforge.client.event.RenderGuiOverlayEvent; -import org.jetbrains.annotations.ApiStatus; - -/** - * An object representation of an {@link IGuiOverlay overlay} with a name. - *

- * Useful to identify overlays in {@link RenderGuiOverlayEvent}. - *

- * Users should not be instantiating this themselves. Retrieve from {@link GuiOverlayManager}. - */ -public record NamedGuiOverlay(ResourceLocation id, IGuiOverlay overlay) { - @ApiStatus.Internal - public NamedGuiOverlay {} -} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/overlay/VanillaGuiOverlay.java b/src/main/java/net/neoforged/neoforge/client/gui/overlay/VanillaGuiOverlay.java deleted file mode 100644 index df90516217e..00000000000 --- a/src/main/java/net/neoforged/neoforge/client/gui/overlay/VanillaGuiOverlay.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.client.gui.overlay; - -import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.client.Minecraft; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; -import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.PlayerRideableJumping; -import net.minecraft.world.level.GameType; -import net.minecraft.world.scores.DisplaySlot; -import net.minecraft.world.scores.Objective; -import net.minecraft.world.scores.PlayerTeam; -import net.minecraft.world.scores.Scoreboard; -import org.lwjgl.opengl.GL11; - -/** - * All the vanilla {@linkplain IGuiOverlay HUD overlays} in the order that they render. - */ -public enum VanillaGuiOverlay { - VIGNETTE("vignette", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (Minecraft.useFancyGraphics()) { - gui.setupOverlayRenderState(true, false); - gui.renderVignette(guiGraphics, gui.getMinecraft().getCameraEntity()); - } - }), - SPYGLASS("spyglass", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - gui.setupOverlayRenderState(true, false); - gui.renderSpyglassOverlay(guiGraphics); - }), - HELMET("helmet", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - gui.setupOverlayRenderState(true, false); - gui.renderHelmet(partialTick, guiGraphics); - }), - FROSTBITE("frostbite", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - gui.setupOverlayRenderState(true, false); - gui.renderFrostbite(guiGraphics); - }), - PORTAL("portal", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - float f1 = Mth.lerp(partialTick, gui.getMinecraft().player.oSpinningEffectIntensity, gui.getMinecraft().player.spinningEffectIntensity); - if (f1 > 0.0F && !gui.getMinecraft().player.hasEffect(MobEffects.CONFUSION)) { - gui.setupOverlayRenderState(true, false); - gui.renderPortalOverlay(guiGraphics, f1); - } - }), - HOTBAR("hotbar", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui) { - gui.setupOverlayRenderState(true, false); - if (gui.getMinecraft().gameMode.getPlayerMode() == GameType.SPECTATOR) { - gui.getSpectatorGui().renderHotbar(guiGraphics); - } else { - gui.renderHotbar(partialTick, guiGraphics); - } - } - }), - CROSSHAIR("crosshair", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui) { - gui.setupOverlayRenderState(true, false); - - guiGraphics.pose().pushPose(); - guiGraphics.pose().translate(0, 0, -90); - gui.renderCrosshair(guiGraphics); - guiGraphics.pose().popPose(); - } - }), - BOSS_EVENT_PROGRESS("boss_event_progress", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui) { - gui.setupOverlayRenderState(true, false); - - guiGraphics.pose().pushPose(); - guiGraphics.pose().translate(0, 0, -90); - gui.renderBossHealth(guiGraphics); - guiGraphics.pose().popPose(); - } - }), - PLAYER_HEALTH("player_health", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui && gui.shouldDrawSurvivalElements()) { - gui.setupOverlayRenderState(true, false); - gui.renderHealth(screenWidth, screenHeight, guiGraphics); - } - }), - ARMOR_LEVEL("armor_level", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui && gui.shouldDrawSurvivalElements()) { - gui.setupOverlayRenderState(true, false); - gui.renderArmor(guiGraphics, screenWidth, screenHeight); - } - }), - FOOD_LEVEL("food_level", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - Entity vehicle = gui.getMinecraft().player.getVehicle(); - boolean isMounted = vehicle != null && vehicle.showVehicleHealth(); - if (!isMounted && !gui.getMinecraft().options.hideGui && gui.shouldDrawSurvivalElements()) { - gui.setupOverlayRenderState(true, false); - gui.renderFood(screenWidth, screenHeight, guiGraphics); - } - }), - AIR_LEVEL("air_level", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui && gui.shouldDrawSurvivalElements()) { - gui.setupOverlayRenderState(true, false); - gui.renderAir(screenWidth, screenHeight, guiGraphics); - } - }), - MOUNT_HEALTH("mount_health", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui && gui.shouldDrawPlayerElements()) { - gui.setupOverlayRenderState(true, false); - gui.renderHealthMount(screenWidth, screenHeight, guiGraphics); - } - }), - JUMP_BAR("jump_bar", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - PlayerRideableJumping playerRideableJumping = gui.getMinecraft().player.jumpableVehicle(); - if (playerRideableJumping != null && !gui.getMinecraft().options.hideGui) { - gui.setupOverlayRenderState(true, false); - gui.renderJumpMeter(playerRideableJumping, guiGraphics, screenWidth / 2 - 91); - } - }), - EXPERIENCE_BAR("experience_bar", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (gui.getMinecraft().player.jumpableVehicle() == null && !gui.getMinecraft().options.hideGui) { - gui.setupOverlayRenderState(true, false); - gui.renderExperience(screenWidth / 2 - 91, guiGraphics); - } - }), - ITEM_NAME("item_name", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui) { - gui.setupOverlayRenderState(true, false); - if (gui.getMinecraft().gameMode.getPlayerMode() != GameType.SPECTATOR) { - gui.renderSelectedItemName(guiGraphics, Math.max(gui.leftHeight, gui.rightHeight)); - } else if (gui.getMinecraft().player.isSpectator()) { - gui.getSpectatorGui().renderTooltip(guiGraphics); - } - } - }), - SLEEP_FADE("sleep_fade", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - gui.renderSleepFade(screenWidth, screenHeight, guiGraphics); - }), - DEMO_OVERLAY("demo_overlay", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (gui.getMinecraft().isDemo() && !gui.getDebugOverlay().showDebugScreen()) { - gui.renderDemoOverlay(guiGraphics); - } - }), - POTION_ICONS("potion_icons", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - gui.renderEffects(guiGraphics); - }), - DEBUG_SCREEN("debug_screen", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (gui.getDebugOverlay().showDebugScreen()) { - gui.renderDebugScreenOverlay(guiGraphics); - } - }), - RECORD_OVERLAY("record_overlay", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui) { - gui.renderRecordOverlay(screenWidth, screenHeight, partialTick, guiGraphics); - } - }), - TITLE_TEXT("title_text", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui) { - gui.renderTitle(screenWidth, screenHeight, partialTick, guiGraphics); - } - }), - SUBTITLES("subtitles", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - if (!gui.getMinecraft().options.hideGui) { - gui.renderSubtitles(guiGraphics); - } - }), - SCOREBOARD("scoreboard", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - - Scoreboard scoreboard = gui.getMinecraft().level.getScoreboard(); - Objective objective = null; - PlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(gui.getMinecraft().player.getScoreboardName()); - if (scoreplayerteam != null) { - DisplaySlot displayslot = DisplaySlot.teamColorToSlot(scoreplayerteam.getColor()); - if (displayslot != null) objective = scoreboard.getDisplayObjective(displayslot); - } - Objective scoreobjective1 = objective != null ? objective : scoreboard.getDisplayObjective(DisplaySlot.SIDEBAR); - if (scoreobjective1 != null) { - gui.displayScoreboardSidebar(guiGraphics, scoreobjective1); - } - }), - CHAT_PANEL("chat_panel", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - - RenderSystem.enableBlend(); - RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - - gui.renderChat(screenWidth, screenHeight, guiGraphics); - }), - PLAYER_LIST("player_list", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { - - RenderSystem.enableBlend(); - RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - - gui.renderPlayerList(screenWidth, screenHeight, guiGraphics); - }); - - private final ResourceLocation id; - final IGuiOverlay overlay; - NamedGuiOverlay type; - - VanillaGuiOverlay(String id, IGuiOverlay overlay) { - this.id = new ResourceLocation("minecraft", id); - this.overlay = overlay; - } - - public ResourceLocation id() { - return id; - } - - public NamedGuiOverlay type() { - return type; - } -} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/overlay/package-info.java b/src/main/java/net/neoforged/neoforge/client/gui/overlay/package-info.java deleted file mode 100644 index 6c23e12b60c..00000000000 --- a/src/main/java/net/neoforged/neoforge/client/gui/overlay/package-info.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) NeoForged and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -@FieldsAreNonnullByDefault -@MethodsReturnNonnullByDefault -@ParametersAreNonnullByDefault -package net.neoforged.neoforge.client.gui.overlay; - -import javax.annotation.ParametersAreNonnullByDefault; -import net.minecraft.FieldsAreNonnullByDefault; -import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/src/main/java/net/neoforged/neoforge/client/gui/widget/ModListWidget.java b/src/main/java/net/neoforged/neoforge/client/gui/widget/ModListWidget.java index d99583fe4f1..e901307ec62 100644 --- a/src/main/java/net/neoforged/neoforge/client/gui/widget/ModListWidget.java +++ b/src/main/java/net/neoforged/neoforge/client/gui/widget/ModListWidget.java @@ -15,7 +15,6 @@ import net.minecraft.resources.ResourceLocation; import net.neoforged.fml.VersionChecker; import net.neoforged.neoforge.client.gui.ModListScreen; -import net.neoforged.neoforge.common.I18nExtension; import net.neoforged.neoforge.common.util.MavenVersionStringHelper; import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; import net.neoforged.neoforgespi.language.IModInfo; @@ -34,7 +33,7 @@ public ModListWidget(ModListScreen parent, int listWidth, int top, int bottom) { super(parent.getMinecraftInstance(), listWidth, bottom - top, top, parent.getFontRenderer().lineHeight * 2 + 8); this.parent = parent; this.listWidth = listWidth; - this.setRenderBackground(false); + //this.setRenderBackground(false); // Porting 1.20.5 still needed? this.refreshList(); } @@ -53,12 +52,6 @@ public void refreshList() { parent.buildModList(this::addEntry, mod -> new ModEntry(mod, this.parent)); } - @Override - public void renderWidget(GuiGraphics p_282708_, int p_283242_, int p_282891_, float p_283683_) { - this.parent.renderBackground(p_282708_, p_283242_, p_282891_, p_283683_); - super.renderWidget(p_282708_, p_283242_, p_282891_, p_283683_); - } - public class ModEntry extends ObjectSelectionList.Entry { private final IModInfo modInfo; private final ModListScreen parent; @@ -70,12 +63,12 @@ public class ModEntry extends ObjectSelectionList.Entry { @Override public Component getNarration() { - return Component.translatable("narrator.select", I18nExtension.getDisplayName(modInfo)); + return Component.translatable("narrator.select", modInfo.getDisplayName()); } @Override public void render(GuiGraphics guiGraphics, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isMouseOver, float partialTick) { - Component name = Component.literal(stripControlCodes(I18nExtension.getDisplayName(modInfo))); + Component name = Component.literal(stripControlCodes(modInfo.getDisplayName())); Component version = Component.literal(stripControlCodes(MavenVersionStringHelper.artifactVersionToString(modInfo.getVersion()))); VersionChecker.CheckResult vercheck = VersionChecker.getResult(modInfo); Font font = this.parent.getFontRenderer(); diff --git a/src/main/java/net/neoforged/neoforge/client/gui/widget/ModsButton.java b/src/main/java/net/neoforged/neoforge/client/gui/widget/ModsButton.java new file mode 100644 index 00000000000..f0835f8bc5b --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/client/gui/widget/ModsButton.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.client.gui.widget; + +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.fml.VersionChecker; +import net.neoforged.fml.loading.FMLConfig; +import net.neoforged.neoforge.client.loading.ClientModLoader; +import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; + +/** + * Custom button subclass to draw an indicator overlay on the button when updates are available. + */ +@ApiStatus.Internal +public class ModsButton extends Button { + private static final ResourceLocation VERSION_CHECK_ICONS = new ResourceLocation(NeoForgeVersion.MOD_ID, "textures/gui/version_check_icons.png"); + + @Nullable + private VersionChecker.Status showNotification; + private boolean hasCheckedForUpdates = false; + + public ModsButton(Builder builder) { + super(builder); + } + + @Override + protected void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { + super.renderWidget(guiGraphics, mouseX, mouseY, partialTick); + + if (!hasCheckedForUpdates) { + showNotification = ClientModLoader.checkForUpdates(); + hasCheckedForUpdates = true; + } + + if (showNotification == null || !showNotification.shouldDraw() || !FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.VERSION_CHECK)) { + return; + } + + int x = getX(); + int y = getY(); + int w = getWidth(); + int h = getHeight(); + + guiGraphics.blit( + VERSION_CHECK_ICONS, + x + w - (h / 2 + 4), + y + (h / 2 - 4), + showNotification.getSheetOffset() * 8, + (showNotification.isAnimated() && ((System.currentTimeMillis() / 800 & 1) == 1)) ? 8 : 0, + 8, + 8, + 64, + 16); + } +} diff --git a/src/main/java/net/neoforged/neoforge/client/gui/widget/ScrollPanel.java b/src/main/java/net/neoforged/neoforge/client/gui/widget/ScrollPanel.java index 25ecfd50ece..f4c0c771d9e 100644 --- a/src/main/java/net/neoforged/neoforge/client/gui/widget/ScrollPanel.java +++ b/src/main/java/net/neoforged/neoforge/client/gui/widget/ScrollPanel.java @@ -39,8 +39,6 @@ public abstract class ScrollPanel extends AbstractContainerEventHandler implemen private final int barWidth; private final int barLeft; - private final int bgColorFrom; - private final int bgColorTo; private final int barBgColor; private final int barColor; private final int barBorderColor; @@ -68,33 +66,6 @@ public ScrollPanel(Minecraft client, int width, int height, int top, int left, i this(client, width, height, top, left, border, 6); } - /** - * @param client the minecraft instance this ScrollPanel should use - * @param width the width - * @param height the height - * @param top the offset from the top (y coord) - * @param left the offset from the left (x coord) - * @param border the size of the border - * @param barWidth the width of the scroll bar - */ - public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border, int barWidth) { - this(client, width, height, top, left, border, barWidth, 0xC0101010, 0xD0101010); - } - - /** - * @param client the minecraft instance this ScrollPanel should use - * @param width the width - * @param height the height - * @param top the offset from the top (y coord) - * @param left the offset from the left (x coord) - * @param border the size of the border - * @param barWidth the width of the scroll bar - * @param bgColor the color for the background - */ - public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border, int barWidth, int bgColor) { - this(client, width, height, top, left, border, barWidth, bgColor, bgColor); - } - /** * @param client the minecraft instance this ScrollPanel should use * @param width the width @@ -106,8 +77,8 @@ public ScrollPanel(Minecraft client, int width, int height, int top, int left, i * @param bgColorFrom the start color for the background gradient * @param bgColorTo the end color for the background gradient */ - public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border, int barWidth, int bgColorFrom, int bgColorTo) { - this(client, width, height, top, left, border, barWidth, bgColorFrom, bgColorTo, 0xFF000000, 0xFF808080, 0xFFC0C0C0); + public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border, int barWidth) { + this(client, width, height, top, left, border, barWidth, 0xFF000000, 0xFF808080, 0xFFC0C0C0); } /** @@ -126,7 +97,7 @@ public ScrollPanel(Minecraft client, int width, int height, int top, int left, i * @param barColor the color for the scroll bar handle * @param barBorderColor the border color for the scroll bar handle */ - public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border, int barWidth, int bgColorFrom, int bgColorTo, int barBgColor, int barColor, int barBorderColor) { + public ScrollPanel(Minecraft client, int width, int height, int top, int left, int border, int barWidth, int barBgColor, int barColor, int barBorderColor) { this.client = client; this.width = width; this.height = height; @@ -137,8 +108,6 @@ public ScrollPanel(Minecraft client, int width, int height, int top, int left, i this.barLeft = this.left + this.width - barWidth; this.border = border; this.barWidth = barWidth; - this.bgColorFrom = bgColorFrom; - this.bgColorTo = bgColorTo; this.barBgColor = barBgColor; this.barColor = barColor; this.barBorderColor = barBorderColor; @@ -150,22 +119,7 @@ public ScrollPanel(Minecraft client, int width, int height, int top, int left, i * Draws the background of the scroll panel. This runs AFTER Scissors are enabled. */ protected void drawBackground(GuiGraphics guiGraphics, Tesselator tess, float partialTick) { - BufferBuilder worldr = tess.getBuilder(); - - if (this.client.level != null) { - this.drawGradientRect(guiGraphics, this.left, this.top, this.right, this.bottom, bgColorFrom, bgColorTo); - } else // Draw dark dirt background - { - RenderSystem.setShader(GameRenderer::getPositionTexColorShader); - RenderSystem.setShaderTexture(0, Screen.BACKGROUND_LOCATION); - final float texScale = 32.0F; - worldr.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); - worldr.vertex(this.left, this.bottom, 0.0D).uv(this.left / texScale, (this.bottom + (int) this.scrollDistance) / texScale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); - worldr.vertex(this.right, this.bottom, 0.0D).uv(this.right / texScale, (this.bottom + (int) this.scrollDistance) / texScale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); - worldr.vertex(this.right, this.top, 0.0D).uv(this.right / texScale, (this.top + (int) this.scrollDistance) / texScale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); - worldr.vertex(this.left, this.top, 0.0D).uv(this.left / texScale, (this.top + (int) this.scrollDistance) / texScale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); - tess.end(); - } + Screen.renderMenuBackgroundTexture(guiGraphics, Screen.MENU_BACKGROUND, this.left, this.top, 0f, 0f, this.width, this.height); } /** diff --git a/src/main/java/net/neoforged/neoforge/client/loading/ClientModLoader.java b/src/main/java/net/neoforged/neoforge/client/loading/ClientModLoader.java index 8bee7f4f379..4e6575f2cbe 100644 --- a/src/main/java/net/neoforged/neoforge/client/loading/ClientModLoader.java +++ b/src/main/java/net/neoforged/neoforge/client/loading/ClientModLoader.java @@ -31,18 +31,21 @@ import net.neoforged.neoforge.common.NeoForgeConfig; import net.neoforged.neoforge.common.util.LogicalSidedProvider; import net.neoforged.neoforge.internal.BrandingControl; +import net.neoforged.neoforge.internal.CommonModLoader; import net.neoforged.neoforge.logging.CrashReportExtender; import net.neoforged.neoforge.resource.ResourcePackLoader; import net.neoforged.neoforge.server.LanguageHook; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.Nullable; @OnlyIn(Dist.CLIENT) -public class ClientModLoader { +public class ClientModLoader extends CommonModLoader { private static final Logger LOGGER = LogManager.getLogger(); private static boolean loading; private static Minecraft mc; private static boolean loadingComplete; + @Nullable private static LoadingFailedException error; public static void begin(final Minecraft minecraft, final PackRepository defaultResourcePacks, final ReloadableResourceManager mcResourceManager) { @@ -53,7 +56,11 @@ public static void begin(final Minecraft minecraft, final PackRepository default ClientModLoader.mc = minecraft; LogicalSidedProvider.setClient(() -> minecraft); LanguageHook.loadBuiltinLanguages(); - createRunnableWithCatch(() -> ModLoader.get().gatherAndInitializeMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), ImmediateWindowHandler::renderTick)).run(); + try { + begin(ImmediateWindowHandler::renderTick); + } catch (LoadingFailedException e) { + error = e; + } if (error == null) { ResourcePackLoader.populatePackRepository(defaultResourcePacks, PackType.CLIENT_RESOURCES); DataPackConfig.DEFAULT.addModPacks(ResourcePackLoader.getDataPackNames()); @@ -63,28 +70,30 @@ public static void begin(final Minecraft minecraft, final PackRepository default } private static CompletableFuture onResourceReload(final PreparableReloadListener.PreparationBarrier stage, final ResourceManager resourceManager, final ProfilerFiller prepareProfiler, final ProfilerFiller executeProfiler, final Executor asyncExecutor, final Executor syncExecutor) { - return CompletableFuture.runAsync(createRunnableWithCatch(() -> startModLoading(ModWorkManager.wrappedExecutor(syncExecutor), asyncExecutor)), ModWorkManager.parallelExecutor()) + return CompletableFuture.runAsync(() -> startModLoading(syncExecutor, asyncExecutor), ModWorkManager.parallelExecutor()) .thenCompose(stage::wait) - .thenRunAsync(() -> finishModLoading(ModWorkManager.wrappedExecutor(syncExecutor), asyncExecutor), ModWorkManager.parallelExecutor()); + .thenRunAsync(() -> finishModLoading(syncExecutor, asyncExecutor), ModWorkManager.parallelExecutor()); } - private static Runnable createRunnableWithCatch(Runnable r) { - return () -> { - if (loadingComplete) return; - try { - r.run(); - } catch (LoadingFailedException e) { - if (error == null) error = e; - } - }; + private static void catchLoadingException(Runnable r) { + // Don't load again on subsequent reloads + if (loadingComplete) return; + // If the mod loading state is invalid, skip further mod initialization + if (!ModLoader.isLoadingStateValid()) return; + + try { + r.run(); + } catch (LoadingFailedException e) { + if (error == null) error = e; + } } - private static void startModLoading(ModWorkManager.DrivenExecutor syncExecutor, Executor parallelExecutor) { - createRunnableWithCatch(() -> ModLoader.get().loadMods(syncExecutor, parallelExecutor, ImmediateWindowHandler::renderTick)).run(); + private static void startModLoading(Executor syncExecutor, Executor parallelExecutor) { + catchLoadingException(() -> load(syncExecutor, parallelExecutor)); } - private static void finishModLoading(ModWorkManager.DrivenExecutor syncExecutor, Executor parallelExecutor) { - createRunnableWithCatch(() -> ModLoader.get().finishMods(syncExecutor, parallelExecutor, ImmediateWindowHandler::renderTick)).run(); + private static void finishModLoading(Executor syncExecutor, Executor parallelExecutor) { + catchLoadingException(() -> finish(syncExecutor, parallelExecutor)); loading = false; loadingComplete = true; // reload game settings on main thread @@ -100,7 +109,7 @@ public static VersionChecker.Status checkForUpdates() { } public static boolean completeModLoading() { - var warnings = ModLoader.get().getWarnings(); + var warnings = ModLoader.getWarnings(); boolean showWarnings = true; try { showWarnings = NeoForgeConfig.CLIENT.showLoadWarnings.get(); diff --git a/src/main/java/net/neoforged/neoforge/client/loading/NeoForgeLoadingOverlay.java b/src/main/java/net/neoforged/neoforge/client/loading/NeoForgeLoadingOverlay.java index a558a854cbd..5345ef1801a 100644 --- a/src/main/java/net/neoforged/neoforge/client/loading/NeoForgeLoadingOverlay.java +++ b/src/main/java/net/neoforged/neoforge/client/loading/NeoForgeLoadingOverlay.java @@ -26,10 +26,10 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ReloadInstance; import net.minecraft.util.Mth; -import net.neoforged.fml.StartupMessageManager; import net.neoforged.fml.earlydisplay.ColourScheme; import net.neoforged.fml.earlydisplay.DisplayWindow; import net.neoforged.fml.loading.progress.ProgressMeter; +import net.neoforged.fml.loading.progress.StartupNotificationManager; import org.joml.Matrix4f; import org.lwjgl.opengl.GL30C; @@ -57,7 +57,7 @@ public NeoForgeLoadingOverlay(final Minecraft mc, final ReloadInstance reloader, this.onFinish = errorConsumer; this.displayWindow = displayWindow; displayWindow.addMojangTexture(mc.getTextureManager().getTexture(new ResourceLocation("textures/gui/title/mojangstudios.png")).getId()); - this.progressMeter = StartupMessageManager.prependProgressBar("Minecraft Progress", 1000); + this.progressMeter = StartupNotificationManager.prependProgressBar("Minecraft Progress", 1000); } public static Supplier newInstance(Supplier mc, Supplier ri, Consumer> handler, DisplayWindow window) { diff --git a/src/main/java/net/neoforged/neoforge/client/model/BakedModelWrapper.java b/src/main/java/net/neoforged/neoforge/client/model/BakedModelWrapper.java index b47d6782375..0b9491dc0cc 100644 --- a/src/main/java/net/neoforged/neoforge/client/model/BakedModelWrapper.java +++ b/src/main/java/net/neoforged/neoforge/client/model/BakedModelWrapper.java @@ -47,16 +47,6 @@ public boolean useAmbientOcclusion() { return originalModel.useAmbientOcclusion(); } - @Override - public boolean useAmbientOcclusion(BlockState state) { - return originalModel.useAmbientOcclusion(state); - } - - @Override - public boolean useAmbientOcclusion(BlockState state, RenderType renderType) { - return originalModel.useAmbientOcclusion(state, renderType); - } - @Override public TriState useAmbientOcclusion(BlockState state, ModelData data, RenderType renderType) { return originalModel.useAmbientOcclusion(state, data, renderType); diff --git a/src/main/java/net/neoforged/neoforge/client/model/ExtraFaceData.java b/src/main/java/net/neoforged/neoforge/client/model/ExtraFaceData.java index 0d0e96da7d4..8cce5c50870 100644 --- a/src/main/java/net/neoforged/neoforge/client/model/ExtraFaceData.java +++ b/src/main/java/net/neoforged/neoforge/client/model/ExtraFaceData.java @@ -15,7 +15,6 @@ import javax.annotation.Nullable; import net.minecraft.client.renderer.block.model.BlockElement; import net.minecraft.client.renderer.block.model.BlockElementFace; -import net.minecraft.util.ExtraCodecs; /** * Holds extra data that may be injected into a face.

@@ -30,7 +29,7 @@ public record ExtraFaceData(int color, int blockLight, int skyLight, boolean amb public static final ExtraFaceData DEFAULT = new ExtraFaceData(0xFFFFFFFF, 0, 0, true); - public static final Codec COLOR = new ExtraCodecs.EitherCodec<>(Codec.INT, Codec.STRING).xmap( + public static final Codec COLOR = Codec.either(Codec.INT, Codec.STRING).xmap( either -> either.map(Function.identity(), str -> (int) Long.parseLong(str, 16)), color -> Either.right(Integer.toHexString(color))); @@ -55,6 +54,6 @@ public static ExtraFaceData read(@Nullable JsonElement obj, @Nullable ExtraFaceD if (obj == null) { return fallback; } - return CODEC.parse(JsonOps.INSTANCE, obj).getOrThrow(false, JsonParseException::new); + return CODEC.parse(JsonOps.INSTANCE, obj).getOrThrow(JsonParseException::new); } } diff --git a/src/main/java/net/neoforged/neoforge/client/model/data/ModelData.java b/src/main/java/net/neoforged/neoforge/client/model/data/ModelData.java index 31569ec78ac..e980e296f08 100644 --- a/src/main/java/net/neoforged/neoforge/client/model/data/ModelData.java +++ b/src/main/java/net/neoforged/neoforge/client/model/data/ModelData.java @@ -6,8 +6,9 @@ package net.neoforged.neoforge.client.model.data; import com.google.common.base.Preconditions; +import it.unimi.dsi.fastutil.objects.Reference2ReferenceArrayMap; +import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; import java.util.Collections; -import java.util.IdentityHashMap; import java.util.Map; import java.util.Set; import net.minecraft.client.renderer.RenderType; @@ -37,12 +38,19 @@ public final class ModelData { private final Map, Object> properties; + @Nullable + private Set> propertySetView; + private ModelData(Map, Object> properties) { this.properties = properties; } public Set> getProperties() { - return properties.keySet(); + var view = propertySetView; + if (view == null) { + propertySetView = view = Collections.unmodifiableSet(properties.keySet()); + } + return view; } public boolean has(ModelProperty property) { @@ -63,11 +71,26 @@ public static Builder builder() { } public static final class Builder { - private final Map, Object> properties = new IdentityHashMap<>(); + /** + * Hash maps are slower than array maps for *extremely* small maps (empty maps or singletons are the most + * extreme examples). Many block entities/models only use a single model data property, which means the + * overhead of hashing is quite wasteful. However, we do want to support any number of properties with + * reasonable performance. Therefore, we use an array map until the number of properties reaches this + * threshold, at which point we convert it to a hash map. + */ + private static final int HASH_THRESHOLD = 4; + + private Map, Object> properties; private Builder(@Nullable ModelData parent) { if (parent != null) { - properties.putAll(parent.properties); + // When cloning the map, use the expected type based on size + properties = parent.properties.size() >= HASH_THRESHOLD ? new Reference2ReferenceOpenHashMap<>(parent.properties) : new Reference2ReferenceArrayMap<>(parent.properties); + } else { + // Allocate the maximum number of entries we'd ever put into the map. + // We convert to a hash map *after* insertion of the HASH_THRESHOLD + // entry, so we need at least that many spots. + properties = new Reference2ReferenceArrayMap<>(HASH_THRESHOLD); } } @@ -75,13 +98,16 @@ private Builder(@Nullable ModelData parent) { public Builder with(ModelProperty property, T value) { Preconditions.checkState(property.test(value), "The provided value is invalid for this property."); properties.put(property, value); + // Convert to a hash map if needed + if (properties.size() == HASH_THRESHOLD && properties instanceof Reference2ReferenceArrayMap, Object>) { + properties = new Reference2ReferenceOpenHashMap<>(properties); + } return this; } @Contract("-> new") public ModelData build() { - // IdentityHashMap is slow when calling get() on an empty instance, so use a singleton empty map if possible - return new ModelData(properties.isEmpty() ? Collections.emptyMap() : Collections.unmodifiableMap(properties)); + return new ModelData(properties); } } } diff --git a/src/main/java/net/neoforged/neoforge/client/model/data/ModelDataManager.java b/src/main/java/net/neoforged/neoforge/client/model/data/ModelDataManager.java index 171240cc569..65afdc76251 100644 --- a/src/main/java/net/neoforged/neoforge/client/model/data/ModelDataManager.java +++ b/src/main/java/net/neoforged/neoforge/client/model/data/ModelDataManager.java @@ -6,211 +6,168 @@ package net.neoforged.neoforge.client.model.data; import com.google.common.base.Preconditions; +import it.unimi.dsi.fastutil.longs.Long2ObjectFunction; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import java.util.HashSet; -import java.util.Objects; import java.util.Set; import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.neoforged.api.distmarker.Dist; import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.Mod.EventBusSubscriber; -import net.neoforged.fml.common.Mod.EventBusSubscriber.Bus; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.fml.common.EventBusSubscriber.Bus; import net.neoforged.neoforge.event.level.ChunkEvent; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.UnmodifiableView; /** * A manager for the lifecycle of all the {@link ModelData} instances in a {@link Level}. + * + * Users should not instantiate this unless they know what they are doing. The manager is also not thread-safe, + * it should only be interacted with on the main client thread. */ -@EventBusSubscriber(modid = "neoforge", bus = Bus.FORGE, value = Dist.CLIENT) -public abstract sealed class ModelDataManager permits ModelDataManager.Active, ModelDataManager.Snapshot { - ModelDataManager() {} +@EventBusSubscriber(modid = "neoforge", bus = Bus.GAME, value = Dist.CLIENT) +public class ModelDataManager { + private final Thread owningThread = Thread.currentThread(); + private final Level level; + private final Long2ObjectMap> needModelDataRefresh = new Long2ObjectOpenHashMap<>(); + private final Long2ObjectMap> modelDataCache = new Long2ObjectOpenHashMap<>(); + public static final Long2ObjectFunction EMPTY_SNAPSHOT = pos -> ModelData.EMPTY; + + public ModelDataManager(Level level) { + this.level = level; + } /** - * {@return the {@link ModelData} stored for the given position or {@code null} if none is present} - * - * @param pos The position to query + * Request a refresh of the stored data for the given {@link BlockEntity}. The given {@code BlockEntity} + * must be in the level owning this manager */ - @Nullable - public abstract ModelData getAt(BlockPos pos); + public void requestRefresh(BlockEntity blockEntity) { + if (isOtherThread()) { + throw new UnsupportedOperationException("Cannot request ModelData refresh outside the owning thread: " + owningThread); + } + + Preconditions.checkNotNull(blockEntity, "BlockEntity must not be null"); + Preconditions.checkState(blockEntity.getLevel() == level, "BlockEntity does not belong to the level owning this manager"); + needModelDataRefresh.computeIfAbsent(SectionPos.asLong(blockEntity.getBlockPos()), $ -> new HashSet<>()) + .add(blockEntity.getBlockPos()); + } /** - * {@return the {@link ModelData} stored for the given position or {@link ModelData#EMPTY} if none is present} - * - * @param pos The position to query + * Provides all the model data for a given chunk section. This is useful for mods which wish to retrieve + * a fast view of the model data for a single section in a level. + * + *

The returned map must be copied if it needs to be accessed from another thread, as it may be modified + * by this data manager. + * + * @param pos the section to query + * @return an (unmodifiable) map containing the {@link ModelData} stored for the given chunk section */ - public abstract ModelData getAtOrEmpty(BlockPos pos); + @UnmodifiableView + public Long2ObjectMap getAt(SectionPos pos) { + long sectionKey = pos.asLong(); + refreshAt(sectionKey); + var map = modelDataCache.get(sectionKey); + if (map != null) { + return Long2ObjectMaps.unmodifiable(map); + } else { + return Long2ObjectMaps.emptyMap(); + } + } /** - * Snapshot the state of this manager for all sections in the volume specified by the given section coordinates. - * - * @throws IllegalArgumentException if this is a snapshot and the given region doesn't match the snapshot's region + * Retrieves model data for a block at the given position. + * + * @param pos the position to query + * @return the model data at this position, or {@link ModelData#EMPTY} if none exists */ - @ApiStatus.Internal - public abstract ModelDataManager.Snapshot snapshotSectionRegion(int sectionMinX, int sectionMinY, int sectionMinZ, int sectionMaxX, int sectionMaxY, int sectionMaxZ); + public ModelData getAt(BlockPos pos) { + Preconditions.checkArgument(level.isClientSide, "Cannot request model data for server level"); + long sectionPos = SectionPos.asLong(pos); + refreshAt(sectionPos); + return modelDataCache.getOrDefault(sectionPos, Long2ObjectMaps.emptyMap()).getOrDefault(pos.asLong(), ModelData.EMPTY); + } /** - * The active manager owned by the client's level and operated on the main client thread. - *

- * Users should not be instantiating this themselves unless they know what they're doing. + * Snapshot the state of this manager for all sections in the volume specified by the given section coordinates. + * The snapshot will return {@link ModelData#EMPTY} for nonexistent keys. */ - @ApiStatus.Internal - public static final class Active extends ModelDataManager { - private final Thread owningThread = Thread.currentThread(); - private final Level level; - private final Long2ObjectMap> needModelDataRefresh = new Long2ObjectOpenHashMap<>(); - private final Long2ObjectMap> modelDataCache = new Long2ObjectOpenHashMap<>(); - - public Active(Level level) { - this.level = level; + public Long2ObjectFunction snapshotSectionRegion(int sectionMinX, int sectionMinY, int sectionMinZ, int sectionMaxX, int sectionMaxY, int sectionMaxZ) { + if (isOtherThread()) { + throw new UnsupportedOperationException("Cannot snapshot active manager outside the owning thread: " + owningThread); } - - /** - * Request a refresh of the stored data for the given {@link BlockEntity}. The given {@code BlockEntity} - * must be in the level owning this manager - */ - public void requestRefresh(BlockEntity blockEntity) { - if (isOtherThread()) { - throw new UnsupportedOperationException("Cannot request ModelData refresh outside the owning thread: " + owningThread); + Long2ObjectMap cache = new Long2ObjectOpenHashMap<>(); + cache.defaultReturnValue(ModelData.EMPTY); + for (int x = sectionMinX; x <= sectionMaxX; x++) { + for (int y = sectionMinY; y <= sectionMaxY; y++) { + for (int z = sectionMinZ; z <= sectionMaxZ; z++) { + long sectionPos = SectionPos.asLong(x, y, z); + refreshAt(sectionPos); + cache.putAll(modelDataCache.getOrDefault(sectionPos, Long2ObjectMaps.emptyMap())); + } } - - Preconditions.checkNotNull(blockEntity, "BlockEntity must not be null"); - Preconditions.checkState(blockEntity.getLevel() == level, "BlockEntity does not belong to the level owning this manager"); - needModelDataRefresh.computeIfAbsent(SectionPos.asLong(blockEntity.getBlockPos()), $ -> new HashSet<>()) - .add(blockEntity.getBlockPos()); - } - - @Override - @Nullable - public ModelData getAt(BlockPos pos) { - Preconditions.checkArgument(level.isClientSide, "Cannot request model data for server level"); - long sectionPos = SectionPos.asLong(pos); - refreshAt(sectionPos); - return modelDataCache.getOrDefault(sectionPos, Long2ObjectMaps.emptyMap()).get(pos.asLong()); - } - - @Override - public ModelData getAtOrEmpty(BlockPos pos) { - return Objects.requireNonNullElse(getAt(pos), ModelData.EMPTY); } + return cache.isEmpty() ? EMPTY_SNAPSHOT : cache; + } - @Override - public ModelDataManager.Snapshot snapshotSectionRegion(int sectionMinX, int sectionMinY, int sectionMinZ, int sectionMaxX, int sectionMaxY, int sectionMaxZ) { - if (isOtherThread()) { - throw new UnsupportedOperationException("Cannot snapshot active manager outside the owning thread: " + owningThread); - } - return new ModelDataManager.Snapshot(this, sectionMinX, sectionMinY, sectionMinZ, sectionMaxX, sectionMaxY, sectionMaxZ); + private void refreshAt(long section) { + if (isOtherThread()) { + return; } - private void refreshAt(long section) { - if (isOtherThread()) { - return; - } - - Set needUpdate = needModelDataRefresh.remove(section); - - if (needUpdate != null) { - Long2ObjectMap data = modelDataCache.computeIfAbsent(section, $ -> new Long2ObjectOpenHashMap<>()); - for (BlockPos pos : needUpdate) { - BlockEntity toUpdate = level.getBlockEntity(pos); - ModelData newData = ModelData.EMPTY; - // Query the BE for new model data if it exists - if (toUpdate != null && !toUpdate.isRemoved()) { - newData = toUpdate.getModelData(); - } - // Make sure we don't bother storing empty data in the map - if (newData != ModelData.EMPTY) { - data.put(pos.asLong(), newData); - } else { - data.remove(pos.asLong()); + Set needUpdate = needModelDataRefresh.remove(section); + + if (needUpdate != null) { + Long2ObjectMap data = modelDataCache.computeIfAbsent(section, $ -> new Long2ObjectOpenHashMap<>()); + for (BlockPos pos : needUpdate) { + BlockEntity toUpdate = level.getBlockEntity(pos); + ModelData newData = ModelData.EMPTY; + // Query the BE for new model data if it exists + if (toUpdate != null && !toUpdate.isRemoved()) { + newData = toUpdate.getModelData(); + // Sanity check so that mods cannot cause impossible-to-trace NPEs in other code later + //noinspection ConstantValue + if (newData == null) { + throw new NullPointerException("Null ModelData provided by " + BlockEntityType.getKey(toUpdate.getType()) + " @ " + pos); } } - // Remove the map completely if it's now empty - if (data.isEmpty()) { - modelDataCache.remove(section); + // Make sure we don't bother storing empty data in the map + if (newData != ModelData.EMPTY) { + data.put(pos.asLong(), newData); + } else { + data.remove(pos.asLong()); } } - } - - private boolean isOtherThread() { - return Thread.currentThread() != owningThread; - } - } - - /** - * A snapshot of the active manager's state in the specified sections at the point in time when a chunk section was - * prepared for re-rendering. Holds an immutable copy of the applicable subset of the active manager's state. - */ - @ApiStatus.Internal - public static final class Snapshot extends ModelDataManager { - public static final ModelDataManager.Snapshot EMPTY = new ModelDataManager.Snapshot(); - - private final Long2ObjectMap modelDataCache; - private final long sectionMin; - private final long sectionMax; - - Snapshot(ModelDataManager.Active srcManager, int sectionMinX, int sectionMinY, int sectionMinZ, int sectionMaxX, int sectionMaxY, int sectionMaxZ) { - this.sectionMin = SectionPos.asLong(sectionMinX, sectionMinY, sectionMinZ); - this.sectionMax = SectionPos.asLong(sectionMaxX, sectionMaxY, sectionMaxZ); - - Long2ObjectMap cache = new Long2ObjectOpenHashMap<>(); - for (int x = sectionMinX; x <= sectionMaxX; x++) { - for (int y = sectionMinY; y <= sectionMaxY; y++) { - for (int z = sectionMinZ; z <= sectionMaxZ; z++) { - long sectionPos = SectionPos.asLong(x, y, z); - srcManager.refreshAt(sectionPos); - cache.putAll(srcManager.modelDataCache.getOrDefault(sectionPos, Long2ObjectMaps.emptyMap())); - } - } + // Remove the map completely if it's now empty + if (data.isEmpty()) { + modelDataCache.remove(section); } - this.modelDataCache = cache.isEmpty() ? Long2ObjectMaps.emptyMap() : cache; - } - - private Snapshot() { - this.sectionMin = this.sectionMax = SectionPos.asLong(0, 0, 0); - this.modelDataCache = Long2ObjectMaps.emptyMap(); - } - - @Override - @Nullable - public ModelData getAt(BlockPos pos) { - return modelDataCache.get(pos.asLong()); - } - - @Override - public ModelData getAtOrEmpty(BlockPos pos) { - return modelDataCache.getOrDefault(pos.asLong(), ModelData.EMPTY); } + } - @Override - public ModelDataManager.Snapshot snapshotSectionRegion(int sectionMinX, int sectionMinY, int sectionMinZ, int sectionMaxX, int sectionMaxY, int sectionMaxZ) { - Preconditions.checkArgument( - this.sectionMin == SectionPos.asLong(sectionMinX, sectionMinY, sectionMinZ) && this.sectionMax == SectionPos.asLong(sectionMaxX, sectionMaxY, sectionMaxZ), - "Cannot request snapshot for a different range from this snapshot"); - return this; - } + private boolean isOtherThread() { + return Thread.currentThread() != owningThread; } @SubscribeEvent public static void onChunkUnload(ChunkEvent.Unload event) { - var level = event.getChunk().getWorldForge(); + var level = event.getChunk().getLevel(); if (level == null) return; var modelDataManager = level.getModelDataManager(); - if (modelDataManager instanceof Active activeManager) { + if (modelDataManager != null) { ChunkPos chunk = event.getChunk().getPos(); int maxSection = level.getMaxSection(); for (int y = level.getMinSection(); y < maxSection; y++) { long section = SectionPos.asLong(chunk.x, y, chunk.z); - activeManager.needModelDataRefresh.remove(section); - activeManager.modelDataCache.remove(section); + modelDataManager.needModelDataRefresh.remove(section); + modelDataManager.modelDataCache.remove(section); } } } diff --git a/src/main/java/net/neoforged/neoforge/client/model/data/MultipartModelData.java b/src/main/java/net/neoforged/neoforge/client/model/data/MultipartModelData.java index 1e109b46795..a7320ca44ee 100644 --- a/src/main/java/net/neoforged/neoforge/client/model/data/MultipartModelData.java +++ b/src/main/java/net/neoforged/neoforge/client/model/data/MultipartModelData.java @@ -16,25 +16,10 @@ import net.minecraft.world.level.block.state.BlockState; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.Nullable; @ApiStatus.Internal public class MultipartModelData { - // Next BC window: don't remove but make private and change the type to ModelProperty>. - @Deprecated(forRemoval = true) - public static final ModelProperty PROPERTY = new ModelProperty<>(); - - private final Map partData; - - private MultipartModelData(Map partData) { - this.partData = partData; - } - - @Deprecated(forRemoval = true) - @Nullable - public ModelData get(BakedModel model) { - return partData.get(model); - } + private static final ModelProperty> PROPERTY = new ModelProperty<>(); /** * Helper to get the data from a {@link ModelData} instance. @@ -69,25 +54,6 @@ public static ModelData create(List, BakedModel>> sel } } - return dataMap == null ? tileModelData : tileModelData.derive().with(PROPERTY, new MultipartModelData(dataMap)).build(); - } - - @Deprecated(forRemoval = true) - public static Builder builder() { - return new Builder(); - } - - @Deprecated(forRemoval = true) - public static final class Builder { - private final Map partData = new IdentityHashMap<>(); - - public Builder with(BakedModel model, ModelData data) { - partData.put(model, data); - return this; - } - - public MultipartModelData build() { - return new MultipartModelData(partData); - } + return dataMap == null ? tileModelData : tileModelData.derive().with(PROPERTY, dataMap).build(); } } diff --git a/src/main/java/net/neoforged/neoforge/client/model/generators/loaders/ItemLayerModelBuilder.java b/src/main/java/net/neoforged/neoforge/client/model/generators/loaders/ItemLayerModelBuilder.java index 3355785403c..4b804da4be2 100644 --- a/src/main/java/net/neoforged/neoforge/client/model/generators/loaders/ItemLayerModelBuilder.java +++ b/src/main/java/net/neoforged/neoforge/client/model/generators/loaders/ItemLayerModelBuilder.java @@ -142,7 +142,7 @@ public JsonObject toJson(JsonObject json) { JsonObject layerObj = new JsonObject(); for (Int2ObjectMap.Entry entry : this.faceData.int2ObjectEntrySet()) { - layerObj.add(String.valueOf(entry.getIntKey()), ExtraFaceData.CODEC.encodeStart(JsonOps.INSTANCE, entry.getValue()).getOrThrow(false, s -> {})); + layerObj.add(String.valueOf(entry.getIntKey()), ExtraFaceData.CODEC.encodeStart(JsonOps.INSTANCE, entry.getValue()).getOrThrow()); } forgeData.add("layers", layerObj); diff --git a/src/main/java/net/neoforged/neoforge/client/model/geometry/GeometryLoaderManager.java b/src/main/java/net/neoforged/neoforge/client/model/geometry/GeometryLoaderManager.java index e08e4da205d..1382c821c1e 100644 --- a/src/main/java/net/neoforged/neoforge/client/model/geometry/GeometryLoaderManager.java +++ b/src/main/java/net/neoforged/neoforge/client/model/geometry/GeometryLoaderManager.java @@ -42,7 +42,7 @@ public static String getLoaderList() { public static void init() { var loaders = new HashMap>(); var event = new ModelEvent.RegisterGeometryLoaders(loaders); - ModLoader.get().postEventWrapContainerInModOrder(event); + ModLoader.postEventWrapContainerInModOrder(event); LOADERS = ImmutableMap.copyOf(loaders); LOADER_LIST = loaders.keySet().stream().map(ResourceLocation::toString).collect(Collectors.joining(", ")); } diff --git a/src/main/java/net/neoforged/neoforge/client/model/lighting/QuadLighter.java b/src/main/java/net/neoforged/neoforge/client/model/lighting/QuadLighter.java index c6389c882f0..7f579ee6c59 100644 --- a/src/main/java/net/neoforged/neoforge/client/model/lighting/QuadLighter.java +++ b/src/main/java/net/neoforged/neoforge/client/model/lighting/QuadLighter.java @@ -119,7 +119,7 @@ public final void process(VertexConsumer consumer, PoseStack.Pose pose, BakedQua } var color = quad.isTinted() ? getColorFast(quad.getTintIndex()) : WHITE; - consumer.putBulkData(pose, quad, brightness, color[0], color[1], color[2], lightmap, overlay, true); + consumer.putBulkData(pose, quad, brightness, color[0], color[1], color[2], 1.0f, lightmap, overlay, true); } private float[] getColorFast(int tintIndex) { diff --git a/src/main/java/net/neoforged/neoforge/client/model/renderable/CompositeRenderable.java b/src/main/java/net/neoforged/neoforge/client/model/renderable/CompositeRenderable.java index 6dd7d97c6e6..d4fec4b841f 100644 --- a/src/main/java/net/neoforged/neoforge/client/model/renderable/CompositeRenderable.java +++ b/src/main/java/net/neoforged/neoforge/client/model/renderable/CompositeRenderable.java @@ -50,7 +50,7 @@ public void render(PoseStack poseStack, MultiBufferSource bufferSource, ITexture Matrix4f matrix = context.getTransform(name); if (matrix != null) { poseStack.pushPose(); - poseStack.mulPoseMatrix(matrix); + poseStack.mulPose(matrix); } for (var part : children) diff --git a/src/main/java/net/neoforged/neoforge/common/BasicItemListing.java b/src/main/java/net/neoforged/neoforge/common/BasicItemListing.java index d606386860a..33a7e2db4a6 100644 --- a/src/main/java/net/neoforged/neoforge/common/BasicItemListing.java +++ b/src/main/java/net/neoforged/neoforge/common/BasicItemListing.java @@ -5,12 +5,16 @@ package net.neoforged.neoforge.common; +import java.util.Optional; +import net.minecraft.core.component.DataComponentPredicate; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.npc.VillagerTrades.ItemListing; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraft.world.item.trading.ItemCost; import net.minecraft.world.item.trading.MerchantOffer; +import org.jetbrains.annotations.Nullable; /** * A default, exposed implementation of ITrade. All of the other implementations of ITrade (in VillagerTrades) are not public. @@ -45,9 +49,11 @@ public BasicItemListing(int emeralds, ItemStack forSale, int maxTrades, int xp) this(new ItemStack(Items.EMERALD, emeralds), forSale, maxTrades, xp, 1); } - @org.jetbrains.annotations.Nullable + @Nullable @Override public MerchantOffer getOffer(Entity p_219693_, RandomSource p_219694_) { - return new MerchantOffer(price, price2, forSale, maxTrades, xp, priceMult); + ItemCost cost = new ItemCost(price.getItemHolder(), price.getCount(), DataComponentPredicate.EMPTY, price); // Porting 1.20.5 do something proper for the components here + ItemCost cost2 = new ItemCost(price2.getItemHolder(), price2.getCount(), DataComponentPredicate.EMPTY, price2); + return new MerchantOffer(cost, Optional.of(cost2), forSale, maxTrades, xp, priceMult); } } diff --git a/src/main/java/net/neoforged/neoforge/common/CommonHooks.java b/src/main/java/net/neoforged/neoforge/common/CommonHooks.java index 699dd1490ad..a0532e05622 100644 --- a/src/main/java/net/neoforged/neoforge/common/CommonHooks.java +++ b/src/main/java/net/neoforged/neoforge/common/CommonHooks.java @@ -14,6 +14,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.Lifecycle; import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import java.lang.reflect.Method; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; @@ -26,6 +27,7 @@ import java.util.Objects; import java.util.Optional; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.BiConsumer; import java.util.function.Function; import java.util.regex.Matcher; @@ -33,16 +35,19 @@ import java.util.stream.Stream; import net.minecraft.ChatFormatting; import net.minecraft.ResourceLocationException; +import net.minecraft.SharedConstants; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; import net.minecraft.core.HolderSet; +import net.minecraft.core.Registry; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.network.chat.ChatDecorator; @@ -90,23 +95,24 @@ import net.minecraft.world.inventory.ClickAction; import net.minecraft.world.inventory.ContainerLevelAccess; import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.AdventureModePredicate; import net.minecraft.world.item.BucketItem; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.EnchantedBookItem; 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.SpawnEggItem; import net.minecraft.world.item.Tiers; import net.minecraft.world.item.TippedArrowItem; import net.minecraft.world.item.alchemy.Potion; -import net.minecraft.world.item.alchemy.PotionUtils; +import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.item.context.UseOnContext; -import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.RecipeType; +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.enchantment.ItemEnchantments; import net.minecraft.world.level.GameType; import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.Biome; @@ -120,6 +126,7 @@ import net.minecraft.world.level.block.state.pattern.BlockInWorld; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.storage.LevelStorageSource; import net.minecraft.world.level.storage.WorldData; @@ -228,10 +235,6 @@ public static LivingChangeTargetEvent onLivingChangeTarget(LivingEntity entity, return event; } - public static boolean onLivingTick(LivingEntity entity) { - return NeoForge.EVENT_BUS.post(new LivingEvent.LivingTickEvent(entity)).isCanceled(); - } - public static boolean onLivingAttack(LivingEntity entity, DamageSource src, float amount) { return entity instanceof Player || !NeoForge.EVENT_BUS.post(new LivingAttackEvent(entity, src, amount)).isCanceled(); } @@ -343,7 +346,7 @@ public static ItemEntity onPlayerTossEvent(Player player, ItemStack item, boolea return event.getEntity(); } - public static boolean onVanillaGameEvent(Level level, GameEvent vanillaEvent, Vec3 pos, GameEvent.Context context) { + public static boolean onVanillaGameEvent(Level level, Holder vanillaEvent, Vec3 pos, GameEvent.Context context) { return !NeoForge.EVENT_BUS.post(new VanillaGameEvent(level, vanillaEvent, pos, context)).isCanceled(); } @@ -440,7 +443,7 @@ else if (end.length() > 0) } public static void dropXpForBlock(BlockState state, ServerLevel level, BlockPos pos, ItemStack stack) { - int fortuneLevel = stack.getEnchantmentLevel(Enchantments.BLOCK_FORTUNE); + int fortuneLevel = stack.getEnchantmentLevel(Enchantments.FORTUNE); int silkTouchLevel = stack.getEnchantmentLevel(Enchantments.SILK_TOUCH); int exp = state.getExpDrop(level, level.random, pos, fortuneLevel, silkTouchLevel); if (exp > 0) @@ -460,8 +463,10 @@ public static int onBlockBreakEvent(Level level, GameType gameType, ServerPlayer preCancelEvent = true; if (!entityPlayer.mayBuild()) { - if (itemstack.isEmpty() || !itemstack.hasAdventureModeBreakTagForBlock(level.registryAccess().registryOrThrow(Registries.BLOCK), new BlockInWorld(level, pos, false))) + AdventureModePredicate adventureModePredicate = itemstack.get(DataComponents.CAN_BREAK); + if (itemstack.isEmpty() || adventureModePredicate == null || !adventureModePredicate.test(new BlockInWorld(level, pos, false))) { preCancelEvent = true; + } } } @@ -498,15 +503,20 @@ public static InteractionResult onPlaceItemIntoWorld(UseOnContext context) { Level level = context.getLevel(); Player player = context.getPlayer(); - if (player != null && !player.getAbilities().mayBuild && !itemstack.hasAdventureModePlaceTagForBlock(level.registryAccess().registryOrThrow(Registries.BLOCK), new BlockInWorld(level, context.getClickedPos(), false))) - return InteractionResult.PASS; + if (player != null && !player.getAbilities().mayBuild) { + AdventureModePredicate adventureModePredicate = itemstack.get(DataComponents.CAN_PLACE_ON); + if (adventureModePredicate == null || !adventureModePredicate.test(new BlockInWorld(level, context.getClickedPos(), false))) { + return net.minecraft.world.InteractionResult.PASS; + } + } // handle all placement events here Item item = itemstack.getItem(); int size = itemstack.getCount(); - CompoundTag nbt = null; - if (itemstack.getTag() != null) - nbt = itemstack.getTag().copy(); + // Porting 1.20.5 redo this for components? + //CompoundTag nbt = null; + //if (itemstack.getTag() != null) + // nbt = itemstack.getTag().copy(); if (!(itemstack.getItem() instanceof BucketItem)) // if not bucket level.captureBlockSnapshots = true; @@ -521,17 +531,17 @@ public static InteractionResult onPlaceItemIntoWorld(UseOnContext context) { if (ret.consumesAction()) { // save new item data int newSize = itemstack.getCount(); - CompoundTag newNBT = null; - if (itemstack.getTag() != null) { - newNBT = itemstack.getTag().copy(); - } + //CompoundTag newNBT = null; + //if (itemstack.getTag() != null) { + // newNBT = itemstack.getTag().copy(); + //} @SuppressWarnings("unchecked") List blockSnapshots = (List) level.capturedBlockSnapshots.clone(); level.capturedBlockSnapshots.clear(); // make sure to set pre-placement item data for event itemstack.setCount(size); - itemstack.setTag(nbt); + //itemstack.setTag(nbt); //TODO: Set pre-placement item attachments? Direction side = context.getClickedFace(); @@ -554,7 +564,7 @@ public static InteractionResult onPlaceItemIntoWorld(UseOnContext context) { } else { // Change the stack to its new content itemstack.setCount(newSize); - itemstack.setTag(newNBT); + //itemstack.setTag(newNBT); for (BlockSnapshot snap : blockSnapshots) { int updateFlag = snap.getFlag(); @@ -573,7 +583,7 @@ public static InteractionResult onPlaceItemIntoWorld(UseOnContext context) { return ret; } - public static boolean onAnvilChange(AnvilMenu container, ItemStack left, ItemStack right, Container outputSlot, String name, int baseCost, Player player) { + public static boolean onAnvilChange(AnvilMenu container, ItemStack left, ItemStack right, Container outputSlot, String name, long baseCost, Player player) { AnvilUpdateEvent e = new AnvilUpdateEvent(left, right, name, baseCost, player); if (NeoForge.EVENT_BUS.post(e).isCanceled()) return false; @@ -658,23 +668,27 @@ public static boolean onTravelToDimension(Entity entity, ResourceKey dime return !event.isCanceled(); } + @Nullable public static InteractionResult onInteractEntityAt(Player player, Entity entity, HitResult ray, InteractionHand hand) { Vec3 vec3d = ray.getLocation().subtract(entity.position()); return onInteractEntityAt(player, entity, vec3d, hand); } + @Nullable public static InteractionResult onInteractEntityAt(Player player, Entity entity, Vec3 vec3d, InteractionHand hand) { PlayerInteractEvent.EntityInteractSpecific evt = new PlayerInteractEvent.EntityInteractSpecific(player, hand, entity, vec3d); NeoForge.EVENT_BUS.post(evt); return evt.isCanceled() ? evt.getCancellationResult() : null; } + @Nullable public static InteractionResult onInteractEntity(Player player, Entity entity, InteractionHand hand) { PlayerInteractEvent.EntityInteract evt = new PlayerInteractEvent.EntityInteract(player, hand, entity); NeoForge.EVENT_BUS.post(evt); return evt.isCanceled() ? evt.getCancellationResult() : null; } + @Nullable public static InteractionResult onItemRightClick(Player player, InteractionHand hand) { PlayerInteractEvent.RightClickItem evt = new PlayerInteractEvent.RightClickItem(player, hand); NeoForge.EVENT_BUS.post(evt); @@ -810,9 +824,9 @@ public static CriticalHitEvent getCriticalHit(Player player, Entity target, bool } /** - * Hook to fire {@link ItemAttributeModifierEvent}. Modders should use {@link ItemStack#getAttributeModifiers(EquipmentSlot)} instead. + * Hook to fire {@link ItemAttributeModifierEvent}. Modders should use {@link ItemStack#forEachModifier(EquipmentSlot, BiConsumer)} instead. */ - public static Multimap getAttributeModifiers(ItemStack stack, EquipmentSlot equipmentSlot, Multimap attributes) { + public static Multimap, AttributeModifier> getAttributeModifiers(ItemStack stack, EquipmentSlot equipmentSlot, Multimap, AttributeModifier> attributes) { ItemAttributeModifierEvent event = new ItemAttributeModifierEvent(stack, equipmentSlot, attributes); NeoForge.EVENT_BUS.post(event); return event.getModifiers(); @@ -837,24 +851,25 @@ public static String getDefaultCreatorModId(ItemStack itemStack) { String modId = registryName == null ? null : registryName.getNamespace(); if ("minecraft".equals(modId)) { if (item instanceof EnchantedBookItem) { - ListTag enchantmentsNbt = EnchantedBookItem.getEnchantments(itemStack); - if (enchantmentsNbt.size() == 1) { - CompoundTag nbttagcompound = enchantmentsNbt.getCompound(0); - ResourceLocation resourceLocation = ResourceLocation.tryParse(nbttagcompound.getString("id")); - if (resourceLocation != null && BuiltInRegistries.ENCHANTMENT.containsKey(resourceLocation)) { - return resourceLocation.getNamespace(); + Set> enchantments = itemStack.getOrDefault(DataComponents.STORED_ENCHANTMENTS, ItemEnchantments.EMPTY).keySet(); + if (enchantments.size() == 1) { + Holder enchantmentHolder = enchantments.iterator().next(); + Optional> key = enchantmentHolder.unwrapKey(); + if (key.isPresent()) { + return key.get().location().getNamespace(); } } } else if (item instanceof PotionItem || item instanceof TippedArrowItem) { - Potion potionType = PotionUtils.getPotion(itemStack); - ResourceLocation resourceLocation = BuiltInRegistries.POTION.getKey(potionType); - if (resourceLocation != null) { - return resourceLocation.getNamespace(); + PotionContents potionContents = itemStack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY); + Optional> potionType = potionContents.potion(); + Optional> key = potionType.flatMap(Holder::unwrapKey); + if (key.isPresent()) { + return key.get().location().getNamespace(); } - } else if (item instanceof SpawnEggItem) { - ResourceLocation resourceLocation = BuiltInRegistries.ENTITY_TYPE.getKey(((SpawnEggItem) item).getType(null)); - if (resourceLocation != null) { - return resourceLocation.getNamespace(); + } else if (item instanceof SpawnEggItem spawnEggItem) { + Optional>> key = BuiltInRegistries.ENTITY_TYPE.getResourceKey(spawnEggItem.getType(itemStack)); + if (key.isPresent()) { + return key.get().location().getNamespace(); } } } @@ -877,18 +892,6 @@ public static int onNoteChange(Level level, BlockPos pos, BlockState state, int return event.getVanillaNoteId(); } - public static boolean hasNoElements(Ingredient ingredient) { - ItemStack[] items = ingredient.getItems(); - if (items.length == 0) - return true; - if (items.length == 1) { - // If we potentially added a barrier due to the ingredient being an empty tag, try and check if it is the stack we added - ItemStack item = items[0]; - return item.getItem() == Items.BARRIER && item.getHoverName() instanceof MutableComponent hoverName && hoverName.getString().startsWith("Empty Tag: "); - } - return false; - } - @Deprecated(forRemoval = true, since = "1.20.1") // Tags use a codec now This was never used in 1.20 public static void deserializeTagAdditions(List list, JsonObject json, List allList) {} @@ -998,9 +1001,9 @@ public static Map, AttributeSupplier> getAttr /** FOR INTERNAL USE ONLY, DO NOT CALL DIRECTLY */ @Deprecated public static void modifyAttributes() { - ModLoader.get().postEvent(new EntityAttributeCreationEvent(FORGE_ATTRIBUTES)); + ModLoader.postEvent(new EntityAttributeCreationEvent(FORGE_ATTRIBUTES)); Map, AttributeSupplier.Builder> finalMap = new HashMap<>(); - ModLoader.get().postEvent(new EntityAttributeModificationEvent(finalMap)); + ModLoader.postEvent(new EntityAttributeModificationEvent(finalMap)); finalMap.forEach((k, v) -> { AttributeSupplier supplier = DefaultAttributes.getSupplier(k); @@ -1072,7 +1075,7 @@ public static void readAdditionalLevelSaveData(CompoundTag rootTag, LevelStorage } final var mismatchEvent = new ModMismatchEvent(levelDirectory, mismatchedVersions, missingVersions); - ModLoader.get().postEvent(mismatchEvent); + ModLoader.postEvent(mismatchEvent); StringBuilder resolved = new StringBuilder("The following mods have version differences that were marked resolved:"); StringBuilder unresolved = new StringBuilder("The following mods have version differences that were not resolved:"); @@ -1219,7 +1222,7 @@ public static boolean canUseEntitySelectors(SharedSuggestionProvider provider) { public static HolderLookup.RegistryLookup wrapRegistryLookup(final HolderLookup.RegistryLookup lookup) { return new HolderLookup.RegistryLookup.Delegate<>() { @Override - protected RegistryLookup parent() { + public RegistryLookup parent() { return lookup; } @@ -1282,4 +1285,88 @@ public static void onLivingBreathe(LivingEntity entity, int consumeAirAmount, in entity.stopRiding(); } } + + private static final Set> checkedComponentClasses = ConcurrentHashMap.newKeySet(); + + /** + * Marks a class as being safe to use as a {@link DataComponents data component}. + * Keep in mind that data components are compared with {@link Object#equals(Object)} + * and hashed with {@link Object#hashCode()}. + * They must also be immutable. + * + *

Only call this method if the default implementations of {@link Object#equals(Object)} + * and {@link Object#hashCode()} are suitable for this class, + * and if instances of this class are immutable. + * Typically, this is only the case for singletons such as {@link Block} instances. + */ + public static void markComponentClassAsValid(Class clazz) { + if (clazz.isRecord() || clazz.isEnum()) { + throw new IllegalArgumentException("Records and enums are always valid components"); + } + + if (overridesEqualsAndHashCode(clazz)) { + throw new IllegalArgumentException("Class " + clazz + " already overrides equals and hashCode"); + } + + checkedComponentClasses.add(clazz); + } + + static { + // Mark common singletons as valid + markComponentClassAsValid(BlockState.class); + markComponentClassAsValid(FluidState.class); + // Block, Fluid, Item, etc. are handled via the registry check further down + } + + /** + * Checks that all data components override equals and hashCode. + */ + @ApiStatus.Internal + public static void validateComponent(@Nullable Object dataComponent) { + if (!SharedConstants.IS_RUNNING_IN_IDE || dataComponent == null) { + return; + } + + Class clazz = dataComponent.getClass(); + if (!checkedComponentClasses.contains(clazz)) { + if (clazz.isRecord() || clazz.isEnum()) { + checkedComponentClasses.add(clazz); + return; // records and enums are always ok + } + + if (overridesEqualsAndHashCode(clazz)) { + checkedComponentClasses.add(clazz); + return; + } + + // By far the slowest check: Is this a registry object? + // If it is, we assume it must be usable as a singleton... + if (isPotentialRegistryObject(dataComponent)) { + checkedComponentClasses.add(clazz); + return; + } + + throw new IllegalArgumentException("Data components must implement equals and hashCode. Keep in mind they must also be immutable. Problematic class: " + clazz); + } + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + private static boolean isPotentialRegistryObject(Object value) { + for (Registry registry : BuiltInRegistries.REGISTRY) { + if (registry.containsValue(value)) { + return true; + } + } + return false; + } + + private static boolean overridesEqualsAndHashCode(Class clazz) { + try { + Method equals = clazz.getMethod("equals", Object.class); + Method hashCode = clazz.getMethod("hashCode"); + return equals.getDeclaringClass() != Object.class && hashCode.getDeclaringClass() != Object.class; + } catch (ReflectiveOperationException exception) { + throw new RuntimeException("Failed to check for component equals and hashCode", exception); + } + } } diff --git a/src/main/java/net/neoforged/neoforge/common/DeferredSpawnEggItem.java b/src/main/java/net/neoforged/neoforge/common/DeferredSpawnEggItem.java index a2924dd386a..1b1ac206b7e 100644 --- a/src/main/java/net/neoforged/neoforge/common/DeferredSpawnEggItem.java +++ b/src/main/java/net/neoforged/neoforge/common/DeferredSpawnEggItem.java @@ -12,6 +12,7 @@ import java.util.function.Supplier; import net.minecraft.core.Direction; import net.minecraft.core.dispenser.DispenseItemBehavior; +import net.minecraft.util.FastColor; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobSpawnType; @@ -22,7 +23,7 @@ import net.neoforged.api.distmarker.Dist; import net.neoforged.bus.api.EventPriority; import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.Mod; +import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; import org.jetbrains.annotations.ApiStatus; @@ -58,7 +59,7 @@ protected EntityType getDefaultType() { private static final DispenseItemBehavior DEFAULT_DISPENSE_BEHAVIOR = (source, stack) -> { Direction face = source.state().getValue(DispenserBlock.FACING); - EntityType type = ((SpawnEggItem) stack.getItem()).getType(stack.getTag()); + EntityType type = ((SpawnEggItem) stack.getItem()).getType(stack); try { type.spawn(source.level(), stack, null, source.pos().relative(face), MobSpawnType.DISPENSER, face != Direction.UP, false); @@ -72,7 +73,7 @@ protected EntityType getDefaultType() { return stack; }; - @Mod.EventBusSubscriber(modid = "neoforge", bus = Mod.EventBusSubscriber.Bus.MOD) + @EventBusSubscriber(modid = "neoforge", bus = EventBusSubscriber.Bus.MOD) private static class CommonHandler { @SubscribeEvent public static void onCommonSetup(FMLCommonSetupEvent event) { @@ -89,11 +90,11 @@ public static void onCommonSetup(FMLCommonSetupEvent event) { } } - @Mod.EventBusSubscriber(value = Dist.CLIENT, modid = "neoforge", bus = Mod.EventBusSubscriber.Bus.MOD) + @EventBusSubscriber(value = Dist.CLIENT, modid = "neoforge", bus = EventBusSubscriber.Bus.MOD) private static class ColorRegisterHandler { @SubscribeEvent(priority = EventPriority.HIGHEST) public static void registerSpawnEggColors(RegisterColorHandlersEvent.Item event) { - MOD_EGGS.forEach(egg -> event.register((stack, layer) -> egg.getColor(layer), egg)); + MOD_EGGS.forEach(egg -> event.register((stack, layer) -> FastColor.ARGB32.opaque(egg.getColor(layer)), egg)); } } } diff --git a/src/main/java/net/neoforged/neoforge/common/EffectCure.java b/src/main/java/net/neoforged/neoforge/common/EffectCure.java index db5f27a79f4..aa29b06fcea 100644 --- a/src/main/java/net/neoforged/neoforge/common/EffectCure.java +++ b/src/main/java/net/neoforged/neoforge/common/EffectCure.java @@ -6,11 +6,14 @@ package net.neoforged.neoforge.common; import com.mojang.serialization.Codec; +import io.netty.buffer.ByteBuf; import java.util.Collection; import java.util.Collections; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.LivingEntity; @@ -25,6 +28,7 @@ public final class EffectCure { private static final Map CURES = new ConcurrentHashMap<>(); public static Codec CODEC = Codec.STRING.xmap(EffectCure::get, EffectCure::name); + public static final StreamCodec STREAM_CODEC = ByteBufCodecs.STRING_UTF8.map(EffectCure::get, EffectCure::name); /** * {@return all registered cures} diff --git a/src/main/java/net/neoforged/neoforge/common/FarmlandWaterManager.java b/src/main/java/net/neoforged/neoforge/common/FarmlandWaterManager.java index 0ee5bbdefcc..b8d35a719ec 100644 --- a/src/main/java/net/neoforged/neoforge/common/FarmlandWaterManager.java +++ b/src/main/java/net/neoforged/neoforge/common/FarmlandWaterManager.java @@ -123,7 +123,7 @@ public static boolean hasBlockWaterTicket(LevelReader level, BlockPos pos) { } static void removeTickets(ChunkAccess chunk) { - ChunkTicketManager ticketManager = getTicketManager(chunk.getPos(), chunk.getWorldForge()); + ChunkTicketManager ticketManager = getTicketManager(chunk.getPos(), chunk.getLevel()); if (ticketManager != null) { if (DEBUG) LOGGER.info("FarmlandWaterManager: got tickets {} at {} before", ticketManager.getTickets().size(), ticketManager.pos); diff --git a/src/main/java/net/neoforged/neoforge/common/I18nExtension.java b/src/main/java/net/neoforged/neoforge/common/I18nExtension.java index 00b2ab2b5e6..48870bb3f22 100644 --- a/src/main/java/net/neoforged/neoforge/common/I18nExtension.java +++ b/src/main/java/net/neoforged/neoforge/common/I18nExtension.java @@ -74,7 +74,7 @@ private static void parseModInfo(final String formatString, final StringBuffer s if (Objects.equals(formatString, "id")) { stringBuffer.append(info.getModId()); } else if (Objects.equals(formatString, "name")) { - stringBuffer.append(getDisplayName(info)); + stringBuffer.append(info.getDisplayName()); } } @@ -110,10 +110,6 @@ public static String parseFormat(final String format, final Object... args) { return extendedMessageFormat.format(args); } - public static String getDisplayName(final IModInfo modInfo) { - return parseMessageWithFallback("fml.menu.mods.info.displayname." + modInfo.getModId(), modInfo::getDisplayName); - } - public static String getDescription(final IModInfo modInfo) { return parseMessageWithFallback("fml.menu.mods.info.description." + modInfo.getModId(), modInfo::getDescription); } diff --git a/src/main/java/net/neoforged/neoforge/common/IExtensibleEnum.java b/src/main/java/net/neoforged/neoforge/common/IExtensibleEnum.java index 72ae1bd453e..68b7c98484c 100644 --- a/src/main/java/net/neoforged/neoforge/common/IExtensibleEnum.java +++ b/src/main/java/net/neoforged/neoforge/common/IExtensibleEnum.java @@ -8,8 +8,13 @@ import com.mojang.datafixers.util.Either; import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; +import io.netty.buffer.ByteBuf; import java.util.function.Function; +import java.util.function.IntFunction; import java.util.function.Supplier; +import java.util.function.ToIntFunction; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.util.StringRepresentable; /** @@ -55,4 +60,11 @@ static & StringRepresentable> Codec createCodecForExtensib }), value -> Either.left(value.getSerializedName())); } + + /** + * Use this instead of {@link ByteBufCodecs#idMapper(IntFunction, ToIntFunction)} for extensible enums because this not cache the enum values on construction + */ + static & StringRepresentable> StreamCodec createStreamCodecForExtensibleEnum(Supplier valuesSupplier) { + return ByteBufCodecs.INT.map(i -> valuesSupplier.get()[i], Enum::ordinal); + } } diff --git a/src/main/java/net/neoforged/neoforge/common/MutableDataComponentHolder.java b/src/main/java/net/neoforged/neoforge/common/MutableDataComponentHolder.java new file mode 100644 index 00000000000..154d8116067 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/MutableDataComponentHolder.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.common; + +import java.util.function.BiFunction; +import java.util.function.Supplier; +import java.util.function.UnaryOperator; +import net.minecraft.core.component.DataComponentHolder; +import net.minecraft.core.component.DataComponentMap; +import net.minecraft.core.component.DataComponentPatch; +import net.minecraft.core.component.DataComponentType; +import org.jetbrains.annotations.Nullable; + +public interface MutableDataComponentHolder extends DataComponentHolder { + /** + * Sets a data component. + */ + @Nullable + T set(DataComponentType componentType, @Nullable T value); + + /** + * Sets a data component. + */ + @Nullable + default T set(Supplier> componentType, @Nullable T value) { + return set(componentType.get(), value); + } + + /** + * Updates a data component if it exists, using an additional {@code updateContext}. + */ + @Nullable + default T update(DataComponentType componentType, T value, U updateContext, BiFunction updater) { + return set(componentType, updater.apply(getOrDefault(componentType, value), updateContext)); + } + + /** + * Updates a data component if it exists, using an additional {@code updateContext}. + */ + @Nullable + default T update(Supplier> componentType, T value, U updateContext, BiFunction updater) { + return update(componentType.get(), value, updateContext, updater); + } + + /** + * Updates a data component if it exists. + */ + @Nullable + default T update(DataComponentType componentType, T value, UnaryOperator updater) { + return set(componentType, updater.apply(getOrDefault(componentType, value))); + } + + /** + * Updates a data component if it exists. + */ + @Nullable + default T update(Supplier> componentType, T value, UnaryOperator updater) { + return update(componentType.get(), value, updater); + } + + /** + * Removes a data component. + */ + @Nullable + T remove(DataComponentType componentType); + + /** + * Removes a data component. + */ + @Nullable + default T remove(Supplier> componentType) { + return remove(componentType.get()); + } + + /** + * Copies all data components from {@code src} + * + * @implNote This will clear any components if the requested {@code src} holder does not contain a matching value. + */ + default void copyFrom(DataComponentHolder src, DataComponentType... componentTypes) { + for (var componentType : componentTypes) { + copyFrom(componentType, src); + } + } + + /** + * Copies all data components from {@code src} + * + * @implNote This will clear any components if the requested {@code src} holder does not contain a matching value. + */ + default void copyFrom(DataComponentHolder src, Supplier>... componentTypes) { + for (var componentType : componentTypes) { + copyFrom(componentType.get(), src); + } + } + + /** + * Applies a set of component changes to this stack. + */ + void applyComponents(DataComponentPatch patch); + + /** + * Applies a set of component changes to this stack. + */ + void applyComponents(DataComponentMap components); + + private void copyFrom(DataComponentType componentType, DataComponentHolder src) { + set(componentType, src.get(componentType)); + } +} diff --git a/src/main/java/net/neoforged/neoforge/common/NeoForgeConfig.java b/src/main/java/net/neoforged/neoforge/common/NeoForgeConfig.java index 79469532641..cc69f9ed628 100644 --- a/src/main/java/net/neoforged/neoforge/common/NeoForgeConfig.java +++ b/src/main/java/net/neoforged/neoforge/common/NeoForgeConfig.java @@ -68,10 +68,23 @@ public static class Server { * General configuration that doesn't need to be synchronized but needs to be available before server startup */ public static class Common { + public final ModConfigSpec.EnumValue logUntranslatedItemTagWarnings; + public final ModConfigSpec.EnumValue logLegacyTagWarnings; + Common(ModConfigSpec.Builder builder) { - builder.comment("[DEPRECATED / NO EFFECT]: General configuration settings") + builder.comment("General configuration settings") .push("general"); + logUntranslatedItemTagWarnings = builder + .comment("A config option mainly for developers. Logs out modded item tags that do not have translations when running on integrated server. Format desired is tag.item.. for the translation key. Defaults to SILENCED.") + .translation("forge.configgui.logUntranslatedItemTagWarnings") + .defineEnum("logUntranslatedItemTagWarnings", TagConventionLogWarning.LogWarningMode.SILENCED); + + logLegacyTagWarnings = builder + .comment("A config option mainly for developers. Logs out modded tags that are using the 'forge' namespace when running on integrated server. Defaults to DEV_SHORT.") + .translation("forge.configgui.logLegacyTagWarnings") + .defineEnum("logLegacyTagWarnings", TagConventionLogWarning.LogWarningMode.DEV_SHORT); + builder.pop(); } } diff --git a/src/main/java/net/neoforged/neoforge/common/NeoForgeEventHandler.java b/src/main/java/net/neoforged/neoforge/common/NeoForgeEventHandler.java index 93154652138..4397530fb4d 100644 --- a/src/main/java/net/neoforged/neoforge/common/NeoForgeEventHandler.java +++ b/src/main/java/net/neoforged/neoforge/common/NeoForgeEventHandler.java @@ -30,11 +30,11 @@ import net.neoforged.neoforge.event.OnDatapackSyncEvent; import net.neoforged.neoforge.event.RegisterCommandsEvent; import net.neoforged.neoforge.event.TagsUpdatedEvent; -import net.neoforged.neoforge.event.TickEvent; import net.neoforged.neoforge.event.entity.EntityJoinLevelEvent; import net.neoforged.neoforge.event.entity.player.PlayerEvent; import net.neoforged.neoforge.event.level.ChunkEvent; import net.neoforged.neoforge.event.level.LevelEvent; +import net.neoforged.neoforge.event.tick.ServerTickEvent; import net.neoforged.neoforge.network.PacketDistributor; import net.neoforged.neoforge.network.payload.RegistryDataMapSyncPayload; import net.neoforged.neoforge.registries.DataMapLoader; @@ -70,14 +70,13 @@ public void onDimensionUnload(LevelEvent.Unload event) { } @SubscribeEvent - public void onServerTick(TickEvent.ServerTickEvent event) { - WorldWorkerManager.tick(event.phase == TickEvent.Phase.START); + public void preServerTick(ServerTickEvent.Pre event) { + WorldWorkerManager.tick(true); } @SubscribeEvent - public void checkSettings(TickEvent.ClientTickEvent event) { - //if (event.phase == Phase.END) - // CloudRenderer.updateCloudSettings(); + public void postServerTick(ServerTickEvent.Post event) { + WorldWorkerManager.tick(false); } @SubscribeEvent @@ -109,13 +108,12 @@ public void tagsUpdated(TagsUpdatedEvent event) { @SubscribeEvent public void onDpSync(final OnDatapackSyncEvent event) { - final List players = event.getPlayer() == null ? event.getPlayerList().getPlayers() : List.of(event.getPlayer()); RegistryManager.getDataMaps().forEach((registry, values) -> { final var regOpt = event.getPlayerList().getServer().overworld().registryAccess() .registry(registry); if (regOpt.isEmpty()) return; - players.forEach(player -> { - if (!player.connection.isConnected(RegistryDataMapSyncPayload.ID)) { + event.getRelevantPlayers().forEach(player -> { + if (!player.connection.hasChannel(RegistryDataMapSyncPayload.TYPE)) { return; } if (player.connection.getConnection().isMemoryConnection()) { @@ -138,7 +136,7 @@ private void handleSync(ServerPlayer player, Registry registry, Collectio att.put(key, registry.getDataMap(attach)); }); if (!att.isEmpty()) { - PacketDistributor.PLAYER.with(player).send(new RegistryDataMapSyncPayload<>(registry.key(), att)); + PacketDistributor.sendToPlayer(player, new RegistryDataMapSyncPayload<>(registry.key(), att)); } } @@ -166,7 +164,6 @@ static LootModifierManager getLootModifierManager() { @SubscribeEvent public void resourceReloadListeners(AddReloadListenerEvent event) { - event.addListener(TierSortingRegistry.getReloadListener()); event.addListener(CreativeModeTabRegistry.getReloadListener()); } diff --git a/src/main/java/net/neoforged/neoforge/common/NeoForgeMod.java b/src/main/java/net/neoforged/neoforge/common/NeoForgeMod.java index bbb39ccb6c7..779a90d4032 100644 --- a/src/main/java/net/neoforged/neoforge/common/NeoForgeMod.java +++ b/src/main/java/net/neoforged/neoforge/common/NeoForgeMod.java @@ -7,7 +7,7 @@ import com.mojang.datafixers.util.Either; import com.mojang.serialization.Codec; -import com.mojang.serialization.Lifecycle; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.Arrays; import java.util.EnumSet; @@ -20,6 +20,8 @@ import java.util.function.Function; import java.util.function.Predicate; import net.minecraft.DetectedVersion; +import net.minecraft.advancements.critereon.EntitySubPredicate; +import net.minecraft.advancements.critereon.ItemSubPredicate; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BiomeColors; import net.minecraft.commands.Commands; @@ -30,6 +32,7 @@ import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; import net.minecraft.core.MappedRegistry; +import net.minecraft.core.RegistrationInfo; import net.minecraft.core.RegistryCodecs; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.registries.Registries; @@ -43,7 +46,6 @@ import net.minecraft.server.packs.metadata.pack.PackMetadataSection; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; -import net.minecraft.util.ExtraCodecs; import net.minecraft.util.InclusiveRange; import net.minecraft.world.damagesource.DamageSources; import net.minecraft.world.damagesource.DamageType; @@ -56,7 +58,6 @@ import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.Items; -import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.GameRules; @@ -74,29 +75,24 @@ import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; -import net.minecraft.world.level.pathfinder.BlockPathTypes; +import net.minecraft.world.level.pathfinder.PathType; import net.minecraft.world.phys.Vec3; import net.neoforged.api.distmarker.Dist; import net.neoforged.bus.api.EventPriority; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.CrashReportCallables; -import net.neoforged.fml.IExtensionPoint; import net.neoforged.fml.ModContainer; import net.neoforged.fml.ModLoader; -import net.neoforged.fml.ModLoadingContext; -import net.neoforged.fml.ModLoadingStage; import net.neoforged.fml.ModLoadingWarning; -import net.neoforged.fml.StartupMessageManager; import net.neoforged.fml.VersionChecker; import net.neoforged.fml.common.Mod; import net.neoforged.fml.config.ModConfig; import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; import net.neoforged.fml.event.lifecycle.FMLLoadCompleteEvent; +import net.neoforged.fml.loading.progress.StartupNotificationManager; import net.neoforged.neoforge.capabilities.CapabilityHooks; import net.neoforged.neoforge.client.ClientCommandHandler; import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions; -import net.neoforged.neoforge.common.advancements.critereon.ICustomEntityPredicate; -import net.neoforged.neoforge.common.advancements.critereon.ICustomItemPredicate; import net.neoforged.neoforge.common.advancements.critereon.PiglinCurrencyItemPredicate; import net.neoforged.neoforge.common.advancements.critereon.PiglinNeutralArmorEntityPredicate; import net.neoforged.neoforge.common.advancements.critereon.ToolActionItemPredicate; @@ -110,26 +106,27 @@ import net.neoforged.neoforge.common.conditions.TagEmptyCondition; import net.neoforged.neoforge.common.conditions.TrueCondition; import net.neoforged.neoforge.common.crafting.CompoundIngredient; +import net.neoforged.neoforge.common.crafting.DataComponentIngredient; import net.neoforged.neoforge.common.crafting.DifferenceIngredient; import net.neoforged.neoforge.common.crafting.IngredientType; import net.neoforged.neoforge.common.crafting.IntersectionIngredient; -import net.neoforged.neoforge.common.crafting.NBTIngredient; import net.neoforged.neoforge.common.data.ExistingFileHelper; import net.neoforged.neoforge.common.data.NeoForgeDamageTypeTagsProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeAdvancementProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeBiomeTagsProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeBlockTagsProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeDataMapsProvider; +import net.neoforged.neoforge.common.data.internal.NeoForgeEnchantmentTagsProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeEntityTypeTagsProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeFluidTagsProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeItemTagsProvider; +import net.neoforged.neoforge.common.data.internal.NeoForgeLanguageProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeLootTableProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeRecipeProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeRegistryOrderReportProvider; import net.neoforged.neoforge.common.data.internal.NeoForgeSpriteSourceProvider; +import net.neoforged.neoforge.common.data.internal.NeoForgeStructureTagsProvider; import net.neoforged.neoforge.common.data.internal.VanillaSoundDefinitionsProvider; -import net.neoforged.neoforge.common.extensions.IEntityExtension; -import net.neoforged.neoforge.common.extensions.IPlayerExtension; import net.neoforged.neoforge.common.loot.AddTableLootModifier; import net.neoforged.neoforge.common.loot.CanToolPerformAction; import net.neoforged.neoforge.common.loot.IGlobalLootModifier; @@ -187,9 +184,9 @@ public class NeoForgeMod { private static final DeferredRegister ATTRIBUTES = DeferredRegister.create(Registries.ATTRIBUTE, NeoForgeVersion.MOD_ID); private static final DeferredRegister> COMMAND_ARGUMENT_TYPES = DeferredRegister.create(Registries.COMMAND_ARGUMENT_TYPE, NeoForgeVersion.MOD_ID); - private static final DeferredRegister> GLOBAL_LOOT_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, NeoForgeVersion.MOD_ID); - private static final DeferredRegister> BIOME_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, NeoForgeVersion.MOD_ID); - private static final DeferredRegister> STRUCTURE_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.STRUCTURE_MODIFIER_SERIALIZERS, NeoForgeVersion.MOD_ID); + private static final DeferredRegister> GLOBAL_LOOT_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, NeoForgeVersion.MOD_ID); + private static final DeferredRegister> BIOME_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, NeoForgeVersion.MOD_ID); + private static final DeferredRegister> STRUCTURE_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.STRUCTURE_MODIFIER_SERIALIZERS, NeoForgeVersion.MOD_ID); private static final DeferredRegister HOLDER_SET_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.HOLDER_SET_TYPES, NeoForgeVersion.MOD_ID); @SuppressWarnings({ "unchecked", "rawtypes" }) // Uses Holder instead of DeferredHolder as the type due to weirdness between ECJ and javac. @@ -199,15 +196,6 @@ public class NeoForgeMod { public static final Holder SWIM_SPEED = ATTRIBUTES.register("swim_speed", () -> new RangedAttribute("neoforge.swim_speed", 1.0D, 0.0D, 1024.0D).setSyncable(true)); public static final Holder NAMETAG_DISTANCE = ATTRIBUTES.register("nametag_distance", () -> new RangedAttribute("neoforge.name_tag_distance", 64.0D, 0.0D, 64.0).setSyncable(true)); - public static final Holder ENTITY_GRAVITY = ATTRIBUTES.register("entity_gravity", () -> new RangedAttribute("neoforge.entity_gravity", 0.08D, -8.0D, 8.0D).setSyncable(true)); - - /** - * Reach Distance represents the distance at which a player may interact with the world. The default is 4.5 blocks. Players in creative mode have an additional 0.5 blocks of block reach. - * - * @see IPlayerExtension#getBlockReach() - * @see IPlayerExtension#canReach(BlockPos, double) - */ - public static final Holder BLOCK_REACH = ATTRIBUTES.register("block_reach", () -> new RangedAttribute("neoforge.block_reach", 4.5D, 0.0D, 1024.0D).setSyncable(true)); /** * Grants the player the ability to use creative flight when not in creative mode. @@ -228,37 +216,20 @@ public class NeoForgeMod { */ public static final Holder CREATIVE_FLIGHT = ATTRIBUTES.register("creative_flight", () -> new RangedAttribute("neoforge.creative_flight", 0D, 0D, Double.MAX_VALUE).setSyncable(true)); - /** - * Attack Range represents the distance at which a player may attack an entity. The default is 3 blocks. Players in creative mode have an additional 2 blocks of entity reach. - * The default of 3.0 is technically considered a bug by Mojang - see MC-172289 and MC-92484. However, updating this value would allow for longer-range attacks on vanilla servers, which makes some people mad. - * - * @see IPlayerExtension#getEntityReach() - * @see IPlayerExtension#canReach(Entity, double) - * @see IPlayerExtension#canReach(Vec3, double) - */ - public static final Holder ENTITY_REACH = ATTRIBUTES.register("entity_reach", () -> new RangedAttribute("neoforge.entity_reach", 3.0D, 0.0D, 1024.0D).setSyncable(true)); - - /** - * Step Height Addition modifies the amount of blocks an entity may walk up without jumping. - * - * @see IEntityExtension#getStepHeight() - */ - public static final Holder STEP_HEIGHT = ATTRIBUTES.register("step_height", () -> new RangedAttribute("neoforge.step_height", 0.0D, -512.0D, 512.0D).setSyncable(true)); - /** * Stock loot modifier type that adds loot from a subtable to the final loot. */ - public static final DeferredHolder, Codec> ADD_TABLE_LOOT_MODIFIER_TYPE = GLOBAL_LOOT_MODIFIER_SERIALIZERS.register("add_table", () -> AddTableLootModifier.CODEC); + public static final DeferredHolder, MapCodec> ADD_TABLE_LOOT_MODIFIER_TYPE = GLOBAL_LOOT_MODIFIER_SERIALIZERS.register("add_table", () -> AddTableLootModifier.CODEC); /** * Noop biome modifier. Can be used in a biome modifier json with "type": "neoforge:none". */ - public static final DeferredHolder, Codec> NONE_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("none", () -> Codec.unit(NoneBiomeModifier.INSTANCE)); + public static final DeferredHolder, MapCodec> NONE_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("none", () -> MapCodec.unit(NoneBiomeModifier.INSTANCE)); /** * Stock biome modifier for adding features to biomes. */ - public static final DeferredHolder, Codec> ADD_FEATURES_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("add_features", () -> RecordCodecBuilder.create( + public static final DeferredHolder, MapCodec> ADD_FEATURES_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("add_features", () -> RecordCodecBuilder.mapCodec( builder -> builder .group( Biome.LIST_CODEC.fieldOf("biomes").forGetter(AddFeaturesBiomeModifier::biomes), @@ -269,12 +240,12 @@ public class NeoForgeMod { /** * Stock biome modifier for removing features from biomes. */ - public static final DeferredHolder, Codec> REMOVE_FEATURES_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("remove_features", () -> RecordCodecBuilder.create( + public static final DeferredHolder, MapCodec> REMOVE_FEATURES_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("remove_features", () -> RecordCodecBuilder.mapCodec( builder -> builder .group( Biome.LIST_CODEC.fieldOf("biomes").forGetter(RemoveFeaturesBiomeModifier::biomes), PlacedFeature.LIST_CODEC.fieldOf("features").forGetter(RemoveFeaturesBiomeModifier::features), - new ExtraCodecs.EitherCodec, Decoration>(Decoration.CODEC.listOf(), Decoration.CODEC).>xmap( + Codec., Decoration>either(Decoration.CODEC.listOf(), Decoration.CODEC).>xmap( either -> either.map(Set::copyOf, Set::of), // convert list/singleton to set when decoding set -> set.size() == 1 ? Either.right(set.toArray(Decoration[]::new)[0]) : Either.left(List.copyOf(set))).optionalFieldOf("steps", EnumSet.allOf(Decoration.class)).forGetter(RemoveFeaturesBiomeModifier::steps)) .apply(builder, RemoveFeaturesBiomeModifier::new))); @@ -282,13 +253,13 @@ public class NeoForgeMod { /** * Stock biome modifier for adding mob spawns to biomes. */ - public static final DeferredHolder, Codec> ADD_SPAWNS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("add_spawns", () -> RecordCodecBuilder.create( + public static final DeferredHolder, MapCodec> ADD_SPAWNS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("add_spawns", () -> RecordCodecBuilder.mapCodec( builder -> builder .group( Biome.LIST_CODEC.fieldOf("biomes").forGetter(AddSpawnsBiomeModifier::biomes), // Allow either a list or single spawner, attempting to decode the list format first. // Uses the better EitherCodec that logs both errors if both formats fail to parse. - new ExtraCodecs.EitherCodec<>(SpawnerData.CODEC.listOf(), SpawnerData.CODEC).xmap( + Codec.either(SpawnerData.CODEC.listOf(), SpawnerData.CODEC).xmap( either -> either.map(Function.identity(), List::of), // convert list/singleton to list when decoding list -> list.size() == 1 ? Either.right(list.get(0)) : Either.left(list) // convert list to singleton/list when encoding ).fieldOf("spawners").forGetter(AddSpawnsBiomeModifier::spawners)) @@ -297,7 +268,7 @@ public class NeoForgeMod { /** * Stock biome modifier for removing mob spawns from biomes. */ - public static final DeferredHolder, Codec> REMOVE_SPAWNS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("remove_spawns", () -> RecordCodecBuilder.create( + public static final DeferredHolder, MapCodec> REMOVE_SPAWNS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("remove_spawns", () -> RecordCodecBuilder.mapCodec( builder -> builder .group( Biome.LIST_CODEC.fieldOf("biomes").forGetter(RemoveSpawnsBiomeModifier::biomes), @@ -307,7 +278,7 @@ public class NeoForgeMod { /** * Stock biome modifier for adding carvers to biomes. */ - public static final DeferredHolder, Codec> ADD_CARVERS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("add_carvers", () -> RecordCodecBuilder.create(builder -> builder.group( + public static final DeferredHolder, MapCodec> ADD_CARVERS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("add_carvers", () -> RecordCodecBuilder.mapCodec(builder -> builder.group( Biome.LIST_CODEC.fieldOf("biomes").forGetter(BiomeModifiers.AddCarversBiomeModifier::biomes), ConfiguredWorldCarver.LIST_CODEC.fieldOf("carvers").forGetter(BiomeModifiers.AddCarversBiomeModifier::carvers), GenerationStep.Carving.CODEC.fieldOf("step").forGetter(BiomeModifiers.AddCarversBiomeModifier::step)).apply(builder, BiomeModifiers.AddCarversBiomeModifier::new))); @@ -315,10 +286,10 @@ public class NeoForgeMod { /** * Stock biome modifier for removing carvers from biomes. */ - public static final DeferredHolder, Codec> REMOVE_CARVERS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("remove_carvers", () -> RecordCodecBuilder.create(builder -> builder.group( + public static final DeferredHolder, MapCodec> REMOVE_CARVERS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("remove_carvers", () -> RecordCodecBuilder.mapCodec(builder -> builder.group( Biome.LIST_CODEC.fieldOf("biomes").forGetter(BiomeModifiers.RemoveCarversBiomeModifier::biomes), ConfiguredWorldCarver.LIST_CODEC.fieldOf("carvers").forGetter(BiomeModifiers.RemoveCarversBiomeModifier::carvers), - new ExtraCodecs.EitherCodec<>(GenerationStep.Carving.CODEC.listOf(), GenerationStep.Carving.CODEC).xmap( + Codec.either(GenerationStep.Carving.CODEC.listOf(), GenerationStep.Carving.CODEC).xmap( either -> either.map(Set::copyOf, Set::of), set -> set.size() == 1 ? Either.right(set.toArray(GenerationStep.Carving[]::new)[0]) : Either.left(List.copyOf(set))).optionalFieldOf("steps", EnumSet.allOf(GenerationStep.Carving.class)).forGetter(BiomeModifiers.RemoveCarversBiomeModifier::steps)) .apply(builder, BiomeModifiers.RemoveCarversBiomeModifier::new))); @@ -326,7 +297,7 @@ public class NeoForgeMod { /** * Stock biome modifier for adding mob spawn costs to biomes. */ - public static final DeferredHolder, Codec> ADD_SPAWN_COSTS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("add_spawn_costs", () -> RecordCodecBuilder.create(builder -> builder.group( + public static final DeferredHolder, MapCodec> ADD_SPAWN_COSTS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("add_spawn_costs", () -> RecordCodecBuilder.mapCodec(builder -> builder.group( Biome.LIST_CODEC.fieldOf("biomes").forGetter(BiomeModifiers.AddSpawnCostsBiomeModifier::biomes), RegistryCodecs.homogeneousList(Registries.ENTITY_TYPE).fieldOf("entity_types").forGetter(BiomeModifiers.AddSpawnCostsBiomeModifier::entityTypes), MobSpawnSettings.MobSpawnCost.CODEC.fieldOf("spawn_cost").forGetter(BiomeModifiers.AddSpawnCostsBiomeModifier::spawnCost)).apply(builder, BiomeModifiers.AddSpawnCostsBiomeModifier::new))); @@ -334,23 +305,23 @@ public class NeoForgeMod { /** * Stock biome modifier for removing mob spawn costs from biomes. */ - public static final DeferredHolder, Codec> REMOVE_SPAWN_COSTS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("remove_spawn_costs", () -> RecordCodecBuilder.create(builder -> builder.group( + public static final DeferredHolder, MapCodec> REMOVE_SPAWN_COSTS_BIOME_MODIFIER_TYPE = BIOME_MODIFIER_SERIALIZERS.register("remove_spawn_costs", () -> RecordCodecBuilder.mapCodec(builder -> builder.group( Biome.LIST_CODEC.fieldOf("biomes").forGetter(BiomeModifiers.RemoveSpawnCostsBiomeModifier::biomes), RegistryCodecs.homogeneousList(Registries.ENTITY_TYPE).fieldOf("entity_types").forGetter(BiomeModifiers.RemoveSpawnCostsBiomeModifier::entityTypes)).apply(builder, BiomeModifiers.RemoveSpawnCostsBiomeModifier::new))); /** * Noop structure modifier. Can be used in a structure modifier json with "type": "neoforge:none". */ - public static final DeferredHolder, Codec> NONE_STRUCTURE_MODIFIER_TYPE = STRUCTURE_MODIFIER_SERIALIZERS.register("none", () -> Codec.unit(NoneStructureModifier.INSTANCE)); + public static final DeferredHolder, MapCodec> NONE_STRUCTURE_MODIFIER_TYPE = STRUCTURE_MODIFIER_SERIALIZERS.register("none", () -> MapCodec.unit(NoneStructureModifier.INSTANCE)); /** * Stock structure modifier for adding mob spawns to structures. */ - public static final DeferredHolder, Codec> ADD_SPAWNS_STRUCTURE_MODIFIER_TYPE = STRUCTURE_MODIFIER_SERIALIZERS.register("add_spawns", () -> RecordCodecBuilder.create(builder -> builder.group( + public static final DeferredHolder, MapCodec> ADD_SPAWNS_STRUCTURE_MODIFIER_TYPE = STRUCTURE_MODIFIER_SERIALIZERS.register("add_spawns", () -> RecordCodecBuilder.mapCodec(builder -> builder.group( RegistryCodecs.homogeneousList(Registries.STRUCTURE, Structure.DIRECT_CODEC).fieldOf("structures").forGetter(StructureModifiers.AddSpawnsStructureModifier::structures), // Allow either a list or single spawner, attempting to decode the list format first. // Uses the better EitherCodec that logs both errors if both formats fail to parse. - new ExtraCodecs.EitherCodec<>(SpawnerData.CODEC.listOf(), SpawnerData.CODEC).xmap( + Codec.either(SpawnerData.CODEC.listOf(), SpawnerData.CODEC).xmap( either -> either.map(Function.identity(), List::of), // convert list/singleton to list when decoding list -> list.size() == 1 ? Either.right(list.get(0)) : Either.left(list) // convert list to singleton/list when encoding ).fieldOf("spawners").forGetter(StructureModifiers.AddSpawnsStructureModifier::spawners)).apply(builder, StructureModifiers.AddSpawnsStructureModifier::new))); @@ -358,16 +329,16 @@ public class NeoForgeMod { /** * Stock structure modifier for removing mob spawns from structures. */ - public static final DeferredHolder, Codec> REMOVE_SPAWNS_STRUCTURE_MODIFIER_TYPE = STRUCTURE_MODIFIER_SERIALIZERS.register("remove_spawns", () -> RecordCodecBuilder.create(builder -> builder.group( + public static final DeferredHolder, MapCodec> REMOVE_SPAWNS_STRUCTURE_MODIFIER_TYPE = STRUCTURE_MODIFIER_SERIALIZERS.register("remove_spawns", () -> RecordCodecBuilder.mapCodec(builder -> builder.group( RegistryCodecs.homogeneousList(Registries.STRUCTURE, Structure.DIRECT_CODEC).fieldOf("structures").forGetter(StructureModifiers.RemoveSpawnsStructureModifier::structures), RegistryCodecs.homogeneousList(Registries.ENTITY_TYPE).fieldOf("entity_types").forGetter(StructureModifiers.RemoveSpawnsStructureModifier::entityTypes)).apply(builder, StructureModifiers.RemoveSpawnsStructureModifier::new))); /** * Stock structure modifier for removing spawn override lists from structures. */ - public static final DeferredHolder, Codec> CLEAR_SPAWNS_STRUCTURE_MODIFIER_TYPE = STRUCTURE_MODIFIER_SERIALIZERS.register("clear_spawns", () -> RecordCodecBuilder.create(builder -> builder.group( + public static final DeferredHolder, MapCodec> CLEAR_SPAWNS_STRUCTURE_MODIFIER_TYPE = STRUCTURE_MODIFIER_SERIALIZERS.register("clear_spawns", () -> RecordCodecBuilder.mapCodec(builder -> builder.group( RegistryCodecs.homogeneousList(Registries.STRUCTURE, Structure.DIRECT_CODEC).fieldOf("structures").forGetter(StructureModifiers.ClearSpawnsStructureModifier::structures), - new ExtraCodecs.EitherCodec, MobCategory>(MobCategory.CODEC.listOf(), MobCategory.CODEC).>xmap( + Codec., MobCategory>either(MobCategory.CODEC.listOf(), MobCategory.CODEC).>xmap( either -> either.map(Set::copyOf, Set::of), // convert list/singleton to set when decoding set -> set.size() == 1 ? Either.right(set.toArray(MobCategory[]::new)[0]) : Either.left(List.copyOf(set))).optionalFieldOf("categories", EnumSet.allOf(MobCategory.class)).forGetter(StructureModifiers.ClearSpawnsStructureModifier::categories)) .apply(builder, StructureModifiers.ClearSpawnsStructureModifier::new))); @@ -395,30 +366,27 @@ public class NeoForgeMod { private static final DeferredRegister> INGREDIENT_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.INGREDIENT_TYPES, NeoForgeVersion.MOD_ID); - public static final DeferredHolder, IngredientType> COMPOUND_INGREDIENT_TYPE = INGREDIENT_TYPES.register("compound", () -> new IngredientType<>(CompoundIngredient.CODEC, CompoundIngredient.CODEC_NONEMPTY)); - public static final DeferredHolder, IngredientType> NBT_INGREDIENT_TYPE = INGREDIENT_TYPES.register("nbt", () -> new IngredientType<>(NBTIngredient.CODEC, NBTIngredient.CODEC_NONEMPTY)); - public static final DeferredHolder, IngredientType> DIFFERENCE_INGREDIENT_TYPE = INGREDIENT_TYPES.register("difference", () -> new IngredientType<>(DifferenceIngredient.CODEC, DifferenceIngredient.CODEC_NONEMPTY)); - public static final DeferredHolder, IngredientType> INTERSECTION_INGREDIENT_TYPE = INGREDIENT_TYPES.register("intersection", () -> new IngredientType<>(IntersectionIngredient.CODEC, IntersectionIngredient.CODEC_NONEMPTY)); - - private static final DeferredRegister> CONDITION_CODECS = DeferredRegister.create(NeoForgeRegistries.Keys.CONDITION_CODECS, NeoForgeVersion.MOD_ID); - public static final DeferredHolder, Codec> AND_CONDITION = CONDITION_CODECS.register("and", () -> AndCondition.CODEC); - public static final DeferredHolder, Codec> FALSE_CONDITION = CONDITION_CODECS.register("false", () -> FalseCondition.CODEC); - public static final DeferredHolder, Codec> ITEM_EXISTS_CONDITION = CONDITION_CODECS.register("item_exists", () -> ItemExistsCondition.CODEC); - public static final DeferredHolder, Codec> MOD_LOADED_CONDITION = CONDITION_CODECS.register("mod_loaded", () -> ModLoadedCondition.CODEC); - public static final DeferredHolder, Codec> NOT_CONDITION = CONDITION_CODECS.register("not", () -> NotCondition.CODEC); - public static final DeferredHolder, Codec> OR_CONDITION = CONDITION_CODECS.register("or", () -> OrCondition.CODEC); - public static final DeferredHolder, Codec> TAG_EMPTY_CONDITION = CONDITION_CODECS.register("tag_empty", () -> TagEmptyCondition.CODEC); - public static final DeferredHolder, Codec> TRUE_CONDITION = CONDITION_CODECS.register("true", () -> TrueCondition.CODEC); - private static final DeferredRegister> VANILLA_INGREDIENT_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.INGREDIENT_TYPES, "minecraft"); + public static final DeferredHolder, IngredientType> COMPOUND_INGREDIENT_TYPE = INGREDIENT_TYPES.register("compound", () -> new IngredientType<>(CompoundIngredient.CODEC)); + public static final DeferredHolder, IngredientType> DATA_COMPONENT_INGREDIENT_TYPE = INGREDIENT_TYPES.register("components", () -> new IngredientType<>(DataComponentIngredient.CODEC)); + public static final DeferredHolder, IngredientType> DIFFERENCE_INGREDIENT_TYPE = INGREDIENT_TYPES.register("difference", () -> new IngredientType<>(DifferenceIngredient.CODEC)); + public static final DeferredHolder, IngredientType> INTERSECTION_INGREDIENT_TYPE = INGREDIENT_TYPES.register("intersection", () -> new IngredientType<>(IntersectionIngredient.CODEC)); - public static final DeferredHolder, IngredientType> VANILLA_INGREDIENT_TYPE = VANILLA_INGREDIENT_TYPES.register("item", () -> new IngredientType<>(Ingredient.VANILLA_CODEC, Ingredient.VANILLA_CODEC_NONEMPTY)); + private static final DeferredRegister> CONDITION_CODECS = DeferredRegister.create(NeoForgeRegistries.Keys.CONDITION_CODECS, NeoForgeVersion.MOD_ID); + public static final DeferredHolder, MapCodec> AND_CONDITION = CONDITION_CODECS.register("and", () -> AndCondition.CODEC); + public static final DeferredHolder, MapCodec> FALSE_CONDITION = CONDITION_CODECS.register("false", () -> FalseCondition.CODEC); + public static final DeferredHolder, MapCodec> ITEM_EXISTS_CONDITION = CONDITION_CODECS.register("item_exists", () -> ItemExistsCondition.CODEC); + public static final DeferredHolder, MapCodec> MOD_LOADED_CONDITION = CONDITION_CODECS.register("mod_loaded", () -> ModLoadedCondition.CODEC); + public static final DeferredHolder, MapCodec> NOT_CONDITION = CONDITION_CODECS.register("not", () -> NotCondition.CODEC); + public static final DeferredHolder, MapCodec> OR_CONDITION = CONDITION_CODECS.register("or", () -> OrCondition.CODEC); + public static final DeferredHolder, MapCodec> TAG_EMPTY_CONDITION = CONDITION_CODECS.register("tag_empty", () -> TagEmptyCondition.CODEC); + public static final DeferredHolder, MapCodec> TRUE_CONDITION = CONDITION_CODECS.register("true", () -> TrueCondition.CODEC); - private static final DeferredRegister> ENTITY_PREDICATE_CODECS = DeferredRegister.create(NeoForgeRegistries.Keys.ENTITY_PREDICATE_SERIALIZERS, NeoForgeVersion.MOD_ID); - public static final DeferredHolder, Codec> PIGLIN_NEUTRAL_ARMOR_PREDICATE = ENTITY_PREDICATE_CODECS.register("piglin_neutral_armor", () -> PiglinNeutralArmorEntityPredicate.CODEC); + private static final DeferredRegister> ENTITY_PREDICATE_CODECS = DeferredRegister.create(Registries.ENTITY_SUB_PREDICATE_TYPE, NeoForgeVersion.MOD_ID); + public static final DeferredHolder, MapCodec> PIGLIN_NEUTRAL_ARMOR_PREDICATE = ENTITY_PREDICATE_CODECS.register("piglin_neutral_armor", () -> PiglinNeutralArmorEntityPredicate.CODEC); - private static final DeferredRegister> ITEM_PREDICATE_CODECS = DeferredRegister.create(NeoForgeRegistries.Keys.ITEM_PREDICATE_SERIALIZERS, NeoForgeVersion.MOD_ID); - public static final DeferredHolder, Codec> TOOL_ACTION_PREDICATE = ITEM_PREDICATE_CODECS.register("tool_action", () -> ToolActionItemPredicate.CODEC); - public static final DeferredHolder, Codec> PIGLIN_CURRENCY_PREDICATE = ITEM_PREDICATE_CODECS.register("piglin_currency", () -> PiglinCurrencyItemPredicate.CODEC); + private static final DeferredRegister> ITEM_SUB_PREDICATES = DeferredRegister.create(Registries.ITEM_SUB_PREDICATE_TYPE, NeoForgeVersion.MOD_ID); + public static final DeferredHolder, ItemSubPredicate.Type> TOOL_ACTION_PREDICATE = ITEM_SUB_PREDICATES.register("tool_action", () -> ToolActionItemPredicate.TYPE); + public static final DeferredHolder, ItemSubPredicate.Type> PIGLIN_CURRENCY_PREDICATE = ITEM_SUB_PREDICATES.register("piglin_currency", () -> PiglinCurrencyItemPredicate.TYPE); private static final DeferredRegister VANILLA_FLUID_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.FLUID_TYPES, "minecraft"); @@ -460,7 +428,7 @@ public boolean canConvertToSource(FluidState state, LevelReader reader, BlockPos } @Override - public @Nullable BlockPathTypes getBlockPathType(FluidState state, BlockGetter level, BlockPos pos, @Nullable Mob mob, boolean canFluidLog) { + public @Nullable PathType getBlockPathType(FluidState state, BlockGetter level, BlockPos pos, @Nullable Mob mob, boolean canFluidLog) { return canFluidLog ? super.getBlockPathType(state, level, pos, mob, true) : null; } @@ -508,7 +476,7 @@ public int getTintColor(FluidState state, BlockAndTintGetter getter, BlockPos po .descriptionId("block.minecraft.lava") .canSwim(false) .canDrown(false) - .pathType(BlockPathTypes.LAVA) + .pathType(PathType.LAVA) .adjacentPathType(null) .sound(SoundActions.BUCKET_FILL, SoundEvents.BUCKET_FILL_LAVA) .sound(SoundActions.BUCKET_EMPTY, SoundEvents.BUCKET_EMPTY_LAVA) @@ -610,30 +578,30 @@ public NeoForgeMod(IEventBus modEventBus, Dist dist, ModContainer container) { STRUCTURE_MODIFIER_SERIALIZERS.register(modEventBus); HOLDER_SET_TYPES.register(modEventBus); VANILLA_FLUID_TYPES.register(modEventBus); - VANILLA_INGREDIENT_TYPES.register(modEventBus); ENTITY_PREDICATE_CODECS.register(modEventBus); - ITEM_PREDICATE_CODECS.register(modEventBus); + ITEM_SUB_PREDICATES.register(modEventBus); INGREDIENT_TYPES.register(modEventBus); CONDITION_CODECS.register(modEventBus); GLOBAL_LOOT_MODIFIER_SERIALIZERS.register(modEventBus); NeoForge.EVENT_BUS.addListener(this::serverStopping); - ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, NeoForgeConfig.clientSpec); - ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, NeoForgeConfig.serverSpec); - ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, NeoForgeConfig.commonSpec); + container.registerConfig(ModConfig.Type.CLIENT, NeoForgeConfig.clientSpec); + container.registerConfig(ModConfig.Type.SERVER, NeoForgeConfig.serverSpec); + container.registerConfig(ModConfig.Type.COMMON, NeoForgeConfig.commonSpec); modEventBus.register(NeoForgeConfig.class); NeoForgeRegistriesSetup.setup(modEventBus); - // Forge does not display problems when the remote is not matching. - ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> "ANY", (remote, isServer) -> true)); - StartupMessageManager.addModMessage("NeoForge version " + NeoForgeVersion.getVersion()); + StartupNotificationManager.addModMessage("NeoForge version " + NeoForgeVersion.getVersion()); NeoForge.EVENT_BUS.addListener(VillagerTradingManager::loadTrades); NeoForge.EVENT_BUS.register(new NeoForgeEventHandler()); NeoForge.EVENT_BUS.addListener(this::registerPermissionNodes); UsernameCache.load(); - TierSortingRegistry.init(); - if (dist.isClient()) ClientCommandHandler.init(); + if (dist.isClient()) { + ClientCommandHandler.init(); + TagConventionLogWarningClient.init(); + } DualStackUtils.initialise(); + TagConventionLogWarning.init(); modEventBus.addListener(CapabilityHooks::registerVanillaProviders); modEventBus.addListener(CauldronFluidContent::registerCapabilities); @@ -646,9 +614,8 @@ public NeoForgeMod(IEventBus modEventBus, Dist dist, ModContainer container) { if (isPRBuild(container.getModInfo().getVersion().toString())) { isPRBuild = true; - ModLoader.get().addWarning(new ModLoadingWarning( - container.getModInfo(), ModLoadingStage.CONSTRUCT, - "loadwarning.neoforge.prbuild")); + ModLoader.addWarning(new ModLoadingWarning( + container.getModInfo(), "loadwarning.neoforge.prbuild")); } } @@ -679,15 +646,18 @@ public void gatherData(GatherDataEvent event) { gen.addProvider(event.includeServer(), new NeoForgeItemTagsProvider(packOutput, lookupProvider, blockTags.contentsGetter(), existingFileHelper)); gen.addProvider(event.includeServer(), new NeoForgeEntityTypeTagsProvider(packOutput, lookupProvider, existingFileHelper)); gen.addProvider(event.includeServer(), new NeoForgeFluidTagsProvider(packOutput, lookupProvider, existingFileHelper)); - gen.addProvider(event.includeServer(), new NeoForgeRecipeProvider(packOutput)); - gen.addProvider(event.includeServer(), new NeoForgeLootTableProvider(packOutput)); + gen.addProvider(event.includeServer(), new NeoForgeEnchantmentTagsProvider(packOutput, lookupProvider, existingFileHelper)); + gen.addProvider(event.includeServer(), new NeoForgeRecipeProvider(packOutput, lookupProvider)); + gen.addProvider(event.includeServer(), new NeoForgeLootTableProvider(packOutput, lookupProvider)); gen.addProvider(event.includeServer(), new NeoForgeBiomeTagsProvider(packOutput, lookupProvider, existingFileHelper)); + gen.addProvider(event.includeServer(), new NeoForgeStructureTagsProvider(packOutput, lookupProvider, existingFileHelper)); gen.addProvider(event.includeServer(), new NeoForgeDamageTypeTagsProvider(packOutput, lookupProvider, existingFileHelper)); gen.addProvider(event.includeServer(), new NeoForgeRegistryOrderReportProvider(packOutput)); gen.addProvider(event.includeServer(), new NeoForgeDataMapsProvider(packOutput, lookupProvider)); gen.addProvider(event.includeClient(), new NeoForgeSpriteSourceProvider(packOutput, lookupProvider, existingFileHelper)); gen.addProvider(event.includeClient(), new VanillaSoundDefinitionsProvider(packOutput, existingFileHelper)); + gen.addProvider(event.includeClient(), new NeoForgeLanguageProvider(packOutput)); } // done in an event instead of deferred to only enable if a mod requests it @@ -743,7 +713,7 @@ public void registerVanillaDisplayContexts(RegisterEvent event) { Arrays.stream(ItemDisplayContext.values()) .filter(Predicate.not(ItemDisplayContext::isModded)) - .forEach(ctx -> forgeRegistry.registerMapping(ctx.getId(), ResourceKey.create(NeoForgeRegistries.Keys.DISPLAY_CONTEXTS, new ResourceLocation("minecraft", ctx.getSerializedName())), ctx, Lifecycle.stable())); + .forEach(ctx -> forgeRegistry.register(ctx.getId(), ResourceKey.create(NeoForgeRegistries.Keys.DISPLAY_CONTEXTS, new ResourceLocation("minecraft", ctx.getSerializedName())), ctx, RegistrationInfo.BUILT_IN)); } public void registerLootData(RegisterEvent event) { diff --git a/src/main/java/net/neoforged/neoforge/common/SimpleTier.java b/src/main/java/net/neoforged/neoforge/common/SimpleTier.java index 4743f620de6..73b4dfdd417 100644 --- a/src/main/java/net/neoforged/neoforge/common/SimpleTier.java +++ b/src/main/java/net/neoforged/neoforge/common/SimpleTier.java @@ -14,25 +14,21 @@ /** * Helper class to define a custom tier */ -public final class SimpleTier implements Tier { - private final int level; +public class SimpleTier implements Tier { + private final TagKey incorrectBlocksForDrops; private final int uses; private final float speed; private final float attackDamageBonus; private final int enchantmentValue; - - private final TagKey tag; - private final Supplier repairIngredient; - public SimpleTier(int level, int uses, float speed, float attackDamageBonus, int enchantmentValue, - TagKey tag, Supplier repairIngredient) { - this.level = level; + public SimpleTier(TagKey incorrectBlocksForDrops, int uses, float speed, float attackDamageBonus, int enchantmentValue, + Supplier repairIngredient) { + this.incorrectBlocksForDrops = incorrectBlocksForDrops; this.uses = uses; this.speed = speed; this.attackDamageBonus = attackDamageBonus; this.enchantmentValue = enchantmentValue; - this.tag = tag; this.repairIngredient = repairIngredient; } @@ -52,8 +48,8 @@ public float getAttackDamageBonus() { } @Override - public int getLevel() { - return this.level; + public TagKey getIncorrectBlocksForDrops() { + return incorrectBlocksForDrops; } @Override @@ -61,10 +57,6 @@ public int getEnchantmentValue() { return this.enchantmentValue; } - public TagKey getTag() { - return this.tag; - } - @Override public Ingredient getRepairIngredient() { return this.repairIngredient.get(); @@ -73,12 +65,11 @@ public Ingredient getRepairIngredient() { @Override public String toString() { return "SimpleTier[" + - "level=" + level + ", " + + "incorrectBlocksForDrops=" + incorrectBlocksForDrops + ", " + "uses=" + uses + ", " + "speed=" + speed + ", " + "attackDamageBonus=" + attackDamageBonus + ", " + "enchantmentValue=" + enchantmentValue + ", " + - "tag=" + tag + ", " + "repairIngredient=" + repairIngredient + ']'; } } diff --git a/src/main/java/net/neoforged/neoforge/common/TagConventionLogWarning.java b/src/main/java/net/neoforged/neoforge/common/TagConventionLogWarning.java new file mode 100644 index 00000000000..722303640b6 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/TagConventionLogWarning.java @@ -0,0 +1,522 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.common; + +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import java.util.AbstractMap; +import java.util.List; +import java.util.Map; +import net.minecraft.core.Registry; +import net.minecraft.core.RegistryAccess; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.ItemTags; +import net.minecraft.tags.TagKey; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.loading.FMLLoader; +import net.neoforged.neoforge.event.server.ServerStartingEvent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public final class TagConventionLogWarning { + private TagConventionLogWarning() {} + + protected enum LogWarningMode { + SILENCED, + DEV_SHORT, + DEV_VERBOSE, + PROD_SHORT, + PROD_VERBOSE + } + + private static final Logger LOGGER = LogManager.getLogger(); + + /** + * Old `forge` tags that we migrated to a new tag under a new convention. + * May also contain commonly used `forge` tags that are not following convention. + */ + private static final Map, TagKey> LEGACY_FORGE_TAGS = Map., TagKey>ofEntries( + createMapEntry(Registries.BLOCK, "enderman_place_on_blacklist", Tags.Blocks.ENDERMAN_PLACE_ON_BLACKLIST), + createMapEntry(Registries.BLOCK, "needs_wood_tool", Tags.Blocks.NEEDS_WOOD_TOOL), + createMapEntry(Registries.BLOCK, "needs_gold_tool", Tags.Blocks.NEEDS_GOLD_TOOL), + createMapEntry(Registries.BLOCK, "needs_netherite_tool", Tags.Blocks.NEEDS_NETHERITE_TOOL), + + createMapEntry(Registries.BLOCK, "barrels", Tags.Blocks.BARRELS), + createMapEntry(Registries.BLOCK, "barrels/wooden", Tags.Blocks.BARRELS_WOODEN), + createMapEntry(Registries.BLOCK, "bookshelves", Tags.Blocks.BOOKSHELVES), + createMapEntry(Registries.BLOCK, "chests", Tags.Blocks.CHESTS), + createMapEntry(Registries.BLOCK, "chests/ender", Tags.Blocks.CHESTS_ENDER), + createMapEntry(Registries.BLOCK, "chests/trapped", Tags.Blocks.CHESTS_TRAPPED), + createMapEntry(Registries.BLOCK, "chests/wooden", Tags.Blocks.CHESTS_WOODEN), + createMapEntry(Registries.BLOCK, "cobblestone", Tags.Blocks.COBBLESTONES), + createMapEntry(Registries.BLOCK, "cobblestone/normal", Tags.Blocks.COBBLESTONES_NORMAL), + createMapEntry(Registries.BLOCK, "cobblestone/infested", Tags.Blocks.COBBLESTONES_INFESTED), + createMapEntry(Registries.BLOCK, "cobblestone/mossy", Tags.Blocks.COBBLESTONES_MOSSY), + createMapEntry(Registries.BLOCK, "cobblestone/deepslate", Tags.Blocks.COBBLESTONES_DEEPSLATE), + createMapEntry(Registries.BLOCK, "crafting_table", Tags.Blocks.PLAYER_WORKSTATIONS_CRAFTING_TABLES), + createMapEntry(Registries.BLOCK, "crafting_tables", Tags.Blocks.PLAYER_WORKSTATIONS_CRAFTING_TABLES), + createMapEntry(Registries.BLOCK, "workbench", Tags.Blocks.PLAYER_WORKSTATIONS_CRAFTING_TABLES), + createMapEntry(Registries.BLOCK, "workbenches", Tags.Blocks.PLAYER_WORKSTATIONS_CRAFTING_TABLES), + createMapEntry(Registries.BLOCK, "end_stones", Tags.Blocks.END_STONES), + createMapEntry(Registries.BLOCK, "fence_gates", Tags.Blocks.FENCE_GATES), + createMapEntry(Registries.BLOCK, "fence_gates/wooden", Tags.Blocks.FENCE_GATES_WOODEN), + createMapEntry(Registries.BLOCK, "fences", Tags.Blocks.FENCES), + createMapEntry(Registries.BLOCK, "fences/nether_brick", Tags.Blocks.FENCES_NETHER_BRICK), + createMapEntry(Registries.BLOCK, "fences/wooden", Tags.Blocks.FENCES_WOODEN), + createMapEntry(Registries.BLOCK, "furnace", Tags.Blocks.PLAYER_WORKSTATIONS_FURNACES), + createMapEntry(Registries.BLOCK, "furnaces", Tags.Blocks.PLAYER_WORKSTATIONS_FURNACES), + createMapEntry(Registries.BLOCK, "glass", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/black", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/blue", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/brown", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/colorless", Tags.Blocks.GLASS_BLOCKS_COLORLESS), + createMapEntry(Registries.BLOCK, "glass/cyan", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/gray", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/green", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/light_blue", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/light_gray", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/lime", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/magenta", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/orange", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/pink", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/purple", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/red", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/silica", Tags.Blocks.GLASS_BLOCKS_CHEAP), + createMapEntry(Registries.BLOCK, "glass/tinted", Tags.Blocks.GLASS_BLOCKS_TINTED), + createMapEntry(Registries.BLOCK, "glass/white", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass/yellow", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "glass_panes", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/black", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/blue", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/brown", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/colorless", Tags.Blocks.GLASS_PANES_COLORLESS), + createMapEntry(Registries.BLOCK, "glass_panes/cyan", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/gray", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/green", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/light_blue", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/light_gray", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/lime", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/magenta", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/orange", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/pink", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/purple", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/red", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/white", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "glass_panes/yellow", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "gravel", Tags.Blocks.GRAVELS), + createMapEntry(Registries.BLOCK, "heads", Tags.Blocks.SKULLS), + createMapEntry(Registries.BLOCK, "skulls", Tags.Blocks.SKULLS), + createMapEntry(Registries.BLOCK, "netherrack", Tags.Blocks.NETHERRACKS), + createMapEntry(Registries.BLOCK, "obsidian", Tags.Blocks.OBSIDIANS), + createMapEntry(Registries.BLOCK, "ore_bearing_ground/deepslate", Tags.Blocks.ORE_BEARING_GROUND_DEEPSLATE), + createMapEntry(Registries.BLOCK, "ore_bearing_ground/netherrack", Tags.Blocks.ORE_BEARING_GROUND_NETHERRACK), + createMapEntry(Registries.BLOCK, "ore_bearing_ground/stone", Tags.Blocks.ORE_BEARING_GROUND_STONE), + createMapEntry(Registries.BLOCK, "ore_rates/dense", Tags.Blocks.ORE_RATES_DENSE), + createMapEntry(Registries.BLOCK, "ore_rates/singular", Tags.Blocks.ORE_RATES_SINGULAR), + createMapEntry(Registries.BLOCK, "ore_rates/sparse", Tags.Blocks.ORE_RATES_SPARSE), + createMapEntry(Registries.BLOCK, "ores", Tags.Blocks.ORES), + createMapEntry(Registries.BLOCK, "ores/coal", Tags.Blocks.ORES_COAL), + createMapEntry(Registries.BLOCK, "ores/copper", Tags.Blocks.ORES_COPPER), + createMapEntry(Registries.BLOCK, "ores/diamond", Tags.Blocks.ORES_DIAMOND), + createMapEntry(Registries.BLOCK, "ores/emerald", Tags.Blocks.ORES_EMERALD), + createMapEntry(Registries.BLOCK, "ores/gold", Tags.Blocks.ORES_GOLD), + createMapEntry(Registries.BLOCK, "ores/iron", Tags.Blocks.ORES_IRON), + createMapEntry(Registries.BLOCK, "ores/lapis", Tags.Blocks.ORES_LAPIS), + createMapEntry(Registries.BLOCK, "ores/netherite_scrap", Tags.Blocks.ORES_NETHERITE_SCRAP), + createMapEntry(Registries.BLOCK, "ores/quartz", Tags.Blocks.ORES_QUARTZ), + createMapEntry(Registries.BLOCK, "ores/redstone", Tags.Blocks.ORES_REDSTONE), + createMapEntry(Registries.BLOCK, "ores_in_ground/deepslate", Tags.Blocks.ORES_IN_GROUND_DEEPSLATE), + createMapEntry(Registries.BLOCK, "ores_in_ground/netherrack", Tags.Blocks.ORES_IN_GROUND_NETHERRACK), + createMapEntry(Registries.BLOCK, "ores_in_ground/stone", Tags.Blocks.ORES_IN_GROUND_STONE), + createMapEntry(Registries.BLOCK, "sand", Tags.Blocks.SANDS), + createMapEntry(Registries.BLOCK, "sand/colorless", Tags.Blocks.SANDS_COLORLESS), + createMapEntry(Registries.BLOCK, "sand/red", Tags.Blocks.SANDS_RED), + createMapEntry(Registries.BLOCK, "sandstone", Tags.Blocks.SANDSTONE_BLOCKS), + createMapEntry(Registries.BLOCK, "stained_glass", Tags.Blocks.GLASS_BLOCKS), + createMapEntry(Registries.BLOCK, "stained_glass_panes", Tags.Blocks.GLASS_PANES), + createMapEntry(Registries.BLOCK, "stone", Tags.Blocks.STONES), + createMapEntry(Registries.BLOCK, "storage_blocks", Tags.Blocks.STORAGE_BLOCKS), + createMapEntry(Registries.BLOCK, "storage_blocks/amethyst", "storage_blocks/amethyst"), + createMapEntry(Registries.BLOCK, "storage_blocks/coal", Tags.Blocks.STORAGE_BLOCKS_COAL), + createMapEntry(Registries.BLOCK, "storage_blocks/copper", Tags.Blocks.STORAGE_BLOCKS_COPPER), + createMapEntry(Registries.BLOCK, "storage_blocks/diamond", Tags.Blocks.STORAGE_BLOCKS_DIAMOND), + createMapEntry(Registries.BLOCK, "storage_blocks/emerald", Tags.Blocks.STORAGE_BLOCKS_EMERALD), + createMapEntry(Registries.BLOCK, "storage_blocks/gold", Tags.Blocks.STORAGE_BLOCKS_GOLD), + createMapEntry(Registries.BLOCK, "storage_blocks/iron", Tags.Blocks.STORAGE_BLOCKS_IRON), + createMapEntry(Registries.BLOCK, "storage_blocks/lapis", Tags.Blocks.STORAGE_BLOCKS_LAPIS), + createMapEntry(Registries.BLOCK, "storage_blocks/netherite", Tags.Blocks.STORAGE_BLOCKS_NETHERITE), + createMapEntry(Registries.BLOCK, "storage_blocks/quartz", "storage_blocks/quartz"), + createMapEntry(Registries.BLOCK, "storage_blocks/raw_copper", Tags.Blocks.STORAGE_BLOCKS_RAW_COPPER), + createMapEntry(Registries.BLOCK, "storage_blocks/raw_gold", Tags.Blocks.STORAGE_BLOCKS_RAW_GOLD), + createMapEntry(Registries.BLOCK, "storage_blocks/raw_iron", Tags.Blocks.STORAGE_BLOCKS_RAW_IRON), + createMapEntry(Registries.BLOCK, "storage_blocks/redstone", Tags.Blocks.STORAGE_BLOCKS_REDSTONE), + + createMapEntry(Registries.BLOCK, "relocation_not_supported", Tags.Blocks.RELOCATION_NOT_SUPPORTED), + createMapEntry(Registries.BLOCK, "immovable", Tags.Blocks.RELOCATION_NOT_SUPPORTED), + createMapEntry(Registries.BLOCK_PREDICATE_TYPE, "relocation_not_supported", Tags.Blocks.RELOCATION_NOT_SUPPORTED), + createMapEntry(Registries.BLOCK_PREDICATE_TYPE, "immovable", Tags.Blocks.RELOCATION_NOT_SUPPORTED), + + createMapEntry(Registries.ENTITY_TYPE, "bosses", Tags.EntityTypes.BOSSES), + + createMapEntry(Registries.ITEM, "barrels", Tags.Items.BARRELS), + createMapEntry(Registries.ITEM, "barrels/wooden", Tags.Items.BARRELS_WOODEN), + createMapEntry(Registries.ITEM, "bones", Tags.Items.BONES), + createMapEntry(Registries.ITEM, "bookshelves", Tags.Items.BOOKSHELVES), + createMapEntry(Registries.ITEM, "bucket", Tags.Items.BUCKETS), + createMapEntry(Registries.ITEM, "chests", Tags.Items.CHESTS), + createMapEntry(Registries.ITEM, "chests/ender", Tags.Items.CHESTS_ENDER), + createMapEntry(Registries.ITEM, "chests/trapped", Tags.Items.CHESTS_TRAPPED), + createMapEntry(Registries.ITEM, "chests/wooden", Tags.Items.CHESTS_WOODEN), + createMapEntry(Registries.ITEM, "cobblestone", Tags.Items.COBBLESTONES), + createMapEntry(Registries.ITEM, "cobblestone/normal", Tags.Items.COBBLESTONES_NORMAL), + createMapEntry(Registries.ITEM, "cobblestone/infested", Tags.Items.COBBLESTONES_INFESTED), + createMapEntry(Registries.ITEM, "cobblestone/mossy", Tags.Items.COBBLESTONES_MOSSY), + createMapEntry(Registries.ITEM, "cobblestone/deepslate", Tags.Items.COBBLESTONES_DEEPSLATE), + createMapEntry(Registries.ITEM, "crafting_table", Tags.Items.PLAYER_WORKSTATIONS_CRAFTING_TABLES), + createMapEntry(Registries.ITEM, "crafting_tables", Tags.Items.PLAYER_WORKSTATIONS_CRAFTING_TABLES), + createMapEntry(Registries.ITEM, "workbench", Tags.Items.PLAYER_WORKSTATIONS_CRAFTING_TABLES), + createMapEntry(Registries.ITEM, "workbenches", Tags.Items.PLAYER_WORKSTATIONS_CRAFTING_TABLES), + createMapEntry(Registries.ITEM, "crops", Tags.Items.CROPS), + createMapEntry(Registries.ITEM, "crops/beetroot", Tags.Items.CROPS_BEETROOT), + createMapEntry(Registries.ITEM, "crops/carrot", Tags.Items.CROPS_CARROT), + createMapEntry(Registries.ITEM, "crops/nether_wart", Tags.Items.CROPS_NETHER_WART), + createMapEntry(Registries.ITEM, "crops/potato", Tags.Items.CROPS_POTATO), + createMapEntry(Registries.ITEM, "crops/wheat", Tags.Items.CROPS_WHEAT), + createMapEntry(Registries.ITEM, "dusts", Tags.Items.DUSTS), + createMapEntry(Registries.ITEM, "dusts/redstone", Tags.Items.DUSTS_REDSTONE), + createMapEntry(Registries.ITEM, "dusts/glowstone", Tags.Items.DUSTS_GLOWSTONE), + createMapEntry(Registries.ITEM, "dyes", Tags.Items.DYES), + createMapEntry(Registries.ITEM, "dyes/black", Tags.Items.DYES_BLACK), + createMapEntry(Registries.ITEM, "dyes/red", Tags.Items.DYES_RED), + createMapEntry(Registries.ITEM, "dyes/green", Tags.Items.DYES_GREEN), + createMapEntry(Registries.ITEM, "dyes/brown", Tags.Items.DYES_BROWN), + createMapEntry(Registries.ITEM, "dyes/blue", Tags.Items.DYES_BLUE), + createMapEntry(Registries.ITEM, "dyes/purple", Tags.Items.DYES_PURPLE), + createMapEntry(Registries.ITEM, "dyes/cyan", Tags.Items.DYES_CYAN), + createMapEntry(Registries.ITEM, "dyes/light_gray", Tags.Items.DYES_LIGHT_GRAY), + createMapEntry(Registries.ITEM, "dyes/gray", Tags.Items.DYES_GRAY), + createMapEntry(Registries.ITEM, "dyes/pink", Tags.Items.DYES_PINK), + createMapEntry(Registries.ITEM, "dyes/lime", Tags.Items.DYES_LIME), + createMapEntry(Registries.ITEM, "dyes/yellow", Tags.Items.DYES_YELLOW), + createMapEntry(Registries.ITEM, "dyes/light_blue", Tags.Items.DYES_LIGHT_BLUE), + createMapEntry(Registries.ITEM, "dyes/magenta", Tags.Items.DYES_MAGENTA), + createMapEntry(Registries.ITEM, "dyes/orange", Tags.Items.DYES_ORANGE), + createMapEntry(Registries.ITEM, "dyes/white", Tags.Items.DYES_WHITE), + createMapEntry(Registries.ITEM, "eggs", Tags.Items.EGGS), + createMapEntry(Registries.ITEM, "enchanting_fuels", Tags.Items.ENCHANTING_FUELS), + createMapEntry(Registries.ITEM, "end_stones", Tags.Items.END_STONES), + createMapEntry(Registries.ITEM, "ender_pearls", Tags.Items.ENDER_PEARLS), + createMapEntry(Registries.ITEM, "feathers", Tags.Items.FEATHERS), + createMapEntry(Registries.ITEM, "fence_gates", Tags.Items.FENCE_GATES), + createMapEntry(Registries.ITEM, "fence_gates/wooden", Tags.Items.FENCE_GATES_WOODEN), + createMapEntry(Registries.ITEM, "fences", Tags.Items.FENCES), + createMapEntry(Registries.ITEM, "fences/nether_brick", Tags.Items.FENCES_NETHER_BRICK), + createMapEntry(Registries.ITEM, "fences/wooden", Tags.Items.FENCES_WOODEN), + createMapEntry(Registries.ITEM, "furnace", Tags.Items.PLAYER_WORKSTATIONS_FURNACES), + createMapEntry(Registries.ITEM, "furnaces", Tags.Items.PLAYER_WORKSTATIONS_FURNACES), + createMapEntry(Registries.ITEM, "gems", Tags.Items.GEMS), + createMapEntry(Registries.ITEM, "gems/diamond", Tags.Items.GEMS_DIAMOND), + createMapEntry(Registries.ITEM, "gems/emerald", Tags.Items.GEMS_EMERALD), + createMapEntry(Registries.ITEM, "gems/amethyst", Tags.Items.GEMS_AMETHYST), + createMapEntry(Registries.ITEM, "gems/lapis", Tags.Items.GEMS_LAPIS), + createMapEntry(Registries.ITEM, "gems/prismarine", Tags.Items.GEMS_PRISMARINE), + createMapEntry(Registries.ITEM, "gems/quartz", Tags.Items.GEMS_QUARTZ), + createMapEntry(Registries.ITEM, "glass", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/black", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/blue", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/brown", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/colorless", Tags.Items.GLASS_BLOCKS_COLORLESS), + createMapEntry(Registries.ITEM, "glass/cyan", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/gray", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/green", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/light_blue", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/light_gray", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/lime", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/magenta", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/orange", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/pink", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/purple", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/red", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/silica", Tags.Items.GLASS_BLOCKS_CHEAP), + createMapEntry(Registries.ITEM, "glass/tinted", Tags.Items.GLASS_BLOCKS_TINTED), + createMapEntry(Registries.ITEM, "glass/white", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass/yellow", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "glass_panes", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/black", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/blue", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/brown", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/colorless", Tags.Items.GLASS_PANES_COLORLESS), + createMapEntry(Registries.ITEM, "glass_panes/cyan", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/gray", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/green", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/light_blue", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/light_gray", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/lime", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/magenta", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/orange", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/pink", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/purple", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/red", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/white", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "glass_panes/yellow", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "gravel", Tags.Items.GRAVELS), + createMapEntry(Registries.ITEM, "gunpowder", Tags.Items.GUNPOWDERS), + createMapEntry(Registries.ITEM, "ingots", Tags.Items.INGOTS), + createMapEntry(Registries.ITEM, "ingots/brick", Tags.Items.BRICKS_NORMAL), + createMapEntry(Registries.ITEM, "ingots/copper", Tags.Items.INGOTS_COPPER), + createMapEntry(Registries.ITEM, "ingots/gold", Tags.Items.INGOTS_GOLD), + createMapEntry(Registries.ITEM, "ingots/iron", Tags.Items.INGOTS_IRON), + createMapEntry(Registries.ITEM, "ingots/netherite", Tags.Items.INGOTS_NETHERITE), + createMapEntry(Registries.ITEM, "ingots/nether_brick", Tags.Items.BRICKS_NETHER), + createMapEntry(Registries.ITEM, "leather", Tags.Items.LEATHERS), + createMapEntry(Registries.ITEM, "mushrooms", Tags.Items.MUSHROOMS), + createMapEntry(Registries.ITEM, "nether_stars", Tags.Items.NETHER_STARS), + createMapEntry(Registries.ITEM, "netherrack", Tags.Items.NETHERRACKS), + createMapEntry(Registries.ITEM, "nuggets", Tags.Items.NUGGETS), + createMapEntry(Registries.ITEM, "nuggets/gold", Tags.Items.NUGGETS_GOLD), + createMapEntry(Registries.ITEM, "nuggets/iron", Tags.Items.NUGGETS_IRON), + createMapEntry(Registries.ITEM, "obsidian", Tags.Items.OBSIDIANS), + createMapEntry(Registries.ITEM, "ore_bearing_ground/deepslate", Tags.Items.ORE_BEARING_GROUND_DEEPSLATE), + createMapEntry(Registries.ITEM, "ore_bearing_ground/netherrack", Tags.Items.ORE_BEARING_GROUND_NETHERRACK), + createMapEntry(Registries.ITEM, "ore_bearing_ground/stone", Tags.Items.ORE_BEARING_GROUND_STONE), + createMapEntry(Registries.ITEM, "ore_rates/dense", Tags.Items.ORE_RATES_DENSE), + createMapEntry(Registries.ITEM, "ore_rates/singular", Tags.Items.ORE_RATES_SINGULAR), + createMapEntry(Registries.ITEM, "ore_rates/sparse", Tags.Items.ORE_RATES_SPARSE), + createMapEntry(Registries.ITEM, "ores", Tags.Items.ORES), + createMapEntry(Registries.ITEM, "ores/coal", Tags.Items.ORES_COAL), + createMapEntry(Registries.ITEM, "ores/copper", Tags.Items.ORES_COPPER), + createMapEntry(Registries.ITEM, "ores/diamond", Tags.Items.ORES_DIAMOND), + createMapEntry(Registries.ITEM, "ores/emerald", Tags.Items.ORES_EMERALD), + createMapEntry(Registries.ITEM, "ores/gold", Tags.Items.ORES_GOLD), + createMapEntry(Registries.ITEM, "ores/iron", Tags.Items.ORES_IRON), + createMapEntry(Registries.ITEM, "ores/lapis", Tags.Items.ORES_LAPIS), + createMapEntry(Registries.ITEM, "ores/netherite_scrap", Tags.Items.ORES_NETHERITE_SCRAP), + createMapEntry(Registries.ITEM, "ores/quartz", Tags.Items.ORES_QUARTZ), + createMapEntry(Registries.ITEM, "ores/redstone", Tags.Items.ORES_REDSTONE), + createMapEntry(Registries.ITEM, "ores_in_ground/deepslate", Tags.Items.ORES_IN_GROUND_DEEPSLATE), + createMapEntry(Registries.ITEM, "ores_in_ground/netherrack", Tags.Items.ORES_IN_GROUND_NETHERRACK), + createMapEntry(Registries.ITEM, "ores_in_ground/stone", Tags.Items.ORES_IN_GROUND_STONE), + createMapEntry(Registries.ITEM, "raw_materials", Tags.Items.RAW_MATERIALS), + createMapEntry(Registries.ITEM, "raw_materials/copper", Tags.Items.RAW_MATERIALS_COPPER), + createMapEntry(Registries.ITEM, "raw_materials/gold", Tags.Items.RAW_MATERIALS_GOLD), + createMapEntry(Registries.ITEM, "raw_materials/iron", Tags.Items.RAW_MATERIALS_IRON), + createMapEntry(Registries.ITEM, "rods", Tags.Items.RODS), + createMapEntry(Registries.ITEM, "rods/blaze", Tags.Items.RODS_BLAZE), + createMapEntry(Registries.ITEM, "rods/wooden", Tags.Items.RODS_WOODEN), + createMapEntry(Registries.ITEM, "rope", Tags.Items.ROPES), + createMapEntry(Registries.ITEM, "sand", Tags.Items.SANDS), + createMapEntry(Registries.ITEM, "sand/colorless", Tags.Items.SANDS_COLORLESS), + createMapEntry(Registries.ITEM, "sand/red", Tags.Items.SANDS_RED), + createMapEntry(Registries.ITEM, "sandstone", Tags.Items.SANDSTONE_BLOCKS), + createMapEntry(Registries.ITEM, "seeds", Tags.Items.SEEDS), + createMapEntry(Registries.ITEM, "seeds/beetroot", Tags.Items.SEEDS_BEETROOT), + createMapEntry(Registries.ITEM, "seeds/melon", Tags.Items.SEEDS_MELON), + createMapEntry(Registries.ITEM, "seeds/pumpkin", Tags.Items.SEEDS_PUMPKIN), + createMapEntry(Registries.ITEM, "seeds/wheat", Tags.Items.SEEDS_WHEAT), + createMapEntry(Registries.ITEM, "shears", Tags.Items.TOOLS_SHEARS), + createMapEntry(Registries.ITEM, "slimeballs", Tags.Items.SLIMEBALLS), + createMapEntry(Registries.ITEM, "stained_glass", Tags.Items.GLASS_BLOCKS), + createMapEntry(Registries.ITEM, "stained_glass_panes", Tags.Items.GLASS_PANES), + createMapEntry(Registries.ITEM, "stone", Tags.Items.STONES), + createMapEntry(Registries.ITEM, "storage_blocks", Tags.Items.STORAGE_BLOCKS), + createMapEntry(Registries.ITEM, "storage_blocks/amethyst", "storage_blocks/amethyst"), + createMapEntry(Registries.ITEM, "storage_blocks/coal", Tags.Items.STORAGE_BLOCKS_COAL), + createMapEntry(Registries.ITEM, "storage_blocks/copper", Tags.Items.STORAGE_BLOCKS_COPPER), + createMapEntry(Registries.ITEM, "storage_blocks/diamond", Tags.Items.STORAGE_BLOCKS_DIAMOND), + createMapEntry(Registries.ITEM, "storage_blocks/emerald", Tags.Items.STORAGE_BLOCKS_EMERALD), + createMapEntry(Registries.ITEM, "storage_blocks/gold", Tags.Items.STORAGE_BLOCKS_GOLD), + createMapEntry(Registries.ITEM, "storage_blocks/iron", Tags.Items.STORAGE_BLOCKS_IRON), + createMapEntry(Registries.ITEM, "storage_blocks/lapis", Tags.Items.STORAGE_BLOCKS_LAPIS), + createMapEntry(Registries.ITEM, "storage_blocks/netherite", Tags.Items.STORAGE_BLOCKS_NETHERITE), + createMapEntry(Registries.ITEM, "storage_blocks/quartz", "storage_blocks/quartz"), + createMapEntry(Registries.ITEM, "storage_blocks/raw_copper", Tags.Items.STORAGE_BLOCKS_RAW_COPPER), + createMapEntry(Registries.ITEM, "storage_blocks/raw_gold", Tags.Items.STORAGE_BLOCKS_RAW_GOLD), + createMapEntry(Registries.ITEM, "storage_blocks/raw_iron", Tags.Items.STORAGE_BLOCKS_RAW_IRON), + createMapEntry(Registries.ITEM, "storage_blocks/redstone", Tags.Items.STORAGE_BLOCKS_REDSTONE), + createMapEntry(Registries.ITEM, "string", Tags.Items.STRINGS), + createMapEntry(Registries.ITEM, "tools", Tags.Items.TOOLS), + createMapEntry(Registries.ITEM, "tools/shields", Tags.Items.TOOLS_SHIELDS), + createMapEntry(Registries.ITEM, "tools/bows", Tags.Items.TOOLS_BOWS), + createMapEntry(Registries.ITEM, "tools/crossbows", Tags.Items.TOOLS_CROSSBOWS), + createMapEntry(Registries.ITEM, "tools/fishing_rods", Tags.Items.TOOLS_FISHING_RODS), + createMapEntry(Registries.ITEM, "tools/tridents", Tags.Items.TOOLS_SPEARS), + createMapEntry(Registries.ITEM, "tools/brushes", Tags.Items.TOOLS_BRUSHES), + createMapEntry(Registries.ITEM, "armors", Tags.Items.ARMORS), + createMapEntry(Registries.ITEM, "armors/helmets", ItemTags.HEAD_ARMOR), + createMapEntry(Registries.ITEM, "armors/chestplates", ItemTags.CHEST_ARMOR), + createMapEntry(Registries.ITEM, "armors/leggings", ItemTags.LEG_ARMOR), + createMapEntry(Registries.ITEM, "armors/boots", ItemTags.FOOT_ARMOR), + createMapEntry(Registries.ITEM, "wrench", "tools/wrenches"), + createMapEntry(Registries.ITEM, "wrenches", "tools/wrenches"), + createMapEntry(Registries.ITEM, "tools/wrench", "tools/wrenches"), + createMapEntry(Registries.ITEM, "tools/wrenches", "tools/wrenches"), + createMapEntry(Registries.ITEM, "food", Tags.Items.FOODS), + createMapEntry(Registries.ITEM, "foods", Tags.Items.FOODS), + createMapEntry(Registries.ITEM, "fruit", Tags.Items.FOODS_FRUITS), + createMapEntry(Registries.ITEM, "fruits", Tags.Items.FOODS_FRUITS), + createMapEntry(Registries.ITEM, "vegetable", Tags.Items.FOODS_VEGETABLES), + createMapEntry(Registries.ITEM, "vegetables", Tags.Items.FOODS_VEGETABLES), + createMapEntry(Registries.ITEM, "berry", Tags.Items.FOODS_BERRIES), + createMapEntry(Registries.ITEM, "berries", Tags.Items.FOODS_BERRIES), + createMapEntry(Registries.ITEM, "bread", Tags.Items.FOODS_BREADS), + createMapEntry(Registries.ITEM, "breads", Tags.Items.FOODS_BREADS), + createMapEntry(Registries.ITEM, "cookie", Tags.Items.FOODS_COOKIES), + createMapEntry(Registries.ITEM, "cookies", Tags.Items.FOODS_COOKIES), + createMapEntry(Registries.ITEM, "raw_meat", Tags.Items.FOODS_RAW_MEATS), + createMapEntry(Registries.ITEM, "raw_meats", Tags.Items.FOODS_RAW_MEATS), + createMapEntry(Registries.ITEM, "raw_fish", Tags.Items.FOODS_RAW_FISHES), + createMapEntry(Registries.ITEM, "raw_fishes", Tags.Items.FOODS_RAW_FISHES), + createMapEntry(Registries.ITEM, "cooked_meat", Tags.Items.FOODS_COOKED_MEATS), + createMapEntry(Registries.ITEM, "cooked_meats", Tags.Items.FOODS_COOKED_MEATS), + createMapEntry(Registries.ITEM, "cooked_fish", Tags.Items.FOODS_COOKED_FISHES), + createMapEntry(Registries.ITEM, "cooked_fishes", Tags.Items.FOODS_COOKED_FISHES), + createMapEntry(Registries.ITEM, "soup", Tags.Items.FOODS_SOUPS), + createMapEntry(Registries.ITEM, "soups", Tags.Items.FOODS_SOUPS), + createMapEntry(Registries.ITEM, "stew", Tags.Items.FOODS_SOUPS), + createMapEntry(Registries.ITEM, "stews", Tags.Items.FOODS_SOUPS), + createMapEntry(Registries.ITEM, "candy", Tags.Items.FOODS_CANDIES), + createMapEntry(Registries.ITEM, "candies", Tags.Items.FOODS_CANDIES), + + createMapEntry(Registries.FLUID, "water", Tags.Fluids.WATER), + createMapEntry(Registries.FLUID, "lava", Tags.Fluids.LAVA), + createMapEntry(Registries.FLUID, "milk", Tags.Fluids.MILK), + createMapEntry(Registries.FLUID, "gaseous", Tags.Fluids.GASEOUS), + createMapEntry(Registries.FLUID, "honey", Tags.Fluids.HONEY), + createMapEntry(Registries.FLUID, "potion", Tags.Fluids.POTION), + createMapEntry(Registries.FLUID, "plantoil", "plant_oil"), + + createMapEntry(Registries.BIOME, "is_hot", Tags.Biomes.IS_HOT), + createMapEntry(Registries.BIOME, "is_hot/overworld", Tags.Biomes.IS_HOT_OVERWORLD), + createMapEntry(Registries.BIOME, "is_hot/nether", Tags.Biomes.IS_HOT_NETHER), + createMapEntry(Registries.BIOME, "is_hot/end", Tags.Biomes.IS_HOT_END), + createMapEntry(Registries.BIOME, "is_cold", Tags.Biomes.IS_COLD), + createMapEntry(Registries.BIOME, "is_cold/overworld", Tags.Biomes.IS_COLD_OVERWORLD), + createMapEntry(Registries.BIOME, "is_cold/nether", Tags.Biomes.IS_COLD_NETHER), + createMapEntry(Registries.BIOME, "is_cold/end", Tags.Biomes.IS_COLD_END), + createMapEntry(Registries.BIOME, "is_sparse", Tags.Biomes.IS_SPARSE_VEGETATION), + createMapEntry(Registries.BIOME, "is_sparse/overworld", Tags.Biomes.IS_SPARSE_VEGETATION_OVERWORLD), + createMapEntry(Registries.BIOME, "is_sparse/nether", Tags.Biomes.IS_SPARSE_VEGETATION_NETHER), + createMapEntry(Registries.BIOME, "is_sparse/end", Tags.Biomes.IS_SPARSE_VEGETATION_END), + createMapEntry(Registries.BIOME, "is_dense", Tags.Biomes.IS_DENSE_VEGETATION), + createMapEntry(Registries.BIOME, "is_dense/overworld", Tags.Biomes.IS_DENSE_VEGETATION_OVERWORLD), + createMapEntry(Registries.BIOME, "is_dense/nether", Tags.Biomes.IS_DENSE_VEGETATION_NETHER), + createMapEntry(Registries.BIOME, "is_dense/end", Tags.Biomes.IS_DENSE_VEGETATION_END), + createMapEntry(Registries.BIOME, "is_wet", Tags.Biomes.IS_WET), + createMapEntry(Registries.BIOME, "is_wet/overworld", Tags.Biomes.IS_WET_OVERWORLD), + createMapEntry(Registries.BIOME, "is_wet/nether", Tags.Biomes.IS_WET_NETHER), + createMapEntry(Registries.BIOME, "is_wet/end", Tags.Biomes.IS_WET_END), + createMapEntry(Registries.BIOME, "is_dry", Tags.Biomes.IS_DRY), + createMapEntry(Registries.BIOME, "is_dry/overworld", Tags.Biomes.IS_DRY_OVERWORLD), + createMapEntry(Registries.BIOME, "is_dry/nether", Tags.Biomes.IS_DRY_NETHER), + createMapEntry(Registries.BIOME, "is_dry/end", Tags.Biomes.IS_DRY_END), + createMapEntry(Registries.BIOME, "is_coniferous", Tags.Biomes.IS_CONIFEROUS_TREE), + createMapEntry(Registries.BIOME, "is_savanna", Tags.Biomes.IS_SAVANNA_TREE), + createMapEntry(Registries.BIOME, "is_jungle", Tags.Biomes.IS_JUNGLE_TREE), + createMapEntry(Registries.BIOME, "is_deciduous", Tags.Biomes.IS_DECIDUOUS_TREE), + createMapEntry(Registries.BIOME, "is_spooky", Tags.Biomes.IS_SPOOKY), + createMapEntry(Registries.BIOME, "is_dead", Tags.Biomes.IS_DEAD), + createMapEntry(Registries.BIOME, "is_lush", Tags.Biomes.IS_LUSH), + createMapEntry(Registries.BIOME, "is_mushroom", Tags.Biomes.IS_MUSHROOM), + createMapEntry(Registries.BIOME, "is_magical", Tags.Biomes.IS_MAGICAL), + createMapEntry(Registries.BIOME, "is_rare", Tags.Biomes.IS_RARE), + createMapEntry(Registries.BIOME, "is_plateau", Tags.Biomes.IS_PLATEAU), + createMapEntry(Registries.BIOME, "is_modified", Tags.Biomes.IS_MODIFIED), + createMapEntry(Registries.BIOME, "is_water", Tags.Biomes.IS_AQUATIC), + createMapEntry(Registries.BIOME, "is_desert", Tags.Biomes.IS_DESERT), + createMapEntry(Registries.BIOME, "is_plains", Tags.Biomes.IS_PLAINS), + createMapEntry(Registries.BIOME, "is_swamp", Tags.Biomes.IS_SWAMP), + createMapEntry(Registries.BIOME, "is_sandy", Tags.Biomes.IS_SANDY), + createMapEntry(Registries.BIOME, "is_snowy", Tags.Biomes.IS_SNOWY), + createMapEntry(Registries.BIOME, "is_wasteland", Tags.Biomes.IS_WASTELAND), + createMapEntry(Registries.BIOME, "is_void", Tags.Biomes.IS_VOID), + createMapEntry(Registries.BIOME, "is_underground", Tags.Biomes.IS_UNDERGROUND), + createMapEntry(Registries.BIOME, "is_cave", Tags.Biomes.IS_CAVE), + createMapEntry(Registries.BIOME, "is_peak", Tags.Biomes.IS_MOUNTAIN_PEAK), + createMapEntry(Registries.BIOME, "is_slope", Tags.Biomes.IS_MOUNTAIN_SLOPE), + createMapEntry(Registries.BIOME, "is_mountain", Tags.Biomes.IS_MOUNTAIN), + createMapEntry(Registries.BIOME, "is_end", Tags.Biomes.IS_END), + createMapEntry(Registries.BIOME, "is_nether", Tags.Biomes.IS_NETHER), + createMapEntry(Registries.BIOME, "is_overworld", Tags.Biomes.IS_OVERWORLD), + createMapEntry(Registries.BIOME, "no_default_monsters", Tags.Biomes.NO_DEFAULT_MONSTERS)); + + /*package private*/ + static void init() { + IEventBus forgeBus = NeoForge.EVENT_BUS; + + setupLegacyTagWarning(forgeBus); + } + + // Remove in 1.22 + private static void setupLegacyTagWarning(IEventBus forgeBus) { + // Log tags that are still using legacy 'forge' namespace + forgeBus.addListener((ServerStartingEvent serverStartingEvent) -> { + // We have to wait for server start to read the server config. + LogWarningMode legacyTagWarningMode = NeoForgeConfig.COMMON.logLegacyTagWarnings.get(); + if (legacyTagWarningMode != LogWarningMode.SILENCED) { + boolean isConfigSetToDev = legacyTagWarningMode == LogWarningMode.DEV_SHORT || + legacyTagWarningMode == LogWarningMode.DEV_VERBOSE; + + if (!FMLLoader.isProduction() == isConfigSetToDev) { + List> legacyTags = new ObjectArrayList<>(); + RegistryAccess.Frozen registryAccess = serverStartingEvent.getServer().registryAccess(); + + // We only care about vanilla registries + registryAccess.registries().forEach(registryEntry -> { + if (registryEntry.key().location().getNamespace().equals("minecraft")) { + registryEntry.value().getTagNames().forEach(tagKey -> { + // Grab tags under 'forge' namespace + if (LEGACY_FORGE_TAGS.containsKey(tagKey) || tagKey.location().getNamespace().equals("forge")) { + legacyTags.add(tagKey); + } + }); + } + }); + + if (!legacyTags.isEmpty()) { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(""" + \n Dev warning - Legacy Tags detected. Please migrate your 'forge' namespace tags to the 'c' namespace! See net.neoforged.neoforge.common.Tags.java for all tags. + NOTE: Many tags have been moved around or renamed. Some new ones were added so please review the new tags. + And make sure you follow tag conventions for new tags! The convention is `c` with nouns generally being plural and adjectives being singular. + You can disable this message in NeoForge's common config by setting `logLegacyTagWarnings` to "SILENCED" or see individual tags with "DEV_VERBOSE". + """); + + // Print out all legacy tags when desired. + boolean isConfigSetToVerbose = legacyTagWarningMode == LogWarningMode.DEV_VERBOSE || + legacyTagWarningMode == LogWarningMode.PROD_VERBOSE; + + if (isConfigSetToVerbose) { + stringBuilder.append("\nLegacy tags:"); + for (TagKey tagKey : legacyTags) { + if (LEGACY_FORGE_TAGS.containsKey(tagKey)) { + TagKey replacementTagkey = LEGACY_FORGE_TAGS.get(tagKey); + stringBuilder.append("\n ").append(tagKey).append(" -> ").append(replacementTagkey); + } else { + stringBuilder.append("\n ").append(tagKey).append(" -> ").append("See similar `c` tags in NeoForge's Tags class"); + } + } + } + + LOGGER.warn(stringBuilder); + } + } + } + }); + } + + private static AbstractMap.SimpleEntry, TagKey> createMapEntry(ResourceKey> registryKey, String tagId1, String tagId2) { + return new AbstractMap.SimpleEntry<>(createTagKey(registryKey, "forge", tagId1), createTagKey(registryKey, "c", tagId2)); + } + + private static AbstractMap.SimpleEntry, TagKey> createMapEntry(ResourceKey> registryKey, String tagId1, TagKey tag2) { + return new AbstractMap.SimpleEntry<>(createTagKey(registryKey, "forge", tagId1), tag2); + } + + private static TagKey createTagKey(ResourceKey> registryKey, String namespace, String tagId) { + return TagKey.create(registryKey, new ResourceLocation(namespace, tagId)); + } +} diff --git a/src/main/java/net/neoforged/neoforge/common/TagConventionLogWarningClient.java b/src/main/java/net/neoforged/neoforge/common/TagConventionLogWarningClient.java new file mode 100644 index 00000000000..6f789e45a27 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/TagConventionLogWarningClient.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.common; + +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import java.util.List; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.core.Registry; +import net.minecraft.core.RegistryAccess; +import net.minecraft.core.registries.Registries; +import net.minecraft.tags.TagKey; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.loading.FMLEnvironment; +import net.neoforged.fml.loading.FMLLoader; +import net.neoforged.neoforge.event.server.ServerStartingEvent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public final class TagConventionLogWarningClient { + private TagConventionLogWarningClient() {} + + private static final Logger LOGGER = LogManager.getLogger(); + + /*package private*/ + static void init() { + IEventBus forgeBus = NeoForge.EVENT_BUS; + + TagConventionLogWarningClient.setupUntranslatedItemTagWarning(forgeBus); + } + + /*package private*/ + static void setupUntranslatedItemTagWarning(IEventBus forgeBus) { + // Log missing item tag translations only in integrated server so we can safely get translations. + forgeBus.addListener((ServerStartingEvent serverStartingEvent) -> { + // We have to wait for server start to read the server config. + TagConventionLogWarning.LogWarningMode untranslatedTagWarningMode = NeoForgeConfig.COMMON.logUntranslatedItemTagWarnings.get(); + if (FMLEnvironment.dist == Dist.CLIENT && untranslatedTagWarningMode != TagConventionLogWarning.LogWarningMode.SILENCED) { + boolean isConfigSetToDev = untranslatedTagWarningMode == TagConventionLogWarning.LogWarningMode.DEV_SHORT || + untranslatedTagWarningMode == TagConventionLogWarning.LogWarningMode.DEV_VERBOSE; + + if (!FMLLoader.isProduction() == isConfigSetToDev) { + List> untranslatedTags = new ObjectArrayList<>(); + RegistryAccess.Frozen registryAccess = serverStartingEvent.getServer().registryAccess(); + extractUnregisteredModdedTags(registryAccess.registryOrThrow(Registries.ITEM), untranslatedTags); + + if (!untranslatedTags.isEmpty()) { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(""" + \n Dev warning - Untranslated Item Tags detected. Please translate your item tags so other mods such as recipe viewers can properly display your tag's name. + The format desired is tag.item.. for the translation key with slashes in path turned into periods. + You can see a shortened version of this message by setting logUntranslatedItemTagWarnings in NeoForge's common config to "DEV_SHORT". + You can see individual untranslated item tags by setting logUntranslatedItemTagWarnings in NeoForge's common config to "DEV_VERBOSE". + Default is "SILENCED" to hide this message. + """); + + // Print out all untranslated tags when desired. + boolean isConfigSetToVerbose = untranslatedTagWarningMode == TagConventionLogWarning.LogWarningMode.DEV_VERBOSE || + untranslatedTagWarningMode == TagConventionLogWarning.LogWarningMode.PROD_VERBOSE; + + if (isConfigSetToVerbose) { + stringBuilder.append("\nUntranslated item tags:"); + for (TagKey tagKey : untranslatedTags) { + stringBuilder.append("\n ").append(tagKey.location()); + } + } + + LOGGER.warn(stringBuilder); + } + } + } + }); + } + + private static void extractUnregisteredModdedTags(Registry registry, List> untranslatedTags) { + registry.getTagNames().forEach(itemTagKey -> { + // We do not translate vanilla's tags at this moment. + if (itemTagKey.location().getNamespace().equals("minecraft")) { + return; + } + + String translationKey = Tags.getTagTranslationKey(itemTagKey); + if (!I18n.exists(translationKey)) { + untranslatedTags.add(itemTagKey); + } + }); + } +} diff --git a/src/main/java/net/neoforged/neoforge/common/Tags.java b/src/main/java/net/neoforged/neoforge/common/Tags.java index 07b6e3464e5..a68c0a229fc 100644 --- a/src/main/java/net/neoforged/neoforge/common/Tags.java +++ b/src/main/java/net/neoforged/neoforge/common/Tags.java @@ -6,6 +6,7 @@ package net.neoforged.neoforge.common; import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.core.BlockPos; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; @@ -16,78 +17,102 @@ import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.material.Fluid; public class Tags { public static class Blocks { + // `neoforge` tags for functional behavior provided by NeoForge + /** + * Controls what blocks Endermen cannot place blocks onto. + *

+ * This is patched into the following method: {@link net.minecraft.world.entity.monster.EnderMan.EndermanLeaveBlockGoal#canPlaceBlock(Level, BlockPos, BlockState, BlockState, BlockState, BlockPos)} + */ + public static final TagKey ENDERMAN_PLACE_ON_BLACKLIST = neoforgeTag("enderman_place_on_blacklist"); + public static final TagKey NEEDS_WOOD_TOOL = neoforgeTag("needs_wood_tool"); + public static final TagKey NEEDS_GOLD_TOOL = neoforgeTag("needs_gold_tool"); + public static final TagKey NEEDS_NETHERITE_TOOL = neoforgeTag("needs_netherite_tool"); + + // `c` tags for common conventions public static final TagKey BARRELS = tag("barrels"); public static final TagKey BARRELS_WOODEN = tag("barrels/wooden"); public static final TagKey BOOKSHELVES = tag("bookshelves"); + /** + * For blocks that are similar to amethyst where their budding block produces buds and cluster blocks + */ + public static final TagKey BUDDING_BLOCKS = tag("budding_blocks"); + /** + * For blocks that are similar to amethyst where they have buddings forming from budding blocks + */ + public static final TagKey BUDS = tag("buds"); + public static final TagKey CHAINS = tag("chains"); 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"); + /** + * For blocks that are similar to amethyst where they have clusters forming from budding blocks + */ + public static final TagKey CLUSTERS = tag("clusters"); + public static final TagKey COBBLESTONES = tag("cobblestones"); + public static final TagKey COBBLESTONES_NORMAL = tag("cobblestones/normal"); + public static final TagKey COBBLESTONES_INFESTED = tag("cobblestones/infested"); + public static final TagKey COBBLESTONES_MOSSY = tag("cobblestones/mossy"); + public static final TagKey COBBLESTONES_DEEPSLATE = tag("cobblestones/deepslate"); + + /** + * Tag that holds all blocks that can be dyed a specific color. + * (Does not include color blending blocks that would behave similar to leather armor item) + */ + public static final TagKey DYED = tag("dyed"); + public static final TagKey DYED_BLACK = tag("dyed/black"); + public static final TagKey DYED_BLUE = tag("dyed/blue"); + public static final TagKey DYED_BROWN = tag("dyed/brown"); + public static final TagKey DYED_CYAN = tag("dyed/cyan"); + public static final TagKey DYED_GRAY = tag("dyed/gray"); + public static final TagKey DYED_GREEN = tag("dyed/green"); + public static final TagKey DYED_LIGHT_BLUE = tag("dyed/light_blue"); + public static final TagKey DYED_LIGHT_GRAY = tag("dyed/light_gray"); + public static final TagKey DYED_LIME = tag("dyed/lime"); + public static final TagKey DYED_MAGENTA = tag("dyed/magenta"); + public static final TagKey DYED_ORANGE = tag("dyed/orange"); + public static final TagKey DYED_PINK = tag("dyed/pink"); + public static final TagKey DYED_PURPLE = tag("dyed/purple"); + public static final TagKey DYED_RED = tag("dyed/red"); + public static final TagKey DYED_WHITE = tag("dyed/white"); + public static final TagKey DYED_YELLOW = tag("dyed/yellow"); 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 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 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 TagKey GLASS_BLOCKS = tag("glass_blocks"); + public static final TagKey GLASS_BLOCKS_COLORLESS = tag("glass_blocks/colorless"); + /** + * Glass which is made from cheap resources like sand and only minor additional ingredients like dyes + */ + public static final TagKey GLASS_BLOCKS_CHEAP = tag("glass_blocks/cheap"); + public static final TagKey GLASS_BLOCKS_TINTED = tag("glass_blocks/tinted"); 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 TagKey GRAVEL = tag("gravel"); - public static final TagKey NETHERRACK = tag("netherrack"); - public static final TagKey OBSIDIAN = tag("obsidian"); + + public static final TagKey GRAVELS = tag("gravel"); + /** + * Tag that holds all blocks that recipe viewers should not show to users. + * Recipe viewers may use this to automatically find the corresponding BlockItem to hide. + */ + public static final TagKey HIDDEN_FROM_RECIPE_VIEWERS = tag("hidden_from_recipe_viewers"); + public static final TagKey NETHERRACKS = tag("netherrack"); + public static final TagKey OBSIDIANS = tag("obsidians"); /** * Blocks which are often replaced by deepslate ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_DEEPSLATE}, during world generation */ @@ -135,62 +160,149 @@ public static class Blocks { * 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 TagKey ORES_IN_GROUND_STONE = tag("ores_in_ground/stone"); + public static final TagKey PLAYER_WORKSTATIONS_CRAFTING_TABLES = tag("player_workstations/crafting_tables"); + public static final TagKey PLAYER_WORKSTATIONS_FURNACES = tag("player_workstations/furnaces"); + /** + * Blocks should be included in this tag if their movement/relocation can cause serious issues such + * as world corruption upon being moved or for balance reason where the block should not be able to be relocated. + * Example: Chunk loaders or pipes where other mods that move blocks do not respect + * {@link BlockBehaviour.BlockStateBase#getPistonPushReaction}. + */ + public static final TagKey RELOCATION_NOT_SUPPORTED = tag("relocation_not_supported"); + public static final TagKey ROPES = tag("ropes"); - 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 TagKey SANDS = tag("sands"); + public static final TagKey SANDS_COLORLESS = tag("sands/colorless"); + public static final TagKey SANDS_RED = tag("sands/red"); - 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 SANDSTONE_BLOCKS = tag("sandstone/blocks"); + public static final TagKey SANDSTONE_SLABS = tag("sandstone/slabs"); + public static final TagKey SANDSTONE_STAIRS = tag("sandstone/stairs"); + public static final TagKey SANDSTONE_RED_BLOCKS = tag("sandstone/red_blocks"); + public static final TagKey SANDSTONE_RED_SLABS = tag("sandstone/red_slabs"); + public static final TagKey SANDSTONE_RED_STAIRS = tag("sandstone/red_stairs"); + public static final TagKey SANDSTONE_UNCOLORED_BLOCKS = tag("sandstone/uncolored_blocks"); + public static final TagKey SANDSTONE_UNCOLORED_SLABS = tag("sandstone/uncolored_slabs"); + public static final TagKey SANDSTONE_UNCOLORED_STAIRS = tag("sandstone/uncolored_stairs"); + /** + * Tag that holds all head based blocks such as Skeleton Skull or Player Head. (Named skulls to match minecraft:skulls item tag) + */ + public static final TagKey SKULLS = tag("skulls"); + /** + * Natural stone-like blocks that can be used as a base ingredient in recipes that takes stone. + */ + public static final TagKey STONES = tag("stones"); + /** + * A storage block is generally a block that has a recipe to craft a bulk of 1 kind of resource to a block + * and has a mirror recipe to reverse the crafting with no loss in resources. + *

+ * Honey Block is special in that the reversing recipe is not a perfect mirror of the crafting recipe + * and so, it is considered a special case and not given a storage block tag. + */ 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_BONE_MEAL = tag("storage_blocks/bone_meal"); 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_DRIED_KELP = tag("storage_blocks/dried_kelp"); 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 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"); + public static final TagKey STORAGE_BLOCKS_SLIME = tag("storage_blocks/slime"); + public static final TagKey STORAGE_BLOCKS_WHEAT = tag("storage_blocks/wheat"); + public static final TagKey VILLAGER_JOB_SITES = tag("villager_job_sites"); private static TagKey tag(String name) { - return BlockTags.create(new ResourceLocation("forge", name)); + return BlockTags.create(new ResourceLocation("c", name)); + } + + private static TagKey neoforgeTag(String name) { + return BlockTags.create(new ResourceLocation("neoforge", name)); } } public static class EntityTypes { public static final TagKey> BOSSES = tag("bosses"); + public static final TagKey> MINECARTS = tag("minecarts"); + public static final TagKey> BOATS = tag("boats"); + + /** + * Entities should be included in this tag if they are not allowed to be picked up by items or grabbed in a way + * that a player can easily move the entity to anywhere they want. Ideal for special entities that should not + * be able to be put into a mob jar for example. + */ + public static final TagKey> CAPTURING_NOT_SUPPORTED = tag("capturing_not_supported"); + + /** + * Entities should be included in this tag if they are not allowed to be teleported in any way. + * This is more for mods that allow teleporting entities within the same dimension. Any mod that is + * teleporting entities to new dimensions should be checking canChangeDimensions method on the entity itself. + */ + public static final TagKey> TELEPORTING_NOT_SUPPORTED = tag("teleporting_not_supported"); private static TagKey> tag(String name) { - return TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation("forge", name)); + return TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation("c", name)); } } public static class Items { + // `neoforge` tags for functional behavior provided by NeoForge + /** + * Controls what items can be consumed for enchanting such as Enchanting Tables. + * This tag defaults to {@link net.minecraft.world.item.Items#LAPIS_LAZULI} when not present in any datapacks, including forge client on vanilla server + */ + public static final TagKey ENCHANTING_FUELS = neoforgeTag("enchanting_fuels"); + + // `c` tags for common conventions 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 BRICKS = tag("bricks"); + public static final TagKey BRICKS_NORMAL = tag("bricks/normal"); + public static final TagKey BRICKS_NETHER = tag("bricks/nether"); + public static final TagKey BUCKETS = tag("buckets"); + public static final TagKey BUCKETS_EMPTY = tag("buckets/empty"); + /** + * Does not include entity water buckets. + * If checking for the fluid this bucket holds in code, please use {@link net.neoforged.neoforge.fluids.capability.wrappers.FluidBucketWrapper#getFluid} instead. + */ + public static final TagKey BUCKETS_WATER = tag("buckets/water"); + /** + * If checking for the fluid this bucket holds in code, please use {@link net.neoforged.neoforge.fluids.capability.wrappers.FluidBucketWrapper#getFluid} instead. + */ + public static final TagKey BUCKETS_LAVA = tag("buckets/lava"); + public static final TagKey BUCKETS_MILK = tag("buckets/milk"); + public static final TagKey BUCKETS_POWDER_SNOW = tag("buckets/powder_snow"); + public static final TagKey BUCKETS_ENTITY_WATER = tag("buckets/entity_water"); + /** + * For blocks that are similar to amethyst where their budding block produces buds and cluster blocks + */ + public static final TagKey BUDDING_BLOCKS = tag("budding_blocks"); + /** + * For blocks that are similar to amethyst where they have buddings forming from budding blocks + */ + public static final TagKey BUDS = tag("buds"); + public static final TagKey CHAINS = tag("chains"); 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 COBBLESTONES = tag("cobblestones"); + public static final TagKey COBBLESTONES_NORMAL = tag("cobblestones/normal"); + public static final TagKey COBBLESTONES_INFESTED = tag("cobblestones/infested"); + public static final TagKey COBBLESTONES_MOSSY = tag("cobblestones/mossy"); + public static final TagKey COBBLESTONES_DEEPSLATE = tag("cobblestones/deepslate"); + /** + * For blocks that are similar to amethyst where they have clusters forming from budding blocks + */ + public static final TagKey CLUSTERS = tag("clusters"); 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"); @@ -198,10 +310,37 @@ public static class Items { 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"); + /** + * Tag that holds all blocks and items that can be dyed a specific color. + * (Does not include color blending items like leather armor + * Use {@link net.minecraft.tags.ItemTags#DYEABLE} tag instead for color blending items) + *

+ * Note: Use custom ingredients in recipes to do tag intersections and/or tag exclusions + * to make more powerful recipes utilizing multiple tags such as dyed tags for an ingredient. + * See {@link net.neoforged.neoforge.common.crafting.DifferenceIngredient} and {@link net.neoforged.neoforge.common.crafting.CompoundIngredient} + * for various custom ingredients available that can also be used in data generation. + */ + public static final TagKey DYED = tag("dyed"); + public static final TagKey DYED_BLACK = tag("dyed/black"); + public static final TagKey DYED_BLUE = tag("dyed/blue"); + public static final TagKey DYED_BROWN = tag("dyed/brown"); + public static final TagKey DYED_CYAN = tag("dyed/cyan"); + public static final TagKey DYED_GRAY = tag("dyed/gray"); + public static final TagKey DYED_GREEN = tag("dyed/green"); + public static final TagKey DYED_LIGHT_BLUE = tag("dyed/light_blue"); + public static final TagKey DYED_LIGHT_GRAY = tag("dyed/light_gray"); + public static final TagKey DYED_LIME = tag("dyed/lime"); + public static final TagKey DYED_MAGENTA = tag("dyed/magenta"); + public static final TagKey DYED_ORANGE = tag("dyed/orange"); + public static final TagKey DYED_PINK = tag("dyed/pink"); + public static final TagKey DYED_PURPLE = tag("dyed/purple"); + public static final TagKey DYED_RED = tag("dyed/red"); + public static final TagKey DYED_WHITE = tag("dyed/white"); + public static final TagKey DYED_YELLOW = tag("dyed/yellow"); + 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(); @@ -221,11 +360,6 @@ public static class Items { public static final TagKey DYES_WHITE = DyeColor.WHITE.getTag(); public static final TagKey EGGS = tag("eggs"); - /** - * @deprecated Avoid using this tag, especially on the client side, as optional tags, for now, do not exist after the registry rework. - */ - @Deprecated - public static final TagKey ENCHANTING_FUELS = tag("enchanting_fuels"); 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"); @@ -234,6 +368,44 @@ public static class Items { 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 FOODS = tag("foods"); + /** + * Apples and other foods that are considered fruits in the culinary field belong in this tag. + * Cherries would go here as they are considered a "stone fruit" within culinary fields. + */ + public static final TagKey FOODS_FRUITS = tag("foods/fruits"); + /** + * Tomatoes and other foods that are considered vegetables in the culinary field belong in this tag. + */ + public static final TagKey FOODS_VEGETABLES = tag("foods/vegetables"); + /** + * Strawberries, raspberries, and other berry foods belong in this tag. + * Cherries would NOT go here as they are considered a "stone fruit" within culinary fields. + */ + public static final TagKey FOODS_BERRIES = tag("foods/berries"); + public static final TagKey FOODS_BREADS = tag("foods/breads"); + public static final TagKey FOODS_COOKIES = tag("foods/cookies"); + public static final TagKey FOODS_RAW_MEATS = tag("foods/raw_meats"); + public static final TagKey FOODS_COOKED_MEATS = tag("foods/cooked_meats"); + public static final TagKey FOODS_RAW_FISHES = tag("foods/raw_fishes"); + public static final TagKey FOODS_COOKED_FISHES = tag("foods/cooked_fishes"); + /** + * Soups, stews, and other liquid food in bowls belongs in this tag. + */ + public static final TagKey FOODS_SOUPS = tag("foods/soups"); + /** + * Sweets and candies like lollipops or chocolate belong in this tag. + */ + public static final TagKey FOODS_CANDIES = tag("foods/candies"); + /** + * Foods like cake that can be eaten when placed in the world belong in this tag. + */ + public static final TagKey FOODS_EDIBLE_WHEN_PLACED = tag("foods/edible_when_placed"); + /** + * For foods that inflict food poisoning-like effects. + * Examples are Rotten Flesh's Hunger or Pufferfish's Nausea, or Poisonous Potato's Poison. + */ + public static final TagKey FOODS_FOOD_POISONING = tag("foods/food_poisoning"); 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"); @@ -242,67 +414,36 @@ public static class Items { public static final TagKey GEMS_PRISMARINE = tag("gems/prismarine"); public static final TagKey GEMS_QUARTZ = tag("gems/quartz"); - 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 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 TagKey GLASS_BLOCKS = tag("glass_blocks"); + public static final TagKey GLASS_BLOCKS_COLORLESS = tag("glass_blocks/colorless"); + /** + * Glass which is made from cheap resources like sand and only minor additional ingredients like dyes + */ + public static final TagKey GLASS_BLOCKS_CHEAP = tag("glass_blocks/cheap"); + public static final TagKey GLASS_BLOCKS_TINTED = tag("glass_blocks/tinted"); 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 TagKey GRAVEL = tag("gravel"); - public static final TagKey GUNPOWDER = tag("gunpowder"); - public static final TagKey HEADS = tag("heads"); + + public static final TagKey GRAVELS = tag("gravel"); + public static final TagKey GUNPOWDERS = tag("gunpowder"); + /** + * Tag that holds all items that recipe viewers should not show to users. + */ + public static final TagKey HIDDEN_FROM_RECIPE_VIEWERS = tag("hidden_from_recipe_viewers"); 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 LEATHERS = 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 NETHERRACKS = 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"); + public static final TagKey OBSIDIANS = tag("obsidians"); /** * Blocks which are often replaced by deepslate ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_DEEPSLATE}, during world generation */ @@ -350,126 +491,180 @@ public static class Items { * 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 TagKey ORES_IN_GROUND_STONE = tag("ores_in_ground/stone"); + public static final TagKey PLAYER_WORKSTATIONS_CRAFTING_TABLES = tag("player_workstations/crafting_tables"); + public static final TagKey PLAYER_WORKSTATIONS_FURNACES = tag("player_workstations/furnaces"); + public static final TagKey RAW_BLOCKS = tag("raw_blocks"); + public static final TagKey RAW_BLOCKS_COPPER = tag("raw_blocks/copper"); + public static final TagKey RAW_BLOCKS_GOLD = tag("raw_blocks/gold"); + public static final TagKey RAW_BLOCKS_IRON = tag("raw_blocks/iron"); 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"); + /** + * For rod-like materials to be used in recipes. + */ public static final TagKey RODS = tag("rods"); public static final TagKey RODS_BLAZE = tag("rods/blaze"); + public static final TagKey RODS_BREEZE = tag("rods/breeze"); + /** + * For stick-like materials to be used in recipes. + * One example is a mod adds stick variants such as Spruce Sticks but would like stick recipes to be able to use it. + */ public static final TagKey RODS_WOODEN = tag("rods/wooden"); + public static final TagKey ROPES = tag("ropes"); - 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 TagKey SANDS = tag("sands"); + public static final TagKey SANDS_COLORLESS = tag("sands/colorless"); + public static final TagKey SANDS_RED = tag("sands/red"); + + public static final TagKey SANDSTONE_BLOCKS = tag("sandstone/blocks"); + public static final TagKey SANDSTONE_SLABS = tag("sandstone/slabs"); + public static final TagKey SANDSTONE_STAIRS = tag("sandstone/stairs"); + public static final TagKey SANDSTONE_RED_BLOCKS = tag("sandstone/red_blocks"); + public static final TagKey SANDSTONE_RED_SLABS = tag("sandstone/red_slabs"); + public static final TagKey SANDSTONE_RED_STAIRS = tag("sandstone/red_stairs"); + public static final TagKey SANDSTONE_UNCOLORED_BLOCKS = tag("sandstone/uncolored_blocks"); + public static final TagKey SANDSTONE_UNCOLORED_SLABS = tag("sandstone/uncolored_slabs"); + public static final TagKey SANDSTONE_UNCOLORED_STAIRS = tag("sandstone/uncolored_stairs"); - 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"); + /** + * Natural stone-like blocks that can be used as a base ingredient in recipes that takes stone. + */ + public static final TagKey STONES = tag("stones"); + /** + * A storage block is generally a block that has a recipe to craft a bulk of 1 kind of resource to a block + * and has a mirror recipe to reverse the crafting with no loss in resources. + *

+ * Honey Block is special in that the reversing recipe is not a perfect mirror of the crafting recipe + * and so, it is considered a special case and not given a storage block tag. + */ 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_BONE_MEAL = tag("storage_blocks/bone_meal"); 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_DRIED_KELP = tag("storage_blocks/dried_kelp"); 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"); + public static final TagKey STORAGE_BLOCKS_SLIME = tag("storage_blocks/slime"); + public static final TagKey STORAGE_BLOCKS_WHEAT = tag("storage_blocks/wheat"); + public static final TagKey STRINGS = tag("strings"); + public static final TagKey VILLAGER_JOB_SITES = tag("villager_job_sites"); + + // Tools and Armors /** - * A tag containing all existing tools. - * - * Note: This tag is not an alternative or a substitute to {@link ToolActions}. + * A tag containing all existing tools. Do not use this tag for determining a tool's behavior. + * Please use {@link net.neoforged.neoforge.common.ToolActions} instead for what action a tool can do. * * @see ToolAction * @see ToolActions */ public static final TagKey TOOLS = tag("tools"); /** - * A tag containing all existing shields. - * - * Note: This tag is not an alternative or a substitute to {@link ToolActions}. + * A tag containing all existing shields. Do not use this tag for determining a tool's behavior. + * Please use {@link net.neoforged.neoforge.common.ToolActions} instead for what action a tool can do. * * @see ToolAction * @see ToolActions */ public static final TagKey TOOLS_SHIELDS = tag("tools/shields"); /** - * A tag containing all existing bows. - * - * Note: This tag is not an alternative or a substitute to {@link ToolActions}. + * A tag containing all existing bows. Do not use this tag for determining a tool's behavior. + * Please use {@link net.neoforged.neoforge.common.ToolActions} instead for what action a tool can do. * * @see ToolAction * @see ToolActions */ public static final TagKey TOOLS_BOWS = tag("tools/bows"); /** - * A tag containing all existing crossbows. - * - * Note: This tag is not an alternative or a substitute to {@link ToolActions}. + * A tag containing all existing crossbows. Do not use this tag for determining a tool's behavior. + * Please use {@link net.neoforged.neoforge.common.ToolActions} instead for what action a tool can do. * - * @see ToolAction - * @see ToolActions + * @see net.neoforged.neoforge.common.ToolAction + * @see net.neoforged.neoforge.common.ToolActions */ public static final TagKey TOOLS_CROSSBOWS = tag("tools/crossbows"); /** - * A tag containing all existing fishing rods. + * A tag containing all existing fishing rods. Do not use this tag for determining a tool's behavior. + * Please use {@link net.neoforged.neoforge.common.ToolActions} instead for what action a tool can do. * - * Note: This tag is not an alternative or a substitute to {@link ToolActions}. - * - * @see ToolAction - * @see ToolActions + * @see net.neoforged.neoforge.common.ToolAction + * @see net.neoforged.neoforge.common.ToolActions */ public static final TagKey TOOLS_FISHING_RODS = tag("tools/fishing_rods"); /** - * A tag containing all existing tridents. - * - * Note: This tag is not an alternative or a substitute to {@link ToolActions}. + * A tag containing all existing spears. Other tools such as throwing knives or boomerangs + * should not be put into this tag and should be put into their own tool tags. + * Do not use this tag for determining a tool's behavior. + * Please use {@link net.neoforged.neoforge.common.ToolActions} instead for what action a tool can do. * * @see ToolAction * @see ToolActions */ - public static final TagKey TOOLS_TRIDENTS = tag("tools/tridents"); - /** - * A tag containing all existing armors. - */ - public static final TagKey ARMORS = tag("armors"); + public static final TagKey TOOLS_SPEARS = tag("tools/spears"); /** - * A tag containing all existing helmets. + * A tag containing all existing shears. Do not use this tag for determining a tool's behavior. + * Please use {@link net.neoforged.neoforge.common.ToolActions} instead for what action a tool can do. + * + * @see ToolAction + * @see ToolActions */ - public static final TagKey ARMORS_HELMETS = tag("armors/helmets"); + public static final TagKey TOOLS_SHEARS = tag("tools/shears"); /** - * A tag containing all chestplates. + * A tag containing all existing brushes. Do not use this tag for determining a tool's behavior. + * Please use {@link net.neoforged.neoforge.common.ToolActions} instead for what action a tool can do. + * + * @see ToolAction + * @see ToolActions */ - public static final TagKey ARMORS_CHESTPLATES = tag("armors/chestplates"); + public static final TagKey TOOLS_BRUSHES = tag("tools/brushes"); /** - * A tag containing all existing leggings. + * Collects the 4 vanilla armor tags into one parent collection for ease. */ - public static final TagKey ARMORS_LEGGINGS = tag("armors/leggings"); + public static final TagKey ARMORS = tag("armors"); /** - * A tag containing all existing boots. + * Collects the many enchantable tags into one parent collection for ease. */ - public static final TagKey ARMORS_BOOTS = tag("armors/boots"); + public static final TagKey ENCHANTABLES = tag("enchantables"); private static TagKey tag(String name) { - return ItemTags.create(new ResourceLocation("forge", name)); + return ItemTags.create(new ResourceLocation("c", name)); + } + + private static TagKey neoforgeTag(String name) { + return ItemTags.create(new ResourceLocation("neoforge", name)); } } + /** + * Note, fluid tags should not be plural to match the vanilla standard. + * This is the only tag category exempted from many-different-types plural rule. + */ public static class Fluids { + /** + * Holds all fluids related to water. + * This tag is done to help out multi-loader mods/datapacks where the vanilla water tag has attached behaviors outside Neo. + */ + public static final TagKey WATER = tag("water"); + /** + * Holds all fluids related to lava. + * This tag is done to help out multi-loader mods/datapacks where the vanilla lava tag has attached behaviors outside Neo. + */ + public static final TagKey LAVA = tag("lava"); /** * Holds all fluids related to milk. */ @@ -478,13 +673,98 @@ public static class Fluids { * Holds all fluids that are gaseous at room temperature. */ public static final TagKey GASEOUS = tag("gaseous"); + /** + * Holds all fluids related to honey.

+ * (Standard unit for honey bottle is 250mb per bottle) + */ + public static final TagKey HONEY = tag("honey"); + /** + * Holds all fluids related to potions. The effects of the potion fluid should be read from NBT. + * The effects and color of the potion fluid should be read from {@link net.minecraft.core.component.DataComponents#POTION_CONTENTS} + * component that people should be attaching to the fluidstack of this fluid.

+ * (Standard unit for potions is 250mb per bottle) + */ + public static final TagKey POTION = tag("potion"); + /** + * Holds all fluids related to Suspicious Stew. + * The effects of the suspicious stew fluid should be read from {@link net.minecraft.core.component.DataComponents#SUSPICIOUS_STEW_EFFECTS} + * component that people should be attaching to the fluidstack of this fluid.

+ * (Standard unit for suspicious stew is 250mb per bowl) + */ + public static final TagKey SUSPICIOUS_STEW = tag("suspicious_stew"); + /** + * Holds all fluids related to Mushroom Stew.

+ * (Standard unit for mushroom stew is 250mb per bowl) + */ + public static final TagKey MUSHROOM_STEW = tag("mushroom_stew"); + /** + * Holds all fluids related to Rabbit Stew.

+ * (Standard unit for rabbit stew is 250mb per bowl) + */ + public static final TagKey RABBIT_STEW = tag("rabbit_stew"); + /** + * Holds all fluids related to Beetroot Soup.

+ * (Standard unit for beetroot soup is 250mb per bowl) + */ + public static final TagKey BEETROOT_SOUP = tag("beetroot_soup"); + /** + * Tag that holds all fluids that recipe viewers should not show to users. + */ + public static final TagKey HIDDEN_FROM_RECIPE_VIEWERS = tag("hidden_from_recipe_viewers"); private static TagKey tag(String name) { - return FluidTags.create(new ResourceLocation("forge", name)); + return FluidTags.create(new ResourceLocation("c", name)); + } + } + + public static class Enchantments { + /** + * A tag containing enchantments that increase the amount or + * quality of drops from blocks, such as {@link net.minecraft.world.item.enchantment.Enchantments#FORTUNE}. + */ + public static final TagKey INCREASE_BLOCK_DROPS = tag("increase_block_drops"); + /** + * A tag containing enchantments that increase the amount or + * quality of drops from entities, such as {@link net.minecraft.world.item.enchantment.Enchantments#LOOTING}. + */ + public static final TagKey INCREASE_ENTITY_DROPS = tag("increase_entity_drops"); + /** + * For enchantments that increase the damage dealt by an item. + */ + public static final TagKey WEAPON_DAMAGE_ENHANCEMENTS = tag("weapon_damage_enhancements"); + /** + * For enchantments that increase movement speed for entity wearing armor enchanted with it. + */ + public static final TagKey ENTITY_SPEED_ENHANCEMENTS = tag("entity_speed_enhancements"); + /** + * For enchantments that applies movement-based benefits unrelated to speed for the entity wearing armor enchanted with it. + * Example: Reducing falling speeds ({@link net.minecraft.world.item.enchantment.Enchantments#FEATHER_FALLING}) or allowing walking on water ({@link net.minecraft.world.item.enchantment.Enchantments#FROST_WALKER}) + */ + public static final TagKey ENTITY_AUXILIARY_MOVEMENT_ENHANCEMENTS = tag("entity_auxiliary_movement_enhancements"); + /** + * For enchantments that decrease damage taken or otherwise benefit, in regard to damage, the entity wearing armor enchanted with it. + */ + public static final TagKey ENTITY_DEFENSE_ENHANCEMENTS = tag("entity_defense_enhancements"); + + private static TagKey tag(String name) { + return TagKey.create(Registries.ENCHANTMENT, new ResourceLocation("c", name)); } } public static class Biomes { + /** + * For biomes that should not spawn monsters over time the normal way. + * In other words, their Spawners and Spawn Cost entries have the monster category empty. + * Example: Mushroom Biomes not having Zombies, Creepers, Skeleton, nor any other normal monsters. + */ + public static final TagKey NO_DEFAULT_MONSTERS = tag("no_default_monsters"); + /** + * Biomes that should not be locatable/selectable by modded biome-locating items or abilities. + */ + public static final TagKey HIDDEN_FROM_LOCATOR_SELECTION = tag("hidden_from_locator_selection"); + + public static final TagKey IS_VOID = tag("is_void"); + public static final TagKey IS_HOT = tag("is_hot"); public static final TagKey IS_HOT_OVERWORLD = tag("is_hot/overworld"); public static final TagKey IS_HOT_NETHER = tag("is_hot/nether"); @@ -495,14 +775,14 @@ public static class Biomes { public static final TagKey IS_COLD_NETHER = tag("is_cold/nether"); public static final TagKey IS_COLD_END = tag("is_cold/end"); - public static final TagKey IS_SPARSE = tag("is_sparse"); - public static final TagKey IS_SPARSE_OVERWORLD = tag("is_sparse/overworld"); - public static final TagKey IS_SPARSE_NETHER = tag("is_sparse/nether"); - public static final TagKey IS_SPARSE_END = tag("is_sparse/end"); - public static final TagKey IS_DENSE = tag("is_dense"); - public static final TagKey IS_DENSE_OVERWORLD = tag("is_dense/overworld"); - public static final TagKey IS_DENSE_NETHER = tag("is_dense/nether"); - public static final TagKey IS_DENSE_END = tag("is_dense/end"); + public static final TagKey IS_SPARSE_VEGETATION = tag("is_sparse_vegetation"); + public static final TagKey IS_SPARSE_VEGETATION_OVERWORLD = tag("is_sparse_vegetation/overworld"); + public static final TagKey IS_SPARSE_VEGETATION_NETHER = tag("is_sparse_vegetation/nether"); + public static final TagKey IS_SPARSE_VEGETATION_END = tag("is_sparse_vegetation/end"); + public static final TagKey IS_DENSE_VEGETATION = tag("is_dense_vegetation"); + public static final TagKey IS_DENSE_VEGETATION_OVERWORLD = tag("is_dense_vegetation/overworld"); + public static final TagKey IS_DENSE_VEGETATION_NETHER = tag("is_dense_vegetation/nether"); + public static final TagKey IS_DENSE_VEGETATION_END = tag("is_dense_vegetation/end"); public static final TagKey IS_WET = tag("is_wet"); public static final TagKey IS_WET_OVERWORLD = tag("is_wet/overworld"); @@ -513,34 +793,197 @@ public static class Biomes { public static final TagKey IS_DRY_NETHER = tag("is_dry/nether"); public static final TagKey IS_DRY_END = tag("is_dry/end"); - public static final TagKey IS_CONIFEROUS = tag("is_coniferous"); + /** + * Biomes that spawn in the Overworld. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_OVERWORLD} + *

+ * NOTE: If you do not add to the vanilla Overworld tag, be sure to add to + * {@link net.minecraft.tags.BiomeTags#HAS_STRONGHOLD} so some Strongholds do not go missing.) + */ + public static final TagKey IS_OVERWORLD = tag("is_overworld"); - public static final TagKey IS_SPOOKY = tag("is_spooky"); - public static final TagKey IS_DEAD = tag("is_dead"); - public static final TagKey IS_LUSH = tag("is_lush"); + public static final TagKey IS_CONIFEROUS_TREE = tag("is_tree/coniferous"); + public static final TagKey IS_SAVANNA_TREE = tag("is_tree/savanna"); + public static final TagKey IS_JUNGLE_TREE = tag("is_tree/jungle"); + public static final TagKey IS_DECIDUOUS_TREE = tag("is_tree/deciduous"); + + /** + * Biomes that spawn as part of giant mountains. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_MOUNTAIN}) + */ + public static final TagKey IS_MOUNTAIN = tag("is_mountain"); + public static final TagKey IS_MOUNTAIN_PEAK = tag("is_mountain/peak"); + public static final TagKey IS_MOUNTAIN_SLOPE = tag("is_mountain/slope"); + + /** + * For temperate or warmer plains-like biomes. + * For snowy plains-like biomes, see {@link #IS_SNOWY_PLAINS}. + */ + public static final TagKey IS_PLAINS = tag("is_plains"); + /** + * For snowy plains-like biomes. + * For warmer plains-like biomes, see {@link #IS_PLAINS}. + */ + public static final TagKey IS_SNOWY_PLAINS = tag("is_snowy_plains"); + /** + * Biomes densely populated with deciduous trees. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_FOREST}) + */ + public static final TagKey IS_FOREST = tag("is_forest"); + public static final TagKey IS_BIRCH_FOREST = tag("is_birch_forest"); + public static final TagKey IS_FLOWER_FOREST = tag("is_flower_forest"); + /** + * Biomes that spawn as a taiga. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_TAIGA}) + */ + public static final TagKey IS_TAIGA = tag("is_taiga"); + public static final TagKey IS_OLD_GROWTH = tag("is_old_growth"); + /** + * Biomes that spawn as a hills biome. (Previously was called Extreme Hills biome in past) + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_HILL}) + */ + public static final TagKey IS_HILL = tag("is_hill"); + public static final TagKey IS_WINDSWEPT = tag("is_windswept"); + /** + * Biomes that spawn as a jungle. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_JUNGLE}) + */ + public static final TagKey IS_JUNGLE = tag("is_jungle"); + /** + * Biomes that spawn as a savanna. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_SAVANNA}) + */ + public static final TagKey IS_SAVANNA = tag("is_savanna"); + public static final TagKey IS_SWAMP = tag("is_swamp"); + public static final TagKey IS_DESERT = tag("is_desert"); + /** + * Biomes that spawn as a badlands. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_BADLANDS}) + */ + public static final TagKey IS_BADLANDS = tag("is_badlands"); + /** + * Biomes that are dedicated to spawning on the shoreline of a body of water. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_BEACH}) + */ + public static final TagKey IS_BEACH = tag("is_beach"); + public static final TagKey IS_STONY_SHORES = tag("is_stony_shores"); public static final TagKey IS_MUSHROOM = tag("is_mushroom"); + + /** + * Biomes that spawn as a river. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_RIVER}) + */ + public static final TagKey IS_RIVER = tag("is_river"); + /** + * Biomes that spawn as part of the world's oceans. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_OCEAN}) + */ + public static final TagKey IS_OCEAN = tag("is_ocean"); + /** + * Biomes that spawn as part of the world's oceans that have low depth. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_DEEP_OCEAN}) + */ + public static final TagKey IS_DEEP_OCEAN = tag("is_deep_ocean"); + public static final TagKey IS_SHALLOW_OCEAN = tag("is_shallow_ocean"); + + public static final TagKey IS_UNDERGROUND = tag("is_underground"); + public static final TagKey IS_CAVE = tag("is_cave"); + + public static final TagKey IS_LUSH = tag("is_lush"); public static final TagKey IS_MAGICAL = tag("is_magical"); public static final TagKey IS_RARE = tag("is_rare"); public static final TagKey IS_PLATEAU = tag("is_plateau"); public static final TagKey IS_MODIFIED = tag("is_modified"); - - public static final TagKey IS_WATER = tag("is_water"); - public static final TagKey IS_DESERT = tag("is_desert"); - public static final TagKey IS_PLAINS = tag("is_plains"); - public static final TagKey IS_SWAMP = tag("is_swamp"); + public static final TagKey IS_SPOOKY = tag("is_spooky"); + /** + * Biomes that lack any natural life or vegetation. + * (Example, land destroyed and sterilized by nuclear weapons) + */ + public static final TagKey IS_WASTELAND = tag("is_wasteland"); + /** + * Biomes whose flora primarily consists of dead or decaying vegetation. + */ + public static final TagKey IS_DEAD = tag("is_dead"); + /** + * Biomes with a large amount of flowers. + */ + public static final TagKey IS_FLORAL = tag("is_floral"); + /** + * Biomes that are able to spawn sand-based blocks on the surface. + */ public static final TagKey IS_SANDY = tag("is_sandy"); + /** + * For biomes that contains lots of naturally spawned snow. + * For biomes where lot of ice is present, see {@link #IS_ICY}. + * Biome with lots of both snow and ice may be in both tags. + */ public static final TagKey IS_SNOWY = tag("is_snowy"); - public static final TagKey IS_WASTELAND = tag("is_wasteland"); - public static final TagKey IS_VOID = tag("is_void"); - public static final TagKey IS_UNDERGROUND = tag("is_underground"); + /** + * For land biomes where ice naturally spawns. + * For biomes where snow alone spawns, see {@link #IS_SNOWY}. + */ + public static final TagKey IS_ICY = tag("is_icy"); + /** + * Biomes consisting primarily of water. + */ + public static final TagKey IS_AQUATIC = tag("is_aquatic"); + /** + * For water biomes where ice naturally spawns. + * For biomes where snow alone spawns, see {@link #IS_SNOWY}. + */ + public static final TagKey IS_AQUATIC_ICY = tag("is_aquatic_icy"); - public static final TagKey IS_CAVE = tag("is_cave"); - public static final TagKey IS_PEAK = tag("is_peak"); - public static final TagKey IS_SLOPE = tag("is_slope"); - public static final TagKey IS_MOUNTAIN = tag("is_mountain"); + /** + * Biomes that spawn in the Nether. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_NETHER}) + */ + public static final TagKey IS_NETHER = tag("is_nether"); + public static final TagKey IS_NETHER_FOREST = tag("is_nether_forest"); + + /** + * Biomes that spawn in the End. + * (This is for people who want to tag their biomes without getting + * side effects from {@link net.minecraft.tags.BiomeTags#IS_END}) + */ + public static final TagKey IS_END = tag("is_end"); + /** + * Biomes that spawn as part of the large islands outside the center island in The End dimension. + */ + public static final TagKey IS_OUTER_END_ISLAND = tag("is_outer_end_island"); private static TagKey tag(String name) { - return TagKey.create(Registries.BIOME, new ResourceLocation("forge", name)); + return TagKey.create(Registries.BIOME, new ResourceLocation("c", name)); + } + } + + public static class Structures { + /** + * Structures that should not show up on minimaps or world map views from mods/sites. + * No effect on vanilla map items. + */ + public static final TagKey HIDDEN_FROM_DISPLAYERS = tag("hidden_from_displayers"); + + /** + * Structures that should not be locatable/selectable by modded structure-locating items or abilities. + * No effect on vanilla map items. + */ + public static final TagKey HIDDEN_FROM_LOCATOR_SELECTION = tag("hidden_from_locator_selection"); + + private static TagKey tag(String name) { + return TagKey.create(Registries.STRUCTURE, new ResourceLocation("c", name)); } } @@ -548,46 +991,72 @@ public static class DamageTypes { /** * Damage types representing magic damage. */ - public static final TagKey IS_MAGIC = tag("is_magic"); + public static final TagKey IS_MAGIC = neoforgeTag("is_magic"); /** * Damage types representing poison damage. */ - public static final TagKey IS_POISON = tag("is_poison"); + public static final TagKey IS_POISON = neoforgeTag("is_poison"); /** * Damage types representing damage that can be attributed to withering or the wither. */ - public static final TagKey IS_WITHER = tag("is_wither"); + public static final TagKey IS_WITHER = neoforgeTag("is_wither"); /** * Damage types representing environmental damage, such as fire, lava, magma, cactus, lightning, etc. */ - public static final TagKey IS_ENVIRONMENT = tag("is_environment"); + public static final TagKey IS_ENVIRONMENT = neoforgeTag("is_environment"); /** * Damage types representing physical damage.
* These are types that do not fit other #is_x tags (except #is_fall) * and would meet the general definition of physical damage. */ - public static final TagKey IS_PHYSICAL = tag("is_physical"); + public static final TagKey IS_PHYSICAL = neoforgeTag("is_physical"); /** * Damage types representing damage from commands or other non-gameplay sources.
* Damage from these types should not be reduced, and bypasses invulnerability. */ - public static final TagKey IS_TECHNICAL = tag("is_technical"); + public static final TagKey IS_TECHNICAL = neoforgeTag("is_technical"); /** * Damage types that will not cause the red flashing effect.
* This tag is empty by default. - * + * * @see GameRenderer#bobHurt */ - public static final TagKey NO_FLINCH = tag("no_flinch"); + public static final TagKey NO_FLINCH = neoforgeTag("no_flinch"); - private static TagKey tag(String name) { - return TagKey.create(Registries.DAMAGE_TYPE, new ResourceLocation("forge", name)); + private static TagKey neoforgeTag(String name) { + return TagKey.create(Registries.DAMAGE_TYPE, new ResourceLocation("neoforge", name)); } } + + /** + * Use this to get a TagKey's translation key safely on any side. + * + * @return the translation key for a TagKey. + */ + public static String getTagTranslationKey(TagKey tagKey) { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("tag."); + + ResourceLocation registryIdentifier = tagKey.registry().location(); + ResourceLocation tagIdentifier = tagKey.location(); + + if (!registryIdentifier.getNamespace().equals("minecraft")) { + stringBuilder.append(registryIdentifier.getNamespace()) + .append("."); + } + + stringBuilder.append(registryIdentifier.getPath().replace("/", ".")) + .append(".") + .append(tagIdentifier.getNamespace()) + .append(".") + .append(tagIdentifier.getPath().replace("/", ".").replace(":", ".")); + + return stringBuilder.toString(); + } } diff --git a/src/main/java/net/neoforged/neoforge/common/TierSortingRegistry.java b/src/main/java/net/neoforged/neoforge/common/TierSortingRegistry.java deleted file mode 100644 index 2ce2fead5b1..00000000000 --- a/src/main/java/net/neoforged/neoforge/common/TierSortingRegistry.java +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.common; - -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.google.common.graph.ElementOrder; -import com.google.common.graph.GraphBuilder; -import com.google.common.graph.MutableGraph; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import it.unimi.dsi.fastutil.booleans.BooleanConsumer; -import java.io.IOException; -import java.io.Reader; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import net.minecraft.network.chat.Component; -import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.network.protocol.configuration.ServerConfigurationPacketListener; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.packs.resources.PreparableReloadListener; -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.TagKey; -import net.minecraft.util.GsonHelper; -import net.minecraft.util.profiling.ProfilerFiller; -import net.minecraft.world.item.DiggerItem; -import net.minecraft.world.item.Tier; -import net.minecraft.world.item.Tiers; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.state.BlockState; -import net.neoforged.fml.loading.FMLEnvironment; -import net.neoforged.fml.loading.toposort.TopologicalSort; -import net.neoforged.neoforge.client.event.ClientPlayerNetworkEvent; -import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion; -import net.neoforged.neoforge.network.configuration.SyncTierSortingRegistry; -import net.neoforged.neoforge.network.handling.IPayloadContext; -import net.neoforged.neoforge.network.payload.TierSortingRegistryPayload; -import net.neoforged.neoforge.network.payload.TierSortingRegistrySyncCompletePayload; -import net.neoforged.neoforge.server.ServerLifecycleHooks; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.jetbrains.annotations.Nullable; - -public class TierSortingRegistry { - private static final Logger LOGGER = LogManager.getLogger(); - private static final ResourceLocation ITEM_TIER_ORDERING_JSON = new ResourceLocation("neoforge", "item_tier_ordering.json"); - - /** - * Registers a tier into the tier sorting registry. - * - * @param tier The tier to register - * @param name The name to use internally for dependency resolution - * @param after List of tiers to place this tier after (the tiers in the list will be considered lesser tiers) - * @param before List of tiers to place this tier before (the tiers in the list will be considered better tiers) - */ - public static synchronized Tier registerTier(Tier tier, ResourceLocation name, List after, List before) { - if (tiers.containsKey(name)) - throw new IllegalStateException("Duplicate tier name " + name); - - processTier(tier, name, after, before); - - hasCustomTiers = true; - return tier; - } - - /** - * Returns the list of tiers in the order defined by the dependencies. - * This list will remain valid - * - * @return An unmodifiable list of tiers ordered lesser to greater - */ - public static List getSortedTiers() { - return sortedTiersUnmodifiable; - } - - /** - * Returns the tier associated with a name, if registered into the sorting system. - * - * @param name The name to look up - * @return The tier, or null if not registered - */ - @Nullable - public static Tier byName(ResourceLocation name) { - return tiers.get(name); - } - - /** - * Returns the name associated with a tier, if the tier is registered into the sorting system. - * - * @param tier The tier to look up - * @return The name for the tier, or null if not registered - */ - @Nullable - public static ResourceLocation getName(Tier tier) { - return tiers.inverse().get(tier); - } - - /** - * Queries if a tier should be evaluated using the sorting system, by calling isCorrectTierForDrops - * - * @param tier The tier to query - * @return True if isCorrectTierForDrops should be called for the tier - */ - public static boolean isTierSorted(Tier tier) { - return getName(tier) != null; - } - - /** - * Queries if a tier is high enough to be able to get drops for the given blockstate. - * - * @param tier The tier to look up - * @param state The state to test against - * @return True if the tier is good enough - */ - public static boolean isCorrectTierForDrops(Tier tier, BlockState state) { - if (!isTierSorted(tier)) - return isCorrectTierVanilla(tier, state); - - for (int x = sortedTiers.indexOf(tier) + 1; x < sortedTiers.size(); x++) { - TagKey tag = sortedTiers.get(x).getTag(); - if (tag != null && state.is(tag)) - return false; - } - return true; - } - - /** - * Helper to query all tiers that are lower than the given tier - * - * @param tier The tier - * @return All the lower tiers - */ - public static List getTiersLowerThan(Tier tier) { - if (!isTierSorted(tier)) return List.of(); - return sortedTiers.stream().takeWhile(t -> t != tier).toList(); - } - - // ===================== PRIVATE INTERNAL STUFFS BELOW THIS LINE ===================== - - /** - * Fallback for when a tier isn't in the registry, copy of the logic in {@link DiggerItem#isCorrectToolForDrops} - */ - private static boolean isCorrectTierVanilla(Tier tier, BlockState state) { - int i = tier.getLevel(); - if (i < 3 && state.is(BlockTags.NEEDS_DIAMOND_TOOL)) { - return false; - } else if (i < 2 && state.is(BlockTags.NEEDS_IRON_TOOL)) { - return false; - } else if (i < 1 && state.is(BlockTags.NEEDS_STONE_TOOL)) { - return false; - } - return true; - } - - private static void processTier(Tier tier, ResourceLocation name, List afters, List befores) { - tiers.put(name, tier); - for (Object after : afters) { - ResourceLocation other = getTierName(after); - edges.put(other, name); - } - for (Object before : befores) { - ResourceLocation other = getTierName(before); - edges.put(name, other); - } - } - - private static ResourceLocation getTierName(Object entry) { - if (entry instanceof String s) - return new ResourceLocation(s); - if (entry instanceof ResourceLocation rl) - return rl; - if (entry instanceof Tier t) - return Objects.requireNonNull(getName(t), "Can't have sorting dependencies for tiers not registered in the TierSortingRegistry"); - throw new IllegalStateException("Invalid object type passed into the tier dependencies " + entry.getClass()); - } - - private static boolean hasCustomTiers = false; - private static final BiMap tiers = HashBiMap.create(); - private static final Multimap edges = HashMultimap.create(); - private static final Multimap vanillaEdges = HashMultimap.create(); - - static { - var wood = new ResourceLocation("wood"); - var stone = new ResourceLocation("stone"); - var iron = new ResourceLocation("iron"); - var diamond = new ResourceLocation("diamond"); - var netherite = new ResourceLocation("netherite"); - var gold = new ResourceLocation("gold"); - processTier(Tiers.WOOD, wood, List.of(), List.of()); - processTier(Tiers.GOLD, gold, List.of(wood), List.of(stone)); - processTier(Tiers.STONE, stone, List.of(wood), List.of(iron)); - processTier(Tiers.IRON, iron, List.of(stone), List.of(diamond)); - processTier(Tiers.DIAMOND, diamond, List.of(iron), List.of(netherite)); - processTier(Tiers.NETHERITE, netherite, List.of(diamond), List.of()); - vanillaEdges.putAll(edges); - } - - private static final List sortedTiers = new ArrayList<>(); - private static final List sortedTiersUnmodifiable = Collections.unmodifiableList(sortedTiers); - - static boolean allowVanilla() { - return !hasCustomTiers; - } - - /*package private*/ static void init() { - if (FMLEnvironment.dist.isClient()) ClientEvents.init(); - } - - /*package private*/ static PreparableReloadListener getReloadListener() { - return new SimplePreparableReloadListener() { - final Gson gson = (new GsonBuilder()).create(); - - @Override - protected JsonObject prepare(ResourceManager resourceManager, ProfilerFiller p) { - Optional res = resourceManager.getResource(ITEM_TIER_ORDERING_JSON); - if (res.isEmpty()) - return new JsonObject(); - - try (Reader reader = res.get().openAsReader()) { - return gson.fromJson(reader, JsonObject.class); - } catch (IOException e) { - LOGGER.error("Could not read Tier sorting file " + ITEM_TIER_ORDERING_JSON, e); - return new JsonObject(); - } - } - - @Override - protected void apply(JsonObject data, ResourceManager resourceManager, ProfilerFiller p) { - try { - if (data.size() > 0) { - JsonArray order = GsonHelper.getAsJsonArray(data, "order"); - List customOrder = new ArrayList<>(); - for (JsonElement entry : order) { - ResourceLocation id = new ResourceLocation(entry.getAsString()); - Tier tier = byName(id); - if (tier == null) throw new IllegalStateException("Tier not found with name " + id); - customOrder.add(tier); - } - - List missingTiers = tiers.values().stream().filter(tier -> !customOrder.contains(tier)).toList(); - if (!missingTiers.isEmpty()) - throw new IllegalStateException("Tiers missing from the ordered list: " + missingTiers.stream().map(tier -> Objects.toString(TierSortingRegistry.getName(tier))).collect(Collectors.joining(", "))); - - setTierOrder(customOrder); - return; - } - } catch (Exception e) { - LOGGER.error("Error parsing Tier sorting file " + ITEM_TIER_ORDERING_JSON, e); - } - - recalculateItemTiers(); - } - }; - } - - @SuppressWarnings("UnstableApiUsage") - private static void recalculateItemTiers() { - final MutableGraph graph = GraphBuilder.directed().nodeOrder(ElementOrder.insertion()).build(); - - for (Tier tier : tiers.values()) { - graph.addNode(tier); - } - edges.forEach((key, value) -> { - if (tiers.containsKey(key) && tiers.containsKey(value)) - graph.putEdge(tiers.get(key), tiers.get(value)); - }); - List tierList = TopologicalSort.topologicalSort(graph, null); - - setTierOrder(tierList); - } - - private static void setTierOrder(List tierList) { - runInServerThreadIfPossible(hasServer -> { - sortedTiers.clear(); - sortedTiers.addAll(tierList); - }); - } - - private static void runInServerThreadIfPossible(BooleanConsumer runnable) { - MinecraftServer server = ServerLifecycleHooks.getCurrentServer(); - if (server != null) server.execute(() -> runnable.accept(true)); - else runnable.accept(false); - } - - public static void handleSync(TierSortingRegistryPayload payload, IPayloadContext context) { - setTierOrder(payload.tiers().stream().map(TierSortingRegistry::byName).toList()); - context.replyHandler().send(new TierSortingRegistrySyncCompletePayload()); - } - - public static void sync(ServerConfigurationPacketListener listener, Consumer sender) { - if (!listener.isConnected(TierSortingRegistryPayload.ID)) { - if (allowVanilla()) { - listener.finishCurrentTask(SyncTierSortingRegistry.TYPE); - } else { - listener.disconnect(Component.translatable("multiplayer.disconnect.incompatible", "NeoForge %s".formatted(NeoForgeVersion.getVersion()))); - } - return; - } - sender.accept(new TierSortingRegistryPayload(TierSortingRegistry.getSortedTiers().stream().map(TierSortingRegistry::getName).toList())); - } - - private static class ClientEvents { - public static void init() { - NeoForge.EVENT_BUS.addListener(ClientEvents::clientLogInToServer); - } - - private static void clientLogInToServer(ClientPlayerNetworkEvent.LoggingIn event) { - if (!event.getConnection().isMemoryConnection()) - recalculateItemTiers(); - } - } -} diff --git a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ICustomEntityPredicate.java b/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ICustomEntityPredicate.java deleted file mode 100644 index d1425619216..00000000000 --- a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ICustomEntityPredicate.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) NeoForged and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.common.advancements.critereon; - -import com.mojang.serialization.Codec; -import javax.annotation.Nullable; -import net.minecraft.advancements.critereon.EntityPredicate; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.phys.Vec3; -import net.neoforged.neoforge.registries.NeoForgeRegistries; - -/** - * Interface that mods can use to define {@link EntityPredicate}s with custom matching logic. - */ -public interface ICustomEntityPredicate { - /** - * {@return the codec for this predicate} - *

- * The codec must be registered to {@link NeoForgeRegistries#ENTITY_PREDICATE_SERIALIZERS}. - */ - Codec codec(); - - /** - * Convert to a vanilla {@link EntityPredicate}. - */ - default EntityPredicate toVanilla() { - return new EntityPredicate(this); - } - - /** - * Evaluates this predicate on the given arguments. - * - * @param level Level the predicate is being tested in. - * @param position Position in the level the test is being run from. - * @param entity Entity to test. - * - * @return {@code true} if the input arguments matches the predicate, otherwise {@code false} - */ - boolean test(ServerLevel level, @Nullable Vec3 position, Entity entity); -} diff --git a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ICustomItemPredicate.java b/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ICustomItemPredicate.java deleted file mode 100644 index d66ced28138..00000000000 --- a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ICustomItemPredicate.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) NeoForged and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.common.advancements.critereon; - -import com.mojang.serialization.Codec; -import java.util.function.Predicate; -import net.minecraft.advancements.critereon.ItemPredicate; -import net.minecraft.world.item.ItemStack; -import net.neoforged.neoforge.registries.NeoForgeRegistries; - -/** - * Interface that mods can use to define {@link ItemPredicate}s with custom matching logic. - */ -public interface ICustomItemPredicate extends Predicate { - /** - * {@return the codec for this predicate} - *

- * The codec must be registered to {@link NeoForgeRegistries#ITEM_PREDICATE_SERIALIZERS}. - */ - Codec codec(); - - /** - * Convert to a vanilla {@link ItemPredicate}. - */ - default ItemPredicate toVanilla() { - return new ItemPredicate(this); - } -} diff --git a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/PiglinCurrencyItemPredicate.java b/src/main/java/net/neoforged/neoforge/common/advancements/critereon/PiglinCurrencyItemPredicate.java index da0d6a9c17b..82b7daa1dcc 100644 --- a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/PiglinCurrencyItemPredicate.java +++ b/src/main/java/net/neoforged/neoforge/common/advancements/critereon/PiglinCurrencyItemPredicate.java @@ -6,21 +6,18 @@ package net.neoforged.neoforge.common.advancements.critereon; import com.mojang.serialization.Codec; +import net.minecraft.advancements.critereon.ItemSubPredicate; import net.minecraft.world.item.ItemStack; -public class PiglinCurrencyItemPredicate implements ICustomItemPredicate { +public class PiglinCurrencyItemPredicate implements ItemSubPredicate { public static final PiglinCurrencyItemPredicate INSTANCE = new PiglinCurrencyItemPredicate(); public static final Codec CODEC = Codec.unit(INSTANCE); + public static final Type TYPE = new Type<>(PiglinCurrencyItemPredicate.CODEC); private PiglinCurrencyItemPredicate() {} @Override - public Codec codec() { - return CODEC; - } - - @Override - public boolean test(ItemStack stack) { + public boolean matches(ItemStack stack) { return stack.isPiglinCurrency(); } } diff --git a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/PiglinNeutralArmorEntityPredicate.java b/src/main/java/net/neoforged/neoforge/common/advancements/critereon/PiglinNeutralArmorEntityPredicate.java index 63cbec12a93..815643b1a34 100644 --- a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/PiglinNeutralArmorEntityPredicate.java +++ b/src/main/java/net/neoforged/neoforge/common/advancements/critereon/PiglinNeutralArmorEntityPredicate.java @@ -5,29 +5,30 @@ package net.neoforged.neoforge.common.advancements.critereon; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import javax.annotation.Nullable; +import net.minecraft.advancements.critereon.EntitySubPredicate; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.Vec3; -public class PiglinNeutralArmorEntityPredicate implements ICustomEntityPredicate { +public class PiglinNeutralArmorEntityPredicate implements EntitySubPredicate { public static final PiglinNeutralArmorEntityPredicate INSTANCE = new PiglinNeutralArmorEntityPredicate(); - public static final Codec CODEC = Codec.unit(INSTANCE); + public static final MapCodec CODEC = MapCodec.unit(INSTANCE); private PiglinNeutralArmorEntityPredicate() {} @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } @Override - public boolean test(ServerLevel level, @Nullable Vec3 position, Entity entity) { + public boolean matches(Entity entity, ServerLevel level, @Nullable Vec3 position) { if (entity instanceof LivingEntity living) { - for (ItemStack armor : entity.getArmorSlots()) { + for (ItemStack armor : living.getArmorSlots()) { if (!armor.isEmpty() && armor.makesPiglinsNeutral(living)) { return true; } diff --git a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ToolActionItemPredicate.java b/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ToolActionItemPredicate.java index edd58e3dac0..879aee94856 100644 --- a/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ToolActionItemPredicate.java +++ b/src/main/java/net/neoforged/neoforge/common/advancements/critereon/ToolActionItemPredicate.java @@ -6,19 +6,16 @@ package net.neoforged.neoforge.common.advancements.critereon; import com.mojang.serialization.Codec; +import net.minecraft.advancements.critereon.ItemSubPredicate; import net.minecraft.world.item.ItemStack; import net.neoforged.neoforge.common.ToolAction; -public record ToolActionItemPredicate(ToolAction action) implements ICustomItemPredicate { +public record ToolActionItemPredicate(ToolAction action) implements ItemSubPredicate { public static final Codec CODEC = ToolAction.CODEC.xmap(ToolActionItemPredicate::new, ToolActionItemPredicate::action); + public static final Type TYPE = new Type<>(ToolActionItemPredicate.CODEC); @Override - public Codec codec() { - return CODEC; - } - - @Override - public boolean test(ItemStack stack) { + public boolean matches(ItemStack stack) { return stack.canPerformAction(action); } } diff --git a/src/main/java/net/neoforged/neoforge/common/brewing/BrewingRecipeRegistry.java b/src/main/java/net/neoforged/neoforge/common/brewing/BrewingRecipeRegistry.java index 583854c17b0..277d96f057b 100644 --- a/src/main/java/net/neoforged/neoforge/common/brewing/BrewingRecipeRegistry.java +++ b/src/main/java/net/neoforged/neoforge/common/brewing/BrewingRecipeRegistry.java @@ -5,51 +5,24 @@ package net.neoforged.neoforge.common.brewing; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import net.minecraft.core.NonNullList; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; - -public class BrewingRecipeRegistry { - private static List recipes = new ArrayList(); - - static { - addRecipe(new VanillaBrewingRecipe()); - } - - /** - * Adds a recipe to the registry. Due to the nature of the brewing stand - * inputs that stack (a.k.a max stack size > 1) are not allowed. - * - * @param input - * The Ingredient that goes in same slots as the water bottles - * would. - * @param ingredient - * The Ingredient that goes in the same slot as nether wart would. - * @param output - * The ItemStack that will replace the input once the brewing is - * done. - * @return true if the recipe was added. - */ - public static boolean addRecipe(Ingredient input, Ingredient ingredient, ItemStack output) { - return addRecipe(new BrewingRecipe(input, ingredient, output)); - } - - /** - * Adds a recipe to the registry. Due to the nature of the brewing stand - * inputs that stack (a.k.a max stack size > 1) are not allowed. - */ - public static boolean addRecipe(IBrewingRecipe recipe) { - return recipes.add(recipe); - } - +import net.minecraft.world.item.alchemy.PotionBrewing; +import net.neoforged.neoforge.event.brewing.RegisterBrewingRecipesEvent; +import org.jetbrains.annotations.ApiStatus; + +/** + * Starting from 1.20.5 this is used to hold {@link IBrewingRecipe}s inside of {@link PotionBrewing}. + * For queries, use the vanilla {@link PotionBrewing}. + * For registration, use {@link RegisterBrewingRecipesEvent}. + */ +@ApiStatus.Internal +public record BrewingRecipeRegistry(List recipes) { /** * Returns the output ItemStack obtained by brewing the passed input and * ingredient. */ - public static ItemStack getOutput(ItemStack input, ItemStack ingredient) { + public ItemStack getOutput(ItemStack input, ItemStack ingredient) { if (input.isEmpty() || input.getCount() != 1) return ItemStack.EMPTY; if (ingredient.isEmpty()) return ItemStack.EMPTY; @@ -65,45 +38,15 @@ public static ItemStack getOutput(ItemStack input, ItemStack ingredient) { /** * Returns true if the passed input and ingredient have an output */ - public static boolean hasOutput(ItemStack input, ItemStack ingredient) { + public boolean hasOutput(ItemStack input, ItemStack ingredient) { return !getOutput(input, ingredient).isEmpty(); } - /** - * Used by the brewing stand to determine if its contents can be brewed. - * Extra parameters exist to allow modders to create bigger brewing stands - * without much hassle - */ - public static boolean canBrew(NonNullList inputs, ItemStack ingredient, int[] inputIndexes) { - if (ingredient.isEmpty()) return false; - - for (int i : inputIndexes) { - if (hasOutput(inputs.get(i), ingredient)) { - return true; - } - } - - return false; - } - - /** - * Used by the brewing stand to brew its inventory Extra parameters exist to - * allow modders to create bigger brewing stands without much hassle - */ - public static void brewPotions(NonNullList inputs, ItemStack ingredient, int[] inputIndexes) { - for (int i : inputIndexes) { - ItemStack output = getOutput(inputs.get(i), ingredient); - if (!output.isEmpty()) { - inputs.set(i, output); - } - } - } - /** * Returns true if the passed ItemStack is a valid ingredient for any of the * recipes in the registry. */ - public static boolean isValidIngredient(ItemStack stack) { + public boolean isValidIngredient(ItemStack stack) { if (stack.isEmpty()) return false; for (IBrewingRecipe recipe : recipes) { @@ -118,7 +61,7 @@ public static boolean isValidIngredient(ItemStack stack) { * Returns true if the passed ItemStack is a valid input for any of the * recipes in the registry. */ - public static boolean isValidInput(ItemStack stack) { + public boolean isValidInput(ItemStack stack) { for (IBrewingRecipe recipe : recipes) { if (recipe.isInput(stack)) { return true; @@ -126,11 +69,4 @@ public static boolean isValidInput(ItemStack stack) { } return false; } - - /** - * Returns an unmodifiable list containing all the recipes in the registry - */ - public static List getRecipes() { - return Collections.unmodifiableList(recipes); - } } diff --git a/src/main/java/net/neoforged/neoforge/common/brewing/IBrewingRecipe.java b/src/main/java/net/neoforged/neoforge/common/brewing/IBrewingRecipe.java index 9e9a11c190e..c8a113c4899 100644 --- a/src/main/java/net/neoforged/neoforge/common/brewing/IBrewingRecipe.java +++ b/src/main/java/net/neoforged/neoforge/common/brewing/IBrewingRecipe.java @@ -5,8 +5,16 @@ package net.neoforged.neoforge.common.brewing; +import static net.minecraft.world.item.alchemy.PotionBrewing.Builder; + import net.minecraft.world.item.ItemStack; +import net.neoforged.neoforge.event.brewing.RegisterBrewingRecipesEvent; +/** + * Interface for more flexible brewing recipes. + * + *

Register using {@link RegisterBrewingRecipesEvent} and {@link Builder#addRecipe(IBrewingRecipe)}. + */ public interface IBrewingRecipe { /** * Returns true is the passed ItemStack is an input for this recipe. "Input" diff --git a/src/main/java/net/neoforged/neoforge/common/brewing/VanillaBrewingRecipe.java b/src/main/java/net/neoforged/neoforge/common/brewing/VanillaBrewingRecipe.java deleted file mode 100644 index 34e68cf75bc..00000000000 --- a/src/main/java/net/neoforged/neoforge/common/brewing/VanillaBrewingRecipe.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.common.brewing; - -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.alchemy.PotionBrewing; - -/** - * Used in BrewingRecipeRegistry to maintain the vanilla behaviour. - * - * Most of the code was simply adapted from net.minecraft.tileentity.TileEntityBrewingStand - */ -public class VanillaBrewingRecipe implements IBrewingRecipe { - /** - * Code adapted from TileEntityBrewingStand.isItemValidForSlot(int index, ItemStack stack) - */ - @Override - public boolean isInput(ItemStack stack) { - Item item = stack.getItem(); - return item == Items.POTION || item == Items.SPLASH_POTION || item == Items.LINGERING_POTION || item == Items.GLASS_BOTTLE; - } - - /** - * Code adapted from TileEntityBrewingStand.isItemValidForSlot(int index, ItemStack stack) - */ - @Override - public boolean isIngredient(ItemStack stack) { - return PotionBrewing.isIngredient(stack); - } - - /** - * Code copied from TileEntityBrewingStand.brewPotions() - * It brews the potion by doing the bit-shifting magic and then checking if the new PotionEffect list is different to the old one, - * or if the new potion is a splash potion when the old one wasn't. - */ - @Override - public ItemStack getOutput(ItemStack input, ItemStack ingredient) { - if (!input.isEmpty() && !ingredient.isEmpty() && isIngredient(ingredient)) { - ItemStack result = PotionBrewing.mix(ingredient, input); - if (result != input) { - return result; - } - return ItemStack.EMPTY; - } - - return ItemStack.EMPTY; - } -} diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/AndCondition.java b/src/main/java/net/neoforged/neoforge/common/conditions/AndCondition.java index 03ee44bbdfc..e4cf0f34b62 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/AndCondition.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/AndCondition.java @@ -6,12 +6,12 @@ package net.neoforged.neoforge.common.conditions; import com.google.common.base.Joiner; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; public record AndCondition(List children) implements ICondition { - public static final Codec CODEC = RecordCodecBuilder.create( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( LIST_CODEC.fieldOf("values").forGetter(AndCondition::children)) @@ -27,7 +27,7 @@ public boolean test(IContext context) { } @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/ConditionContext.java b/src/main/java/net/neoforged/neoforge/common/conditions/ConditionContext.java index 6f304c49288..186cbb63475 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/ConditionContext.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/ConditionContext.java @@ -14,9 +14,11 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagManager; +import org.jetbrains.annotations.Nullable; public class ConditionContext implements ICondition.IContext { private final TagManager tagManager; + @Nullable // TODO 1.20.5: Clear loaded tags after reloads complete. The context object may leak, but we still want to invalidate it. private Map, Map>>> loadedTags = null; diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/ConditionalOps.java b/src/main/java/net/neoforged/neoforge/common/conditions/ConditionalOps.java index ed18b15009e..91904084739 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/ConditionalOps.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/ConditionalOps.java @@ -23,14 +23,6 @@ * This allows getting the {@link ICondition.IContext} while decoding an entry from within a codec. */ public class ConditionalOps extends RegistryOps { - /** - * @deprecated Use the constructor directly - */ - @Deprecated(forRemoval = true, since = "1.20.4") - public static ConditionalOps create(RegistryOps ops, ICondition.IContext context) { - return new ConditionalOps(ops, context); - } - private final ICondition.IContext context; public ConditionalOps(RegistryOps ops, ICondition.IContext context) { diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/FalseCondition.java b/src/main/java/net/neoforged/neoforge/common/conditions/FalseCondition.java index 594e0b77047..6410e2b8aa3 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/FalseCondition.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/FalseCondition.java @@ -5,13 +5,12 @@ package net.neoforged.neoforge.common.conditions; -import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; public final class FalseCondition implements ICondition { public static final FalseCondition INSTANCE = new FalseCondition(); - public static final Codec CODEC = MapCodec.unit(INSTANCE).stable().codec(); + public static final MapCodec CODEC = MapCodec.unit(INSTANCE).stable(); private FalseCondition() {} @@ -21,7 +20,7 @@ public boolean test(IContext condition) { } @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/ICondition.java b/src/main/java/net/neoforged/neoforge/common/conditions/ICondition.java index 9a0432a52e5..04e0ff5f025 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/ICondition.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/ICondition.java @@ -11,6 +11,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.DynamicOps; import com.mojang.serialization.JsonOps; +import com.mojang.serialization.MapCodec; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -18,7 +19,6 @@ import java.util.Optional; import java.util.Set; import java.util.function.Function; -import net.minecraft.Util; import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; import net.minecraft.core.Registry; @@ -39,11 +39,11 @@ static Optional getConditionally(Codec codec, DynamicOps ops, V } static Optional getWithConditionalCodec(Codec> codec, DynamicOps ops, V element) { - return Util.getOrThrow(codec.parse(ops, element), JsonParseException::new); + return codec.parse(ops, element).getOrThrow(JsonParseException::new); } static Optional getWithWithConditionsCodec(Codec>> codec, DynamicOps ops, V elements) { - return Util.getOrThrow(codec.parse(ops, elements).promotePartial((m) -> {}), JsonParseException::new).map(WithConditions::carrier); + return codec.parse(ops, elements).promotePartial((m) -> {}).getOrThrow(JsonParseException::new).map(WithConditions::carrier); } static boolean conditionsMatched(DynamicOps ops, V element) { @@ -78,7 +78,7 @@ static void writeConditions(DynamicOps jsonOps, JsonObject jsonObje boolean test(IContext context); - Codec codec(); + MapCodec codec(); interface IContext { IContext EMPTY = new IContext() { diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/ItemExistsCondition.java b/src/main/java/net/neoforged/neoforge/common/conditions/ItemExistsCondition.java index ee1f35146a4..3b566207812 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/ItemExistsCondition.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/ItemExistsCondition.java @@ -5,13 +5,13 @@ package net.neoforged.neoforge.common.conditions; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; public class ItemExistsCondition implements ICondition { - public static Codec CODEC = RecordCodecBuilder.create( + public static MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( ResourceLocation.CODEC.fieldOf("item").forGetter(ItemExistsCondition::getItem)) @@ -37,7 +37,7 @@ public boolean test(IContext context) { } @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/ModLoadedCondition.java b/src/main/java/net/neoforged/neoforge/common/conditions/ModLoadedCondition.java index bf0913da46f..58bbd2460e2 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/ModLoadedCondition.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/ModLoadedCondition.java @@ -6,11 +6,12 @@ package net.neoforged.neoforge.common.conditions; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.neoforged.fml.ModList; public record ModLoadedCondition(String modid) implements ICondition { - public static Codec CODEC = RecordCodecBuilder.create( + public static MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( Codec.STRING.fieldOf("modid").forGetter(ModLoadedCondition::modid)) @@ -22,7 +23,7 @@ public boolean test(IContext context) { } @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/NotCondition.java b/src/main/java/net/neoforged/neoforge/common/conditions/NotCondition.java index 2ed9ca50e08..cdcd5f4f1cb 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/NotCondition.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/NotCondition.java @@ -5,11 +5,11 @@ package net.neoforged.neoforge.common.conditions; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; public record NotCondition(ICondition value) implements ICondition { - public static final Codec CODEC = RecordCodecBuilder.create( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( ICondition.CODEC.fieldOf("value").forGetter(NotCondition::value)) @@ -21,7 +21,7 @@ public boolean test(IContext context) { } @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/OrCondition.java b/src/main/java/net/neoforged/neoforge/common/conditions/OrCondition.java index c256b624eba..767bd24a9d9 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/OrCondition.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/OrCondition.java @@ -6,12 +6,12 @@ package net.neoforged.neoforge.common.conditions; import com.google.common.base.Joiner; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.util.List; public record OrCondition(List values) implements ICondition { - public static final Codec CODEC = RecordCodecBuilder.create( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( LIST_CODEC.fieldOf("values").forGetter(OrCondition::values)) @@ -28,7 +28,7 @@ public boolean test(IContext context) { } @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/TagEmptyCondition.java b/src/main/java/net/neoforged/neoforge/common/conditions/TagEmptyCondition.java index 64cc28efb06..dc9fdcf0911 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/TagEmptyCondition.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/TagEmptyCondition.java @@ -5,7 +5,7 @@ package net.neoforged.neoforge.common.conditions; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; @@ -13,7 +13,7 @@ import net.minecraft.world.item.Item; public record TagEmptyCondition(TagKey tag) implements ICondition { - public static final Codec CODEC = RecordCodecBuilder.create( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( ResourceLocation.CODEC.xmap(loc -> TagKey.create(Registries.ITEM, loc), TagKey::location).fieldOf("tag").forGetter(TagEmptyCondition::tag)) @@ -37,7 +37,7 @@ public boolean test(ICondition.IContext context) { } @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } diff --git a/src/main/java/net/neoforged/neoforge/common/conditions/TrueCondition.java b/src/main/java/net/neoforged/neoforge/common/conditions/TrueCondition.java index b2b39ed19e7..2b93aa46fcc 100644 --- a/src/main/java/net/neoforged/neoforge/common/conditions/TrueCondition.java +++ b/src/main/java/net/neoforged/neoforge/common/conditions/TrueCondition.java @@ -5,13 +5,12 @@ package net.neoforged.neoforge.common.conditions; -import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; public final class TrueCondition implements ICondition { public static final TrueCondition INSTANCE = new TrueCondition(); - public static Codec CODEC = MapCodec.unit(INSTANCE).stable().codec(); + public static MapCodec CODEC = MapCodec.unit(INSTANCE).stable(); private TrueCondition() {} @@ -21,7 +20,7 @@ public boolean test(IContext context) { } @Override - public Codec codec() { + public MapCodec codec() { return CODEC; } diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/ChildBasedIngredient.java b/src/main/java/net/neoforged/neoforge/common/crafting/ChildBasedIngredient.java deleted file mode 100644 index 39e85f43cd2..00000000000 --- a/src/main/java/net/neoforged/neoforge/common/crafting/ChildBasedIngredient.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.common.crafting; - -import java.util.Collections; -import java.util.List; -import java.util.function.Supplier; -import java.util.stream.Stream; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; -import org.jetbrains.annotations.Nullable; - -/** Intermediary class for easing handling of ingredients that make use of multiple children */ -public abstract class ChildBasedIngredient extends Ingredient { - protected final List children; - private final boolean isSimple; - private final boolean synchronizeWithContents; - - @Nullable - private ItemStack[] filteredMatchingStacks; - - protected ChildBasedIngredient(Stream values, Supplier> type, List children) { - super(values, type); - this.children = Collections.unmodifiableList(children); - this.isSimple = children.stream().allMatch(Ingredient::isSimple); - this.synchronizeWithContents = children.stream().anyMatch(Ingredient::synchronizeWithContents); - } - - protected abstract Stream generateMatchingStacks(); - - protected abstract boolean testComplex(@Nullable ItemStack stack); - - @Override - public final ItemStack[] getItems() { - if (synchronizeWithContents() && isSimple()) { - return super.getItems(); - } - - if (this.filteredMatchingStacks == null) { - this.filteredMatchingStacks = generateMatchingStacks() - .distinct()//Mimic super that calls distinct on the stacks - .toArray(ItemStack[]::new); - } - return this.filteredMatchingStacks; - } - - @Override - public final boolean test(@Nullable ItemStack stack) { - return synchronizeWithContents() && isSimple() ? super.test(stack) : testComplex(stack); - } - - @Override - public final boolean isSimple() { - return isSimple; - } - - @Override - public final boolean synchronizeWithContents() { - return synchronizeWithContents; - } - - public final List getChildren() { - return this.children; - } -} diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/CompoundIngredient.java b/src/main/java/net/neoforged/neoforge/common/crafting/CompoundIngredient.java index d0094bc2b07..84ada5514e1 100644 --- a/src/main/java/net/neoforged/neoforge/common/crafting/CompoundIngredient.java +++ b/src/main/java/net/neoforged/neoforge/common/crafting/CompoundIngredient.java @@ -1,56 +1,67 @@ /* - * Copyright (c) Forge Development LLC and contributors + * Copyright (c) NeoForged and contributors * SPDX-License-Identifier: LGPL-2.1-only */ package net.neoforged.neoforge.common.crafting; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import java.util.Arrays; -import java.util.Collection; import java.util.List; import java.util.stream.Stream; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; import net.neoforged.neoforge.common.NeoForgeMod; import net.neoforged.neoforge.common.util.NeoForgeExtraCodecs; -import org.jetbrains.annotations.Nullable; /** Ingredient that matches if any of the child ingredients match */ -public class CompoundIngredient extends ChildBasedIngredient { - public static final Codec CODEC = NeoForgeExtraCodecs.aliasedFieldOf(Ingredient.LIST_CODEC, "children", "ingredients").xmap(CompoundIngredient::new, ChildBasedIngredient::getChildren).codec(); - public static final Codec DIRECT_CODEC = Ingredient.LIST_CODEC.xmap(CompoundIngredient::new, ChildBasedIngredient::getChildren); - public static final Codec CODEC_NONEMPTY = NeoForgeExtraCodecs.aliasedFieldOf(Ingredient.LIST_CODEC_NONEMPTY, "children", "ingredients").xmap(CompoundIngredient::new, ChildBasedIngredient::getChildren).codec(); - public static final Codec DIRECT_CODEC_NONEMPTY = Ingredient.LIST_CODEC_NONEMPTY.xmap(CompoundIngredient::new, ChildBasedIngredient::getChildren); - - protected CompoundIngredient(List children) { - super(children.stream().map(Value::new), NeoForgeMod.COMPOUND_INGREDIENT_TYPE, children); +public record CompoundIngredient(List children) implements ICustomIngredient { + public CompoundIngredient { + if (children.isEmpty()) { + // Empty ingredients are always represented as Ingredient.EMPTY. + throw new IllegalArgumentException("Compound ingredient must have at least one child"); + } } + public static final MapCodec CODEC = NeoForgeExtraCodecs.aliasedFieldOf(Ingredient.LIST_CODEC_NONEMPTY, "children", "ingredients").xmap(CompoundIngredient::new, CompoundIngredient::children); + /** Creates a compound ingredient from the given list of ingredients */ public static Ingredient of(Ingredient... children) { if (children.length == 0) - return of(); + return Ingredient.EMPTY; if (children.length == 1) return children[0]; - return new CompoundIngredient(List.of(children)); + return new CompoundIngredient(List.of(children)).toVanilla(); } @Override - protected Stream generateMatchingStacks() { + public Stream getItems() { return children.stream().flatMap(child -> Arrays.stream(child.getItems())); } @Override - protected boolean testComplex(@Nullable ItemStack stack) { - return children.stream().anyMatch(i -> i.test(stack)); + public boolean test(ItemStack stack) { + for (var child : children) { + if (child.test(stack)) { + return true; + } + } + return false; } - private record Value(Ingredient inner) implements Ingredient.Value { - @Override - public Collection getItems() { - return List.of(inner.getItems()); + @Override + public boolean isSimple() { + for (var child : children) { + if (!child.isSimple()) { + return false; + } } + return true; + } + + @Override + public IngredientType getType() { + return NeoForgeMod.COMPOUND_INGREDIENT_TYPE.get(); } } diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/CraftingHelper.java b/src/main/java/net/neoforged/neoforge/common/crafting/CraftingHelper.java index 1fd381d30fe..e89e5480983 100644 --- a/src/main/java/net/neoforged/neoforge/common/crafting/CraftingHelper.java +++ b/src/main/java/net/neoforged/neoforge/common/crafting/CraftingHelper.java @@ -8,81 +8,59 @@ import com.mojang.datafixers.util.Either; import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; -import java.util.function.Function; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.TagParser; -import net.minecraft.util.ExtraCodecs; -import net.minecraft.world.item.ItemStack; +import com.mojang.serialization.MapCodec; +import java.util.stream.Stream; import net.minecraft.world.item.crafting.Ingredient; -import net.neoforged.neoforge.common.NeoForgeMod; import net.neoforged.neoforge.common.util.NeoForgeExtraCodecs; import net.neoforged.neoforge.registries.NeoForgeRegistries; import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.Nullable; +@ApiStatus.Internal public class CraftingHelper { - public static final Codec TAG_CODEC = ExtraCodecs.withAlternative(TagParser.AS_CODEC, net.minecraft.nbt.CompoundTag.CODEC); - - @ApiStatus.Internal - public static Codec smeltingResultCodec() { - return ExtraCodecs - .either( - BuiltInRegistries.ITEM.byNameCodec(), - ItemStack.ITEM_WITH_COUNT_CODEC) - .xmap( - either -> either.map(ItemStack::new, Function.identity()), - stack -> { - if (stack.getCount() != 1) { - return Either.right(stack); - } - - var tagForWriting = getTagForWriting(stack); - var attachments = stack.serializeAttachments(); - return tagForWriting == null && attachments == null ? Either.left(stack.getItem()) : Either.right(stack); - }); - } - - @Nullable - public static CompoundTag getTagForWriting(ItemStack stack) { - // Check if not writing the NBT would still give the correct item. - // Just checking for tag != null is not enough: damageable items get a tag set in the stack constructor, - // but we don't want to write it to the recipe file. - if (stack.getTag() == null || stack.getTag().equals(new ItemStack(stack.getItem(), stack.getCount()).getTag())) { - return null; - } else { - return stack.getTag(); - } - } - - @ApiStatus.Internal - public static Codec makeIngredientCodec(boolean allowEmpty, Codec vanillaCodec) { - var compoundIngredientCodec = ExtraCodecs.lazyInitializedCodec(() -> allowEmpty ? CompoundIngredient.DIRECT_CODEC : CompoundIngredient.DIRECT_CODEC_NONEMPTY); - return NeoForgeExtraCodecs.withAlternative( - // Compound ingredient handling - compoundIngredientCodec.flatComapMap( - Function.identity(), - i -> i instanceof CompoundIngredient c ? DataResult.success(c) : DataResult.error(() -> "Not a compound ingredient")), - // Otherwise choose between custom and vanilla - makeIngredientCodec0(allowEmpty, vanillaCodec)); + public static Codec makeIngredientCodec(boolean allowEmpty) { + var listCodec = Codec.lazyInitialized(() -> allowEmpty ? Ingredient.LIST_CODEC : Ingredient.LIST_CODEC_NONEMPTY); + return Codec.either(listCodec, makeIngredientMapCodec().codec()) + .xmap(either -> either.map(list -> { + // Use CompoundIngredient.of(...) to convert empty ingredients to Ingredient.EMPTY + return CompoundIngredient.of(list.toArray(Ingredient[]::new)); + }, i -> i), ingredient -> { + if (ingredient.isCustom()) { + if (ingredient.getCustomIngredient() instanceof CompoundIngredient compound) { + // Use [] syntax for CompoundIngredients. + return Either.left(compound.children()); + } + } else if (ingredient.getValues().length != 1) { + // Use [] syntax for vanilla ingredients that either 0 or 2+ values. + return Either.left(Stream.of(ingredient.getValues()).map(v -> Ingredient.fromValues(Stream.of(v))).toList()); + } + // Else use {} syntax. + return Either.right(ingredient); + }); } - // Choose between dispatch codec for custom ingredients and vanilla codec - private static Codec makeIngredientCodec0(boolean allowEmpty, Codec vanillaCodec) { - // Dispatch codec for custom ingredient types: - Codec dispatchCodec = NeoForgeRegistries.INGREDIENT_TYPES.byNameCodec() - .dispatch(Ingredient::getType, ingredientType -> ingredientType.codec(allowEmpty)); - // Either codec to combine with the vanilla ingredient codec: - Codec> eitherCodec = ExtraCodecs.either( - dispatchCodec, - vanillaCodec); - return eitherCodec.xmap(either -> either.map(i -> i, i -> i), ingredient -> { - // Prefer writing without the "type" field if possible: - if (ingredient.getType() == NeoForgeMod.VANILLA_INGREDIENT_TYPE.get()) { - return Either.right(ingredient); - } else { - return Either.left(ingredient); - } - }); + public static MapCodec makeIngredientMapCodec() { + // Dispatch codec for custom ingredient types, else fallback to vanilla ingredient codec. + return NeoForgeExtraCodecs., ICustomIngredient, Ingredient.Value>dispatchMapOrElse( + NeoForgeRegistries.INGREDIENT_TYPES.byNameCodec(), + ICustomIngredient::getType, + IngredientType::codec, + Ingredient.Value.MAP_CODEC) + .xmap(either -> either.map(ICustomIngredient::toVanilla, v -> Ingredient.fromValues(Stream.of(v))), ingredient -> { + if (!ingredient.isCustom()) { + var values = ingredient.getValues(); + if (values.length == 1) { + return Either.right(values[0]); + } + // Convert vanilla ingredients with 2+ values to a CompoundIngredient. Empty ingredients are not allowed here. + return Either.left(new CompoundIngredient(Stream.of(ingredient.getValues()).map(v -> Ingredient.fromValues(Stream.of(v))).toList())); + } + return Either.left(ingredient.getCustomIngredient()); + }) + .validate(ingredient -> { + if (!ingredient.isCustom() && ingredient.getValues().length == 0) { + return DataResult.error(() -> "Cannot serialize empty ingredient using the map codec"); + } + return DataResult.success(ingredient); + }); } } diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/DataComponentIngredient.java b/src/main/java/net/neoforged/neoforge/common/crafting/DataComponentIngredient.java new file mode 100644 index 00000000000..c3565ff7342 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/crafting/DataComponentIngredient.java @@ -0,0 +1,160 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.common.crafting; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.Arrays; +import java.util.function.Supplier; +import java.util.stream.Stream; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderSet; +import net.minecraft.core.component.DataComponentMap; +import net.minecraft.core.component.DataComponentPredicate; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.HolderSetCodec; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.ItemLike; +import net.neoforged.neoforge.common.NeoForgeMod; + +/** + * Ingredient that matches the given items, performing either a {@link DataComponentIngredient#isStrict() strict} or a partial NBT test. + *

+ * Strict NBT ingredients will only match items that have exactly the provided tag, while partial ones will + * match if the item's tags contain all of the elements of the provided one, while allowing for additional elements to exist. + */ +public class DataComponentIngredient implements ICustomIngredient { + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + builder -> builder + .group( + HolderSetCodec.create(Registries.ITEM, BuiltInRegistries.ITEM.holderByNameCodec(), false).fieldOf("items").forGetter(DataComponentIngredient::items), + DataComponentPredicate.CODEC.fieldOf("components").forGetter(DataComponentIngredient::components), + Codec.BOOL.optionalFieldOf("strict", false).forGetter(DataComponentIngredient::isStrict)) + .apply(builder, DataComponentIngredient::new)); + + private final HolderSet items; + private final DataComponentPredicate components; + private final boolean strict; + private final ItemStack[] stacks; + + public DataComponentIngredient(HolderSet items, DataComponentPredicate components, boolean strict) { + this.items = items; + this.components = components; + this.strict = strict; + this.stacks = items.stream() + .map(i -> new ItemStack(i, 1, components.asPatch())) + .toArray(ItemStack[]::new); + } + + @Override + public boolean test(ItemStack stack) { + if (strict) { + for (ItemStack stack2 : this.stacks) { + if (ItemStack.matches(stack, stack2)) return true; + } + return false; + } else { + return this.items.contains(stack.getItemHolder()) && this.components.test(stack); + } + } + + @Override + public Stream getItems() { + return Stream.of(stacks); + } + + @Override + public boolean isSimple() { + return false; + } + + @Override + public IngredientType getType() { + return NeoForgeMod.DATA_COMPONENT_INGREDIENT_TYPE.get(); + } + + public HolderSet items() { + return items; + } + + public DataComponentPredicate components() { + return components; + } + + public boolean isStrict() { + return strict; + } + + /** + * Creates a new ingredient matching the given item, containing the given components + */ + public static Ingredient of(boolean strict, ItemStack stack) { + return of(strict, stack.getComponents(), stack.getItem()); + } + + /** + * Creates a new ingredient matching any item from the list, containing the given components + */ + public static Ingredient of(boolean strict, DataComponentType type, T value, ItemLike... items) { + return of(strict, DataComponentPredicate.builder().expect(type, value).build(), items); + } + + /** + * Creates a new ingredient matching any item from the list, containing the given components + */ + public static Ingredient of(boolean strict, Supplier> type, T value, ItemLike... items) { + return of(strict, type.get(), value, items); + } + + /** + * Creates a new ingredient matching any item from the list, containing the given components + */ + public static Ingredient of(boolean strict, DataComponentMap map, ItemLike... items) { + return of(strict, DataComponentPredicate.allOf(map), items); + } + + /** + * Creates a new ingredient matching any item from the list, containing the given components + */ + @SafeVarargs + public static Ingredient of(boolean strict, DataComponentMap map, Holder... items) { + return of(strict, DataComponentPredicate.allOf(map), items); + } + + /** + * Creates a new ingredient matching any item from the list, containing the given components + */ + public static Ingredient of(boolean strict, DataComponentMap map, HolderSet items) { + return of(strict, DataComponentPredicate.allOf(map), items); + } + + /** + * Creates a new ingredient matching any item from the list, containing the given components + */ + @SafeVarargs + public static Ingredient of(boolean strict, DataComponentPredicate predicate, Holder... items) { + return of(strict, predicate, HolderSet.direct(items)); + } + + /** + * Creates a new ingredient matching any item from the list, containing the given components + */ + public static Ingredient of(boolean strict, DataComponentPredicate predicate, ItemLike... items) { + return of(strict, predicate, HolderSet.direct(Arrays.stream(items).map(ItemLike::asItem).map(Item::builtInRegistryHolder).toList())); + } + + /** + * Creates a new ingredient matching any item from the list, containing the given components + */ + public static Ingredient of(boolean strict, DataComponentPredicate predicate, HolderSet items) { + return new DataComponentIngredient(items, predicate, strict).toVanilla(); + } +} diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/DifferenceIngredient.java b/src/main/java/net/neoforged/neoforge/common/crafting/DifferenceIngredient.java index 84ed4753c69..2fed470d180 100644 --- a/src/main/java/net/neoforged/neoforge/common/crafting/DifferenceIngredient.java +++ b/src/main/java/net/neoforged/neoforge/common/crafting/DifferenceIngredient.java @@ -5,59 +5,40 @@ package net.neoforged.neoforge.common.crafting; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; import java.util.stream.Stream; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; import net.neoforged.neoforge.common.NeoForgeMod; -import org.jetbrains.annotations.Nullable; /** Ingredient that matches everything from the first ingredient that is not included in the second ingredient */ -public class DifferenceIngredient extends ChildBasedIngredient { - public static final Codec CODEC = RecordCodecBuilder.create( +public record DifferenceIngredient(Ingredient base, Ingredient subtracted) implements ICustomIngredient { + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( - Ingredient.CODEC.fieldOf("base").forGetter(DifferenceIngredient::getBase), - Ingredient.CODEC.fieldOf("subtracted").forGetter(DifferenceIngredient::getSubtracted)) + Ingredient.CODEC.fieldOf("base").forGetter(DifferenceIngredient::base), + Ingredient.CODEC.fieldOf("subtracted").forGetter(DifferenceIngredient::subtracted)) .apply(builder, DifferenceIngredient::new)); - public static final Codec CODEC_NONEMPTY = RecordCodecBuilder.create( - builder -> builder - .group( - Ingredient.CODEC_NONEMPTY.fieldOf("base").forGetter(DifferenceIngredient::getBase), - Ingredient.CODEC_NONEMPTY.fieldOf("subtracted").forGetter(DifferenceIngredient::getSubtracted)) - .apply(builder, DifferenceIngredient::new)); - - private final Ingredient base; - private final Ingredient subtracted; - - protected DifferenceIngredient(Ingredient base, Ingredient subtracted) { - super(Arrays.stream(base.getValues()).map(value -> new SubtractingValue(value, subtracted)), NeoForgeMod.DIFFERENCE_INGREDIENT_TYPE, List.of(base, subtracted)); - - this.base = base; - this.subtracted = subtracted; - } - - public Ingredient getBase() { - return base; + @Override + public Stream getItems() { + return Stream.of(base.getItems()).filter(subtracted.negate()); } - public Ingredient getSubtracted() { - return subtracted; + @Override + public boolean test(ItemStack stack) { + return base.test(stack) && !subtracted.test(stack); } @Override - protected Stream generateMatchingStacks() { - return Arrays.stream(base.getItems()).filter(subtracted.negate()); + public boolean isSimple() { + return base.isSimple() && subtracted.isSimple(); } @Override - protected boolean testComplex(@Nullable ItemStack stack) { - return base.test(stack) && !subtracted.test(stack); + public IngredientType getType() { + return NeoForgeMod.DIFFERENCE_INGREDIENT_TYPE.get(); } /** @@ -67,14 +48,7 @@ protected boolean testComplex(@Nullable ItemStack stack) { * @param subtracted Ingredient the item must not match * @return Ingredient that {@code base} anything in base that is not in {@code subtracted} */ - public static DifferenceIngredient of(Ingredient base, Ingredient subtracted) { - return new DifferenceIngredient(base, subtracted); - } - - private record SubtractingValue(Value inner, Ingredient subtracted) implements Ingredient.Value { - @Override - public Collection getItems() { - return inner().getItems().stream().filter(subtracted.negate()).toList(); - } + public static Ingredient of(Ingredient base, Ingredient subtracted) { + return new DifferenceIngredient(base, subtracted).toVanilla(); } } diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/ICustomIngredient.java b/src/main/java/net/neoforged/neoforge/common/crafting/ICustomIngredient.java new file mode 100644 index 00000000000..dc213aee674 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/crafting/ICustomIngredient.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.common.crafting; + +import java.util.stream.Stream; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.neoforged.neoforge.registries.NeoForgeRegistries; +import org.jetbrains.annotations.ApiStatus; + +/** + * Interface that modders can implement to create new behaviors for {@link Ingredient}s. + * + *

This is not directly implemented on vanilla {@link Ingredient}s, but conversions are possible: + *

    + *
  • {@link #toVanilla()} converts a custom ingredient to a vanilla {@link Ingredient}.
  • + *
  • {@link Ingredient#getCustomIngredient()} retrieves the custom ingredient inside a vanilla {@link Ingredient}.
  • + *
+ * + *

Implementations of this interface must implement {@link Object#equals} and {@link Object#hashCode} + * to ensure that the ingredient also supports them. + */ +public interface ICustomIngredient { + /** + * Checks if a stack matches this ingredient. + * The stack must not be modified in any way. + * + * @param stack the stack to test + * @return {@code true} if the stack matches this ingredient, {@code false} otherwise + */ + boolean test(ItemStack stack); + + /** + * {@return the list of stacks that this ingredient accepts} + * + *

The following guidelines should be followed for good compatibility: + *

    + *
  • These stacks are generally used for display purposes, and need not be exhaustive or perfectly accurate.
  • + *
  • An exception is ingredients that {@linkplain #isSimple() are simple}, + * for which it is important that the returned stacks correspond exactly to all the accepted {@link Item}s.
  • + *
  • At least one stack must be returned for the ingredient not to be considered {@linkplain Ingredient#hasNoItems() accidentally empty}.
  • + *
  • The ingredient should try to return at least one stack with each accepted {@link Item}. + * This allows mods that inspect the ingredient to figure out which stacks it might accept.
  • + *
+ * + *

Note: no caching needs to be done by the implementation, this is already handled by the ingredient itself. + */ + Stream getItems(); + + /** + * Returns whether this ingredient always requires {@linkplain #test direct stack testing}. + * + * @return {@code true} if this ingredient ignores NBT data when matching stacks, {@code false} otherwise + * @see Ingredient#isSimple() + */ + boolean isSimple(); + + /** + * {@return the type of this ingredient} + * + *

The type must be registered to {@link NeoForgeRegistries#INGREDIENT_TYPES}. + */ + IngredientType getType(); + + /** + * {@return a new {@link Ingredient} behaving as defined by this custom ingredient} + */ + @ApiStatus.NonExtendable + default Ingredient toVanilla() { + return new Ingredient(this); + } +} diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/IShapedRecipe.java b/src/main/java/net/neoforged/neoforge/common/crafting/IShapedRecipe.java index e546bf276a2..cd2fd333a2c 100644 --- a/src/main/java/net/neoforged/neoforge/common/crafting/IShapedRecipe.java +++ b/src/main/java/net/neoforged/neoforge/common/crafting/IShapedRecipe.java @@ -14,7 +14,7 @@ * Note: These methods can't be named 'getHeight' or 'getWidth' due to obfusication issues. */ public interface IShapedRecipe extends Recipe { - int getRecipeWidth(); + int getWidth(); - int getRecipeHeight(); + int getHeight(); } diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/IngredientType.java b/src/main/java/net/neoforged/neoforge/common/crafting/IngredientType.java index 243a5f83d7e..c8b21c56d41 100644 --- a/src/main/java/net/neoforged/neoforge/common/crafting/IngredientType.java +++ b/src/main/java/net/neoforged/neoforge/common/crafting/IngredientType.java @@ -5,27 +5,21 @@ package net.neoforged.neoforge.common.crafting; -import com.mojang.serialization.Codec; -import net.minecraft.world.item.crafting.Ingredient; +import com.mojang.serialization.MapCodec; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; /** - * An ingredient type encapsulates the codecs to serialize and deserialize an ingredient. - *

- * {@code codec} allows ingredients that are known to be empty at deserialization time, - * whereas {@code nonEmptyCodec} does not. + * An ingredient type encapsulates the codecs to serialize and deserialize a custom ingredient. + * + *

Note that the {@link #streamCodec()} is only used if {@link ICustomIngredient#isSimple()} returns {@code false}. */ -public record IngredientType(Codec codec, Codec nonEmptyCodec) { +public record IngredientType(MapCodec codec, StreamCodec streamCodec) { /** - * Constructor for ingredient types that have the same codec for empty and non-empty serialization. + * Constructor for ingredient types that use a regular codec for network syncing. */ - public IngredientType(Codec nonEmptyCodec) { - this(nonEmptyCodec, nonEmptyCodec); - } - - /** - * Returns the right codec for this ingredient type based on {@code allowEmpty}. - */ - public Codec codec(boolean allowEmpty) { - return allowEmpty ? codec : nonEmptyCodec; + public IngredientType(MapCodec codec) { + this(codec, ByteBufCodecs.fromCodecWithRegistries(codec.codec())); } } diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/IntersectionIngredient.java b/src/main/java/net/neoforged/neoforge/common/crafting/IntersectionIngredient.java index 95eae2813df..7f3678822b6 100644 --- a/src/main/java/net/neoforged/neoforge/common/crafting/IntersectionIngredient.java +++ b/src/main/java/net/neoforged/neoforge/common/crafting/IntersectionIngredient.java @@ -5,41 +5,29 @@ package net.neoforged.neoforge.common.crafting; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import java.util.ArrayList; import java.util.Arrays; -import java.util.Collection; import java.util.List; import java.util.stream.Stream; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; import net.neoforged.neoforge.common.NeoForgeMod; -import org.jetbrains.annotations.Nullable; /** Ingredient that matches if all child ingredients match */ -public class IntersectionIngredient extends ChildBasedIngredient { - public static final Codec CODEC = RecordCodecBuilder.create( - builder -> builder - .group( - Ingredient.LIST_CODEC.fieldOf("children").forGetter(ChildBasedIngredient::getChildren)) - .apply(builder, IntersectionIngredient::new)); +public record IntersectionIngredient(List children) implements ICustomIngredient { + public IntersectionIngredient { + if (children.isEmpty()) { + throw new IllegalArgumentException("Cannot create an IntersectionIngredient with no children, use Ingredient.of() to create an empty ingredient"); + } + } - public static final Codec CODEC_NONEMPTY = RecordCodecBuilder.create( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( builder -> builder .group( - Ingredient.LIST_CODEC_NONEMPTY.fieldOf("children").forGetter(ChildBasedIngredient::getChildren)) + Ingredient.LIST_CODEC_NONEMPTY.fieldOf("children").forGetter(IntersectionIngredient::children)) .apply(builder, IntersectionIngredient::new)); - protected IntersectionIngredient(List children) { - super(children.stream().flatMap(ingredient -> Arrays.stream(ingredient.getValues()).map(value -> { - final List matchers = new ArrayList<>(children); - matchers.remove(ingredient); - - return new IntersectionValue(value, matchers); - })), NeoForgeMod.INTERSECTION_INGREDIENT_TYPE, children); - } - /** * Gets an intersection ingredient * @@ -52,27 +40,38 @@ public static Ingredient of(Ingredient... ingredients) { if (ingredients.length == 1) return ingredients[0]; - return new IntersectionIngredient(Arrays.asList(ingredients)); + return new IntersectionIngredient(Arrays.asList(ingredients)).toVanilla(); + } + + @Override + public boolean test(ItemStack stack) { + for (var child : children) { + if (!child.test(stack)) { + return false; + } + } + return true; } @Override - protected Stream generateMatchingStacks() { + public Stream getItems() { return children.stream() .flatMap(child -> Arrays.stream(child.getItems())) - .filter(this::testComplex); + .filter(this::test); } @Override - protected boolean testComplex(@Nullable ItemStack stack) { - return children.stream().allMatch(c -> c.test(stack)); + public boolean isSimple() { + for (var child : children) { + if (!child.isSimple()) { + return false; + } + } + return true; } - public record IntersectionValue(Value inner, List other) implements Ingredient.Value { - @Override - public Collection getItems() { - return inner().getItems().stream() - .filter(stack -> other().stream().allMatch(ingredient -> ingredient.test(stack))) - .toList(); - } + @Override + public IngredientType getType() { + return NeoForgeMod.INTERSECTION_INGREDIENT_TYPE.get(); } } diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/NBTIngredient.java b/src/main/java/net/neoforged/neoforge/common/crafting/NBTIngredient.java deleted file mode 100644 index 1d87afa8656..00000000000 --- a/src/main/java/net/neoforged/neoforge/common/crafting/NBTIngredient.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.neoforged.neoforge.common.crafting; - -import com.google.common.base.Preconditions; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import java.util.Arrays; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.NbtUtils; -import net.minecraft.util.ExtraCodecs; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.level.ItemLike; -import net.neoforged.neoforge.attachment.AttachmentHolder; -import net.neoforged.neoforge.common.NeoForgeMod; -import net.neoforged.neoforge.common.util.NeoForgeExtraCodecs; -import org.jetbrains.annotations.Nullable; - -/** - * Ingredient that matches the given items, performing either a {@link NBTIngredient#isStrict() strict} or a partial NBT test. - *

- * Strict NBT ingredients will only match items that have exactly the provided tag, while partial ones will - * match if the item's tags contain all of the elements of the provided one, while allowing for additional elements to exist. - */ -public class NBTIngredient extends Ingredient { - public static final Codec CODEC = RecordCodecBuilder.create( - builder -> builder - .group( - NeoForgeExtraCodecs.singularOrPluralCodec(BuiltInRegistries.ITEM.byNameCodec(), "item").forGetter(NBTIngredient::getContainedItems), - ExtraCodecs.strictOptionalField(CraftingHelper.TAG_CODEC, "tag").forGetter(NBTIngredient::getOptionalTag), - ExtraCodecs.strictOptionalField(CraftingHelper.TAG_CODEC, AttachmentHolder.ATTACHMENTS_NBT_KEY).forGetter(NBTIngredient::getAttachmentNbt), - Codec.BOOL.optionalFieldOf("strict", false).forGetter(NBTIngredient::isStrict)) - .apply(builder, NBTIngredient::new)); - - public static final Codec CODEC_NONEMPTY = RecordCodecBuilder.create( - builder -> builder - .group( - NeoForgeExtraCodecs.singularOrPluralCodecNotEmpty(BuiltInRegistries.ITEM.byNameCodec(), "item").forGetter(NBTIngredient::getContainedItems), - ExtraCodecs.strictOptionalField(CraftingHelper.TAG_CODEC, "tag").forGetter(NBTIngredient::getOptionalTag), - ExtraCodecs.strictOptionalField(CraftingHelper.TAG_CODEC, AttachmentHolder.ATTACHMENTS_NBT_KEY).forGetter(NBTIngredient::getAttachmentNbt), - Codec.BOOL.optionalFieldOf("strict", false).forGetter(NBTIngredient::isStrict)) - .apply(builder, NBTIngredient::new)); - - private final boolean strict; - - @Deprecated(forRemoval = true, since = "1.20.4") - protected NBTIngredient(Set items, CompoundTag tag, boolean strict) { - this(items, tag, null, strict); - } - - @SuppressWarnings("OptionalUsedAsFieldOrParameterType") - private NBTIngredient(Set items, Optional tag, Optional attachmentTag, boolean strict) { - this(items, tag.orElse(null), attachmentTag.orElse(null), strict); - } - - protected NBTIngredient(Set items, @Nullable CompoundTag tag, @Nullable CompoundTag attachmentTag, boolean strict) { - super(items.stream().map(item -> { - //Copy the attachment tag in case a modder mutates the tag they get passed when deserializing an attachment - ItemStack stack = new ItemStack(item, 1, attachmentTag == null ? null : attachmentTag.copy()); - // copy NBT to prevent the stack from modifying the original, as attachments or vanilla item durability will modify the tag - if (tag != null) { - stack.setTag(tag.copy()); - } - return new Ingredient.ItemValue(stack, strict ? ItemStack::matches : NBTIngredient::compareStacksWithNBT); - }), NeoForgeMod.NBT_INGREDIENT_TYPE); - Preconditions.checkArgument(!items.isEmpty(), "At least one item needs to be provided for a nbt matching ingredient"); - if (!strict) { - Preconditions.checkArgument(tag != null || attachmentTag != null, "Either nbt or attachment nbt needs to be provided for a non-strict nbt matching ingredient"); - } - this.strict = strict; - } - - @Override - protected boolean areStacksEqual(ItemStack left, ItemStack right) { - return strict ? ItemStack.matches(left, right) : compareStacksWithNBT(left, right); - } - - @Override - public boolean synchronizeWithContents() { - return false; - } - - private static boolean compareStacksWithNBT(ItemStack left, ItemStack right) { - return left.is(right.getItem()) && NbtUtils.compareNbt(left.getTag(), right.getTag(), true) && NbtUtils.compareNbt(left.serializeAttachments(), right.serializeAttachments(), true); - } - - /** - * Creates a new ingredient matching any item from the list, containing the given NBT - */ - public static NBTIngredient of(boolean strict, CompoundTag nbt, ItemLike... items) { - return of(strict, nbt, null, items); - } - - /** - * Creates a new ingredient matching any item from the list, containing the given NBT - */ - public static NBTIngredient of(boolean strict, @Nullable CompoundTag nbt, @Nullable CompoundTag attachmentNbt, ItemLike... items) { - return new NBTIngredient(Arrays.stream(items).map(ItemLike::asItem).collect(Collectors.toSet()), nbt, attachmentNbt, strict); - } - - /** - * Creates a new ingredient matching any item from the list, containing the given NBT - */ - public static NBTIngredient ofAttachment(boolean strict, CompoundTag attachmentNbt, ItemLike... items) { - return of(strict, null, attachmentNbt, items); - } - - /** - * Creates a new ingredient matching the given item, containing the given NBT - */ - public static NBTIngredient of(boolean strict, ItemStack stack) { - //TODO - 1.20.5: return of(strict, stack.getTag(), stack.serializeAttachments(), stack.getItem()); - CompoundTag attachmentNbt = stack.serializeAttachments(); - //Only force create a tag if there is no serializable attachments - CompoundTag nbt = attachmentNbt == null ? stack.getOrCreateTag() : stack.getTag(); - return new NBTIngredient(Set.of(stack.getItem()), nbt, attachmentNbt, strict); - } - - public Set getContainedItems() { - return Arrays.stream(getItems()).map(ItemStack::getItem).collect(Collectors.toSet()); - } - - public CompoundTag getTag() { - return getOptionalTag().orElseGet(CompoundTag::new); - } - - //TODO - 1.20.5: Replace getTag with this method and rename this to getTag - public Optional getOptionalTag() { - return getFirstItem().map(ItemStack::getTag); - } - - public Optional getAttachmentNbt() { - return getFirstItem().map(AttachmentHolder::serializeAttachments); - } - - private Optional getFirstItem() { - final ItemStack[] items = getItems(); - return items.length == 0 ? Optional.empty() : Optional.of(items[0]); - } - - @Override - public boolean isSimple() { - return false; - } - - public boolean isStrict() { - return strict; - } -} diff --git a/src/main/java/net/neoforged/neoforge/common/crafting/SizedIngredient.java b/src/main/java/net/neoforged/neoforge/common/crafting/SizedIngredient.java new file mode 100644 index 00000000000..f55e959612c --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/crafting/SizedIngredient.java @@ -0,0 +1,150 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.common.crafting; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import java.util.stream.Stream; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.tags.TagKey; +import net.minecraft.util.ExtraCodecs; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.ItemLike; +import net.neoforged.neoforge.common.util.NeoForgeExtraCodecs; +import org.jetbrains.annotations.Nullable; + +/** + * Standard implementation for an ingredient and a count. + * + *

{@link Ingredient} does not perform count checks, so this class is used to wrap an ingredient with a count, + * and provide a standard serialization format. + */ +public final class SizedIngredient { + /** + * The "flat" codec for {@link SizedIngredient}. + * + *

The count is serialized inline with the rest of the ingredient, for example: + * + *

{@code
+     * {
+     *     "item": "minecraft:apple",
+     *     "count": 3
+     * }
+     * }
+ * + * Array ingredients are serialized using the compound ingredient type: + * + *
{@code
+     * {
+     *     "type": "neoforge:compound",
+     *     "ingredients": [
+     *         { "item": "minecraft:coal" },
+     *         { "item": "minecraft:charcoal" }
+     *     ],
+     *     "count": 2
+     * }
+     * }
+ * + * See {@link Ingredient#MAP_CODEC_NONEMPTY} for details of the ingredient serialization. + */ + public static final Codec FLAT_CODEC = RecordCodecBuilder.create(instance -> instance.group( + Ingredient.MAP_CODEC_NONEMPTY.forGetter(SizedIngredient::ingredient), + NeoForgeExtraCodecs.optionalFieldAlwaysWrite(ExtraCodecs.POSITIVE_INT, "count", 1).forGetter(SizedIngredient::count)) + .apply(instance, SizedIngredient::new)); + + /** + * The "nested" codec for {@link SizedIngredient}. + * + *

The count is serialized separately from the rest of the ingredient, for example: + * + *

{@code
+     * {
+     *     "ingredient": {
+     *         "item": "minecraft:apple"
+     *     },
+     *     "count": 3
+     * }
+     * }
+ */ + public static final Codec NESTED_CODEC = RecordCodecBuilder.create(instance -> instance.group( + Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(SizedIngredient::ingredient), + NeoForgeExtraCodecs.optionalFieldAlwaysWrite(ExtraCodecs.POSITIVE_INT, "count", 1).forGetter(SizedIngredient::count)) + .apply(instance, SizedIngredient::new)); + + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + Ingredient.CONTENTS_STREAM_CODEC, + SizedIngredient::ingredient, + ByteBufCodecs.VAR_INT, + SizedIngredient::count, + SizedIngredient::new); + + /** + * Helper method to create a simple sized ingredient that matches a single item. + */ + public static SizedIngredient of(ItemLike item, int count) { + return new SizedIngredient(Ingredient.of(item), count); + } + + /** + * Helper method to create a simple sized ingredient that matches items in a tag. + */ + public static SizedIngredient of(TagKey tag, int count) { + return new SizedIngredient(Ingredient.of(tag), count); + } + + private final Ingredient ingredient; + private final int count; + @Nullable + private ItemStack[] cachedStacks; + + public SizedIngredient(Ingredient ingredient, int count) { + if (count <= 0) { + throw new IllegalArgumentException("Size must be positive"); + } + this.ingredient = ingredient; + this.count = count; + } + + public Ingredient ingredient() { + return ingredient; + } + + public int count() { + return count; + } + + /** + * Performs a size-sensitive test on the given stack. + * + * @return {@code true} if the stack matches the ingredient and has at least the required count. + */ + public boolean test(ItemStack stack) { + return ingredient.test(stack) && stack.getCount() >= count; + } + + /** + * Returns a list of the stacks from this {@link #ingredient}, with an updated {@link #count}. + * + * @implNote the array is cached and should not be modified, just like {@link Ingredient#getItems()}. + */ + public ItemStack[] getItems() { + if (cachedStacks == null) { + cachedStacks = Stream.of(ingredient.getItems()) + .map(s -> s.copyWithCount(count)) + .toArray(ItemStack[]::new); + } + return cachedStacks; + } + + @Override + public String toString() { + return count + "x " + ingredient; + } +} diff --git a/src/main/java/net/neoforged/neoforge/common/data/DataMapProvider.java b/src/main/java/net/neoforged/neoforge/common/data/DataMapProvider.java index 72051355ffc..feb26716cc9 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/DataMapProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/DataMapProvider.java @@ -76,7 +76,7 @@ public CompletableFuture run(CachedOutput cache) { private CompletableFuture generate(Path out, CachedOutput cache, Builder builder, DynamicOps ops) { return CompletableFuture.supplyAsync(() -> { final Codec>>> withConditionsCodec = ConditionalOps.createConditionalCodecWithConditions(DataMapFile.codec(builder.registryKey, builder.type)); - return withConditionsCodec.encodeStart(ops, Optional.of(builder.build())).getOrThrow(false, msg -> LOGGER.error("Failed to encode {}: {}", out, msg)); + return withConditionsCodec.encodeStart(ops, Optional.of(builder.build())).getOrThrow(msg -> new RuntimeException("Failed to encode %s: %s".formatted(out, msg))); }).thenComposeAsync(encoded -> DataProvider.saveStable(cache, encoded, out)); } diff --git a/src/main/java/net/neoforged/neoforge/common/data/EnchantmentTagsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/EnchantmentTagsProvider.java new file mode 100644 index 00000000000..4f0241f4ad3 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/data/EnchantmentTagsProvider.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.common.data; + +import java.util.concurrent.CompletableFuture; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.PackOutput; +import net.minecraft.data.tags.IntrinsicHolderTagsProvider; +import net.minecraft.world.item.enchantment.Enchantment; +import org.jetbrains.annotations.Nullable; + +public abstract class EnchantmentTagsProvider extends IntrinsicHolderTagsProvider { + @SuppressWarnings("deprecation") + public EnchantmentTagsProvider(PackOutput output, CompletableFuture lookupProvider, String modId, @Nullable ExistingFileHelper existingFileHelper) { + super(output, Registries.ENCHANTMENT, lookupProvider, enchantment -> BuiltInRegistries.ENCHANTMENT.getResourceKey(enchantment).orElseThrow(), modId, existingFileHelper); + } +} diff --git a/src/main/java/net/neoforged/neoforge/common/data/ExistingFileHelper.java b/src/main/java/net/neoforged/neoforge/common/data/ExistingFileHelper.java index da7f588e48b..d2028b73af7 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/ExistingFileHelper.java +++ b/src/main/java/net/neoforged/neoforge/common/data/ExistingFileHelper.java @@ -13,16 +13,20 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Optional; import java.util.Set; import net.minecraft.client.resources.ClientPackSource; import net.minecraft.client.resources.IndexedAssetSource; import net.minecraft.data.DataProvider; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.FilePackResources; +import net.minecraft.server.packs.PackLocationInfo; import net.minecraft.server.packs.PackResources; import net.minecraft.server.packs.PackType; import net.minecraft.server.packs.PathPackResources; import net.minecraft.server.packs.VanillaPackResources; +import net.minecraft.server.packs.repository.PackSource; import net.minecraft.server.packs.repository.ServerPacksSource; import net.minecraft.server.packs.resources.MultiPackResourceManager; import net.minecraft.server.packs.resources.Resource; @@ -107,7 +111,7 @@ public ExistingFileHelper(Collection existingPacks, final Set exis File file = existing.toFile(); if (!file.exists()) continue; - PackResources pack = file.isDirectory() ? new PathPackResources(file.getName(), file.toPath(), false) : new FilePackResources(file.getName(), new FilePackResources.SharedZipFileAccess(file), false, ""); + PackResources pack = file.isDirectory() ? new PathPackResources(new PackLocationInfo(file.getName(), Component.empty(), PackSource.BUILT_IN, Optional.empty()), file.toPath()) : new FilePackResources(new PackLocationInfo(file.getName(), Component.empty(), PackSource.BUILT_IN, Optional.empty()), new FilePackResources.SharedZipFileAccess(file), ""); candidateClientResources.add(pack); candidateServerResources.add(pack); } @@ -116,8 +120,8 @@ public ExistingFileHelper(Collection existingPacks, final Set exis if (modFileInfo != null) { // Only opens primary packs - overlays are not currently considered for datagen final String name = "mod:" + existingMod; - candidateClientResources.add(ResourcePackLoader.createPackForMod(modFileInfo).openPrimary(name)); - candidateServerResources.add(ResourcePackLoader.createPackForMod(modFileInfo).openPrimary(name)); + candidateClientResources.add(ResourcePackLoader.createPackForMod(modFileInfo).openPrimary(new PackLocationInfo(name, Component.empty(), PackSource.BUILT_IN, Optional.empty()))); + candidateServerResources.add(ResourcePackLoader.createPackForMod(modFileInfo).openPrimary(new PackLocationInfo(name, Component.empty(), PackSource.BUILT_IN, Optional.empty()))); } } diff --git a/src/main/java/net/neoforged/neoforge/common/data/GlobalLootModifierProvider.java b/src/main/java/net/neoforged/neoforge/common/data/GlobalLootModifierProvider.java index dcb2e243c7d..05b68917a7b 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/GlobalLootModifierProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/GlobalLootModifierProvider.java @@ -8,10 +8,7 @@ import com.google.common.collect.ImmutableList; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.mojang.serialization.JsonOps; -import cpw.mods.modlauncher.api.LamdbaExceptionUtils; import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; @@ -21,6 +18,7 @@ import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; +import net.minecraft.core.HolderLookup; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; @@ -38,12 +36,14 @@ public abstract class GlobalLootModifierProvider implements DataProvider { private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); private final PackOutput output; + private final CompletableFuture registries; private final String modid; - private final Map toSerialize = new HashMap<>(); + private final Map> toSerialize = new HashMap<>(); private boolean replace = false; - public GlobalLootModifierProvider(PackOutput output, String modid) { + public GlobalLootModifierProvider(PackOutput output, CompletableFuture registries, String modid) { this.output = output; + this.registries = registries; this.modid = modid; } @@ -60,7 +60,11 @@ protected void replacing() { protected abstract void start(); @Override - public CompletableFuture run(CachedOutput cache) { + public final CompletableFuture run(CachedOutput cache) { + return this.registries.thenCompose(registries -> this.run(cache, registries)); + } + + protected CompletableFuture run(CachedOutput cache, HolderLookup.Provider registries) { start(); Path forgePath = this.output.getOutputFolder(PackOutput.Target.DATA_PACK).resolve("neoforge").resolve("loot_modifiers").resolve("global_loot_modifiers.json"); @@ -69,11 +73,13 @@ public CompletableFuture run(CachedOutput cache) { ImmutableList.Builder> futuresBuilder = new ImmutableList.Builder<>(); - toSerialize.forEach(LamdbaExceptionUtils.rethrowBiConsumer((name, json) -> { + for (var entry : toSerialize.entrySet()) { + var name = entry.getKey(); + var lootModifier = entry.getValue(); entries.add(new ResourceLocation(modid, name)); Path modifierPath = modifierFolderPath.resolve(name + ".json"); - futuresBuilder.add(DataProvider.saveStable(cache, json, modifierPath)); - })); + futuresBuilder.add(DataProvider.saveStable(cache, registries, IGlobalLootModifier.CONDITIONAL_CODEC, Optional.of(lootModifier), modifierPath)); + } JsonObject forgeJson = new JsonObject(); forgeJson.addProperty("replace", this.replace); @@ -92,8 +98,7 @@ public CompletableFuture run(CachedOutput cache) { * @param conditions a list of conditions to add to the GLM file */ public void add(String modifier, T instance, List conditions) { - JsonElement json = IGlobalLootModifier.CONDITIONAL_CODEC.encodeStart(JsonOps.INSTANCE, Optional.of(new WithConditions<>(conditions, instance))).getOrThrow(false, s -> {}); - this.toSerialize.put(modifier, json); + this.toSerialize.put(modifier, new WithConditions<>(conditions, instance)); } /** diff --git a/src/main/java/net/neoforged/neoforge/common/data/JsonCodecProvider.java b/src/main/java/net/neoforged/neoforge/common/data/JsonCodecProvider.java index 5a0bd43c1f1..568fd674d9f 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/JsonCodecProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/JsonCodecProvider.java @@ -84,14 +84,14 @@ public CompletableFuture run(final CachedOutput cache) { gather(); return lookupProvider.thenCompose(provider -> { - final DynamicOps dynamicOps = ConditionalOps.create(RegistryOps.create(JsonOps.INSTANCE, provider), ICondition.IContext.EMPTY); + final DynamicOps dynamicOps = new ConditionalOps<>(RegistryOps.create(JsonOps.INSTANCE, provider), ICondition.IContext.EMPTY); this.conditions.forEach((id, withConditions) -> { final Path path = this.pathProvider.json(id); futuresBuilder.add(CompletableFuture.supplyAsync(() -> { final Codec>> withConditionsCodec = ConditionalOps.createConditionalCodecWithConditions(this.codec); - return withConditionsCodec.encodeStart(dynamicOps, Optional.of(withConditions)).getOrThrow(false, msg -> LOGGER.error("Failed to encode {}: {}", path, msg)); + return withConditionsCodec.encodeStart(dynamicOps, Optional.of(withConditions)).getOrThrow(msg -> new RuntimeException("Failed to encode %s: %s".formatted(path, msg))); }).thenComposeAsync(encoded -> DataProvider.saveStable(cache, encoded, path))); }); diff --git a/src/main/java/net/neoforged/neoforge/common/data/LanguageProvider.java b/src/main/java/net/neoforged/neoforge/common/data/LanguageProvider.java index 963065e50d3..e77645fca95 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/LanguageProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/LanguageProvider.java @@ -14,6 +14,8 @@ import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.Item; @@ -116,6 +118,26 @@ public void add(EntityType key, String name) { add(key.getDescriptionId(), name); } + public void addTag(Supplier> key, String name) { + add(key.get(), name); + } + + public void add(TagKey tagKey, String name) { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("tag."); + + ResourceLocation registryIdentifier = tagKey.registry().location(); + ResourceLocation tagResourceLocation = tagKey.location(); + + stringBuilder.append(registryIdentifier.toShortLanguageKey().replace("/", ".")) + .append(".") + .append(tagResourceLocation.getNamespace()) + .append(".") + .append(tagResourceLocation.getPath().replace("/", ".").replace(":", ".")); + + add(stringBuilder.toString(), name); + } + public void add(String key, String value) { if (data.put(key, value) != null) throw new IllegalStateException("Duplicate translation key " + key); diff --git a/src/main/java/net/neoforged/neoforge/common/data/NeoForgeDamageTypeTagsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/NeoForgeDamageTypeTagsProvider.java index 3bfd3369b92..1236e4308ec 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/NeoForgeDamageTypeTagsProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/NeoForgeDamageTypeTagsProvider.java @@ -10,6 +10,7 @@ import net.minecraft.data.PackOutput; import net.minecraft.data.tags.DamageTypeTagsProvider; import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import net.minecraft.world.damagesource.DamageType; import net.minecraft.world.damagesource.DamageTypes; @@ -78,6 +79,17 @@ protected void addTags(HolderLookup.Provider lookupProvider) { tag(DamageTypes.GENERIC_KILL, Tags.DamageTypes.IS_TECHNICAL); tag(DamageTypes.OUTSIDE_BORDER, Tags.DamageTypes.IS_TECHNICAL); tag(DamageTypes.FELL_OUT_OF_WORLD, Tags.DamageTypes.IS_TECHNICAL); + tag(Tags.DamageTypes.NO_FLINCH); + + // Backwards compat with pre-1.21 tags. Done after so optional tag is last for better readability. + // TODO: Remove backwards compat tag entries in 1.22 + tagWithOptionalLegacy(Tags.DamageTypes.IS_POISON); + tagWithOptionalLegacy(Tags.DamageTypes.IS_WITHER); + tagWithOptionalLegacy(Tags.DamageTypes.IS_MAGIC); + tagWithOptionalLegacy(Tags.DamageTypes.IS_ENVIRONMENT); + tagWithOptionalLegacy(Tags.DamageTypes.IS_PHYSICAL); + tagWithOptionalLegacy(Tags.DamageTypes.IS_TECHNICAL); + tagWithOptionalLegacy(Tags.DamageTypes.NO_FLINCH); } @SafeVarargs @@ -87,6 +99,12 @@ private void tag(ResourceKey type, TagKey... tags) { } } + private TagAppender tagWithOptionalLegacy(TagKey tag) { + TagAppender tagAppender = tag(tag); + tagAppender.addOptionalTag(new ResourceLocation("forge", tag.location().getPath())); + return tagAppender; + } + @Override public String getName() { return "NeoForge Damage Type Tags"; diff --git a/src/main/java/net/neoforged/neoforge/common/data/fixes/NeoForgeEntityLegacyAttributesFix.java b/src/main/java/net/neoforged/neoforge/common/data/fixes/NeoForgeEntityLegacyAttributesFix.java new file mode 100644 index 00000000000..24a248024d3 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/data/fixes/NeoForgeEntityLegacyAttributesFix.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.common.data.fixes; + +import com.mojang.datafixers.DSL; +import com.mojang.datafixers.DataFix; +import com.mojang.datafixers.DataFixUtils; +import com.mojang.datafixers.OpticFinder; +import com.mojang.datafixers.TypeRewriteRule; +import com.mojang.datafixers.Typed; +import com.mojang.datafixers.schemas.Schema; +import com.mojang.datafixers.types.Type; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import net.minecraft.util.datafix.fixes.References; + +public class NeoForgeEntityLegacyAttributesFix extends DataFix { + private final Set legacyAttributes = new HashSet<>(); + private final String name; + + public NeoForgeEntityLegacyAttributesFix(String name, Schema outputSchema, List attributesToRemove) { + super(outputSchema, false); + this.name = name; + legacyAttributes.addAll(attributesToRemove); + } + + @Override + protected TypeRewriteRule makeRule() { + Schema schema = this.getInputSchema(); + Type itemStackType = schema.getType(References.ITEM_STACK); + OpticFinder itemStackTag = itemStackType.findField("tag"); + return TypeRewriteRule.seq( + this.fixTypeEverywhereTyped(this.name + " (ItemStack)", itemStackType, typed -> typed.updateTyped(itemStackTag, this::fixItemStackTag)), + this.fixTypeEverywhereTyped(name + " (Entity)", schema.getType(References.ENTITY), this::removeLegacyAttributes), + this.fixTypeEverywhereTyped(name + " (Player)", schema.getType(References.PLAYER), this::removeLegacyAttributes)); + } + + private Typed fixItemStackTag(Typed typed) { + return typed.update( + DSL.remainderFinder(), + tagDynamic -> tagDynamic.update( + "AttributeModifiers", + modifiersDynamic -> DataFixUtils.orElse( + modifiersDynamic.asStreamOpt() + .result() + .map(dynamics -> dynamics.filter(dynamic -> dynamic.get("AttributeName").asString().result().map(str -> !legacyAttributes.contains(str)).orElse(true))) + .map(modifiersDynamic::createList), + modifiersDynamic))); + } + + private Typed removeLegacyAttributes(Typed typed) { + return typed.update( + DSL.remainderFinder(), + entityDynamic -> entityDynamic.update( + "Attributes", + attributesDynamic -> DataFixUtils.orElse( + attributesDynamic.asStreamOpt() + .result() + .map(dynamics -> dynamics.filter(dynamic -> dynamic.get("Name").asString().result().map(str -> !legacyAttributes.contains(str)).orElse(true))) + .map(attributesDynamic::createList), + attributesDynamic))); + } +} diff --git a/src/main/java/net/neoforged/neoforge/common/data/fixes/package-info.java b/src/main/java/net/neoforged/neoforge/common/data/fixes/package-info.java new file mode 100644 index 00000000000..61f76cf0d74 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/data/fixes/package-info.java @@ -0,0 +1,9 @@ +/* + * Copyright (c) NeoForged and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +@ApiStatus.Internal +package net.neoforged.neoforge.common.data.fixes; + +import org.jetbrains.annotations.ApiStatus; diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeAdvancementProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeAdvancementProvider.java index 382080cc07a..613c6833f4b 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeAdvancementProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeAdvancementProvider.java @@ -5,6 +5,7 @@ package net.neoforged.neoforge.common.data.internal; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; @@ -13,10 +14,10 @@ import java.util.List; import java.util.Optional; import java.util.concurrent.CompletableFuture; +import java.util.function.BiFunction; import java.util.function.Consumer; import java.util.function.Predicate; import java.util.function.UnaryOperator; -import net.minecraft.Util; import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementHolder; import net.minecraft.advancements.Criterion; @@ -33,6 +34,7 @@ import net.minecraft.data.advancements.AdvancementSubProvider; import net.minecraft.data.advancements.packs.VanillaAdvancementProvider; import net.minecraft.data.advancements.packs.VanillaHusbandryAdvancements; +import net.minecraft.resources.RegistryOps; import net.minecraft.world.entity.monster.piglin.PiglinAi; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; @@ -57,10 +59,10 @@ public NeoForgeAdvancementProvider(PackOutput output, CompletableFuture getVanillaAdvancementProviders(PackOutput output, CompletableFuture registries) { - List>> criteriaReplacers = new ArrayList<>(); + List, HolderLookup.Provider, Criterion>> criteriaReplacers = new ArrayList<>(); criteriaReplacers.add(replaceMatchToolCriteria(ToolActions.AXE_WAX_OFF, getPrivateValue(VanillaHusbandryAdvancements.class, null, "WAX_SCRAPING_TOOLS"))); - criteriaReplacers.add(replaceInteractCriteria(PiglinCurrencyItemPredicate.INSTANCE.toVanilla(), PiglinAi.BARTERING_ITEM)); - criteriaReplacers.add(replaceWearingPredicate(PiglinNeutralArmorEntityPredicate.INSTANCE.toVanilla(), predicate -> { + criteriaReplacers.add(replaceInteractCriteria(ItemPredicate.Builder.item().withSubPredicate(PiglinCurrencyItemPredicate.TYPE, PiglinCurrencyItemPredicate.INSTANCE).build(), PiglinAi.BARTERING_ITEM)); + criteriaReplacers.add(replaceWearingPredicate(EntityPredicate.Builder.entity().subPredicate(PiglinNeutralArmorEntityPredicate.INSTANCE).build(), predicate -> { if (predicate.head().filter(item -> predicateMatches(item, Items.GOLDEN_HELMET)).isPresent()) { return true; } else if (predicate.chest().filter(item -> predicateMatches(item, Items.GOLDEN_CHESTPLATE)).isPresent()) { @@ -77,14 +79,14 @@ private static List getVanillaAdvancementProviders(PackOut .toList(); } - private static UnaryOperator> replaceMatchToolCriteria(ToolAction toolAction, ItemLike... targetItem) { + private static BiFunction, HolderLookup.Provider, Criterion> replaceMatchToolCriteria(ToolAction toolAction, ItemLike... targetItem) { UnaryOperator replacer = condition -> { if (condition instanceof MatchTool toolMatch && toolMatch.predicate().filter(predicate -> predicateMatches(predicate, targetItem)).isPresent()) { - return new MatchTool(Optional.of(new ToolActionItemPredicate(toolAction).toVanilla())); + return new MatchTool(Optional.of(ItemPredicate.Builder.item().withSubPredicate(ToolActionItemPredicate.TYPE, new ToolActionItemPredicate(toolAction)).build())); } return null; }; - return criterion -> { + return (criterion, registries) -> { if (criterion.trigger() instanceof ItemUsedOnLocationTrigger trigger && criterion.triggerInstance() instanceof ItemUsedOnLocationTrigger.TriggerInstance instance) { ContextAwarePredicate newLocation = replaceConditions(instance.location().orElse(null), replacer, condition -> false); if (newLocation != null) { @@ -95,8 +97,8 @@ private static UnaryOperator> replaceMatchToolCriteria(ToolAction t }; } - private static UnaryOperator> replaceInteractCriteria(ItemPredicate replacement, ItemLike... targetItem) { - return criterion -> { + private static BiFunction, HolderLookup.Provider, Criterion> replaceInteractCriteria(ItemPredicate replacement, ItemLike... targetItem) { + return (criterion, registries) -> { if (criterion.trigger() instanceof PlayerInteractTrigger trigger && criterion.triggerInstance() instanceof PlayerInteractTrigger.TriggerInstance instance) { if (instance.item().filter(predicate -> predicateMatches(predicate, targetItem)).isPresent()) { return new Criterion<>(trigger, new PlayerInteractTrigger.TriggerInstance(instance.player(), Optional.of(replacement), instance.entity())); @@ -120,7 +122,7 @@ private static boolean predicateMatches(ItemPredicate predicate, ItemLike... tar return true; } - private static UnaryOperator> replaceWearingPredicate(EntityPredicate replacement, Predicate shouldReplace) { + private static BiFunction, HolderLookup.Provider, Criterion> replaceWearingPredicate(EntityPredicate replacement, Predicate shouldReplace) { return replacePlayerPredicate(condition -> { if (condition instanceof InvertedLootItemCondition inverted) { if (inverted.term() instanceof LootItemEntityPropertyCondition entityPropertyCondition) { @@ -138,30 +140,31 @@ private static UnaryOperator> replaceWearingPredicate(EntityPredica }, condition -> true);//Skip any additional replacements as we know they would be duplicates } - private static UnaryOperator> replacePlayerPredicate(UnaryOperator replacer, Predicate shouldSkipReplacement) { - return criterion -> { + private static BiFunction, HolderLookup.Provider, Criterion> replacePlayerPredicate(UnaryOperator replacer, Predicate shouldSkipReplacement) { + return (criterion, registries) -> { if (criterion.triggerInstance() instanceof SimpleCriterionTrigger.SimpleInstance simpleInstance) { ContextAwarePredicate newPlayer = replaceConditions(simpleInstance.player().orElse(null), replacer, shouldSkipReplacement); if (newPlayer != null) { - return replacePlayerPredicate((Criterion) criterion, newPlayer); + return replacePlayerPredicate((Criterion) criterion, newPlayer, registries); } } return null; }; } - private static Criterion replacePlayerPredicate(Criterion old, ContextAwarePredicate newPlayer) { + private static Criterion replacePlayerPredicate(Criterion old, ContextAwarePredicate newPlayer, HolderLookup.Provider registries) { Codec codec = old.trigger().codec(); - return Util.getOrThrow(codec.encodeStart(JsonOps.INSTANCE, old.triggerInstance()) + RegistryOps registryops = registries.createSerializationContext(JsonOps.INSTANCE); + return codec.encodeStart(registryops, old.triggerInstance()) .flatMap(element -> { if (element instanceof JsonObject object && object.has("player")) { - object.add("player", Util.getOrThrow(ContextAwarePredicate.CODEC.encodeStart(JsonOps.INSTANCE, newPlayer), error -> new IllegalStateException("Unable to serialize new player predicate"))); - return codec.parse(JsonOps.INSTANCE, object); + object.add("player", ContextAwarePredicate.CODEC.encodeStart(registryops, newPlayer).getOrThrow(error -> new IllegalStateException("Unable to serialize new player predicate"))); + return codec.parse(registryops, object); } return DataResult.error(() -> "Serialized instance does not contain a 'player' element"); }) - .map(old.trigger()::createCriterion), - error -> new IllegalStateException("Unable to convert criterion serialization and replacement")); + .map(old.trigger()::createCriterion) + .getOrThrow(error -> new IllegalStateException("Unable to convert criterion serialization and replacement: " + error)); } @Nullable @@ -199,11 +202,11 @@ private static T getPrivateValue(Class clazz, @Nullable C inst, String return value; } - private record NeoForgeAdvancementGenerator(AdvancementSubProvider vanillaProvider, List>> criteriaReplacers) implements AdvancementGenerator { + private record NeoForgeAdvancementGenerator(AdvancementSubProvider vanillaProvider, List, HolderLookup.Provider, Criterion>> criteriaReplacers) implements AdvancementGenerator { @Override public void generate(HolderLookup.Provider registries, Consumer saver, ExistingFileHelper existingFileHelper) { vanillaProvider.generate(registries, advancementHolder -> { - Advancement.Builder newBuilder = findAndReplaceInHolder(advancementHolder); + Advancement.Builder newBuilder = findAndReplaceInHolder(advancementHolder, registries); if (newBuilder != null) { newBuilder.save(saver, advancementHolder.id(), existingFileHelper); } @@ -211,14 +214,14 @@ public void generate(HolderLookup.Provider registries, Consumer criterion = entry.getValue(); for (var criteriaReplacer : criteriaReplacers) { - Criterion replacedCriterion = criteriaReplacer.apply(criterion); + Criterion replacedCriterion = criteriaReplacer.apply(criterion, registries); if (replacedCriterion != null) { hasReplaced = true; criterion = replacedCriterion; diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBiomeTagsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBiomeTagsProvider.java index c7e39d6803b..66ed49ca3c3 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBiomeTagsProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBiomeTagsProvider.java @@ -10,6 +10,7 @@ import net.minecraft.data.PackOutput; import net.minecraft.data.tags.BiomeTagsProvider; import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BiomeTags; import net.minecraft.tags.TagKey; import net.minecraft.world.level.biome.Biome; @@ -24,71 +25,226 @@ public NeoForgeBiomeTagsProvider(PackOutput output, CompletableFuture biome, TagKey... tags) { tag(key).add(biome); } } + + private TagAppender tagWithOptionalLegacy(TagKey tag) { + return tag(tag).addOptionalTag(new ResourceLocation("forge", tag.location().getPath())); + } + + @Override + public String getName() { + return "NeoForge Biome Tags"; + } } diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBlockTagsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBlockTagsProvider.java index 9bc63b7d417..aa6350ba9f8 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBlockTagsProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeBlockTagsProvider.java @@ -11,6 +11,7 @@ import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.PackOutput; +import net.minecraft.data.tags.IntrinsicHolderTagsProvider; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagKey; @@ -33,15 +34,33 @@ public void addTags(HolderLookup.Provider p_256380_) { tag(Tags.Blocks.BARRELS).addTag(Tags.Blocks.BARRELS_WOODEN); tag(Tags.Blocks.BARRELS_WOODEN).add(Blocks.BARREL); tag(Tags.Blocks.BOOKSHELVES).add(Blocks.BOOKSHELF); + tag(Tags.Blocks.BUDDING_BLOCKS).add(Blocks.BUDDING_AMETHYST); + tag(Tags.Blocks.BUDS).add(Blocks.SMALL_AMETHYST_BUD).add(Blocks.MEDIUM_AMETHYST_BUD).add(Blocks.LARGE_AMETHYST_BUD); + tag(Tags.Blocks.CHAINS).add(Blocks.CHAIN); tag(Tags.Blocks.CHESTS).addTags(Tags.Blocks.CHESTS_ENDER, Tags.Blocks.CHESTS_TRAPPED, Tags.Blocks.CHESTS_WOODEN); tag(Tags.Blocks.CHESTS_ENDER).add(Blocks.ENDER_CHEST); tag(Tags.Blocks.CHESTS_TRAPPED).add(Blocks.TRAPPED_CHEST); tag(Tags.Blocks.CHESTS_WOODEN).add(Blocks.CHEST, Blocks.TRAPPED_CHEST); - tag(Tags.Blocks.COBBLESTONE).addTags(Tags.Blocks.COBBLESTONE_NORMAL, Tags.Blocks.COBBLESTONE_INFESTED, Tags.Blocks.COBBLESTONE_MOSSY, Tags.Blocks.COBBLESTONE_DEEPSLATE); - tag(Tags.Blocks.COBBLESTONE_NORMAL).add(Blocks.COBBLESTONE); - tag(Tags.Blocks.COBBLESTONE_INFESTED).add(Blocks.INFESTED_COBBLESTONE); - tag(Tags.Blocks.COBBLESTONE_MOSSY).add(Blocks.MOSSY_COBBLESTONE); - tag(Tags.Blocks.COBBLESTONE_DEEPSLATE).add(Blocks.COBBLED_DEEPSLATE); + tag(Tags.Blocks.CLUSTERS).add(Blocks.AMETHYST_CLUSTER); + tag(Tags.Blocks.COBBLESTONES).addTags(Tags.Blocks.COBBLESTONES_NORMAL, Tags.Blocks.COBBLESTONES_INFESTED, Tags.Blocks.COBBLESTONES_MOSSY, Tags.Blocks.COBBLESTONES_DEEPSLATE); + tag(Tags.Blocks.COBBLESTONES_NORMAL).add(Blocks.COBBLESTONE); + tag(Tags.Blocks.COBBLESTONES_INFESTED).add(Blocks.INFESTED_COBBLESTONE); + tag(Tags.Blocks.COBBLESTONES_MOSSY).add(Blocks.MOSSY_COBBLESTONE); + tag(Tags.Blocks.COBBLESTONES_DEEPSLATE).add(Blocks.COBBLED_DEEPSLATE); + addColored(Tags.Blocks.DYED, "{color}_banner"); + addColored(Tags.Blocks.DYED, "{color}_bed"); + addColored(Tags.Blocks.DYED, "{color}_candle"); + addColored(Tags.Blocks.DYED, "{color}_carpet"); + addColored(Tags.Blocks.DYED, "{color}_concrete"); + addColored(Tags.Blocks.DYED, "{color}_concrete_powder"); + addColored(Tags.Blocks.DYED, "{color}_glazed_terracotta"); + addColored(Tags.Blocks.DYED, "{color}_shulker_box"); + addColored(Tags.Blocks.DYED, "{color}_stained_glass"); + addColored(Tags.Blocks.DYED, "{color}_stained_glass_pane"); + addColored(Tags.Blocks.DYED, "{color}_terracotta"); + addColored(Tags.Blocks.DYED, "{color}_wall_banner"); + addColored(Tags.Blocks.DYED, "{color}_wool"); + addColoredTags(tag(Tags.Blocks.DYED)::addTag, Tags.Blocks.DYED); tag(Tags.Blocks.END_STONES).add(Blocks.END_STONE); tag(Tags.Blocks.ENDERMAN_PLACE_ON_BLACKLIST); tag(Tags.Blocks.FENCE_GATES).addTags(Tags.Blocks.FENCE_GATES_WOODEN); @@ -49,24 +68,24 @@ public void addTags(HolderLookup.Provider p_256380_) { tag(Tags.Blocks.FENCES).addTags(Tags.Blocks.FENCES_NETHER_BRICK, Tags.Blocks.FENCES_WOODEN); tag(Tags.Blocks.FENCES_NETHER_BRICK).add(Blocks.NETHER_BRICK_FENCE); tag(Tags.Blocks.FENCES_WOODEN).addTag(BlockTags.WOODEN_FENCES); - tag(Tags.Blocks.GLASS).addTags(Tags.Blocks.GLASS_COLORLESS, Tags.Blocks.STAINED_GLASS, Tags.Blocks.GLASS_TINTED); - tag(Tags.Blocks.GLASS_COLORLESS).add(Blocks.GLASS); - tag(Tags.Blocks.GLASS_SILICA).add(Blocks.GLASS, Blocks.BLACK_STAINED_GLASS, Blocks.BLUE_STAINED_GLASS, Blocks.BROWN_STAINED_GLASS, Blocks.CYAN_STAINED_GLASS, Blocks.GRAY_STAINED_GLASS, Blocks.GREEN_STAINED_GLASS, Blocks.LIGHT_BLUE_STAINED_GLASS, Blocks.LIGHT_GRAY_STAINED_GLASS, Blocks.LIME_STAINED_GLASS, Blocks.MAGENTA_STAINED_GLASS, Blocks.ORANGE_STAINED_GLASS, Blocks.PINK_STAINED_GLASS, Blocks.PURPLE_STAINED_GLASS, Blocks.RED_STAINED_GLASS, Blocks.WHITE_STAINED_GLASS, Blocks.YELLOW_STAINED_GLASS); - tag(Tags.Blocks.GLASS_TINTED).add(Blocks.TINTED_GLASS); - addColored(tag(Tags.Blocks.STAINED_GLASS)::add, Tags.Blocks.GLASS, "{color}_stained_glass"); - tag(Tags.Blocks.GLASS_PANES).addTags(Tags.Blocks.GLASS_PANES_COLORLESS, Tags.Blocks.STAINED_GLASS_PANES); + tag(Tags.Blocks.GLASS_BLOCKS).addTags(Tags.Blocks.GLASS_BLOCKS_COLORLESS, Tags.Blocks.GLASS_BLOCKS_CHEAP, Tags.Blocks.GLASS_BLOCKS_TINTED).add(Blocks.WHITE_STAINED_GLASS, Blocks.ORANGE_STAINED_GLASS, Blocks.MAGENTA_STAINED_GLASS, Blocks.LIGHT_BLUE_STAINED_GLASS, Blocks.YELLOW_STAINED_GLASS, Blocks.LIME_STAINED_GLASS, Blocks.PINK_STAINED_GLASS, Blocks.GRAY_STAINED_GLASS, Blocks.LIGHT_GRAY_STAINED_GLASS, Blocks.CYAN_STAINED_GLASS, Blocks.PURPLE_STAINED_GLASS, Blocks.BLUE_STAINED_GLASS, Blocks.BROWN_STAINED_GLASS, Blocks.GREEN_STAINED_GLASS, Blocks.RED_STAINED_GLASS, Blocks.BLACK_STAINED_GLASS); + tag(Tags.Blocks.GLASS_BLOCKS_COLORLESS).add(Blocks.GLASS); + tag(Tags.Blocks.GLASS_BLOCKS_CHEAP).add(Blocks.GLASS, Blocks.WHITE_STAINED_GLASS, Blocks.ORANGE_STAINED_GLASS, Blocks.MAGENTA_STAINED_GLASS, Blocks.LIGHT_BLUE_STAINED_GLASS, Blocks.YELLOW_STAINED_GLASS, Blocks.LIME_STAINED_GLASS, Blocks.PINK_STAINED_GLASS, Blocks.GRAY_STAINED_GLASS, Blocks.LIGHT_GRAY_STAINED_GLASS, Blocks.CYAN_STAINED_GLASS, Blocks.PURPLE_STAINED_GLASS, Blocks.BLUE_STAINED_GLASS, Blocks.BROWN_STAINED_GLASS, Blocks.GREEN_STAINED_GLASS, Blocks.GREEN_STAINED_GLASS, Blocks.RED_STAINED_GLASS, Blocks.BLACK_STAINED_GLASS); + tag(Tags.Blocks.GLASS_BLOCKS_TINTED).add(Blocks.TINTED_GLASS); + tag(Tags.Blocks.GLASS_PANES).addTags(Tags.Blocks.GLASS_PANES_COLORLESS).add(Blocks.WHITE_STAINED_GLASS_PANE, Blocks.ORANGE_STAINED_GLASS_PANE, Blocks.MAGENTA_STAINED_GLASS_PANE, Blocks.LIGHT_BLUE_STAINED_GLASS_PANE, Blocks.YELLOW_STAINED_GLASS_PANE, Blocks.LIME_STAINED_GLASS_PANE, Blocks.PINK_STAINED_GLASS_PANE, Blocks.GRAY_STAINED_GLASS_PANE, Blocks.LIGHT_GRAY_STAINED_GLASS_PANE, Blocks.CYAN_STAINED_GLASS_PANE, Blocks.PURPLE_STAINED_GLASS_PANE, Blocks.BLUE_STAINED_GLASS_PANE, Blocks.BROWN_STAINED_GLASS_PANE, Blocks.GREEN_STAINED_GLASS_PANE, Blocks.RED_STAINED_GLASS_PANE, Blocks.BLACK_STAINED_GLASS_PANE); tag(Tags.Blocks.GLASS_PANES_COLORLESS).add(Blocks.GLASS_PANE); - addColored(tag(Tags.Blocks.STAINED_GLASS_PANES)::add, Tags.Blocks.GLASS_PANES, "{color}_stained_glass_pane"); - tag(Tags.Blocks.GRAVEL).add(Blocks.GRAVEL); - tag(Tags.Blocks.NETHERRACK).add(Blocks.NETHERRACK); - tag(Tags.Blocks.OBSIDIAN).add(Blocks.OBSIDIAN); + tag(Tags.Blocks.GRAVELS).add(Blocks.GRAVEL); + tag(Tags.Blocks.SKULLS).add(Blocks.SKELETON_SKULL, Blocks.SKELETON_WALL_SKULL, Blocks.WITHER_SKELETON_SKULL, Blocks.WITHER_SKELETON_WALL_SKULL, Blocks.PLAYER_HEAD, Blocks.PLAYER_WALL_HEAD, Blocks.ZOMBIE_HEAD, Blocks.ZOMBIE_WALL_HEAD, Blocks.CREEPER_HEAD, Blocks.CREEPER_WALL_HEAD, Blocks.PIGLIN_HEAD, Blocks.PIGLIN_WALL_HEAD, Blocks.DRAGON_HEAD, Blocks.DRAGON_WALL_HEAD); + tag(Tags.Blocks.HIDDEN_FROM_RECIPE_VIEWERS); + tag(Tags.Blocks.NETHERRACKS).add(Blocks.NETHERRACK); + tag(Tags.Blocks.OBSIDIANS).add(Blocks.OBSIDIAN); tag(Tags.Blocks.ORE_BEARING_GROUND_DEEPSLATE).add(Blocks.DEEPSLATE); tag(Tags.Blocks.ORE_BEARING_GROUND_NETHERRACK).add(Blocks.NETHERRACK); tag(Tags.Blocks.ORE_BEARING_GROUND_STONE).add(Blocks.STONE); tag(Tags.Blocks.ORE_RATES_DENSE).add(Blocks.COPPER_ORE, Blocks.DEEPSLATE_COPPER_ORE, Blocks.DEEPSLATE_LAPIS_ORE, Blocks.DEEPSLATE_REDSTONE_ORE, Blocks.LAPIS_ORE, Blocks.REDSTONE_ORE); tag(Tags.Blocks.ORE_RATES_SINGULAR).add(Blocks.ANCIENT_DEBRIS, Blocks.COAL_ORE, Blocks.DEEPSLATE_COAL_ORE, Blocks.DEEPSLATE_DIAMOND_ORE, Blocks.DEEPSLATE_EMERALD_ORE, Blocks.DEEPSLATE_GOLD_ORE, Blocks.DEEPSLATE_IRON_ORE, Blocks.DIAMOND_ORE, Blocks.EMERALD_ORE, Blocks.GOLD_ORE, Blocks.IRON_ORE, Blocks.NETHER_QUARTZ_ORE); tag(Tags.Blocks.ORE_RATES_SPARSE).add(Blocks.NETHER_GOLD_ORE); - tag(Tags.Blocks.ORES).addTags(Tags.Blocks.ORES_COAL, Tags.Blocks.ORES_COPPER, Tags.Blocks.ORES_DIAMOND, Tags.Blocks.ORES_EMERALD, Tags.Blocks.ORES_GOLD, Tags.Blocks.ORES_IRON, Tags.Blocks.ORES_LAPIS, Tags.Blocks.ORES_REDSTONE, Tags.Blocks.ORES_QUARTZ, Tags.Blocks.ORES_NETHERITE_SCRAP); + tag(Tags.Blocks.ORES).addTags(Tags.Blocks.ORES_COAL, Tags.Blocks.ORES_COPPER, Tags.Blocks.ORES_DIAMOND, Tags.Blocks.ORES_EMERALD, Tags.Blocks.ORES_GOLD, Tags.Blocks.ORES_IRON, Tags.Blocks.ORES_LAPIS, Tags.Blocks.ORES_NETHERITE_SCRAP, Tags.Blocks.ORES_REDSTONE, Tags.Blocks.ORES_QUARTZ); tag(Tags.Blocks.ORES_COAL).addTag(BlockTags.COAL_ORES); tag(Tags.Blocks.ORES_COPPER).addTag(BlockTags.COPPER_ORES); tag(Tags.Blocks.ORES_DIAMOND).addTag(BlockTags.DIAMOND_ORES); @@ -80,38 +99,199 @@ public void addTags(HolderLookup.Provider p_256380_) { tag(Tags.Blocks.ORES_IN_GROUND_DEEPSLATE).add(Blocks.DEEPSLATE_COAL_ORE, Blocks.DEEPSLATE_COPPER_ORE, Blocks.DEEPSLATE_DIAMOND_ORE, Blocks.DEEPSLATE_EMERALD_ORE, Blocks.DEEPSLATE_GOLD_ORE, Blocks.DEEPSLATE_IRON_ORE, Blocks.DEEPSLATE_LAPIS_ORE, Blocks.DEEPSLATE_REDSTONE_ORE); tag(Tags.Blocks.ORES_IN_GROUND_NETHERRACK).add(Blocks.NETHER_GOLD_ORE, Blocks.NETHER_QUARTZ_ORE); tag(Tags.Blocks.ORES_IN_GROUND_STONE).add(Blocks.COAL_ORE, Blocks.COPPER_ORE, Blocks.DIAMOND_ORE, Blocks.EMERALD_ORE, Blocks.GOLD_ORE, Blocks.IRON_ORE, Blocks.LAPIS_ORE, Blocks.REDSTONE_ORE); - tag(Tags.Blocks.SAND).addTags(Tags.Blocks.SAND_COLORLESS, Tags.Blocks.SAND_RED); - tag(Tags.Blocks.SAND_COLORLESS).add(Blocks.SAND); - tag(Tags.Blocks.SAND_RED).add(Blocks.RED_SAND); - tag(Tags.Blocks.SANDSTONE).add(Blocks.SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.SMOOTH_RED_SANDSTONE); - tag(Tags.Blocks.STONE).add(Blocks.ANDESITE, Blocks.DIORITE, Blocks.GRANITE, Blocks.INFESTED_STONE, Blocks.STONE, Blocks.POLISHED_ANDESITE, Blocks.POLISHED_DIORITE, Blocks.POLISHED_GRANITE, Blocks.DEEPSLATE, Blocks.POLISHED_DEEPSLATE, Blocks.INFESTED_DEEPSLATE, Blocks.TUFF); - tag(Tags.Blocks.STORAGE_BLOCKS).addTags(Tags.Blocks.STORAGE_BLOCKS_AMETHYST, Tags.Blocks.STORAGE_BLOCKS_COAL, Tags.Blocks.STORAGE_BLOCKS_COPPER, Tags.Blocks.STORAGE_BLOCKS_DIAMOND, Tags.Blocks.STORAGE_BLOCKS_EMERALD, Tags.Blocks.STORAGE_BLOCKS_GOLD, Tags.Blocks.STORAGE_BLOCKS_IRON, Tags.Blocks.STORAGE_BLOCKS_LAPIS, Tags.Blocks.STORAGE_BLOCKS_QUARTZ, Tags.Blocks.STORAGE_BLOCKS_RAW_COPPER, Tags.Blocks.STORAGE_BLOCKS_RAW_GOLD, Tags.Blocks.STORAGE_BLOCKS_RAW_IRON, Tags.Blocks.STORAGE_BLOCKS_REDSTONE, Tags.Blocks.STORAGE_BLOCKS_NETHERITE); - tag(Tags.Blocks.STORAGE_BLOCKS_AMETHYST).add(Blocks.AMETHYST_BLOCK); + tag(Tags.Blocks.PLAYER_WORKSTATIONS_CRAFTING_TABLES).add(Blocks.CRAFTING_TABLE); + tag(Tags.Blocks.PLAYER_WORKSTATIONS_FURNACES).add(Blocks.FURNACE); + tag(Tags.Blocks.SANDS).addTags(Tags.Blocks.SANDS_COLORLESS, Tags.Blocks.SANDS_RED); + tag(Tags.Blocks.RELOCATION_NOT_SUPPORTED); + tag(Tags.Blocks.ROPES); + tag(Tags.Blocks.SANDS_COLORLESS).add(Blocks.SAND); + tag(Tags.Blocks.SANDS_RED).add(Blocks.RED_SAND); + + tag(Tags.Blocks.SANDSTONE_RED_BLOCKS).add(Blocks.RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.SMOOTH_RED_SANDSTONE); + tag(Tags.Blocks.SANDSTONE_UNCOLORED_BLOCKS).add(Blocks.SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.SMOOTH_SANDSTONE); + tag(Tags.Blocks.SANDSTONE_BLOCKS).addTags(Tags.Blocks.SANDSTONE_RED_BLOCKS, Tags.Blocks.SANDSTONE_UNCOLORED_BLOCKS); + tag(Tags.Blocks.SANDSTONE_RED_SLABS).add(Blocks.RED_SANDSTONE_SLAB, Blocks.CUT_RED_SANDSTONE_SLAB, Blocks.SMOOTH_RED_SANDSTONE_SLAB); + tag(Tags.Blocks.SANDSTONE_UNCOLORED_SLABS).add(Blocks.SANDSTONE_SLAB, Blocks.CUT_SANDSTONE_SLAB, Blocks.SMOOTH_SANDSTONE_SLAB); + tag(Tags.Blocks.SANDSTONE_SLABS).addTags(Tags.Blocks.SANDSTONE_RED_SLABS, Tags.Blocks.SANDSTONE_UNCOLORED_SLABS); + tag(Tags.Blocks.SANDSTONE_RED_STAIRS).add(Blocks.RED_SANDSTONE_STAIRS, Blocks.SMOOTH_RED_SANDSTONE_STAIRS); + tag(Tags.Blocks.SANDSTONE_UNCOLORED_STAIRS).add(Blocks.SANDSTONE_STAIRS, Blocks.SMOOTH_SANDSTONE_STAIRS); + tag(Tags.Blocks.SANDSTONE_STAIRS).addTags(Tags.Blocks.SANDSTONE_RED_STAIRS, Tags.Blocks.SANDSTONE_UNCOLORED_STAIRS); + + tag(Tags.Blocks.STONES).add(Blocks.ANDESITE, Blocks.DIORITE, Blocks.GRANITE, Blocks.STONE, Blocks.DEEPSLATE, Blocks.TUFF); + tag(Tags.Blocks.STORAGE_BLOCKS).addTags(Tags.Blocks.STORAGE_BLOCKS_BONE_MEAL, Tags.Blocks.STORAGE_BLOCKS_COAL, + Tags.Blocks.STORAGE_BLOCKS_COPPER, Tags.Blocks.STORAGE_BLOCKS_DIAMOND, Tags.Blocks.STORAGE_BLOCKS_DRIED_KELP, + Tags.Blocks.STORAGE_BLOCKS_EMERALD, Tags.Blocks.STORAGE_BLOCKS_GOLD, Tags.Blocks.STORAGE_BLOCKS_IRON, + Tags.Blocks.STORAGE_BLOCKS_LAPIS, Tags.Blocks.STORAGE_BLOCKS_NETHERITE, Tags.Blocks.STORAGE_BLOCKS_RAW_COPPER, + Tags.Blocks.STORAGE_BLOCKS_RAW_GOLD, Tags.Blocks.STORAGE_BLOCKS_RAW_IRON, Tags.Blocks.STORAGE_BLOCKS_REDSTONE, + Tags.Blocks.STORAGE_BLOCKS_SLIME, Tags.Blocks.STORAGE_BLOCKS_WHEAT); + tag(Tags.Blocks.STORAGE_BLOCKS_BONE_MEAL).add(Blocks.BONE_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_COAL).add(Blocks.COAL_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_COPPER).add(Blocks.COPPER_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_DIAMOND).add(Blocks.DIAMOND_BLOCK); + tag(Tags.Blocks.STORAGE_BLOCKS_DRIED_KELP).add(Blocks.DRIED_KELP_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_EMERALD).add(Blocks.EMERALD_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_GOLD).add(Blocks.GOLD_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_IRON).add(Blocks.IRON_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_LAPIS).add(Blocks.LAPIS_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_QUARTZ).add(Blocks.QUARTZ_BLOCK); + tag(Tags.Blocks.STORAGE_BLOCKS_NETHERITE).add(Blocks.NETHERITE_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_RAW_COPPER).add(Blocks.RAW_COPPER_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_RAW_GOLD).add(Blocks.RAW_GOLD_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_RAW_IRON).add(Blocks.RAW_IRON_BLOCK); tag(Tags.Blocks.STORAGE_BLOCKS_REDSTONE).add(Blocks.REDSTONE_BLOCK); - tag(Tags.Blocks.STORAGE_BLOCKS_NETHERITE).add(Blocks.NETHERITE_BLOCK); + tag(Tags.Blocks.STORAGE_BLOCKS_SLIME).add(Blocks.SLIME_BLOCK); + tag(Tags.Blocks.STORAGE_BLOCKS_WHEAT).add(Blocks.HAY_BLOCK); + tag(Tags.Blocks.VILLAGER_JOB_SITES).add( + Blocks.BARREL, Blocks.BLAST_FURNACE, Blocks.BREWING_STAND, Blocks.CARTOGRAPHY_TABLE, + Blocks.CAULDRON, Blocks.WATER_CAULDRON, Blocks.LAVA_CAULDRON, Blocks.POWDER_SNOW_CAULDRON, + Blocks.COMPOSTER, Blocks.FLETCHING_TABLE, Blocks.GRINDSTONE, Blocks.LECTERN, + Blocks.LOOM, Blocks.SMITHING_TABLE, Blocks.SMOKER, Blocks.STONECUTTER); + + // Backwards compat with pre-1.21 tags. Done after so optional tag is last for better readability. + // TODO: Remove backwards compat tag entries in 1.22 + tagWithOptionalLegacy(Tags.Blocks.BARRELS); + tagWithOptionalLegacy(Tags.Blocks.BARRELS_WOODEN); + tagWithOptionalLegacy(Tags.Blocks.BOOKSHELVES); + tagWithOptionalLegacy(Tags.Blocks.CHESTS); + tagWithOptionalLegacy(Tags.Blocks.CHESTS_ENDER); + tagWithOptionalLegacy(Tags.Blocks.CHESTS_TRAPPED); + tagWithOptionalLegacy(Tags.Blocks.CHESTS_WOODEN); + tag(Tags.Blocks.COBBLESTONES).addOptionalTag(new ResourceLocation("forge", "cobblestone")); + tag(Tags.Blocks.COBBLESTONES_NORMAL).addOptionalTag(new ResourceLocation("forge", "cobblestone/normal")); + tag(Tags.Blocks.COBBLESTONES_INFESTED).addOptionalTag(new ResourceLocation("forge", "cobblestone/infested")); + tag(Tags.Blocks.COBBLESTONES_MOSSY).addOptionalTag(new ResourceLocation("forge", "cobblestone/mossy")); + tag(Tags.Blocks.COBBLESTONES_DEEPSLATE).addOptionalTag(new ResourceLocation("forge", "cobblestone/deepslate")); + tag(Tags.Blocks.DYED_BLACK) + .addOptionalTag(new ResourceLocation("forge", "glass/black")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/black")); + tag(Tags.Blocks.DYED_BLUE) + .addOptionalTag(new ResourceLocation("forge", "glass/blue")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/blue")); + tag(Tags.Blocks.DYED_BROWN) + .addOptionalTag(new ResourceLocation("forge", "glass/brown")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/brown")); + tag(Tags.Blocks.DYED_CYAN) + .addOptionalTag(new ResourceLocation("forge", "glass/cyan")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/cyan")); + tag(Tags.Blocks.DYED_GRAY) + .addOptionalTag(new ResourceLocation("forge", "glass/gray")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/gray")); + tag(Tags.Blocks.DYED_GREEN) + .addOptionalTag(new ResourceLocation("forge", "glass/green")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/green")); + tag(Tags.Blocks.DYED_LIGHT_BLUE) + .addOptionalTag(new ResourceLocation("forge", "glass/light_blue")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/light_blue")); + tag(Tags.Blocks.DYED_LIGHT_GRAY) + .addOptionalTag(new ResourceLocation("forge", "glass/light_gray")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/light_gray")); + tag(Tags.Blocks.DYED_LIME) + .addOptionalTag(new ResourceLocation("forge", "glass/lime")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/lime")); + tag(Tags.Blocks.DYED_MAGENTA) + .addOptionalTag(new ResourceLocation("forge", "glass/magenta")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/magenta")); + tag(Tags.Blocks.DYED_MAGENTA) + .addOptionalTag(new ResourceLocation("forge", "glass/magenta")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/magenta")); + tag(Tags.Blocks.DYED_ORANGE) + .addOptionalTag(new ResourceLocation("forge", "glass/orange")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/orange")); + tag(Tags.Blocks.DYED_PINK) + .addOptionalTag(new ResourceLocation("forge", "glass/pink")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/pink")); + tag(Tags.Blocks.DYED_PURPLE) + .addOptionalTag(new ResourceLocation("forge", "glass/purple")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/purple")); + tag(Tags.Blocks.DYED_RED) + .addOptionalTag(new ResourceLocation("forge", "glass/red")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/red")); + tag(Tags.Blocks.DYED_WHITE) + .addOptionalTag(new ResourceLocation("forge", "glass/white")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/white")); + tag(Tags.Blocks.DYED_YELLOW) + .addOptionalTag(new ResourceLocation("forge", "glass/yellow")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/yellow")); + tagWithOptionalLegacy(Tags.Blocks.END_STONES); + tagWithOptionalLegacy(Tags.Blocks.ENDERMAN_PLACE_ON_BLACKLIST); + tagWithOptionalLegacy(Tags.Blocks.FENCE_GATES); + tagWithOptionalLegacy(Tags.Blocks.FENCE_GATES_WOODEN); + tagWithOptionalLegacy(Tags.Blocks.FENCES); + tagWithOptionalLegacy(Tags.Blocks.FENCES_NETHER_BRICK); + tagWithOptionalLegacy(Tags.Blocks.FENCES_WOODEN); + tag(Tags.Blocks.GRAVELS).addOptionalTag(new ResourceLocation("forge", "gravel")); + tag(Tags.Blocks.GLASS_BLOCKS).addOptionalTag(new ResourceLocation("forge", "glass")); + tag(Tags.Blocks.GLASS_BLOCKS_COLORLESS).addOptionalTag(new ResourceLocation("forge", "glass_colorless")); + tag(Tags.Blocks.GLASS_BLOCKS_CHEAP).addOptionalTag(new ResourceLocation("forge", "glass_silica")); + tag(Tags.Blocks.GLASS_BLOCKS_TINTED).addOptionalTag(new ResourceLocation("forge", "glass_tinted")); + tag(Tags.Blocks.GLASS_PANES_COLORLESS).addOptionalTag(new ResourceLocation("forge", "glass_panes_colorless")); + tag(Tags.Blocks.NETHERRACKS).addOptionalTag(new ResourceLocation("forge", "netherrack")); + tag(Tags.Blocks.OBSIDIANS).addOptionalTag(new ResourceLocation("forge", "obsidian")); + tagWithOptionalLegacy(Tags.Blocks.ORE_BEARING_GROUND_DEEPSLATE); + tagWithOptionalLegacy(Tags.Blocks.ORE_BEARING_GROUND_NETHERRACK); + tagWithOptionalLegacy(Tags.Blocks.ORE_BEARING_GROUND_STONE); + tagWithOptionalLegacy(Tags.Blocks.ORE_RATES_DENSE); + tagWithOptionalLegacy(Tags.Blocks.ORE_RATES_SINGULAR); + tagWithOptionalLegacy(Tags.Blocks.ORE_RATES_SPARSE); + tagWithOptionalLegacy(Tags.Blocks.ORES); + tagWithOptionalLegacy(Tags.Blocks.ORES_COAL); + tagWithOptionalLegacy(Tags.Blocks.ORES_COPPER); + tagWithOptionalLegacy(Tags.Blocks.ORES_DIAMOND); + tagWithOptionalLegacy(Tags.Blocks.ORES_EMERALD); + tagWithOptionalLegacy(Tags.Blocks.ORES_GOLD); + tagWithOptionalLegacy(Tags.Blocks.ORES_IRON); + tagWithOptionalLegacy(Tags.Blocks.ORES_LAPIS); + tagWithOptionalLegacy(Tags.Blocks.ORES_QUARTZ); + tagWithOptionalLegacy(Tags.Blocks.ORES_REDSTONE); + tagWithOptionalLegacy(Tags.Blocks.ORES_NETHERITE_SCRAP); + tagWithOptionalLegacy(Tags.Blocks.ORES_IN_GROUND_DEEPSLATE); + tagWithOptionalLegacy(Tags.Blocks.ORES_IN_GROUND_NETHERRACK); + tagWithOptionalLegacy(Tags.Blocks.ORES_IN_GROUND_STONE); + tagWithOptionalLegacy(Tags.Blocks.STONES); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_COAL); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_COPPER); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_DIAMOND); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_EMERALD); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_GOLD); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_IRON); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_LAPIS); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_RAW_COPPER); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_RAW_GOLD); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_RAW_IRON); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_REDSTONE); + tagWithOptionalLegacy(Tags.Blocks.STORAGE_BLOCKS_NETHERITE); + tag(Tags.Blocks.RELOCATION_NOT_SUPPORTED) + .addOptionalTag(new ResourceLocation("forge", "relocation_not_supported")) + .addOptionalTag(new ResourceLocation("forge", "immovable")); + tag(Tags.Blocks.SANDSTONE_BLOCKS).addOptionalTag(new ResourceLocation("forge", "sandstone")); + tag(Tags.Blocks.SANDS).addOptionalTag(new ResourceLocation("forge", "sand")); + tag(Tags.Blocks.SANDS_COLORLESS).addOptionalTag(new ResourceLocation("forge", "sand/colorless")); + tag(Tags.Blocks.SANDS_RED).addOptionalTag(new ResourceLocation("forge", "sand/red")); + } + + private IntrinsicHolderTagsProvider.IntrinsicTagAppender tagWithOptionalLegacy(TagKey tag) { + IntrinsicHolderTagsProvider.IntrinsicTagAppender tagAppender = tag(tag); + tagAppender.addOptionalTag(new ResourceLocation("forge", tag.location().getPath())); + return tagAppender; } - private void addColored(Consumer consumer, TagKey group, String pattern) { + private void addColored(TagKey group, String pattern) { String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; for (DyeColor color : DyeColor.values()) { ResourceLocation key = new ResourceLocation("minecraft", pattern.replace("{color}", color.getName())); TagKey tag = getForgeTag(prefix + color.getName()); Block block = BuiltInRegistries.BLOCK.get(key); if (block == null || block == Blocks.AIR) - throw new IllegalStateException("Unknown vanilla block: " + key.toString()); + throw new IllegalStateException("Unknown vanilla block: " + key); tag(tag).add(block); - consumer.accept(block); + } + } + + private void addColoredTags(Consumer> consumer, TagKey group) { + String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; + for (DyeColor color : DyeColor.values()) { + TagKey tag = getForgeTag(prefix + color.getName()); + consumer.accept(tag); } } diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeDataMapsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeDataMapsProvider.java index a0f1f41dbda..d662bed173e 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeDataMapsProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeDataMapsProvider.java @@ -5,13 +5,13 @@ package net.neoforged.neoforge.common.data.internal; -import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Reference2IntMap; import java.util.Map; import java.util.concurrent.CompletableFuture; import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.PackOutput; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.ResourceKey; import net.minecraft.sounds.SoundEvent; import net.minecraft.tags.ItemTags; import net.minecraft.world.entity.EntityType; @@ -22,6 +22,7 @@ import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.gameevent.vibrations.VibrationSystem; +import net.minecraft.world.level.storage.loot.LootTable; import net.neoforged.fml.util.ObfuscationReflectionHelper; import net.neoforged.neoforge.common.data.DataMapProvider; import net.neoforged.neoforge.registries.datamaps.builtin.Compostable; @@ -48,15 +49,15 @@ protected void gather() { fuels.remove(ItemTags.NON_FLAMMABLE_WOOD); final var vibrationFrequencies = builder(NeoForgeDataMaps.VIBRATION_FREQUENCIES); - ((Object2IntMap) VibrationSystem.VIBRATION_FREQUENCY_FOR_EVENT) - .forEach((event, frequency) -> vibrationFrequencies.add(event.builtInRegistryHolder(), new VibrationFrequency(frequency), false)); + ((Reference2IntMap>) VibrationSystem.VIBRATION_FREQUENCY_FOR_EVENT) + .forEach((event, frequency) -> vibrationFrequencies.add(event, new VibrationFrequency(frequency), false)); final var imitations = builder(NeoForgeDataMaps.PARROT_IMITATIONS); ObfuscationReflectionHelper., SoundEvent>, Parrot>getPrivateValue(Parrot.class, null, "MOB_SOUND_MAP") .forEach((type, sound) -> imitations.add(type.builtInRegistryHolder(), new ParrotImitation(sound), false)); final var raidHeroGifts = builder(NeoForgeDataMaps.RAID_HERO_GIFTS); - ObfuscationReflectionHelper., GiveGiftToHero>getPrivateValue(GiveGiftToHero.class, null, "GIFTS") + ObfuscationReflectionHelper.>, GiveGiftToHero>getPrivateValue(GiveGiftToHero.class, null, "GIFTS") .forEach((type, lootTable) -> raidHeroGifts.add(BuiltInRegistries.VILLAGER_PROFESSION.wrapAsHolder(type), new RaidHeroGift(lootTable), false)); } } diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeEnchantmentTagsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeEnchantmentTagsProvider.java new file mode 100644 index 00000000000..97951ec0350 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeEnchantmentTagsProvider.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.common.data.internal; + +import java.util.concurrent.CompletableFuture; +import net.minecraft.core.HolderLookup; +import net.minecraft.data.PackOutput; +import net.minecraft.world.item.enchantment.Enchantments; +import net.neoforged.neoforge.common.Tags; +import net.neoforged.neoforge.common.data.EnchantmentTagsProvider; +import net.neoforged.neoforge.common.data.ExistingFileHelper; + +public final class NeoForgeEnchantmentTagsProvider extends EnchantmentTagsProvider { + public NeoForgeEnchantmentTagsProvider(PackOutput output, CompletableFuture lookupProvider, ExistingFileHelper existingFileHelper) { + super(output, lookupProvider, "neoforge", existingFileHelper); + } + + @Override + public void addTags(HolderLookup.Provider lookupProvider) { + tag(Tags.Enchantments.INCREASE_BLOCK_DROPS) + .add(Enchantments.FORTUNE); + tag(Tags.Enchantments.INCREASE_ENTITY_DROPS) + .add(Enchantments.LOOTING); + tag(Tags.Enchantments.WEAPON_DAMAGE_ENHANCEMENTS) + .add(Enchantments.SHARPNESS) + .add(Enchantments.SMITE) + .add(Enchantments.BANE_OF_ARTHROPODS) + .add(Enchantments.POWER) + .add(Enchantments.IMPALING); + tag(Tags.Enchantments.ENTITY_SPEED_ENHANCEMENTS) + .add(Enchantments.SOUL_SPEED) + .add(Enchantments.SWIFT_SNEAK) + .add(Enchantments.DEPTH_STRIDER); + tag(Tags.Enchantments.ENTITY_AUXILIARY_MOVEMENT_ENHANCEMENTS) + .add(Enchantments.FEATHER_FALLING) + .add(Enchantments.FROST_WALKER); + tag(Tags.Enchantments.ENTITY_DEFENSE_ENHANCEMENTS) + .add(Enchantments.PROTECTION) + .add(Enchantments.BLAST_PROTECTION) + .add(Enchantments.PROJECTILE_PROTECTION) + .add(Enchantments.FIRE_PROTECTION) + .add(Enchantments.RESPIRATION) + .add(Enchantments.FEATHER_FALLING); + } +} diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeEntityTypeTagsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeEntityTypeTagsProvider.java index 34483199bbe..9f92c93c40b 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeEntityTypeTagsProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeEntityTypeTagsProvider.java @@ -9,6 +9,7 @@ import net.minecraft.core.HolderLookup; import net.minecraft.data.PackOutput; import net.minecraft.data.tags.EntityTypeTagsProvider; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; import net.neoforged.neoforge.common.Tags; import net.neoforged.neoforge.common.data.ExistingFileHelper; @@ -21,5 +22,15 @@ public NeoForgeEntityTypeTagsProvider(PackOutput output, CompletableFuture tagWithOptionalLegacy(TagKey tag) { + IntrinsicHolderTagsProvider.IntrinsicTagAppender tagAppender = tag(tag); + tagAppender.addOptionalTag(new ResourceLocation("forge", tag.location().getPath())); + return tagAppender; } } diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeItemTagsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeItemTagsProvider.java index 04e347e34b7..5bcf2f9d594 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeItemTagsProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeItemTagsProvider.java @@ -11,6 +11,7 @@ import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.PackOutput; +import net.minecraft.data.tags.IntrinsicHolderTagsProvider; import net.minecraft.data.tags.ItemTagsProvider; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.ItemTags; @@ -34,26 +35,53 @@ public void addTags(HolderLookup.Provider lookupProvider) { copy(Tags.Blocks.BARRELS_WOODEN, Tags.Items.BARRELS_WOODEN); tag(Tags.Items.BONES).add(Items.BONE); copy(Tags.Blocks.BOOKSHELVES, Tags.Items.BOOKSHELVES); + tag(Tags.Items.BRICKS).addTags(Tags.Items.BRICKS_NORMAL, Tags.Items.BRICKS_NETHER); + tag(Tags.Items.BRICKS_NORMAL).add(Items.BRICK); + tag(Tags.Items.BRICKS_NETHER).add(Items.NETHER_BRICK); + tag(Tags.Items.BUCKETS_EMPTY).add(Items.BUCKET); + tag(Tags.Items.BUCKETS_WATER).add(Items.WATER_BUCKET); + tag(Tags.Items.BUCKETS_LAVA).add(Items.LAVA_BUCKET); + tag(Tags.Items.BUCKETS_MILK).add(Items.MILK_BUCKET); + tag(Tags.Items.BUCKETS_POWDER_SNOW).add(Items.POWDER_SNOW_BUCKET); + tag(Tags.Items.BUCKETS_ENTITY_WATER).add(Items.AXOLOTL_BUCKET, Items.COD_BUCKET, Items.PUFFERFISH_BUCKET, Items.TADPOLE_BUCKET, Items.TROPICAL_FISH_BUCKET, Items.SALMON_BUCKET); + tag(Tags.Items.BUCKETS).addTags(Tags.Items.BUCKETS_EMPTY, Tags.Items.BUCKETS_WATER, Tags.Items.BUCKETS_LAVA, Tags.Items.BUCKETS_MILK, Tags.Items.BUCKETS_POWDER_SNOW, Tags.Items.BUCKETS_ENTITY_WATER); + copy(Tags.Blocks.BUDDING_BLOCKS, Tags.Items.BUDDING_BLOCKS); + copy(Tags.Blocks.BUDS, Tags.Items.BUDS); + copy(Tags.Blocks.CHAINS, Tags.Items.CHAINS); copy(Tags.Blocks.CHESTS, Tags.Items.CHESTS); copy(Tags.Blocks.CHESTS_ENDER, Tags.Items.CHESTS_ENDER); copy(Tags.Blocks.CHESTS_TRAPPED, Tags.Items.CHESTS_TRAPPED); copy(Tags.Blocks.CHESTS_WOODEN, Tags.Items.CHESTS_WOODEN); - copy(Tags.Blocks.COBBLESTONE, Tags.Items.COBBLESTONE); - copy(Tags.Blocks.COBBLESTONE_NORMAL, Tags.Items.COBBLESTONE_NORMAL); - copy(Tags.Blocks.COBBLESTONE_INFESTED, Tags.Items.COBBLESTONE_INFESTED); - copy(Tags.Blocks.COBBLESTONE_MOSSY, Tags.Items.COBBLESTONE_MOSSY); - copy(Tags.Blocks.COBBLESTONE_DEEPSLATE, Tags.Items.COBBLESTONE_DEEPSLATE); + copy(Tags.Blocks.CLUSTERS, Tags.Items.CLUSTERS); + copy(Tags.Blocks.COBBLESTONES, Tags.Items.COBBLESTONES); + copy(Tags.Blocks.COBBLESTONES_NORMAL, Tags.Items.COBBLESTONES_NORMAL); + copy(Tags.Blocks.COBBLESTONES_INFESTED, Tags.Items.COBBLESTONES_INFESTED); + copy(Tags.Blocks.COBBLESTONES_MOSSY, Tags.Items.COBBLESTONES_MOSSY); + copy(Tags.Blocks.COBBLESTONES_DEEPSLATE, Tags.Items.COBBLESTONES_DEEPSLATE); tag(Tags.Items.CROPS).addTags(Tags.Items.CROPS_BEETROOT, Tags.Items.CROPS_CARROT, Tags.Items.CROPS_NETHER_WART, Tags.Items.CROPS_POTATO, Tags.Items.CROPS_WHEAT); tag(Tags.Items.CROPS_BEETROOT).add(Items.BEETROOT); tag(Tags.Items.CROPS_CARROT).add(Items.CARROT); tag(Tags.Items.CROPS_NETHER_WART).add(Items.NETHER_WART); tag(Tags.Items.CROPS_POTATO).add(Items.POTATO); tag(Tags.Items.CROPS_WHEAT).add(Items.WHEAT); - tag(Tags.Items.DUSTS).addTags(Tags.Items.DUSTS_GLOWSTONE, Tags.Items.DUSTS_PRISMARINE, Tags.Items.DUSTS_REDSTONE); + addColored(Tags.Items.DYED, "{color}_banner"); + addColored(Tags.Items.DYED, "{color}_bed"); + addColored(Tags.Items.DYED, "{color}_candle"); + addColored(Tags.Items.DYED, "{color}_carpet"); + addColored(Tags.Items.DYED, "{color}_concrete"); + addColored(Tags.Items.DYED, "{color}_concrete_powder"); + addColored(Tags.Items.DYED, "{color}_glazed_terracotta"); + addColored(Tags.Items.DYED, "{color}_shulker_box"); + addColored(Tags.Items.DYED, "{color}_stained_glass"); + addColored(Tags.Items.DYED, "{color}_stained_glass_pane"); + addColored(Tags.Items.DYED, "{color}_terracotta"); + addColored(Tags.Items.DYED, "{color}_wool"); + addColoredTags(tag(Tags.Items.DYED)::addTags, Tags.Items.DYED); + tag(Tags.Items.DUSTS).addTags(Tags.Items.DUSTS_GLOWSTONE, Tags.Items.DUSTS_REDSTONE); tag(Tags.Items.DUSTS_GLOWSTONE).add(Items.GLOWSTONE_DUST); - tag(Tags.Items.DUSTS_PRISMARINE).add(Items.PRISMARINE_SHARD); tag(Tags.Items.DUSTS_REDSTONE).add(Items.REDSTONE); - addColored(tag(Tags.Items.DYES)::addTags, Tags.Items.DYES, "{color}_dye"); + addColored(Tags.Items.DYES, "{color}_dye"); + addColoredTags(tag(Tags.Items.DYES)::addTags, Tags.Items.DYES); tag(Tags.Items.EGGS).add(Items.EGG); tag(Tags.Items.ENCHANTING_FUELS).addTag(Tags.Items.GEMS_LAPIS); copy(Tags.Blocks.END_STONES, Tags.Items.END_STONES); @@ -64,6 +92,25 @@ public void addTags(HolderLookup.Provider lookupProvider) { copy(Tags.Blocks.FENCES, Tags.Items.FENCES); copy(Tags.Blocks.FENCES_NETHER_BRICK, Tags.Items.FENCES_NETHER_BRICK); copy(Tags.Blocks.FENCES_WOODEN, Tags.Items.FENCES_WOODEN); + tag(Tags.Items.FOODS_FRUITS).add(Items.APPLE, Items.GOLDEN_APPLE, Items.ENCHANTED_GOLDEN_APPLE); + tag(Tags.Items.FOODS_VEGETABLES).add(Items.CARROT, Items.GOLDEN_CARROT, Items.POTATO, Items.MELON_SLICE, Items.BEETROOT); + tag(Tags.Items.FOODS_BERRIES).add(Items.SWEET_BERRIES, Items.GLOW_BERRIES); + tag(Tags.Items.FOODS_BREADS).add(Items.BREAD); + tag(Tags.Items.FOODS_COOKIES).add(Items.COOKIE); + tag(Tags.Items.FOODS_RAW_MEATS).add(Items.BEEF, Items.PORKCHOP, Items.CHICKEN, Items.RABBIT, Items.MUTTON); + tag(Tags.Items.FOODS_RAW_FISHES).add(Items.COD, Items.SALMON, Items.TROPICAL_FISH, Items.PUFFERFISH); + tag(Tags.Items.FOODS_COOKED_MEATS).add(Items.COOKED_BEEF, Items.COOKED_PORKCHOP, Items.COOKED_CHICKEN, Items.COOKED_RABBIT, Items.COOKED_MUTTON); + tag(Tags.Items.FOODS_COOKED_FISHES).add(Items.COOKED_COD, Items.COOKED_SALMON); + tag(Tags.Items.FOODS_SOUPS).add(Items.BEETROOT_SOUP, Items.MUSHROOM_STEW, Items.RABBIT_STEW, Items.SUSPICIOUS_STEW); + tag(Tags.Items.FOODS_CANDIES); + tag(Tags.Items.FOODS_EDIBLE_WHEN_PLACED).add(Items.CAKE); + tag(Tags.Items.FOODS_FOOD_POISONING).add(Items.POISONOUS_POTATO, Items.PUFFERFISH, Items.SPIDER_EYE, Items.CHICKEN, Items.ROTTEN_FLESH); + tag(Tags.Items.FOODS) + .add(Items.BAKED_POTATO, Items.PUMPKIN_PIE, Items.HONEY_BOTTLE, Items.OMINOUS_BOTTLE, Items.DRIED_KELP) + .addTags(Tags.Items.FOODS_FRUITS, Tags.Items.FOODS_VEGETABLES, Tags.Items.FOODS_BERRIES, Tags.Items.FOODS_BREADS, Tags.Items.FOODS_COOKIES, + Tags.Items.FOODS_RAW_MEATS, Tags.Items.FOODS_RAW_FISHES, Tags.Items.FOODS_COOKED_MEATS, Tags.Items.FOODS_COOKED_FISHES, + Tags.Items.FOODS_SOUPS, Tags.Items.FOODS_CANDIES, + Tags.Items.FOODS_EDIBLE_WHEN_PLACED, Tags.Items.FOODS_FOOD_POISONING); tag(Tags.Items.GEMS).addTags(Tags.Items.GEMS_AMETHYST, Tags.Items.GEMS_DIAMOND, Tags.Items.GEMS_EMERALD, Tags.Items.GEMS_LAPIS, Tags.Items.GEMS_PRISMARINE, Tags.Items.GEMS_QUARTZ); tag(Tags.Items.GEMS_AMETHYST).add(Items.AMETHYST_SHARD); tag(Tags.Items.GEMS_DIAMOND).add(Items.DIAMOND); @@ -71,30 +118,28 @@ public void addTags(HolderLookup.Provider lookupProvider) { tag(Tags.Items.GEMS_LAPIS).add(Items.LAPIS_LAZULI); tag(Tags.Items.GEMS_PRISMARINE).add(Items.PRISMARINE_CRYSTALS); tag(Tags.Items.GEMS_QUARTZ).add(Items.QUARTZ); - copy(Tags.Blocks.GLASS, Tags.Items.GLASS); - copy(Tags.Blocks.GLASS_TINTED, Tags.Items.GLASS_TINTED); - copy(Tags.Blocks.GLASS_SILICA, Tags.Items.GLASS_SILICA); - copyColored(Tags.Blocks.GLASS, Tags.Items.GLASS); + copy(Tags.Blocks.GLASS_BLOCKS, Tags.Items.GLASS_BLOCKS); + copy(Tags.Blocks.GLASS_BLOCKS_COLORLESS, Tags.Items.GLASS_BLOCKS_COLORLESS); + copy(Tags.Blocks.GLASS_BLOCKS_TINTED, Tags.Items.GLASS_BLOCKS_TINTED); + copy(Tags.Blocks.GLASS_BLOCKS_CHEAP, Tags.Items.GLASS_BLOCKS_CHEAP); copy(Tags.Blocks.GLASS_PANES, Tags.Items.GLASS_PANES); - copyColored(Tags.Blocks.GLASS_PANES, Tags.Items.GLASS_PANES); - copy(Tags.Blocks.GRAVEL, Tags.Items.GRAVEL); - tag(Tags.Items.GUNPOWDER).add(Items.GUNPOWDER); - tag(Tags.Items.HEADS).add(Items.CREEPER_HEAD, Items.DRAGON_HEAD, Items.PLAYER_HEAD, Items.SKELETON_SKULL, Items.WITHER_SKELETON_SKULL, Items.ZOMBIE_HEAD); - tag(Tags.Items.INGOTS).addTags(Tags.Items.INGOTS_BRICK, Tags.Items.INGOTS_COPPER, Tags.Items.INGOTS_GOLD, Tags.Items.INGOTS_IRON, Tags.Items.INGOTS_NETHERITE, Tags.Items.INGOTS_NETHER_BRICK); - tag(Tags.Items.INGOTS_BRICK).add(Items.BRICK); + copy(Tags.Blocks.GLASS_PANES_COLORLESS, Tags.Items.GLASS_PANES_COLORLESS); + copy(Tags.Blocks.GRAVELS, Tags.Items.GRAVELS); + tag(Tags.Items.GUNPOWDERS).add(Items.GUNPOWDER); + tag(Tags.Items.HIDDEN_FROM_RECIPE_VIEWERS); + tag(Tags.Items.INGOTS).addTags(Tags.Items.INGOTS_COPPER, Tags.Items.INGOTS_GOLD, Tags.Items.INGOTS_IRON, Tags.Items.INGOTS_NETHERITE); tag(Tags.Items.INGOTS_COPPER).add(Items.COPPER_INGOT); tag(Tags.Items.INGOTS_GOLD).add(Items.GOLD_INGOT); tag(Tags.Items.INGOTS_IRON).add(Items.IRON_INGOT); tag(Tags.Items.INGOTS_NETHERITE).add(Items.NETHERITE_INGOT); - tag(Tags.Items.INGOTS_NETHER_BRICK).add(Items.NETHER_BRICK); - tag(Tags.Items.LEATHER).add(Items.LEATHER); + tag(Tags.Items.LEATHERS).add(Items.LEATHER); tag(Tags.Items.MUSHROOMS).add(Items.BROWN_MUSHROOM, Items.RED_MUSHROOM); tag(Tags.Items.NETHER_STARS).add(Items.NETHER_STAR); - copy(Tags.Blocks.NETHERRACK, Tags.Items.NETHERRACK); - tag(Tags.Items.NUGGETS).addTags(Tags.Items.NUGGETS_IRON, Tags.Items.NUGGETS_GOLD); + copy(Tags.Blocks.NETHERRACKS, Tags.Items.NETHERRACKS); + tag(Tags.Items.NUGGETS).addTags(Tags.Items.NUGGETS_GOLD, Tags.Items.NUGGETS_IRON); tag(Tags.Items.NUGGETS_IRON).add(Items.IRON_NUGGET); tag(Tags.Items.NUGGETS_GOLD).add(Items.GOLD_NUGGET); - copy(Tags.Blocks.OBSIDIAN, Tags.Items.OBSIDIAN); + copy(Tags.Blocks.OBSIDIANS, Tags.Items.OBSIDIANS); copy(Tags.Blocks.ORE_BEARING_GROUND_DEEPSLATE, Tags.Items.ORE_BEARING_GROUND_DEEPSLATE); copy(Tags.Blocks.ORE_BEARING_GROUND_NETHERRACK, Tags.Items.ORE_BEARING_GROUND_NETHERRACK); copy(Tags.Blocks.ORE_BEARING_GROUND_STONE, Tags.Items.ORE_BEARING_GROUND_STONE); @@ -115,80 +160,220 @@ public void addTags(HolderLookup.Provider lookupProvider) { copy(Tags.Blocks.ORES_IN_GROUND_DEEPSLATE, Tags.Items.ORES_IN_GROUND_DEEPSLATE); copy(Tags.Blocks.ORES_IN_GROUND_NETHERRACK, Tags.Items.ORES_IN_GROUND_NETHERRACK); copy(Tags.Blocks.ORES_IN_GROUND_STONE, Tags.Items.ORES_IN_GROUND_STONE); + copy(Tags.Blocks.PLAYER_WORKSTATIONS_CRAFTING_TABLES, Tags.Items.PLAYER_WORKSTATIONS_CRAFTING_TABLES); + copy(Tags.Blocks.PLAYER_WORKSTATIONS_FURNACES, Tags.Items.PLAYER_WORKSTATIONS_FURNACES); + tag(Tags.Items.RAW_BLOCKS).addTags(Tags.Items.RAW_BLOCKS_COPPER, Tags.Items.RAW_BLOCKS_GOLD, Tags.Items.RAW_BLOCKS_IRON); + tag(Tags.Items.RAW_BLOCKS_COPPER).add(Items.RAW_COPPER_BLOCK); + tag(Tags.Items.RAW_BLOCKS_GOLD).add(Items.RAW_GOLD_BLOCK); + tag(Tags.Items.RAW_BLOCKS_IRON).add(Items.RAW_IRON_BLOCK); tag(Tags.Items.RAW_MATERIALS).addTags(Tags.Items.RAW_MATERIALS_COPPER, Tags.Items.RAW_MATERIALS_GOLD, Tags.Items.RAW_MATERIALS_IRON); tag(Tags.Items.RAW_MATERIALS_COPPER).add(Items.RAW_COPPER); tag(Tags.Items.RAW_MATERIALS_GOLD).add(Items.RAW_GOLD); tag(Tags.Items.RAW_MATERIALS_IRON).add(Items.RAW_IRON); - tag(Tags.Items.RODS).addTags(Tags.Items.RODS_BLAZE, Tags.Items.RODS_WOODEN); + tag(Tags.Items.RODS).addTags(Tags.Items.RODS_WOODEN, Tags.Items.RODS_BLAZE, Tags.Items.RODS_BREEZE); tag(Tags.Items.RODS_BLAZE).add(Items.BLAZE_ROD); + tag(Tags.Items.RODS_BREEZE).add(Items.BREEZE_ROD); tag(Tags.Items.RODS_WOODEN).add(Items.STICK); - copy(Tags.Blocks.SAND, Tags.Items.SAND); - copy(Tags.Blocks.SAND_COLORLESS, Tags.Items.SAND_COLORLESS); - copy(Tags.Blocks.SAND_RED, Tags.Items.SAND_RED); - copy(Tags.Blocks.SANDSTONE, Tags.Items.SANDSTONE); + copy(Tags.Blocks.ROPES, Tags.Items.ROPES); + copy(Tags.Blocks.SANDS, Tags.Items.SANDS); + copy(Tags.Blocks.SANDS_COLORLESS, Tags.Items.SANDS_COLORLESS); + copy(Tags.Blocks.SANDS_RED, Tags.Items.SANDS_RED); + copy(Tags.Blocks.SANDSTONE_BLOCKS, Tags.Items.SANDSTONE_BLOCKS); + copy(Tags.Blocks.SANDSTONE_SLABS, Tags.Items.SANDSTONE_SLABS); + copy(Tags.Blocks.SANDSTONE_STAIRS, Tags.Items.SANDSTONE_STAIRS); + copy(Tags.Blocks.SANDSTONE_RED_BLOCKS, Tags.Items.SANDSTONE_RED_BLOCKS); + copy(Tags.Blocks.SANDSTONE_RED_SLABS, Tags.Items.SANDSTONE_RED_SLABS); + copy(Tags.Blocks.SANDSTONE_RED_STAIRS, Tags.Items.SANDSTONE_RED_STAIRS); + copy(Tags.Blocks.SANDSTONE_UNCOLORED_BLOCKS, Tags.Items.SANDSTONE_UNCOLORED_BLOCKS); + copy(Tags.Blocks.SANDSTONE_UNCOLORED_SLABS, Tags.Items.SANDSTONE_UNCOLORED_SLABS); + copy(Tags.Blocks.SANDSTONE_UNCOLORED_STAIRS, Tags.Items.SANDSTONE_UNCOLORED_STAIRS); tag(Tags.Items.SEEDS).addTags(Tags.Items.SEEDS_BEETROOT, Tags.Items.SEEDS_MELON, Tags.Items.SEEDS_PUMPKIN, Tags.Items.SEEDS_WHEAT); tag(Tags.Items.SEEDS_BEETROOT).add(Items.BEETROOT_SEEDS); tag(Tags.Items.SEEDS_MELON).add(Items.MELON_SEEDS); tag(Tags.Items.SEEDS_PUMPKIN).add(Items.PUMPKIN_SEEDS); tag(Tags.Items.SEEDS_WHEAT).add(Items.WHEAT_SEEDS); - tag(Tags.Items.SHEARS).add(Items.SHEARS); tag(Tags.Items.SLIMEBALLS).add(Items.SLIME_BALL); - copy(Tags.Blocks.STAINED_GLASS, Tags.Items.STAINED_GLASS); - copy(Tags.Blocks.STAINED_GLASS_PANES, Tags.Items.STAINED_GLASS_PANES); - copy(Tags.Blocks.STONE, Tags.Items.STONE); + copy(Tags.Blocks.STONES, Tags.Items.STONES); copy(Tags.Blocks.STORAGE_BLOCKS, Tags.Items.STORAGE_BLOCKS); - copy(Tags.Blocks.STORAGE_BLOCKS_AMETHYST, Tags.Items.STORAGE_BLOCKS_AMETHYST); + copy(Tags.Blocks.STORAGE_BLOCKS_BONE_MEAL, Tags.Items.STORAGE_BLOCKS_BONE_MEAL); copy(Tags.Blocks.STORAGE_BLOCKS_COAL, Tags.Items.STORAGE_BLOCKS_COAL); copy(Tags.Blocks.STORAGE_BLOCKS_COPPER, Tags.Items.STORAGE_BLOCKS_COPPER); copy(Tags.Blocks.STORAGE_BLOCKS_DIAMOND, Tags.Items.STORAGE_BLOCKS_DIAMOND); + copy(Tags.Blocks.STORAGE_BLOCKS_DRIED_KELP, Tags.Items.STORAGE_BLOCKS_DRIED_KELP); copy(Tags.Blocks.STORAGE_BLOCKS_EMERALD, Tags.Items.STORAGE_BLOCKS_EMERALD); copy(Tags.Blocks.STORAGE_BLOCKS_GOLD, Tags.Items.STORAGE_BLOCKS_GOLD); copy(Tags.Blocks.STORAGE_BLOCKS_IRON, Tags.Items.STORAGE_BLOCKS_IRON); copy(Tags.Blocks.STORAGE_BLOCKS_LAPIS, Tags.Items.STORAGE_BLOCKS_LAPIS); - copy(Tags.Blocks.STORAGE_BLOCKS_QUARTZ, Tags.Items.STORAGE_BLOCKS_QUARTZ); - copy(Tags.Blocks.STORAGE_BLOCKS_REDSTONE, Tags.Items.STORAGE_BLOCKS_REDSTONE); + copy(Tags.Blocks.STORAGE_BLOCKS_NETHERITE, Tags.Items.STORAGE_BLOCKS_NETHERITE); copy(Tags.Blocks.STORAGE_BLOCKS_RAW_COPPER, Tags.Items.STORAGE_BLOCKS_RAW_COPPER); copy(Tags.Blocks.STORAGE_BLOCKS_RAW_GOLD, Tags.Items.STORAGE_BLOCKS_RAW_GOLD); copy(Tags.Blocks.STORAGE_BLOCKS_RAW_IRON, Tags.Items.STORAGE_BLOCKS_RAW_IRON); - copy(Tags.Blocks.STORAGE_BLOCKS_NETHERITE, Tags.Items.STORAGE_BLOCKS_NETHERITE); - tag(Tags.Items.STRING).add(Items.STRING); + copy(Tags.Blocks.STORAGE_BLOCKS_REDSTONE, Tags.Items.STORAGE_BLOCKS_REDSTONE); + copy(Tags.Blocks.STORAGE_BLOCKS_SLIME, Tags.Items.STORAGE_BLOCKS_SLIME); + copy(Tags.Blocks.STORAGE_BLOCKS_WHEAT, Tags.Items.STORAGE_BLOCKS_WHEAT); + tag(Tags.Items.STRINGS).add(Items.STRING); + tag(Tags.Items.VILLAGER_JOB_SITES).add( + Items.BARREL, Items.BLAST_FURNACE, Items.BREWING_STAND, Items.CARTOGRAPHY_TABLE, + Items.CAULDRON, Items.COMPOSTER, Items.FLETCHING_TABLE, Items.GRINDSTONE, + Items.LECTERN, Items.LOOM, Items.SMITHING_TABLE, Items.SMOKER, Items.STONECUTTER); + + // Tools and Armors tag(Tags.Items.TOOLS_SHIELDS).add(Items.SHIELD); tag(Tags.Items.TOOLS_BOWS).add(Items.BOW); + tag(Tags.Items.TOOLS_BRUSHES).add(Items.BRUSH); tag(Tags.Items.TOOLS_CROSSBOWS).add(Items.CROSSBOW); tag(Tags.Items.TOOLS_FISHING_RODS).add(Items.FISHING_ROD); - tag(Tags.Items.TOOLS_TRIDENTS).add(Items.TRIDENT); + tag(Tags.Items.TOOLS_SHEARS).add(Items.SHEARS); + tag(Tags.Items.TOOLS_SPEARS).add(Items.TRIDENT); tag(Tags.Items.TOOLS) - .addTags(ItemTags.SWORDS, ItemTags.AXES, ItemTags.PICKAXES, ItemTags.SHOVELS, ItemTags.HOES) - .addTags(Tags.Items.TOOLS_SHIELDS, Tags.Items.TOOLS_BOWS, Tags.Items.TOOLS_CROSSBOWS, Tags.Items.TOOLS_FISHING_RODS, Tags.Items.TOOLS_TRIDENTS); - tag(Tags.Items.ARMORS_HELMETS).add(Items.LEATHER_HELMET, Items.TURTLE_HELMET, Items.CHAINMAIL_HELMET, Items.IRON_HELMET, Items.GOLDEN_HELMET, Items.DIAMOND_HELMET, Items.NETHERITE_HELMET); - tag(Tags.Items.ARMORS_CHESTPLATES).add(Items.LEATHER_CHESTPLATE, Items.CHAINMAIL_CHESTPLATE, Items.IRON_CHESTPLATE, Items.GOLDEN_CHESTPLATE, Items.DIAMOND_CHESTPLATE, Items.NETHERITE_CHESTPLATE); - tag(Tags.Items.ARMORS_LEGGINGS).add(Items.LEATHER_LEGGINGS, Items.CHAINMAIL_LEGGINGS, Items.IRON_LEGGINGS, Items.GOLDEN_LEGGINGS, Items.DIAMOND_LEGGINGS, Items.NETHERITE_LEGGINGS); - tag(Tags.Items.ARMORS_BOOTS).add(Items.LEATHER_BOOTS, Items.CHAINMAIL_BOOTS, Items.IRON_BOOTS, Items.GOLDEN_BOOTS, Items.DIAMOND_BOOTS, Items.NETHERITE_BOOTS); - tag(Tags.Items.ARMORS).addTags(Tags.Items.ARMORS_HELMETS, Tags.Items.ARMORS_CHESTPLATES, Tags.Items.ARMORS_LEGGINGS, Tags.Items.ARMORS_BOOTS); + .addTags(ItemTags.AXES, ItemTags.HOES, ItemTags.PICKAXES, ItemTags.SHOVELS, ItemTags.SWORDS) + .addTags(Tags.Items.TOOLS_BOWS, Tags.Items.TOOLS_BRUSHES, Tags.Items.TOOLS_CROSSBOWS, Tags.Items.TOOLS_FISHING_RODS, Tags.Items.TOOLS_SHEARS, Tags.Items.TOOLS_SHIELDS, Tags.Items.TOOLS_SPEARS); + tag(Tags.Items.ARMORS).addTags(ItemTags.HEAD_ARMOR, ItemTags.CHEST_ARMOR, ItemTags.LEG_ARMOR, ItemTags.FOOT_ARMOR); + tag(Tags.Items.ENCHANTABLES).addTags(ItemTags.ARMOR_ENCHANTABLE, ItemTags.EQUIPPABLE_ENCHANTABLE, ItemTags.WEAPON_ENCHANTABLE, ItemTags.SWORD_ENCHANTABLE, ItemTags.MINING_ENCHANTABLE, ItemTags.MINING_LOOT_ENCHANTABLE, ItemTags.FISHING_ENCHANTABLE, ItemTags.TRIDENT_ENCHANTABLE, ItemTags.BOW_ENCHANTABLE, ItemTags.CROSSBOW_ENCHANTABLE, ItemTags.FIRE_ASPECT_ENCHANTABLE, ItemTags.DURABILITY_ENCHANTABLE).addOptionalTag(ItemTags.MACE_ENCHANTABLE); + + // Backwards compat with pre-1.21 tags. Done after so optional tag is last for better readability. + // TODO: Remove backwards compat tag entries in 1.22 + tagWithOptionalLegacy(Tags.Items.BONES); + tag(Tags.Items.BRICKS_NORMAL).addOptionalTag(new ResourceLocation("forge", "ingots/brick")); + tag(Tags.Items.BRICKS_NETHER).addOptionalTag(new ResourceLocation("forge", "ingots/nether_brick")); + tagWithOptionalLegacy(Tags.Items.CROPS); + tagWithOptionalLegacy(Tags.Items.CROPS_BEETROOT); + tagWithOptionalLegacy(Tags.Items.CROPS_CARROT); + tagWithOptionalLegacy(Tags.Items.CROPS_NETHER_WART); + tagWithOptionalLegacy(Tags.Items.CROPS_POTATO); + tagWithOptionalLegacy(Tags.Items.CROPS_WHEAT); + tagWithOptionalLegacy(Tags.Items.DUSTS); + tagWithOptionalLegacy(Tags.Items.DUSTS_GLOWSTONE); + tagWithOptionalLegacy(Tags.Items.DUSTS_REDSTONE); + tagColoredWithOptionalLegacy(Tags.Items.DYES); + tag(Tags.Items.DYED_BLACK) + .addOptionalTag(new ResourceLocation("forge", "glass/black")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/black")); + tag(Tags.Items.DYED_BLUE) + .addOptionalTag(new ResourceLocation("forge", "glass/blue")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/blue")); + tag(Tags.Items.DYED_BROWN) + .addOptionalTag(new ResourceLocation("forge", "glass/brown")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/brown")); + tag(Tags.Items.DYED_CYAN) + .addOptionalTag(new ResourceLocation("forge", "glass/cyan")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/cyan")); + tag(Tags.Items.DYED_GRAY) + .addOptionalTag(new ResourceLocation("forge", "glass/gray")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/gray")); + tag(Tags.Items.DYED_GREEN) + .addOptionalTag(new ResourceLocation("forge", "glass/green")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/green")); + tag(Tags.Items.DYED_LIGHT_BLUE) + .addOptionalTag(new ResourceLocation("forge", "glass/light_blue")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/light_blue")); + tag(Tags.Items.DYED_LIGHT_GRAY) + .addOptionalTag(new ResourceLocation("forge", "glass/light_gray")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/light_gray")); + tag(Tags.Items.DYED_LIME) + .addOptionalTag(new ResourceLocation("forge", "glass/lime")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/lime")); + tag(Tags.Items.DYED_MAGENTA) + .addOptionalTag(new ResourceLocation("forge", "glass/magenta")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/magenta")); + tag(Tags.Items.DYED_MAGENTA) + .addOptionalTag(new ResourceLocation("forge", "glass/magenta")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/magenta")); + tag(Tags.Items.DYED_ORANGE) + .addOptionalTag(new ResourceLocation("forge", "glass/orange")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/orange")); + tag(Tags.Items.DYED_PINK) + .addOptionalTag(new ResourceLocation("forge", "glass/pink")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/pink")); + tag(Tags.Items.DYED_PURPLE) + .addOptionalTag(new ResourceLocation("forge", "glass/purple")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/purple")); + tag(Tags.Items.DYED_RED) + .addOptionalTag(new ResourceLocation("forge", "glass/red")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/red")); + tag(Tags.Items.DYED_WHITE) + .addOptionalTag(new ResourceLocation("forge", "glass/white")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/white")); + tag(Tags.Items.DYED_YELLOW) + .addOptionalTag(new ResourceLocation("forge", "glass/yellow")) + .addOptionalTag(new ResourceLocation("forge", "stained_glass/yellow")); + tagWithOptionalLegacy(Tags.Items.ENDER_PEARLS); + tagWithOptionalLegacy(Tags.Items.FEATHERS); + tagWithOptionalLegacy(Tags.Items.GEMS); + tagWithOptionalLegacy(Tags.Items.GEMS_AMETHYST); + tagWithOptionalLegacy(Tags.Items.GEMS_DIAMOND); + tagWithOptionalLegacy(Tags.Items.GEMS_EMERALD); + tagWithOptionalLegacy(Tags.Items.GEMS_LAPIS); + tagWithOptionalLegacy(Tags.Items.GEMS_PRISMARINE); + tagWithOptionalLegacy(Tags.Items.GEMS_QUARTZ); + tagWithOptionalLegacy(Tags.Items.GUNPOWDERS); + tagWithOptionalLegacy(Tags.Items.INGOTS); + tagWithOptionalLegacy(Tags.Items.INGOTS_COPPER); + tagWithOptionalLegacy(Tags.Items.INGOTS_GOLD); + tagWithOptionalLegacy(Tags.Items.INGOTS_IRON); + tagWithOptionalLegacy(Tags.Items.INGOTS_NETHERITE); + tag(Tags.Items.LEATHERS).addOptionalTag(new ResourceLocation("forge", "leather")); + tagWithOptionalLegacy(Tags.Items.MUSHROOMS); + tagWithOptionalLegacy(Tags.Items.NETHER_STARS); + tagWithOptionalLegacy(Tags.Items.NUGGETS); + tagWithOptionalLegacy(Tags.Items.NUGGETS_IRON); + tagWithOptionalLegacy(Tags.Items.NUGGETS_GOLD); + tagWithOptionalLegacy(Tags.Items.RAW_MATERIALS); + tagWithOptionalLegacy(Tags.Items.RAW_MATERIALS_COPPER); + tagWithOptionalLegacy(Tags.Items.RAW_MATERIALS_GOLD); + tagWithOptionalLegacy(Tags.Items.RAW_MATERIALS_IRON); + tagWithOptionalLegacy(Tags.Items.RODS); + tagWithOptionalLegacy(Tags.Items.RODS_BLAZE); + tagWithOptionalLegacy(Tags.Items.RODS_WOODEN); + tagWithOptionalLegacy(Tags.Items.SEEDS); + tagWithOptionalLegacy(Tags.Items.SEEDS_BEETROOT); + tagWithOptionalLegacy(Tags.Items.SEEDS_MELON); + tagWithOptionalLegacy(Tags.Items.SEEDS_PUMPKIN); + tagWithOptionalLegacy(Tags.Items.SEEDS_WHEAT); + tagWithOptionalLegacy(Tags.Items.SLIMEBALLS); + tagWithOptionalLegacy(Tags.Items.STRINGS); + tagWithOptionalLegacy(Tags.Items.TOOLS_SHIELDS); + tagWithOptionalLegacy(Tags.Items.TOOLS_BOWS); + tagWithOptionalLegacy(Tags.Items.TOOLS_CROSSBOWS); + tagWithOptionalLegacy(Tags.Items.TOOLS_FISHING_RODS); + tag(Tags.Items.TOOLS_SHEARS).addOptionalTag(new ResourceLocation("forge", "shears")); + tag(Tags.Items.TOOLS_SPEARS).addOptionalTag(new ResourceLocation("forge", "tools/tridents")); + tagWithOptionalLegacy(Tags.Items.TOOLS); + tagWithOptionalLegacy(Tags.Items.ARMORS); } - private void addColored(Consumer> consumer, TagKey group, String pattern) { + private IntrinsicHolderTagsProvider.IntrinsicTagAppender tagWithOptionalLegacy(TagKey tag) { + IntrinsicHolderTagsProvider.IntrinsicTagAppender tagAppender = tag(tag); + tagAppender.addOptionalTag(new ResourceLocation("forge", tag.location().getPath())); + return tagAppender; + } + + private void tagColoredWithOptionalLegacy(TagKey group) { + String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; + for (DyeColor color : DyeColor.values()) { + TagKey tag = getForgeItemTag(prefix + color.getName()); + tagWithOptionalLegacy(tag); + } + } + + private void addColored(TagKey group, String pattern) { String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; for (DyeColor color : DyeColor.values()) { ResourceLocation key = new ResourceLocation("minecraft", pattern.replace("{color}", color.getName())); TagKey tag = getForgeItemTag(prefix + color.getName()); Item item = BuiltInRegistries.ITEM.get(key); if (item == null || item == Items.AIR) - throw new IllegalStateException("Unknown vanilla item: " + key.toString()); + throw new IllegalStateException("Unknown vanilla item: " + key); tag(tag).add(item); - consumer.accept(tag); } } - private void copyColored(TagKey blockGroup, TagKey itemGroup) { - String blockPre = blockGroup.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; - String itemPre = itemGroup.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; + private void addColoredTags(Consumer> consumer, TagKey group) { + String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_'; for (DyeColor color : DyeColor.values()) { - TagKey from = getForgeBlockTag(blockPre + color.getName()); - TagKey to = getForgeItemTag(itemPre + color.getName()); - copy(from, to); + TagKey tag = getForgeItemTag(prefix + color.getName()); + consumer.accept(tag); } - copy(getForgeBlockTag(blockPre + "colorless"), getForgeItemTag(itemPre + "colorless")); } @SuppressWarnings("unchecked") @@ -210,4 +395,9 @@ private TagKey getForgeItemTag(String name) { throw new IllegalStateException(Tags.Items.class.getName() + " is missing tag name: " + name); } } + + @Override + public String getName() { + return "NeoForge Item Tags"; + } } diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeLanguageProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeLanguageProvider.java new file mode 100644 index 00000000000..10c3d9c07d2 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeLanguageProvider.java @@ -0,0 +1,446 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.common.data.internal; + +import java.util.Locale; +import net.minecraft.data.PackOutput; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.DyeColor; +import net.neoforged.neoforge.common.Tags; +import net.neoforged.neoforge.common.data.LanguageProvider; +import org.apache.commons.lang3.StringUtils; + +public final class NeoForgeLanguageProvider extends LanguageProvider { + public NeoForgeLanguageProvider(PackOutput gen) { + super(gen, "c", "en_us"); + } + + @Override + protected void addTranslations() { + // Blocks + add(Tags.Blocks.BARRELS, "Barrels"); + add(Tags.Blocks.BARRELS_WOODEN, "Wooden Barrels"); + add(Tags.Blocks.BOOKSHELVES, "Bookshelves"); + add(Tags.Blocks.BUDDING_BLOCKS, "Budding Blocks"); + add(Tags.Blocks.BUDS, "Buds"); + add(Tags.Blocks.CHAINS, "Chains"); + add(Tags.Blocks.CHESTS, "Chests"); + add(Tags.Blocks.CHESTS_ENDER, "Ender Chests"); + add(Tags.Blocks.CHESTS_TRAPPED, "Trapped Chests"); + add(Tags.Blocks.CHESTS_WOODEN, "Wooden Chests"); + add(Tags.Blocks.CLUSTERS, "Clusters"); + add(Tags.Blocks.COBBLESTONES, "Cobblestones"); + add(Tags.Blocks.COBBLESTONES_NORMAL, "Normal Cobblestones"); + add(Tags.Blocks.COBBLESTONES_INFESTED, "Infested Cobblestones"); + add(Tags.Blocks.COBBLESTONES_MOSSY, "Mossy Cobblestones"); + add(Tags.Blocks.COBBLESTONES_DEEPSLATE, "Deepslate Cobblestones"); + add(Tags.Blocks.DYED, "Dyed Blocks"); + addColored(Tags.Blocks.DYED, "{color} Dyed Blocks"); + add(Tags.Blocks.END_STONES, "End Stones"); + add(Tags.Blocks.ENDERMAN_PLACE_ON_BLACKLIST, "Enderman Place On Blacklist"); + add(Tags.Blocks.FENCE_GATES, "Fence Gates"); + add(Tags.Blocks.FENCE_GATES_WOODEN, "Wooden Fence Gates"); + add(Tags.Blocks.FENCES, "Fences"); + add(Tags.Blocks.FENCES_NETHER_BRICK, "Fences Nether Brick"); + add(Tags.Blocks.FENCES_WOODEN, "Wooden Fences"); + add(Tags.Blocks.GLASS_BLOCKS, "Glass Blocks"); + add(Tags.Blocks.GLASS_BLOCKS_COLORLESS, "Colorless Glass Blocks"); + add(Tags.Blocks.GLASS_BLOCKS_CHEAP, "Silica Glass Blocks"); + add(Tags.Blocks.GLASS_BLOCKS_TINTED, "Tinted Glass Blocks"); + add(Tags.Blocks.GLASS_PANES, "Glass Panes"); + add(Tags.Blocks.GLASS_PANES_COLORLESS, "Colorless Glass Panes"); + add(Tags.Blocks.GRAVELS, "Gravels"); + add(Tags.Blocks.SKULLS, "Skulls"); + add(Tags.Blocks.HIDDEN_FROM_RECIPE_VIEWERS, "Hidden From Recipe Viewers"); + add(Tags.Blocks.NETHERRACKS, "Netherracks"); + add(Tags.Blocks.NEEDS_WOOD_TOOL, "Needs Wooden Tools"); + add(Tags.Blocks.NEEDS_GOLD_TOOL, "Needs Gold Tools"); + add(Tags.Blocks.NEEDS_NETHERITE_TOOL, "Needs Netherite Tools"); + add(Tags.Blocks.OBSIDIANS, "Obsidians"); + add(Tags.Blocks.ORE_BEARING_GROUND_DEEPSLATE, "Deepslate Ore Bearing Ground"); + add(Tags.Blocks.ORE_BEARING_GROUND_NETHERRACK, "Netherrack Ore Bearing Ground"); + add(Tags.Blocks.ORE_BEARING_GROUND_STONE, "Stone Ore Bearing Ground"); + add(Tags.Blocks.ORE_RATES_DENSE, "Dense Ore Rates"); + add(Tags.Blocks.ORE_RATES_SINGULAR, "Singular Ore Rates"); + add(Tags.Blocks.ORE_RATES_SPARSE, "Sparse Ore Rates"); + add(Tags.Blocks.ORES, "Ores"); + add(Tags.Blocks.ORES_COAL, "Coal Ores"); + add(Tags.Blocks.ORES_COPPER, "Copper Ores"); + add(Tags.Blocks.ORES_DIAMOND, "Diamond Ores"); + add(Tags.Blocks.ORES_EMERALD, "Emerald Ores"); + add(Tags.Blocks.ORES_GOLD, "Gold Ores"); + add(Tags.Blocks.ORES_IRON, "Iron Ores"); + add(Tags.Blocks.ORES_LAPIS, "Lapis Ores"); + add(Tags.Blocks.ORES_QUARTZ, "Quartz Ores"); + add(Tags.Blocks.ORES_REDSTONE, "Redstone Ores"); + add(Tags.Blocks.ORES_NETHERITE_SCRAP, "Netherite Scrap Ores"); + add(Tags.Blocks.ORES_IN_GROUND_DEEPSLATE, "Deepslate Ores In Ground"); + add(Tags.Blocks.ORES_IN_GROUND_NETHERRACK, "Netherrack Ores In Ground"); + add(Tags.Blocks.ORES_IN_GROUND_STONE, "Stone Ores In Ground"); + add(Tags.Blocks.PLAYER_WORKSTATIONS_CRAFTING_TABLES, "Crafting Tables"); + add(Tags.Blocks.PLAYER_WORKSTATIONS_FURNACES, "Furnaces"); + add(Tags.Blocks.RELOCATION_NOT_SUPPORTED, "Relocation Not Supported"); + add(Tags.Blocks.ROPES, "Ropes"); + add(Tags.Blocks.SANDS, "Sands"); + add(Tags.Blocks.SANDS_COLORLESS, "Colorless Sands"); + add(Tags.Blocks.SANDS_RED, "Red Sands"); + add(Tags.Blocks.SANDSTONE_BLOCKS, "Sandstone Blocks"); + add(Tags.Blocks.SANDSTONE_SLABS, "Sandstone Slabs"); + add(Tags.Blocks.SANDSTONE_STAIRS, "Sandstone Stairs"); + add(Tags.Blocks.SANDSTONE_RED_BLOCKS, "Red Sandstone Blocks"); + add(Tags.Blocks.SANDSTONE_RED_SLABS, "Red Sandstone Slabs"); + add(Tags.Blocks.SANDSTONE_RED_STAIRS, "Red Sandstone Stairs"); + add(Tags.Blocks.SANDSTONE_UNCOLORED_BLOCKS, "Uncolored Sandstone Blocks"); + add(Tags.Blocks.SANDSTONE_UNCOLORED_SLABS, "Uncolored Sandstone Slabs"); + add(Tags.Blocks.SANDSTONE_UNCOLORED_STAIRS, "Uncolored Sandstone Stairs"); + add(Tags.Blocks.STONES, "Stones"); + add(Tags.Blocks.STORAGE_BLOCKS, "Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_BONE_MEAL, "Bone Meal Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_COAL, "Coal Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_COPPER, "Copper Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_DIAMOND, "Diamond Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_DRIED_KELP, "Dried Kelp Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_EMERALD, "Emerald Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_GOLD, "Gold Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_IRON, "Iron Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_LAPIS, "Lapis Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_NETHERITE, "Netherite Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_RAW_COPPER, "Raw Copper Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_RAW_GOLD, "Raw Gold Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_RAW_IRON, "Raw Iron Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_REDSTONE, "Redstone Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_SLIME, "Slime Storage Blocks"); + add(Tags.Blocks.STORAGE_BLOCKS_WHEAT, "Wheat Storage Blocks"); + add(Tags.Blocks.VILLAGER_JOB_SITES, "Villager Job Sites"); + + // Items + add(Tags.Items.BARRELS, "Barrels"); + add(Tags.Items.BARRELS_WOODEN, "Wooden Barrels"); + add(Tags.Items.BONES, "Bones"); + add(Tags.Items.BOOKSHELVES, "Bookshelves"); + add(Tags.Items.BRICKS, "Bricks"); + add(Tags.Items.BRICKS_NORMAL, "Normal Bricks"); + add(Tags.Items.BRICKS_NETHER, "Nether Bricks"); + add(Tags.Items.BUCKETS, "Buckets"); + add(Tags.Items.BUCKETS_EMPTY, "Empty Buckets"); + add(Tags.Items.BUCKETS_WATER, "Water Buckets"); + add(Tags.Items.BUCKETS_LAVA, "Lava Buckets"); + add(Tags.Items.BUCKETS_MILK, "Milk Buckets"); + add(Tags.Items.BUCKETS_POWDER_SNOW, "Powder Snow Buckets"); + add(Tags.Items.BUCKETS_ENTITY_WATER, "Water Entity Buckets"); + add(Tags.Items.BUDDING_BLOCKS, "Budding Blocks"); + add(Tags.Items.BUDS, "Buds"); + add(Tags.Items.CHAINS, "Chains"); + add(Tags.Items.CHESTS, "Chests"); + add(Tags.Items.CHESTS_ENDER, "Ender Chests"); + add(Tags.Items.CHESTS_TRAPPED, "Trapped Chests"); + add(Tags.Items.CHESTS_WOODEN, "Wooden Chests"); + add(Tags.Items.CLUSTERS, "Clusters"); + add(Tags.Items.COBBLESTONES, "Cobblestones"); + add(Tags.Items.COBBLESTONES_NORMAL, "Normal Cobblestones"); + add(Tags.Items.COBBLESTONES_INFESTED, "Infested Cobblestones"); + add(Tags.Items.COBBLESTONES_MOSSY, "Mossy Cobblestones"); + add(Tags.Items.COBBLESTONES_DEEPSLATE, "Deepslate Cobblestones"); + add(Tags.Items.CROPS, "Crops"); + add(Tags.Items.CROPS_BEETROOT, "Beetroot Crops"); + add(Tags.Items.CROPS_CARROT, "Carrot Crops"); + add(Tags.Items.CROPS_NETHER_WART, "Nether Wart Crops"); + add(Tags.Items.CROPS_POTATO, "Potato Crops"); + add(Tags.Items.CROPS_WHEAT, "Wheat Crops"); + add(Tags.Items.DUSTS, "Dusts"); + add(Tags.Items.DUSTS_GLOWSTONE, "Glowstone Dusts"); + add(Tags.Items.DUSTS_REDSTONE, "Redstone Dusts"); + add(Tags.Items.DYED, "Dyed Items"); + addColored(Tags.Items.DYED, "{color} Dyed Items"); + add(Tags.Items.DYES, "Dyes"); + add(Tags.Items.DYES_BLACK, "Black Dyes"); + add(Tags.Items.DYES_RED, "Red Dyes"); + add(Tags.Items.DYES_GREEN, "Green Dyes"); + add(Tags.Items.DYES_BROWN, "Brown Dyes"); + add(Tags.Items.DYES_BLUE, "Blue Dyes"); + add(Tags.Items.DYES_PURPLE, "Purple Dyes"); + add(Tags.Items.DYES_CYAN, "Cyan Dyes"); + add(Tags.Items.DYES_LIGHT_GRAY, "Light Gray Dyes"); + add(Tags.Items.DYES_GRAY, "Gray Dyes"); + add(Tags.Items.DYES_PINK, "Pink Dyes"); + add(Tags.Items.DYES_LIME, "Lime Dyes"); + add(Tags.Items.DYES_YELLOW, "Yellow Dyes"); + add(Tags.Items.DYES_LIGHT_BLUE, "Light Blue Dyes"); + add(Tags.Items.DYES_MAGENTA, "Magenta Dyes"); + add(Tags.Items.DYES_ORANGE, "Orange Dyes"); + add(Tags.Items.DYES_WHITE, "White Dyes"); + add(Tags.Items.EGGS, "Eggs"); + add(Tags.Items.ENCHANTING_FUELS, "Enchanting Fuels"); + add(Tags.Items.END_STONES, "End Stones"); + add(Tags.Items.ENDER_PEARLS, "Ender Pearls"); + add(Tags.Items.FEATHERS, "Feathers"); + add(Tags.Items.FENCE_GATES, "Fence Gates"); + add(Tags.Items.FENCE_GATES_WOODEN, "Wooden Fence Gates"); + add(Tags.Items.FENCES, "Fences"); + add(Tags.Items.FENCES_NETHER_BRICK, "Nether Brick Fences"); + add(Tags.Items.FENCES_WOODEN, "Wooden Fences"); + add(Tags.Items.FOODS, "Foods"); + add(Tags.Items.FOODS_BERRIES, "Berries"); + add(Tags.Items.FOODS_BREADS, "Breads"); + add(Tags.Items.FOODS_CANDIES, "Candies"); + add(Tags.Items.FOODS_COOKED_FISHES, "Cooked Fishes"); + add(Tags.Items.FOODS_COOKED_MEATS, "Cooked Meats"); + add(Tags.Items.FOODS_COOKIES, "Cookies"); + add(Tags.Items.FOODS_EDIBLE_WHEN_PLACED, "Edible When Placed"); + add(Tags.Items.FOODS_FOOD_POISONING, "Food Poisoning Foods"); + add(Tags.Items.FOODS_FRUITS, "Fruits"); + add(Tags.Items.FOODS_RAW_FISHES, "Raw Fishes"); + add(Tags.Items.FOODS_RAW_MEATS, "Raw Meats"); + add(Tags.Items.FOODS_SOUPS, "Soups"); + add(Tags.Items.FOODS_VEGETABLES, "Vegetables"); + add(Tags.Items.GEMS, "Gems"); + add(Tags.Items.GEMS_AMETHYST, "Amethyst Gems"); + add(Tags.Items.GEMS_DIAMOND, "Diamond Gems"); + add(Tags.Items.GEMS_EMERALD, "Emerald Gems"); + add(Tags.Items.GEMS_LAPIS, "Lapis Gems"); + add(Tags.Items.GEMS_PRISMARINE, "Prismarine Gems"); + add(Tags.Items.GEMS_QUARTZ, "Quartz Gems"); + add(Tags.Items.GLASS_BLOCKS, "Glass Blocks"); + add(Tags.Items.GLASS_BLOCKS_TINTED, "Tinted Glass Blocks"); + add(Tags.Items.GLASS_BLOCKS_CHEAP, "Cheap Glass Blocks"); + add(Tags.Items.GLASS_BLOCKS_COLORLESS, "Colorless Glass Blocks"); + add(Tags.Items.GLASS_PANES, "Glass Panes"); + add(Tags.Items.GLASS_PANES_COLORLESS, "Colorless Glass Panes"); + add(Tags.Items.GRAVELS, "Gravels"); + add(Tags.Items.GUNPOWDERS, "Gunpowders"); + add(Tags.Items.HIDDEN_FROM_RECIPE_VIEWERS, "Hidden From Recipe Viewers"); + add(Tags.Items.INGOTS, "Ingots"); + add(Tags.Items.INGOTS_COPPER, "Copper Ingots"); + add(Tags.Items.INGOTS_GOLD, "Gold Ingots"); + add(Tags.Items.INGOTS_IRON, "Iron Ingots"); + add(Tags.Items.INGOTS_NETHERITE, "Netherite Ingots"); + add(Tags.Items.LEATHERS, "Leathers"); + add(Tags.Items.MUSHROOMS, "Mushrooms"); + add(Tags.Items.NETHER_STARS, "Nether Stars"); + add(Tags.Items.NETHERRACKS, "Netherracks"); + add(Tags.Items.NUGGETS, "Nuggets"); + add(Tags.Items.NUGGETS_IRON, "Iron Nuggets"); + add(Tags.Items.NUGGETS_GOLD, "Gold Nuggets"); + add(Tags.Items.OBSIDIANS, "Obsidians"); + add(Tags.Items.ORE_BEARING_GROUND_DEEPSLATE, "Deepslate Ore Bearing Ground"); + add(Tags.Items.ORE_BEARING_GROUND_NETHERRACK, "Netherrack Ore Bearing Ground"); + add(Tags.Items.ORE_BEARING_GROUND_STONE, "Stone Ore Bearing Ground"); + add(Tags.Items.ORE_RATES_DENSE, "Dense Ore Rates"); + add(Tags.Items.ORE_RATES_SINGULAR, "Singular Ore Rates"); + add(Tags.Items.ORE_RATES_SPARSE, "Sparse Ore Rates"); + add(Tags.Items.ORES, "Ores"); + add(Tags.Items.ORES_COAL, "Coal Ores"); + add(Tags.Items.ORES_COPPER, "Copper Ores"); + add(Tags.Items.ORES_DIAMOND, "Diamond Ores"); + add(Tags.Items.ORES_EMERALD, "Emerald Ores"); + add(Tags.Items.ORES_GOLD, "Gold Ores"); + add(Tags.Items.ORES_IRON, "Iron Ores"); + add(Tags.Items.ORES_LAPIS, "Lapis Ores"); + add(Tags.Items.ORES_QUARTZ, "Quartz Ores"); + add(Tags.Items.ORES_REDSTONE, "Redstone Ores"); + add(Tags.Items.ORES_NETHERITE_SCRAP, "Netherite Scrap Ores"); + add(Tags.Items.ORES_IN_GROUND_DEEPSLATE, "Deepslate Ores In Ground"); + add(Tags.Items.ORES_IN_GROUND_NETHERRACK, "Netherrack Ores In Ground"); + add(Tags.Items.ORES_IN_GROUND_STONE, "Stone Ores In Ground"); + add(Tags.Items.PLAYER_WORKSTATIONS_CRAFTING_TABLES, "Crafting Tables"); + add(Tags.Items.PLAYER_WORKSTATIONS_FURNACES, "Furnaces"); + add(Tags.Items.RAW_BLOCKS, "Raw Blocks"); + add(Tags.Items.RAW_BLOCKS_COPPER, "Copper Raw Blocks"); + add(Tags.Items.RAW_BLOCKS_GOLD, "Gold Raw Blocks"); + add(Tags.Items.RAW_BLOCKS_IRON, "Iron Raw Blocks"); + add(Tags.Items.RAW_MATERIALS, "Raw Materials"); + add(Tags.Items.RAW_MATERIALS_COPPER, "Copper Raw Materials"); + add(Tags.Items.RAW_MATERIALS_GOLD, "Gold Raw Materials"); + add(Tags.Items.RAW_MATERIALS_IRON, "Iron Raw Materials"); + add(Tags.Items.RODS, "Rods"); + add(Tags.Items.RODS_BLAZE, "Blaze Rods"); + add(Tags.Items.RODS_BREEZE, "Breeze Rods"); + add(Tags.Items.RODS_WOODEN, "Wooden Rods"); + add(Tags.Items.ROPES, "Ropes"); + add(Tags.Items.SANDS, "Sands"); + add(Tags.Items.SANDS_COLORLESS, "Colorless Sands"); + add(Tags.Items.SANDS_RED, "Red Sands"); + add(Tags.Items.SANDSTONE_BLOCKS, "Sandstone Blocks"); + add(Tags.Items.SANDSTONE_SLABS, "Sandstone Slabs"); + add(Tags.Items.SANDSTONE_STAIRS, "Sandstone Stairs"); + add(Tags.Items.SANDSTONE_RED_BLOCKS, "Red Sandstone Blocks"); + add(Tags.Items.SANDSTONE_RED_SLABS, "Red Sandstone Slabs"); + add(Tags.Items.SANDSTONE_RED_STAIRS, "Red Sandstone Stairs"); + add(Tags.Items.SANDSTONE_UNCOLORED_BLOCKS, "Uncolored Sandstone Blocks"); + add(Tags.Items.SANDSTONE_UNCOLORED_SLABS, "Uncolored Sandstone Slabs"); + add(Tags.Items.SANDSTONE_UNCOLORED_STAIRS, "Uncolored Sandstone Stairs"); + add(Tags.Items.SEEDS, "Seeds"); + add(Tags.Items.SEEDS_BEETROOT, "Beetroot Seeds"); + add(Tags.Items.SEEDS_MELON, "Melon Seeds"); + add(Tags.Items.SEEDS_PUMPKIN, "Pumpkin Seeds"); + add(Tags.Items.SEEDS_WHEAT, "Wheat Seeds"); + add(Tags.Items.SLIMEBALLS, "Slimeballs"); + add(Tags.Items.STONES, "Stones"); + add(Tags.Items.STORAGE_BLOCKS, "Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_BONE_MEAL, "Bone Meal Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_COAL, "Coal Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_COPPER, "Copper Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_DIAMOND, "Diamond Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_DRIED_KELP, "Dried Kelp Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_EMERALD, "Emerald Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_GOLD, "Gold Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_IRON, "Iron Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_LAPIS, "Lapis Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_NETHERITE, "Netherite Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_RAW_COPPER, "Raw Copper Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_RAW_GOLD, "Raw Gold Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_RAW_IRON, "Raw Iron Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_REDSTONE, "Redstone Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_SLIME, "Slime Storage Blocks"); + add(Tags.Items.STORAGE_BLOCKS_WHEAT, "Wheat Storage Blocks"); + add(Tags.Items.STRINGS, "Strings"); + add(Tags.Items.VILLAGER_JOB_SITES, "Villager Job Sites"); + add(Tags.Items.TOOLS_SHEARS, "Shears"); + add(Tags.Items.TOOLS_SHIELDS, "Shields"); + add(Tags.Items.TOOLS_BOWS, "Bows"); + add(Tags.Items.TOOLS_CROSSBOWS, "Crossbows"); + add(Tags.Items.TOOLS_FISHING_RODS, "Fishing Rods"); + add(Tags.Items.TOOLS_BRUSHES, "Brushes"); + add(Tags.Items.TOOLS_SPEARS, "Spears"); + add(Tags.Items.TOOLS, "Tools"); + add(Tags.Items.ARMORS, "Armors"); + add(Tags.Items.ENCHANTABLES, "Enchantables"); + + // Fluids + add(Tags.Fluids.WATER, "Water"); + add(Tags.Fluids.LAVA, "Lava"); + add(Tags.Fluids.MILK, "Milk"); + add(Tags.Fluids.GASEOUS, "Gaseous"); + add(Tags.Fluids.HONEY, "Honey"); + add(Tags.Fluids.POTION, "Potion"); + add(Tags.Fluids.SUSPICIOUS_STEW, "Suspicious Stew"); + add(Tags.Fluids.MUSHROOM_STEW, "Mushroom Stew"); + add(Tags.Fluids.RABBIT_STEW, "Rabbit Stew"); + add(Tags.Fluids.BEETROOT_SOUP, "Beetroot Soup"); + add(Tags.Fluids.HIDDEN_FROM_RECIPE_VIEWERS, "Hidden From Recipe Viewers"); + + // Entities + add(Tags.EntityTypes.BOSSES, "Bosses"); + add(Tags.EntityTypes.MINECARTS, "Minecarts"); + add(Tags.EntityTypes.BOATS, "Boats"); + add(Tags.EntityTypes.CAPTURING_NOT_SUPPORTED, "Capturing Not Supported"); + add(Tags.EntityTypes.TELEPORTING_NOT_SUPPORTED, "Teleporting Not Supported"); + + // Enchantments + add(Tags.Enchantments.INCREASE_BLOCK_DROPS, "Increase Block Drops"); + add(Tags.Enchantments.INCREASE_ENTITY_DROPS, "Increase Entity Drops"); + add(Tags.Enchantments.WEAPON_DAMAGE_ENHANCEMENTS, "Weapon Damage Enhancements"); + add(Tags.Enchantments.ENTITY_SPEED_ENHANCEMENTS, "Entity Speed Enhancements"); + add(Tags.Enchantments.ENTITY_AUXILIARY_MOVEMENT_ENHANCEMENTS, "Entity Auxiliary Movement Enhancements"); + add(Tags.Enchantments.ENTITY_DEFENSE_ENHANCEMENTS, "Entity Defense Enhancements"); + + // Biomes + add(Tags.Biomes.NO_DEFAULT_MONSTERS, "No Default Monsters"); + add(Tags.Biomes.HIDDEN_FROM_LOCATOR_SELECTION, "Hidden From Locator's Selection"); + add(Tags.Biomes.IS_VOID, "Voids"); + + add(Tags.Biomes.IS_END, "Is End"); + add(Tags.Biomes.IS_NETHER, "Is Nether"); + add(Tags.Biomes.IS_OVERWORLD, "Is Overworld"); + + add(Tags.Biomes.IS_HOT, "Hot"); + add(Tags.Biomes.IS_HOT_OVERWORLD, "Hot Overworld"); + add(Tags.Biomes.IS_HOT_NETHER, "Hot Nether"); + add(Tags.Biomes.IS_HOT_END, "Hot End"); + add(Tags.Biomes.IS_COLD, "Cold"); + add(Tags.Biomes.IS_COLD_OVERWORLD, "Cold Overworld"); + add(Tags.Biomes.IS_COLD_NETHER, "Cold Nether"); + add(Tags.Biomes.IS_COLD_END, "Cold End"); + add(Tags.Biomes.IS_SPARSE_VEGETATION, "Sparse Vegetation"); + add(Tags.Biomes.IS_SPARSE_VEGETATION_OVERWORLD, "Sparse Overworld Vegetation"); + add(Tags.Biomes.IS_SPARSE_VEGETATION_NETHER, "Sparse Nether Vegetation"); + add(Tags.Biomes.IS_SPARSE_VEGETATION_END, "Sparse End Vegetation"); + add(Tags.Biomes.IS_DENSE_VEGETATION, "Dense Vegetation"); + add(Tags.Biomes.IS_DENSE_VEGETATION_OVERWORLD, "Dense Overworld Vegetation"); + add(Tags.Biomes.IS_DENSE_VEGETATION_NETHER, "Dense Nether Vegetation"); + add(Tags.Biomes.IS_DENSE_VEGETATION_END, "Dense End Vegetation"); + add(Tags.Biomes.IS_WET, "Wet"); + add(Tags.Biomes.IS_WET_OVERWORLD, "Wet Overworld"); + add(Tags.Biomes.IS_WET_NETHER, "Wet Nether"); + add(Tags.Biomes.IS_WET_END, "Wet End"); + add(Tags.Biomes.IS_DRY, "Dry"); + add(Tags.Biomes.IS_DRY_OVERWORLD, "Dry Overworld"); + add(Tags.Biomes.IS_DRY_NETHER, "Dry Nether"); + add(Tags.Biomes.IS_DRY_END, "Dry End"); + + add(Tags.Biomes.IS_CONIFEROUS_TREE, "Coniferous Trees"); + add(Tags.Biomes.IS_SAVANNA_TREE, "Savanna Trees"); + add(Tags.Biomes.IS_JUNGLE_TREE, "Jungle Trees"); + add(Tags.Biomes.IS_DECIDUOUS_TREE, "Deciduous Trees"); + + add(Tags.Biomes.IS_MOUNTAIN, "Mountains"); + add(Tags.Biomes.IS_MOUNTAIN_PEAK, "Peaks"); + add(Tags.Biomes.IS_MOUNTAIN_SLOPE, "Slopes"); + + add(Tags.Biomes.IS_PLAINS, "Plains"); + add(Tags.Biomes.IS_SNOWY_PLAINS, "Snowy Plains"); + add(Tags.Biomes.IS_FOREST, "Forest"); + add(Tags.Biomes.IS_BIRCH_FOREST, "Birch Forest"); + add(Tags.Biomes.IS_FLOWER_FOREST, "Flower Forest"); + add(Tags.Biomes.IS_TAIGA, "Taiga"); + add(Tags.Biomes.IS_HILL, "Hills"); + add(Tags.Biomes.IS_WINDSWEPT, "Windswept"); + add(Tags.Biomes.IS_JUNGLE, "Jungle"); + add(Tags.Biomes.IS_FLORAL, "Floral"); + add(Tags.Biomes.IS_BEACH, "Beach"); + add(Tags.Biomes.IS_STONY_SHORES, "Stony Shores"); + add(Tags.Biomes.IS_SHALLOW_OCEAN, "Shallow Ocean"); + add(Tags.Biomes.IS_OCEAN, "Ocean"); + add(Tags.Biomes.IS_DEEP_OCEAN, "Deep Ocean"); + add(Tags.Biomes.IS_RIVER, "River"); + add(Tags.Biomes.IS_BADLANDS, "Badlands"); + add(Tags.Biomes.IS_SNOWY, "Snowy"); + add(Tags.Biomes.IS_ICY, "Icy"); + add(Tags.Biomes.IS_AQUATIC_ICY, "Aquatic Icy"); + add(Tags.Biomes.IS_SPOOKY, "Spooky"); + add(Tags.Biomes.IS_DEAD, "Dead"); + add(Tags.Biomes.IS_LUSH, "Lush"); + add(Tags.Biomes.IS_MUSHROOM, "Mushrooms"); + add(Tags.Biomes.IS_MAGICAL, "Magical"); + add(Tags.Biomes.IS_RARE, "Rare"); + add(Tags.Biomes.IS_PLATEAU, "Plateaus"); + add(Tags.Biomes.IS_MODIFIED, "Modified"); + add(Tags.Biomes.IS_OLD_GROWTH, "Old Growth"); + + add(Tags.Biomes.IS_AQUATIC, "Aquatic"); + add(Tags.Biomes.IS_DESERT, "Deserts"); + add(Tags.Biomes.IS_SAVANNA, "Savanna"); + add(Tags.Biomes.IS_SWAMP, "Swamps"); + add(Tags.Biomes.IS_SANDY, "Sandy"); + add(Tags.Biomes.IS_WASTELAND, "Wastelands"); + + add(Tags.Biomes.IS_UNDERGROUND, "Underground"); + add(Tags.Biomes.IS_CAVE, "Caves"); + + add(Tags.Biomes.IS_NETHER_FOREST, "Nether Forest"); + add(Tags.Biomes.IS_OUTER_END_ISLAND, "Outer End Island"); + + // Structures + add(Tags.Structures.HIDDEN_FROM_DISPLAYERS, "Hidden From Displayers"); + add(Tags.Structures.HIDDEN_FROM_LOCATOR_SELECTION, "Hidden From Locator's Selection"); + } + + private void addColored(TagKey baseTagKey, String pattern) { + for (DyeColor color : DyeColor.values()) { + TagKey coloredTag = TagKey.create( + baseTagKey.registry(), + new ResourceLocation(baseTagKey.location().getNamespace(), baseTagKey.location().getPath() + "/" + color.name().toLowerCase(Locale.ROOT))); + + add(coloredTag, pattern.replace("{color}", StringUtils.capitalize(color.getName()))); + } + } + + @Override + public String getName() { + return "Forge Translations"; + } +} diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeLootTableProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeLootTableProvider.java index 48aaacc2609..6c9f4868ca2 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeLootTableProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeLootTableProvider.java @@ -5,22 +5,27 @@ package net.neoforged.neoforge.common.data.internal; +import com.mojang.datafixers.util.Either; import java.util.ArrayList; import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.Set; +import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; import net.minecraft.advancements.critereon.ItemPredicate; import net.minecraft.core.Holder; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.WritableRegistry; import net.minecraft.data.PackOutput; import net.minecraft.data.loot.LootTableProvider; import net.minecraft.data.loot.LootTableSubProvider; import net.minecraft.data.loot.packs.VanillaLootTableProvider; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; +import net.minecraft.util.ProblemReporter; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.level.storage.loot.LootPool; @@ -34,7 +39,7 @@ import net.minecraft.world.level.storage.loot.entries.LootItem; import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer; import net.minecraft.world.level.storage.loot.entries.LootPoolSingletonContainer; -import net.minecraft.world.level.storage.loot.entries.LootTableReference; +import net.minecraft.world.level.storage.loot.entries.NestedLootTable; import net.minecraft.world.level.storage.loot.entries.SequentialEntry; import net.minecraft.world.level.storage.loot.entries.TagEntry; import net.minecraft.world.level.storage.loot.functions.LootItemFunction; @@ -55,12 +60,12 @@ public final class NeoForgeLootTableProvider extends LootTableProvider { private final List> conditionReplacers = new ArrayList<>(); - public NeoForgeLootTableProvider(PackOutput packOutput) { - super(packOutput, Set.of(), VanillaLootTableProvider.create(packOutput).getTables()); + public NeoForgeLootTableProvider(PackOutput packOutput, CompletableFuture provider) { + super(packOutput, Set.of(), VanillaLootTableProvider.create(packOutput, provider).getTables(), provider); } @Override - protected void validate(Map map, ValidationContext validationcontext) { + protected void validate(WritableRegistry writableregistry, ValidationContext validationcontext, ProblemReporter.Collector problemreporter$collector) { // Do not validate against all registered loot tables } @@ -79,7 +84,7 @@ public List getTables() { } private LootTableSubProvider replaceAndFilterChangesOnly(LootTableSubProvider subProvider) { - return newConsumer -> subProvider.generate((resourceLocation, builder) -> { + return (lookupProvider, newConsumer) -> subProvider.generate(lookupProvider, (resourceLocation, builder) -> { LootTable.Builder newBuilder = findAndReplaceInLootTableBuilder(builder); if (newBuilder != null) { newConsumer.accept(resourceLocation, newBuilder); @@ -198,9 +203,9 @@ private boolean findAndReplaceInLootEntry(LootPoolEntryContainer entry, Consumer TagKey tag = getPrivateValue(TagEntry.class, tagEntry, "tag"); boolean expand = getPrivateValue(TagEntry.class, tagEntry, "expand"); builder = expand ? TagEntry.expandTag(tag) : TagEntry.tagContents(tag); - } else if (singleton instanceof LootTableReference reference) { - ResourceLocation name = getPrivateValue(LootTableReference.class, reference, "name"); - builder = LootTableReference.lootTableReference(name); + } else if (singleton instanceof NestedLootTable reference) { + Either, LootTable> contents = getPrivateValue(NestedLootTable.class, reference, "contents"); + builder = contents.map(NestedLootTable::lootTableReference, NestedLootTable::inlineLootTable); } else { throw new IllegalStateException("Unknown LootPoolSingletonContainer type: " + singleton.getClass().getName()); } diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeRecipeProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeRecipeProvider.java index 6b067f1563c..54133041cd5 100644 --- a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeRecipeProvider.java +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeRecipeProvider.java @@ -14,6 +14,7 @@ import java.util.concurrent.CompletableFuture; import net.minecraft.advancements.Advancement; import net.minecraft.advancements.AdvancementHolder; +import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.CachedOutput; import net.minecraft.data.PackOutput; @@ -43,8 +44,8 @@ public final class NeoForgeRecipeProvider extends VanillaRecipeProvider { private final Map> replacements = new HashMap<>(); private final Set excludes = new HashSet<>(); - public NeoForgeRecipeProvider(PackOutput packOutput) { - super(packOutput); + public NeoForgeRecipeProvider(PackOutput packOutput, CompletableFuture provider) { + super(packOutput, provider); } private void exclude(ItemLike item) { @@ -72,10 +73,10 @@ protected void buildRecipes(RecipeOutput recipeOutput) { replace(Items.DIAMOND, Tags.Items.GEMS_DIAMOND); replace(Items.EMERALD, Tags.Items.GEMS_EMERALD); replace(Items.CHEST, Tags.Items.CHESTS_WOODEN); - replace(Blocks.COBBLESTONE, Tags.Items.COBBLESTONE_NORMAL); - replace(Blocks.COBBLED_DEEPSLATE, Tags.Items.COBBLESTONE_DEEPSLATE); + replace(Blocks.COBBLESTONE, Tags.Items.COBBLESTONES_NORMAL); + replace(Blocks.COBBLED_DEEPSLATE, Tags.Items.COBBLESTONES_DEEPSLATE); - replace(Items.STRING, Tags.Items.STRING); + replace(Items.STRING, Tags.Items.STRINGS); exclude(getConversionRecipeName(Blocks.WHITE_WOOL, Items.STRING)); exclude(Blocks.GOLD_BLOCK); @@ -134,7 +135,7 @@ private ShapelessRecipe enhance(ResourceLocation id, ShapelessRecipe vanilla) { } @Override - protected CompletableFuture buildAdvancement(CachedOutput p_253674_, AdvancementHolder p_301116_) { + protected CompletableFuture buildAdvancement(CachedOutput p_253674_, HolderLookup.Provider p_323646_, AdvancementHolder p_301116_) { // NOOP - We don't replace any of the advancement things yet... return CompletableFuture.allOf(); } diff --git a/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeStructureTagsProvider.java b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeStructureTagsProvider.java new file mode 100644 index 00000000000..532a394f919 --- /dev/null +++ b/src/main/java/net/neoforged/neoforge/common/data/internal/NeoForgeStructureTagsProvider.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.neoforged.neoforge.common.data.internal; + +import java.util.concurrent.CompletableFuture; +import net.minecraft.core.HolderLookup; +import net.minecraft.data.PackOutput; +import net.minecraft.data.tags.StructureTagsProvider; +import net.neoforged.neoforge.common.Tags; +import net.neoforged.neoforge.common.data.ExistingFileHelper; + +public final class NeoForgeStructureTagsProvider extends StructureTagsProvider { + public NeoForgeStructureTagsProvider(PackOutput output, CompletableFuture lookupProvider, ExistingFileHelper existingFileHelper) { + super(output, lookupProvider, "neoforge", existingFileHelper); + } + + @Override + public void addTags(HolderLookup.Provider lookupProvider) { + tag(Tags.Structures.HIDDEN_FROM_DISPLAYERS); + tag(Tags.Structures.HIDDEN_FROM_LOCATOR_SELECTION); + } +} diff --git a/src/main/java/net/neoforged/neoforge/common/extensions/IBlockEntityExtension.java b/src/main/java/net/neoforged/neoforge/common/extensions/IBlockEntityExtension.java index a0bee8a6b5f..c76d91ab7d4 100644 --- a/src/main/java/net/neoforged/neoforge/common/extensions/IBlockEntityExtension.java +++ b/src/main/java/net/neoforged/neoforge/common/extensions/IBlockEntityExtension.java @@ -7,6 +7,7 @@ import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.Connection; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; @@ -15,24 +16,13 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.chunk.LevelChunk; import net.neoforged.neoforge.client.model.data.ModelData; -import net.neoforged.neoforge.common.util.INBTSerializable; import org.jetbrains.annotations.ApiStatus; -public interface IBlockEntityExtension extends INBTSerializable { +public interface IBlockEntityExtension { private BlockEntity self() { return (BlockEntity) this; } - @Override - default void deserializeNBT(CompoundTag nbt) { - self().load(nbt); - } - - @Override - default CompoundTag serializeNBT() { - return self().saveWithFullMetadata(); - } - /** * Called when you receive a TileEntityData packet for the location this * TileEntity is currently in. On the client, the NetworkManager will always @@ -42,22 +32,22 @@ default CompoundTag serializeNBT() { * @param net The NetworkManager the packet originated from * @param pkt The data packet */ - default void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt) { + default void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt, HolderLookup.Provider lookupProvider) { CompoundTag compoundtag = pkt.getTag(); - if (compoundtag != null) { - self().load(compoundtag); + if (!compoundtag.isEmpty()) { + self().loadWithComponents(compoundtag, lookupProvider); } } /** - * Called when the chunk's TE update tag, gotten from {@link BlockEntity#getUpdateTag()}, is received on the client. + * Called when the chunk's TE update tag, gotten from {@link BlockEntity#getUpdateTag(HolderLookup.Provider)}, is received on the client. *

- * Used to handle this tag in a special way. By default this simply calls {@link BlockEntity#load(CompoundTag)}. + * Used to handle this tag in a special way. By default this simply calls {@link BlockEntity#loadWithComponents(CompoundTag, HolderLookup.Provider)}. * - * @param tag The {@link CompoundTag} sent from {@link BlockEntity#getUpdateTag()} + * @param tag The {@link CompoundTag} sent from {@link BlockEntity#getUpdateTag(HolderLookup.Provider)} */ - default void handleUpdateTag(CompoundTag tag) { - self().load(tag); + default void handleUpdateTag(CompoundTag tag, HolderLookup.Provider lookupProvider) { + self().loadWithComponents(tag, lookupProvider); } /** diff --git a/src/main/java/net/neoforged/neoforge/common/extensions/IBlockExtension.java b/src/main/java/net/neoforged/neoforge/common/extensions/IBlockExtension.java index 7d5e6d5843d..8be04a8f307 100644 --- a/src/main/java/net/neoforged/neoforge/common/extensions/IBlockExtension.java +++ b/src/main/java/net/neoforged/neoforge/common/extensions/IBlockExtension.java @@ -17,7 +17,6 @@ import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.SpawnPlacements; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.entity.boss.wither.WitherBoss; import net.minecraft.world.entity.item.ItemEntity; @@ -32,6 +31,7 @@ import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.EmptyBlockGetter; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; @@ -63,7 +63,7 @@ import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.MapColor; import net.minecraft.world.level.material.PushReaction; -import net.minecraft.world.level.pathfinder.BlockPathTypes; +import net.minecraft.world.level.pathfinder.PathType; import net.minecraft.world.level.pathfinder.WalkNodeEvaluator; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; @@ -71,7 +71,6 @@ import net.neoforged.neoforge.capabilities.BlockCapabilityCache; import net.neoforged.neoforge.client.ClientHooks; import net.neoforged.neoforge.client.model.data.ModelData; -import net.neoforged.neoforge.client.model.data.ModelDataManager; import net.neoforged.neoforge.common.CommonHooks; import net.neoforged.neoforge.common.IPlantable; import net.neoforged.neoforge.common.ToolAction; @@ -104,19 +103,32 @@ default float getFriction(BlockState state, LevelReader level, BlockPos pos, @Nu return self().getFriction(); } + /** + * Whether this block has dynamic light emission which is not solely based on the {@link BlockState} and instead + * uses the {@link BlockPos}, the {@link AuxiliaryLightManager} or another external data source to determine its + * light value in {@link #getLightEmission(BlockState, BlockGetter, BlockPos)} + * + * @param state the block state being checked + * @return true if this block cannot determine its light emission solely based on the block state, false otherwise + */ + default boolean hasDynamicLightEmission(BlockState state) { + return false; + } + /** * Get a light value for this block, taking into account the given state and coordinates, normal ranges are between 0 and 15 * * @param state The state of this block - * @param level The level this block is in - * @param pos The position of this block in the level, will be {@link BlockPos#ZERO} when the chunk being loaded or - * generated calls this to check whether it contains any light sources + * @param level The level this block is in, may be {@link EmptyBlockGetter#INSTANCE}, see implementation notes + * @param pos The position of this block in the level, may be {@link BlockPos#ZERO}, see implementation notes * @return The light value * @implNote