mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-12 16:37:38 +00:00
Made copyFrom loadFrom distinction to make the copyFrom autogen clearer
This commit is contained in:
1 parent
5ed6a85af7
commit
c221e0bdcf
5 files changed
+24
-15
No files matched your search
@@ -77,7 +77,7 @@ object MultipartGenerator
|
||||
{
|
||||
ntile = factory.generateTile(partTraits++tileTraits, world.isRemote)
|
||||
world.setBlockTileEntity(pos.x, pos.y, pos.z, ntile)
|
||||
ntile.loadFrom(tile)
|
||||
ntile.from(tile)
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -118,7 +118,7 @@ object MultipartGenerator
|
||||
{
|
||||
val ntile = factory.generateTile(testSet.toSeq, client)
|
||||
tile.worldObj.setBlockTileEntity(tile.xCoord, tile.yCoord, tile.zCoord, ntile)
|
||||
ntile.loadFrom(tile)
|
||||
ntile.from(tile)
|
||||
return ntile
|
||||
}
|
||||
return tile
|
||||
|
||||
@@ -73,7 +73,7 @@ abstract class TMultiPart
|
||||
def load(tag:NBTTagCompound){}
|
||||
|
||||
def onPartChanged(){}
|
||||
def onNeighbourChanged(){}
|
||||
def onNeighborChanged(){}
|
||||
def onAdded() = onWorldJoin()
|
||||
def onRemoved() = onWorldSeparate()
|
||||
def onChunkLoad() = onWorldJoin()
|
||||
|
||||
@@ -45,11 +45,20 @@ trait TileMultipart extends TileEntity
|
||||
|
||||
private var doesTick = false
|
||||
|
||||
def loadFrom(that:TileMultipart)//Potentially auto gen this
|
||||
private[multipart] def from(that:TileMultipart)
|
||||
{
|
||||
copyFrom(that)
|
||||
loadFrom(that)
|
||||
}
|
||||
|
||||
def copyFrom(that:TileMultipart)//Potentially auto gen this
|
||||
{
|
||||
partList = that.partList
|
||||
doesTick = that.doesTick
|
||||
|
||||
}
|
||||
|
||||
def loadFrom(that:TileMultipart)
|
||||
{
|
||||
partList.foreach(_.bind(this))
|
||||
}
|
||||
|
||||
@@ -109,7 +118,7 @@ trait TileMultipart extends TileEntity
|
||||
def onNeighborBlockChange(world:World, x:Int, y:Int, z:Int, id:Int)
|
||||
{
|
||||
TileMultipartObj.startOperation(this)
|
||||
partList.foreach(_.onNeighbourChanged())
|
||||
partList.foreach(_.onNeighborChanged())
|
||||
TileMultipartObj.finishOperation(this)
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,13 @@ trait TTankContainerTile extends TileMultipart with ITankContainer
|
||||
{
|
||||
var tankList = ListBuffer[ITankContainer]()
|
||||
|
||||
override def copyFrom(that:TileMultipart)
|
||||
{
|
||||
super.copyFrom(that)
|
||||
if(that.isInstanceOf[TTankContainerTile])
|
||||
tankList = that.asInstanceOf[TTankContainerTile].tankList
|
||||
}
|
||||
|
||||
override def partAdded(part:TMultiPart)
|
||||
{
|
||||
super.partAdded(part)
|
||||
@@ -26,13 +33,6 @@ trait TTankContainerTile extends TileMultipart with ITankContainer
|
||||
tankList-=part.asInstanceOf[ITankContainer]
|
||||
}
|
||||
|
||||
override def loadFrom(that:TileMultipart)
|
||||
{
|
||||
super.loadFrom(that)
|
||||
if(that.isInstanceOf[TTankContainerTile])
|
||||
tankList = that.asInstanceOf[TTankContainerTile].tankList
|
||||
}
|
||||
|
||||
override def clearParts()
|
||||
{
|
||||
super.clearParts()
|
||||
|
||||
@@ -9,9 +9,9 @@ trait TSlottedTile extends TileMultipart
|
||||
{
|
||||
var v_partMap = new Array[TMultiPart](27)
|
||||
|
||||
override def loadFrom(that:TileMultipart)
|
||||
override def copyFrom(that:TileMultipart)
|
||||
{
|
||||
super.loadFrom(that)
|
||||
super.copyFrom(that)
|
||||
if(that.isInstanceOf[TSlottedTile])
|
||||
v_partMap = that.asInstanceOf[TSlottedTile].v_partMap
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user