mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 19:56:17 -04:00
Also calling doCustomInit on client side.
This commit is contained in:
parent
19c9ed70b9
commit
799224e92b
@ -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 = {
|
override protected def doCustomInit(tileEntity: tileentity.Microcontroller, player: EntityLivingBase, stack: ItemStack): Unit = {
|
||||||
super.doCustomInit(tileEntity, player, stack)
|
super.doCustomInit(tileEntity, player, stack)
|
||||||
|
if (!tileEntity.world.isRemote) {
|
||||||
tileEntity.info.load(stack)
|
tileEntity.info.load(stack)
|
||||||
tileEntity.snooperNode.changeBuffer(tileEntity.info.storedEnergy - tileEntity.snooperNode.localBuffer)
|
tileEntity.snooperNode.changeBuffer(tileEntity.info.storedEnergy - tileEntity.snooperNode.localBuffer)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override protected def doCustomDrops(tileEntity: tileentity.Microcontroller, player: EntityPlayer, willHarvest: Boolean): Unit = {
|
override protected def doCustomDrops(tileEntity: tileentity.Microcontroller, player: EntityPlayer, willHarvest: Boolean): Unit = {
|
||||||
super.doCustomDrops(tileEntity, player, willHarvest)
|
super.doCustomDrops(tileEntity, player, willHarvest)
|
||||||
|
@ -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 = {
|
override protected def doCustomInit(tileEntity: tileentity.Raid, player: EntityLivingBase, stack: ItemStack): Unit = {
|
||||||
super.doCustomInit(tileEntity, player, stack)
|
super.doCustomInit(tileEntity, player, stack)
|
||||||
|
if (!tileEntity.world.isRemote) {
|
||||||
val data = new RaidData(stack)
|
val data = new RaidData(stack)
|
||||||
for (i <- 0 until math.min(data.disks.length, tileEntity.getSizeInventory)) {
|
for (i <- 0 until math.min(data.disks.length, tileEntity.getSizeInventory)) {
|
||||||
tileEntity.setInventorySlotContents(i, data.disks(i))
|
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))
|
tileEntity.filesystem.foreach(_.load(data.filesystem))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override protected def doCustomDrops(tileEntity: tileentity.Raid, player: EntityPlayer, willHarvest: Boolean): Unit = {
|
override protected def doCustomDrops(tileEntity: tileentity.Raid, player: EntityPlayer, willHarvest: Boolean): Unit = {
|
||||||
super.doCustomDrops(tileEntity, player, willHarvest)
|
super.doCustomDrops(tileEntity, player, willHarvest)
|
||||||
|
@ -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 = {
|
override def onBlockPlacedBy(world: World, x: Int, y: Int, z: Int, player: EntityLivingBase, stack: ItemStack): Unit = {
|
||||||
super.onBlockPlacedBy(world, x, y, z, player, stack)
|
super.onBlockPlacedBy(world, x, y, z, player, stack)
|
||||||
if (!world.isRemote) {
|
|
||||||
val matcher = tileTag
|
val matcher = tileTag
|
||||||
world.getTileEntity(x, y, z) match {
|
world.getTileEntity(x, y, z) match {
|
||||||
case matcher(tileEntity) => doCustomInit(tileEntity, player, stack)
|
case matcher(tileEntity) => doCustomInit(tileEntity, player, stack)
|
||||||
case _ =>
|
case _ =>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected def doCustomInit(tileEntity: Tile, player: EntityLivingBase, stack: ItemStack): Unit = {}
|
protected def doCustomInit(tileEntity: Tile, player: EntityLivingBase, stack: ItemStack): Unit = {}
|
||||||
|
|
||||||
|
@ -4,10 +4,6 @@ import li.cil.oc.api.Persistable
|
|||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.nbt.NBTTagCompound
|
import net.minecraft.nbt.NBTTagCompound
|
||||||
|
|
||||||
object ItemData {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class ItemData extends Persistable {
|
abstract class ItemData extends Persistable {
|
||||||
def load(stack: ItemStack) {
|
def load(stack: ItemStack) {
|
||||||
if (stack.hasTagCompound) {
|
if (stack.hasTagCompound) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user