mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-21 20:52:21 +00:00
Fix ticks breaking and worldJoin/Seperate calls on tile hotswap
This commit is contained in:
1 parent
36068e38ea
commit
6ae0278511
2 files changed
+16
-5
No files matched your search
@@ -77,6 +77,7 @@ object MultipartGenerator
|
||||
if(!partTraits.isEmpty)
|
||||
{
|
||||
ntile = factory.generateTile(partTraits++tileTraits, world.isRemote)
|
||||
tile.prepareSwap()
|
||||
world.setBlockTileEntity(pos.x, pos.y, pos.z, ntile)
|
||||
ntile.from(tile)
|
||||
}
|
||||
@@ -119,6 +120,7 @@ object MultipartGenerator
|
||||
if(!traitsForPart(part, client).forall(testSet(_)))
|
||||
{
|
||||
val ntile = factory.generateTile(testSet.toSeq, client)
|
||||
tile.prepareSwap()
|
||||
tile.worldObj.setBlockTileEntity(tile.xCoord, tile.yCoord, tile.zCoord, ntile)
|
||||
ntile.from(tile)
|
||||
return ntile
|
||||
|
||||
@@ -65,10 +65,11 @@ class TileMultipart extends TileEntity
|
||||
def loadFrom(that:TileMultipart)
|
||||
{
|
||||
partList.foreach(_.bind(this))
|
||||
if(!isInvalid)
|
||||
partList.foreach(_.onWorldJoin())
|
||||
if(doesTick)
|
||||
{
|
||||
doesTick = false
|
||||
setTicking(true)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,11 +110,19 @@ class TileMultipart extends TileEntity
|
||||
partList.foreach(_.onMoved())
|
||||
}
|
||||
|
||||
override def invalidate()
|
||||
private[multipart] def prepareSwap()
|
||||
{
|
||||
super.invalidate()
|
||||
if(worldObj != null)
|
||||
partList.foreach(_.onWorldSeparate())
|
||||
}
|
||||
|
||||
override def invalidate()
|
||||
{
|
||||
if(!isInvalid)
|
||||
{
|
||||
super.invalidate()
|
||||
if(worldObj != null)
|
||||
partList.foreach(_.onWorldSeparate())
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user