ForgePatch/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch

67 lines
2.1 KiB
Diff

--- a/net/minecraft/world/chunk/Chunk.java
+++ b/net/minecraft/world/chunk/Chunk.java
@@ -53,7 +53,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-public class Chunk implements IChunk {
+public class Chunk extends net.minecraftforge.common.capabilities.CapabilityProvider implements IChunk, net.minecraftforge.common.extensions.IForgeChunk {
private static final Logger field_150817_t = LogManager.getLogger();
public static final ChunkSection field_186036_a = null;
private final ChunkSection[] field_76652_q;
@@ -125,6 +125,7 @@
this.field_201621_s = p_i49379_6_;
this.field_205325_u = p_i49379_7_;
this.field_111204_q = p_i49379_8_;
+ this.gatherCapabilities();
}
public Chunk(World p_i48703_1_, ChunkPrimer p_i48703_2_, int p_i48703_3_, int p_i48703_4_) {
@@ -593,6 +594,7 @@
p_76612_1_.field_70162_ai = k;
p_76612_1_.field_70164_aj = this.field_76647_h;
this.field_76645_j[k].add(p_76612_1_);
+ this.func_76630_e(); // Forge - ensure chunks are marked to save after an entity add
}
public void func_201607_a(Heightmap.Type p_201607_1_, long[] p_201607_2_) {
@@ -613,6 +615,7 @@
}
this.field_76645_j[p_76608_2_].remove(p_76608_1_);
+ this.func_76630_e(); // Forge - ensure chunks are marked to save after entity removals
}
public boolean func_177444_d(BlockPos p_177444_1_) {
@@ -1164,4 +1167,30 @@
QUEUED,
CHECK;
}
+
+ /**
+ * <strong>FOR INTERNAL USE ONLY</strong>
+ * <p>
+ * Only public for use in {@link AnvilChunkLoader}.
+ */
+ @java.lang.Deprecated
+ @javax.annotation.Nullable
+ public final NBTTagCompound writeCapsToNBT() {
+ return this.serializeCaps();
+ }
+
+ /**
+ * <strong>FOR INTERNAL USE ONLY</strong>
+ * <p>
+ * Only public for use in {@link AnvilChunkLoader}.
+ */
+ @java.lang.Deprecated
+ public final void readCapsFromNBT(NBTTagCompound tag) {
+ this.deserializeCaps(tag);
+ }
+
+ @Override
+ public World getWorldForge() {
+ return func_177412_p();
+ }
}