From daf21e4dcf246cfa15c362800effc5dc787ab777 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 5 Dec 2016 13:53:38 -0800 Subject: [PATCH] Fix issue reading chunks from the network when client and server do not agree on block count. Closes #34925 --- .../chunk/BlockStateContainer.java.patch | 39 +++++++++++++++++++ src/main/resources/forge.exc | 2 + 2 files changed, 41 insertions(+) create mode 100644 patches/minecraft/net/minecraft/world/chunk/BlockStateContainer.java.patch diff --git a/patches/minecraft/net/minecraft/world/chunk/BlockStateContainer.java.patch b/patches/minecraft/net/minecraft/world/chunk/BlockStateContainer.java.patch new file mode 100644 index 0000000000..ed98b669a5 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/chunk/BlockStateContainer.java.patch @@ -0,0 +1,39 @@ +--- ../src-base/minecraft/net/minecraft/world/chunk/BlockStateContainer.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/BlockStateContainer.java +@@ -30,6 +30,10 @@ + + private void func_186012_b(int p_186012_1_) + { ++ setBits(p_186012_1_, false); ++ } ++ private void setBits(int p_186012_1_, boolean forceBits) ++ { + if (p_186012_1_ != this.field_186024_e) + { + this.field_186024_e = p_186012_1_; +@@ -47,6 +51,8 @@ + { + this.field_186022_c = field_186023_d; + this.field_186024_e = MathHelper.func_151241_e(Block.field_176229_d.func_186804_a()); ++ if (forceBits) ++ this.field_186024_e = p_186012_1_; + } + + this.field_186022_c.func_186041_a(field_186020_a); +@@ -102,11 +108,15 @@ + + if (this.field_186024_e != i) + { +- this.func_186012_b(i); ++ this.setBits(i, true); //Forge, Force bit density to fix network issues, resize below if needed. + } + + this.field_186022_c.func_186038_a(p_186010_1_); + p_186010_1_.func_186873_b(this.field_186021_b.func_188143_a()); ++ ++ int regSize = MathHelper.func_151241_e(Block.field_176229_d.func_186804_a()); ++ if (this.field_186022_c == field_186023_d && this.field_186024_e != regSize) // Resize bits to fit registry. ++ this.func_186008_a(regSize, field_186020_a); + } + + public void func_186009_b(PacketBuffer p_186009_1_) diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index 5dd6d23656..765c9a6475 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -55,3 +55,5 @@ net/minecraft/world/storage/loot/LootEntry.(II[Lnet/minecraft/world/storag net/minecraft/world/storage/loot/LootEntryItem.(Lnet/minecraft/item/Item;II[Lnet/minecraft/world/storage/loot/functions/LootFunction;[Lnet/minecraft/world/storage/loot/conditions/LootCondition;Ljava/lang/String;)V=|p_i46644_1_,p_i46644_2_,p_i46644_3_,p_i46644_4_,p_i46644_5_,entryName net/minecraft/world/storage/loot/LootEntryTable.(Lnet/minecraft/util/ResourceLocation;II[Lnet/minecraft/world/storage/loot/conditions/LootCondition;Ljava/lang/String;)V=|p_i46639_1_,p_i46639_2_,p_i46639_3_,p_i46639_4_,entryName net/minecraft/world/storage/loot/LootEntryEmpty.(II[Lnet/minecraft/world/storage/loot/conditions/LootCondition;Ljava/lang/String;)V=|p_i46645_1_,p_i46645_2_,p_i46645_3_,entryName + +net/minecraft/world/chunk/BlockStateContainer.setBits(IZ)V=|p_186012_1_,forceBits \ No newline at end of file