From bb13dbd65ce54e12bfd1a6ae636efadae71e229b Mon Sep 17 00:00:00 2001 From: Chicken-Bones Date: Tue, 12 Nov 2013 12:59:40 +1000 Subject: [PATCH] Added invalidateConvertedTile callback for parts --- codechicken/multipart/MultipartGenerator.scala | 1 + codechicken/multipart/TMultiPart.scala | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/codechicken/multipart/MultipartGenerator.scala b/codechicken/multipart/MultipartGenerator.scala index 26fb430..7f736dc 100644 --- a/codechicken/multipart/MultipartGenerator.scala +++ b/codechicken/multipart/MultipartGenerator.scala @@ -74,6 +74,7 @@ object MultipartGenerator { if(converted)//perform client conversion { + ntile.partList(0).invalidateConvertedTile() world.setBlock(pos.x, pos.y, pos.z, MultipartProxy.block.blockID, 0, 0) world.setBlockTileEntity(pos.x, pos.y, pos.z, ntile) PacketCustom.sendToChunk(new Packet53BlockChange(pos.x, pos.y, pos.z, world), world, pos.x>>4, pos.z>>4) diff --git a/codechicken/multipart/TMultiPart.scala b/codechicken/multipart/TMultiPart.scala index f6ca6fc..919f3f4 100644 --- a/codechicken/multipart/TMultiPart.scala +++ b/codechicken/multipart/TMultiPart.scala @@ -240,6 +240,11 @@ abstract class TMultiPart * Called when this part is converted from a normal block/tile (only applicable if a converter has been registered) */ def onConverted() = onAdded() + /** + * Called when this part is converted from a normal block/tile (only applicable if a converter has been registered) before the original tile has been replaced + * Use this to clear out things like inventory from the old tile. + */ + def invalidateConvertedTile(){} /** * Called when this part has been moved without a save/load. */