From 1af3922642558f28e46db8ac7e0a8cf749819ebe Mon Sep 17 00:00:00 2001 From: sciwhiz12 Date: Fri, 2 Jun 2023 07:37:37 +0800 Subject: [PATCH] [1.18.2] Add new helper without duplicate neighbor update call (#9235) --- .../world/inventory/BeaconMenu.java.patch | 9 +++++++++ .../net/minecraft/world/level/Level.java.patch | 14 ++++++++++++-- .../level/block/entity/BlockEntity.java.patch | 9 +++++++++ src/main/resources/forge.exc | 1 + 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/world/inventory/BeaconMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/BeaconMenu.java.patch index bb6fbbcd97..cbcd388658 100644 --- a/patches/minecraft/net/minecraft/world/inventory/BeaconMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/BeaconMenu.java.patch @@ -13,3 +13,12 @@ } else if (p_39052_ >= 1 && p_39052_ < 28) { if (!this.m_38903_(itemstack1, 28, 37, false)) { return ItemStack.f_41583_; +@@ -141,7 +_,7 @@ + this.f_39034_.m_8050_(1, p_39054_); + this.f_39034_.m_8050_(2, p_39055_); + this.f_39032_.m_6201_(1); +- this.f_39033_.m_39292_(Level::m_151543_); ++ this.f_39033_.m_39292_(Level::blockEntityChangedWithoutNeighborUpdates); + } + + } diff --git a/patches/minecraft/net/minecraft/world/level/Level.java.patch b/patches/minecraft/net/minecraft/world/level/Level.java.patch index 40780ef4cb..d0c4bb8222 100644 --- a/patches/minecraft/net/minecraft/world/level/Level.java.patch +++ b/patches/minecraft/net/minecraft/world/level/Level.java.patch @@ -207,7 +207,7 @@ if (p_151539_ instanceof EnderDragon) { EnderDragon enderdragon = (EnderDragon)p_151539_; -@@ -570,6 +_,12 @@ +@@ -570,17 +_,29 @@ } }); @@ -220,10 +220,20 @@ return list; } -@@ -581,6 +_,7 @@ + @Nullable + public abstract Entity m_6815_(int p_46492_); + +- public void m_151543_(BlockPos p_151544_) { ++ public void blockEntityChangedWithoutNeighborUpdates(BlockPos p_151544_) { + if (this.m_46805_(p_151544_)) { this.m_46745_(p_151544_).m_8092_(true); } ++ } ++ /** @deprecated Call {@link #blockEntityChangedWithoutNeighborUpdates(BlockPos)} instead. See #9235 for details. */ ++ @Deprecated ++ public void m_151543_(BlockPos p_151544_) { ++ this.blockEntityChangedWithoutNeighborUpdates(p_151544_); + this.m_46717_(p_151544_, m_8055_(p_151544_).m_60734_()); //Notify neighbors of changes } diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch index d09e130c37..446db217a7 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch @@ -38,6 +38,15 @@ } public final CompoundTag m_187480_() { +@@ -133,7 +_,7 @@ + } + + protected static void m_155232_(Level p_155233_, BlockPos p_155234_, BlockState p_155235_) { +- p_155233_.m_151543_(p_155234_); ++ p_155233_.blockEntityChangedWithoutNeighborUpdates(p_155234_); + if (!p_155235_.m_60795_()) { + p_155233_.m_46717_(p_155234_, p_155235_.m_60734_()); + } @@ -163,6 +_,13 @@ public void m_7651_() { diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index 9779699c03..71c207d2c8 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -57,6 +57,7 @@ net/minecraft/world/item/MapItem.getCustomMapData(Lnet/minecraft/world/item/Item net/minecraft/world/item/alchemy/PotionBrewing$Mix.(Lnet/minecraftforge/registries/ForgeRegistryEntry;Lnet/minecraft/world/item/crafting/Ingredient;Lnet/minecraftforge/registries/ForgeRegistryEntry;)V=|p_43536_,p_43537_,p_43538_ net/minecraft/world/item/crafting/RecipeManager.(Lnet/minecraftforge/common/crafting/conditions/ICondition$IContext;)V=|context net/minecraft/world/item/crafting/RecipeManager.fromJson(Lnet/minecraft/resources/ResourceLocation;Lcom/google/gson/JsonObject;Lnet/minecraftforge/common/crafting/conditions/ICondition$IContext;)Lnet/minecraft/world/item/crafting/Recipe;=|p_44046_,p_44047_,context +net/minecraft/world/level/Level.blockEntityChangedWithoutNeighborUpdates(Lnet/minecraft/core/BlockPos;)V=|p_151544_ net/minecraft/world/level/Level.markAndNotifyBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/chunk/LevelChunk;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;II)V=|p_46605_,levelchunk,blockstate,p_46606_,p_46607_,p_46608_ net/minecraft/world/level/LevelSettings.(Ljava/lang/String;Lnet/minecraft/world/level/GameType;ZLnet/minecraft/world/Difficulty;ZLnet/minecraft/world/level/GameRules;Lnet/minecraft/world/level/DataPackConfig;Lcom/mojang/serialization/Lifecycle;)V=|p_46910_,p_46911_,p_46912_,p_46913_,p_46914_,p_46915_,p_46916_,lifecycle net/minecraft/world/level/block/FireBlock.tryCatchFire(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;ILjava/util/Random;ILnet/minecraft/core/Direction;)V=|p_53432_,p_53433_,p_53434_,p_53435_,p_53436_,face