blob: b354d34e5496a97991a8dbad0c69b9a1a4ef8164 [file] [log] [blame] [raw]
package li.cil.oc.common.container
import cpw.mods.fml.relauncher.{Side, SideOnly}
import li.cil.oc.common.tileentity
import li.cil.oc.util.SideTracker
import net.minecraft.entity.player.InventoryPlayer
class ServerRack(playerInventory: InventoryPlayer, rack: tileentity.ServerRack) extends Player(playerInventory, rack) {
addSlotToContainer(106, 8, "server")
addSlotToContainer(106, 26, "server")
addSlotToContainer(106, 44, "server")
addSlotToContainer(106, 62, "server")
addPlayerInventorySlots(8, 84)
var lastSentSwitchMode = !rack.internalSwitch
@SideOnly(Side.CLIENT)
override def updateProgressBar(id: Int, value: Int) {
if (id == 0) {
rack.internalSwitch = value == 1
}
}
override def detectAndSendChanges() {
super.detectAndSendChanges()
if (SideTracker.isServer) {
if (lastSentSwitchMode != rack.internalSwitch) {
lastSentSwitchMode = rack.internalSwitch
sendProgressBarUpdate(0, if (lastSentSwitchMode) 1 else 0)
}
}
}
}