diff --git a/README.md b/README.md index 918d8ec..f7dcfca 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This API provides a suite of tools for transforming blocks and items in the game ## Features -1. **Tile Entity Transformation**: Replace or modify Tile Entities in the game. +1. **Tile Entity Transformation**: Replace or modify tile entities. 2. **Block Replacement**: Replace normal blocks with another normal block. 3. **ItemStack Replacement**: Modify or replace items. @@ -12,7 +12,7 @@ This API provides a suite of tools for transforming blocks and items in the game ### 1. Tile Entity Transformation -#### a. We provide the registered TE ID "GT_TileEntity_Ores" and a lambda function that takes in the NBTTagCompound for any matching tile entity in world and a World and returns a BlockInfo. This will replace all TE's with the ID "GT_TileEntity_Ores" with the block specified in the BlockInfo. The secondary parameter determines the damage value of the block. +#### a. We provide the registered TE ID "GT_TileEntity_Ores" and a lambda function that takes in the NBTTagCompound for any matching tile entity in world and a World and returns a BlockInfo. This will replace all TE's with the ID "GT_TileEntity_Ores" with the block specified in the BlockInfo. The secondary parameter determines the damage value of the block. Returning null instead of a BlockInfo will leave the existing tile and block totally unchanged. ```java TileEntityReplacementManager.tileEntityTransformer("GT_TileEntity_Ores", (tag, world) -> { diff --git a/src/main/java/com/gtnewhorizons/postea/utility/ChunkFixerUtility.java b/src/main/java/com/gtnewhorizons/postea/utility/ChunkFixerUtility.java index 30d73cc..5149520 100644 --- a/src/main/java/com/gtnewhorizons/postea/utility/ChunkFixerUtility.java +++ b/src/main/java/com/gtnewhorizons/postea/utility/ChunkFixerUtility.java @@ -199,6 +199,11 @@ public class ChunkFixerUtility { int z = tileEntity.getInteger("z"); BlockInfo blockInfo = transformationFunction.apply(tileEntity, world); + if (blockInfo == null) { + // Do nothing. + tileEntitiesCopy.appendTag(tileEntity); + continue; + } if (blockInfo.tileTransformer != null) { tileEntitiesCopy.appendTag(blockInfo.tileTransformer.apply(tileEntity)); @@ -206,6 +211,7 @@ public class ChunkFixerUtility { conversionInfo.add(new ConversionInfo(x, y, z, blockInfo)); } else { + // Do nothing. tileEntitiesCopy.appendTag(tileEntity); } }