File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
src/main/java/com/minelittlepony/unicopia/entity/mob Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -187,12 +187,14 @@ public void setChest(ChestBlock chest) {
187187 }
188188 }
189189
190- public void setChest (ChestBlockEntity chestData ) {
190+ public void setChest (@ Nullable ChestBlockEntity chestData ) {
191191 this .chestData = chestData ;
192- ((MimicGeneratable )chestData ).setAllowMimics (false );
193- chestData .setWorld (getWorld ());
192+ if (chestData != null ) {
193+ ((MimicGeneratable )chestData ).setAllowMimics (false );
194+ chestData .setWorld (getWorld ());
195+ }
194196 if (!getWorld ().isClient ) {
195- dataTracker .set (CHEST_DATA , writeChestData (chestData ));
197+ dataTracker .set (CHEST_DATA , chestData == null ? new NbtCompound () : writeChestData (chestData ));
196198 }
197199 }
198200
@@ -339,7 +341,7 @@ public void onTrackedDataSet(TrackedData<?> data) {
339341 @ Override
340342 public void readCustomDataFromNbt (NbtCompound nbt ) {
341343 super .readCustomDataFromNbt (nbt );
342- chestData = nbt .contains ("chest" , NbtElement .COMPOUND_TYPE ) ? readChestData (nbt .getCompound ("chest" )) : null ;
344+ setChest ( nbt .contains ("chest" , NbtElement .COMPOUND_TYPE ) ? readChestData (nbt .getCompound ("chest" )) : null ) ;
343345 }
344346
345347 @ Nullable
You can’t perform that action at this time.
0 commit comments