diff --git a/patches/minecraft/net/minecraft/util/BlockPos.java.patch b/patches/minecraft/net/minecraft/util/BlockPos.java.patch new file mode 100644 index 000000000..bb5ccf3d6 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/BlockPos.java.patch @@ -0,0 +1,32 @@ +--- ../src-base/minecraft/net/minecraft/util/BlockPos.java ++++ ../src-work/minecraft/net/minecraft/util/BlockPos.java +@@ -257,6 +257,21 @@ + }; + } + ++ /** ++ * Returns a version of this BlockPos that is guaranteed to be Immutable. ++ * In most cases this will return 'this', but if 'this' is an instance of ++ * MutableBlockPos it will return a new instance of BlockPos with the same values. ++ * ++ * When storing a parameter given to you for an extended period of time, make sure you ++ * use this in case the value is changed internally. ++ * ++ * @return An immutable BlockPos. ++ */ ++ public BlockPos getImmutable() ++ { ++ return this; ++ } ++ + public static final class MutableBlockPos extends BlockPos + { + private int field_177997_b; +@@ -298,5 +313,7 @@ + this.field_177996_d = p_181079_3_; + return this; + } ++ ++ @Override public BlockPos getImmutable() { return new BlockPos(this); } + } + } diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch index f05c96eb7..231c4aeb2 100644 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -118,8 +118,12 @@ if (tileentity == null) { if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) -@@ -849,11 +852,6 @@ - this.field_177447_w.add(p_177424_1_); +@@ -846,14 +849,9 @@ + } + else if (p_177424_2_ == Chunk.EnumCreateEntityType.QUEUED) + { +- this.field_177447_w.add(p_177424_1_); ++ this.field_177447_w.add(p_177424_1_.getImmutable()); } } - else if (tileentity.func_145837_r()) diff --git a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java index 53222e42e..fc58bb62b 100644 --- a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java +++ b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java @@ -58,7 +58,7 @@ public class BlockSnapshot implements Serializable { this.world = world; this.dimId = world.provider.getDimensionId(); - this.pos = pos; + this.pos = pos.getImmutable(); this.replacedBlock = state; this.blockIdentifier = GameRegistry.findUniqueIdentifierFor(state.getBlock()); this.meta = state.getBlock().getMetaFromState(state); @@ -82,7 +82,7 @@ public class BlockSnapshot implements Serializable public BlockSnapshot(int dimension, BlockPos pos, String modid, String blockName, int meta, int flag, NBTTagCompound nbt) { this.dimId = dimension; - this.pos = pos; + this.pos = pos.getImmutable(); this.flag = flag; this.blockIdentifier = new UniqueIdentifier(modid + ":" + blockName); this.meta = meta;