Also calling doCustomInit on client side.

This commit is contained in:
Florian Nücke 2015-03-23 01:58:35 +01:00
parent 19c9ed70b9
commit 799224e92b
4 changed files with 18 additions and 20 deletions

View File

@ -102,9 +102,11 @@ class Microcontroller(protected implicit val tileTag: ClassTag[tileentity.Microc
override protected def doCustomInit(tileEntity: tileentity.Microcontroller, player: EntityLivingBase, stack: ItemStack): Unit = {
super.doCustomInit(tileEntity, player, stack)
if (!tileEntity.world.isRemote) {
tileEntity.info.load(stack)
tileEntity.snooperNode.changeBuffer(tileEntity.info.storedEnergy - tileEntity.snooperNode.localBuffer)
}
}
override protected def doCustomDrops(tileEntity: tileentity.Microcontroller, player: EntityPlayer, willHarvest: Boolean): Unit = {
super.doCustomDrops(tileEntity, player, willHarvest)

View File

@ -55,6 +55,7 @@ class Raid(protected implicit val tileTag: ClassTag[tileentity.Raid]) extends Si
override protected def doCustomInit(tileEntity: tileentity.Raid, player: EntityLivingBase, stack: ItemStack): Unit = {
super.doCustomInit(tileEntity, player, stack)
if (!tileEntity.world.isRemote) {
val data = new RaidData(stack)
for (i <- 0 until math.min(data.disks.length, tileEntity.getSizeInventory)) {
tileEntity.setInventorySlotContents(i, data.disks(i))
@ -65,6 +66,7 @@ class Raid(protected implicit val tileTag: ClassTag[tileentity.Raid]) extends Si
tileEntity.filesystem.foreach(_.load(data.filesystem))
}
}
}
override protected def doCustomDrops(tileEntity: tileentity.Raid, player: EntityPlayer, willHarvest: Boolean): Unit = {
super.doCustomDrops(tileEntity, player, willHarvest)

View File

@ -31,14 +31,12 @@ trait CustomDrops[Tile <: TileEntity] extends SimpleBlock {
override def onBlockPlacedBy(world: World, x: Int, y: Int, z: Int, player: EntityLivingBase, stack: ItemStack): Unit = {
super.onBlockPlacedBy(world, x, y, z, player, stack)
if (!world.isRemote) {
val matcher = tileTag
world.getTileEntity(x, y, z) match {
case matcher(tileEntity) => doCustomInit(tileEntity, player, stack)
case _ =>
}
}
}
protected def doCustomInit(tileEntity: Tile, player: EntityLivingBase, stack: ItemStack): Unit = {}

View File

@ -4,10 +4,6 @@ import li.cil.oc.api.Persistable
import net.minecraft.item.ItemStack
import net.minecraft.nbt.NBTTagCompound
object ItemData {
}
abstract class ItemData extends Persistable {
def load(stack: ItemStack) {
if (stack.hasTagCompound) {