mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 10:51:55 -04:00
Minor cleanup.
This commit is contained in:
parent
003463ec4a
commit
0e7f7a598d
@ -106,13 +106,13 @@ class Robot extends traits.Computer with traits.PowerInformation with IFluidHand
|
||||
|
||||
override def markDirty() = Robot.this.markDirty()
|
||||
|
||||
override def isItemValidForSlot(slot: Int, stack: ItemStack) = Robot.this.isItemValidForSlot(actualSlot(slot), stack)
|
||||
override def isItemValidForSlot(slot: Int, stack: ItemStack) = Robot.this.isItemValidForSlot(equipmentInventory.getSizeInventory + slot, stack)
|
||||
|
||||
override def getStackInSlot(slot: Int) = Robot.this.getStackInSlot(actualSlot(slot))
|
||||
override def getStackInSlot(slot: Int) = Robot.this.getStackInSlot(equipmentInventory.getSizeInventory + slot)
|
||||
|
||||
override def setInventorySlotContents(slot: Int, stack: ItemStack) = Robot.this.setInventorySlotContents(actualSlot(slot), stack)
|
||||
override def setInventorySlotContents(slot: Int, stack: ItemStack) = Robot.this.setInventorySlotContents(equipmentInventory.getSizeInventory + slot, stack)
|
||||
|
||||
override def decrStackSize(slot: Int, amount: Int) = Robot.this.decrStackSize(actualSlot(slot), amount)
|
||||
override def decrStackSize(slot: Int, amount: Int) = Robot.this.decrStackSize(equipmentInventory.getSizeInventory + slot, amount)
|
||||
|
||||
override def getInventoryName = Robot.this.getInventoryName
|
||||
|
||||
@ -129,7 +129,7 @@ class Robot extends traits.Computer with traits.PowerInformation with IFluidHand
|
||||
|
||||
val actualInventorySize = 86
|
||||
|
||||
def maxInventorySize = actualInventorySize - 1 - containerCount - componentCount
|
||||
def maxInventorySize = actualInventorySize - equipmentInventory.getSizeInventory - componentCount
|
||||
|
||||
var inventorySize = -1
|
||||
|
||||
@ -155,10 +155,6 @@ class Robot extends traits.Computer with traits.PowerInformation with IFluidHand
|
||||
// For client.
|
||||
var renderingErrored = false
|
||||
|
||||
// Fixed number of containers (mostly due to GUI limitation, but also because
|
||||
// I find three to be a large enough number for sufficient flexibility).
|
||||
def containerCount = 3
|
||||
|
||||
override def componentCount = info.components.length
|
||||
|
||||
override def getComponentInSlot(index: Int) = components(index).orNull
|
||||
@ -227,8 +223,6 @@ class Robot extends traits.Computer with traits.PowerInformation with IFluidHand
|
||||
super.onAnalyze(player, side, hitX, hitY, hitZ)
|
||||
}
|
||||
|
||||
def actualSlot(n: Int) = n + 1 + containerCount
|
||||
|
||||
def move(direction: ForgeDirection): Boolean = {
|
||||
val oldPosition = BlockPosition(this)
|
||||
val newPosition = oldPosition.offset(direction)
|
||||
@ -553,7 +547,7 @@ class Robot extends traits.Computer with traits.PowerInformation with IFluidHand
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, getBlockType)
|
||||
}
|
||||
if (isInventorySlot(slot)) {
|
||||
machine.signal("inventory_changed", Int.box(slot - actualSlot(0) + 1))
|
||||
machine.signal("inventory_changed", Int.box(slot - equipmentInventory.getSizeInventory + 1))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -572,7 +566,7 @@ class Robot extends traits.Computer with traits.PowerInformation with IFluidHand
|
||||
common.Sound.playDiskEject(this)
|
||||
}
|
||||
if (isInventorySlot(slot)) {
|
||||
machine.signal("inventory_changed", Int.box(slot - actualSlot(0) + 1))
|
||||
machine.signal("inventory_changed", Int.box(slot - equipmentInventory.getSizeInventory + 1))
|
||||
}
|
||||
if (isComponentSlot(slot)) {
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, getBlockType)
|
||||
@ -677,7 +671,7 @@ class Robot extends traits.Computer with traits.PowerInformation with IFluidHand
|
||||
val newInventorySize = computeInventorySize()
|
||||
if (newInventorySize != inventorySize) {
|
||||
inventorySize = newInventorySize
|
||||
val realSize = 1 + containerCount + inventorySize
|
||||
val realSize = equipmentInventory.getSizeInventory + mainInventory.getSizeInventory
|
||||
val oldSelected = selectedSlot
|
||||
val removed = mutable.ArrayBuffer.empty[ItemStack]
|
||||
for (slot <- realSize until getSizeInventory - componentCount) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user