From 59786708979ccb2bf41e5bf3352373f28d853a53 Mon Sep 17 00:00:00 2001 From: Wyn Price Date: Fri, 11 Oct 2019 04:07:52 +0100 Subject: [PATCH] Fixed IModelData not being cleared when tile entity is removed (#6115) --- .../net/minecraft/tileentity/TileEntity.java.patch | 5 +++-- .../net/minecraftforge/client/model/ModelDataManager.java | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch index a62554ad7..19add8f08 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -49,15 +49,16 @@ this.field_145850_b.func_175666_e(this.field_174879_c, this.field_195045_e.func_177230_c()); } } -@@ -139,6 +146,7 @@ +@@ -139,6 +146,8 @@ public void func_145843_s() { this.field_145846_f = true; + this.invalidateCaps(); ++ requestModelDataUpdate(); } public void func_145829_t() { -@@ -181,6 +189,13 @@ +@@ -181,6 +190,13 @@ return this.field_200663_e; } diff --git a/src/main/java/net/minecraftforge/client/model/ModelDataManager.java b/src/main/java/net/minecraftforge/client/model/ModelDataManager.java index b5dca13cf..88e01420c 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelDataManager.java +++ b/src/main/java/net/minecraftforge/client/model/ModelDataManager.java @@ -84,10 +84,14 @@ public class ModelDataManager for (BlockPos pos : needUpdate) { TileEntity toUpdate = world.getTileEntity(pos); - if (toUpdate != null) + if (toUpdate != null && !toUpdate.isRemoved()) { data.put(pos, toUpdate.getModelData()); } + else + { + data.remove(pos); + } } } }