mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 18:55:03 -04:00
Also calling doCustomInit on client side.
This commit is contained in:
parent
19c9ed70b9
commit
799224e92b
@ -102,8 +102,10 @@ 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)
|
||||
tileEntity.info.load(stack)
|
||||
tileEntity.snooperNode.changeBuffer(tileEntity.info.storedEnergy - tileEntity.snooperNode.localBuffer)
|
||||
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 = {
|
||||
|
@ -55,14 +55,16 @@ 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)
|
||||
val data = new RaidData(stack)
|
||||
for (i <- 0 until math.min(data.disks.length, tileEntity.getSizeInventory)) {
|
||||
tileEntity.setInventorySlotContents(i, data.disks(i))
|
||||
}
|
||||
data.label.foreach(tileEntity.label.setLabel)
|
||||
if (!data.filesystem.hasNoTags) {
|
||||
tileEntity.tryCreateRaid(data.filesystem.getCompoundTag("node").getString("address"))
|
||||
tileEntity.filesystem.foreach(_.load(data.filesystem))
|
||||
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))
|
||||
}
|
||||
data.label.foreach(tileEntity.label.setLabel)
|
||||
if (!data.filesystem.hasNoTags) {
|
||||
tileEntity.tryCreateRaid(data.filesystem.getCompoundTag("node").getString("address"))
|
||||
tileEntity.filesystem.foreach(_.load(data.filesystem))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,12 +31,10 @@ 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 _ =>
|
||||
}
|
||||
val matcher = tileTag
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case matcher(tileEntity) => doCustomInit(tileEntity, player, stack)
|
||||
case _ =>
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user