Remove addBatterySlot of PoweredMatteryMenu

This commit is contained in:
DBotThePony 2022-01-03 15:29:44 +07:00
parent 9f093a74ed
commit 97cb64b3c5
Signed by: DBot
GPG Key ID: DCC23B5715498507
10 changed files with 5 additions and 23 deletions

View File

@ -49,7 +49,6 @@ public class MatterDecomposerMenu extends PoweredMatteryMenu {
progress = new ProgressGaugeWidget(this, () -> (float) tile.getWorkProgress(), tile::cantProcessJob); progress = new ProgressGaugeWidget(this, () -> (float) tile.getWorkProgress(), tile::cantProcessJob);
} }
addBatterySlot(14);
addInventorySlots(); addInventorySlots();
} }

View File

@ -35,7 +35,6 @@ public class MatterReplicatorMenu extends PoweredMatteryMenu {
progress = new ProgressGaugeWidget(this); progress = new ProgressGaugeWidget(this);
} }
addBatterySlot(14);
addInventorySlots(); addInventorySlots();
} }

View File

@ -38,7 +38,6 @@ class AndroidStationMenu @JvmOverloads constructor(
init { init {
addSlot(androidBattery) addSlot(androidBattery)
addBatterySlot()
addInventorySlots() addInventorySlots()
} }

View File

@ -21,7 +21,6 @@ class DriveRackMenu @JvmOverloads constructor(
addSlot(slot) addSlot(slot)
} }
addBatterySlot()
addInventorySlots() addInventorySlots()
} }

View File

@ -56,7 +56,6 @@ class DriveViewerMenu @JvmOverloads constructor(
} }
addSlot(driveSlot) addSlot(driveSlot)
addBatterySlot()
addInventorySlots() addInventorySlots()
} }

View File

@ -37,7 +37,6 @@ class ItemMonitorMenu @JvmOverloads constructor(
local = null local = null
} }
addBatterySlot()
addInventorySlots() addInventorySlots()
} }

View File

@ -55,7 +55,6 @@ class MatterBottlerMenu @JvmOverloads constructor(
} }
addDataSlots(workFlow) addDataSlots(workFlow)
addBatterySlot()
addInventorySlots() addInventorySlots()
} }

View File

@ -43,7 +43,6 @@ class MatterScannerMenu @JvmOverloads constructor(
patterns = LevelGaugeWidget(this) patterns = LevelGaugeWidget(this)
} }
addBatterySlot()
addInventorySlots() addInventorySlots()
} }

View File

@ -51,8 +51,7 @@ abstract class MatteryMenu protected @JvmOverloads constructor(
@JvmField @JvmField
protected var inventorySlotIndexEnd = 0 protected var inventorySlotIndexEnd = 0
@JvmOverloads protected fun addInventorySlots() {
protected fun addInventorySlots(offset: Int = 97) {
var first = true var first = true
for (i in 0..2) { for (i in 0..2) {

View File

@ -13,25 +13,16 @@ abstract class PoweredMatteryMenu protected constructor(
inventory: Inventory, inventory: Inventory,
tile: BlockEntityMatteryPowered? = null tile: BlockEntityMatteryPowered? = null
) : MatteryMenu(menuType, containerID, inventory, tile) { ) : MatteryMenu(menuType, containerID, inventory, tile) {
@JvmField @JvmField val powerWidget: LevelGaugeWidget
val powerWidget: LevelGaugeWidget @JvmField val batterySlot: BatterySlot
@JvmField
var batterySlot: BatterySlot? = null
init { init {
if (tile == null || tile.getCapability(MatteryCapability.ENERGY).resolve().isEmpty) { if (tile == null || tile.getCapability(MatteryCapability.ENERGY).resolve().isEmpty) {
powerWidget = LevelGaugeWidget(this) powerWidget = LevelGaugeWidget(this)
batterySlot = BatterySlot(SimpleContainer(1), 0)
} else { } else {
powerWidget = LevelGaugeWidget(this, tile.getCapability(MatteryCapability.ENERGY).resolve().get()) powerWidget = LevelGaugeWidget(this, tile.getCapability(MatteryCapability.ENERGY).resolve().get())
batterySlot = BatterySlot(tile.battery_container, 0)
} }
} }
@JvmOverloads
protected fun addBatterySlot(x: Int = 10, y: Int = 66) {
val container = if (tile is BlockEntityMatteryPowered) tile.battery_container else SimpleContainer(1)
val batterySlot = BatterySlot(container, 0, x, y)
addSlot(batterySlot)
this.batterySlot = batterySlot
}
} }