diff --git a/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java b/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java index ac02cd9..7e39554 100644 --- a/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java +++ b/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java @@ -253,6 +253,11 @@ public class PipeNetwork implements ICapabilitySerializable, GraphL return tile; } + public void uncachePipe(BlockPos pos) { + if (this.tileCache.remove(pos) != null) + System.out.println("Uncaching pipe at " + pos); + } + public List> getCurrentlyCrafting(BlockPos node, ItemEquality... equalityTypes) { this.startProfile("get_currently_crafting"); List> items = new ArrayList<>(); diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java b/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java index 2e66c97..68ea124 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java @@ -89,6 +89,11 @@ public class PipeTileEntity extends TileEntity implements INamedContainerProvide super(type); } + @Override + public void onChunkUnloaded() { + PipeNetwork.get(this.world).uncachePipe(this.pos); + } + @Override public CompoundNBT write(CompoundNBT compound) { compound.put("modules", this.modules.serializeNBT());