From 5e18fc37bece6d6fa9120d8dbdfd7314e6534c9a Mon Sep 17 00:00:00 2001 From: xbony2 Date: Wed, 11 Feb 2015 16:42:18 -0500 Subject: [PATCH] there's all the code? --- .../com/kaijin/AdvPowerMan/AdvPacket.java | 16 + .../AdvPowerMan/AdvancedPowerManagement.java | 226 +++++ .../kaijin/AdvPowerMan/ChannelHandler.java | 62 ++ .../AdvPowerMan/ClientPacketHandler.java | 92 ++ .../com/kaijin/AdvPowerMan/ClientProxy.java | 41 + .../com/kaijin/AdvPowerMan/CommonProxy.java | 176 ++++ .../java/com/kaijin/AdvPowerMan/Coords.java | 19 + .../java/com/kaijin/AdvPowerMan/Info.java | 144 +++ .../com/kaijin/AdvPowerMan/MovingAverage.java | 95 ++ .../java/com/kaijin/AdvPowerMan/Utils.java | 228 +++++ .../AdvPowerMan/blocks/BlockAdvPwrMan.java | 395 +++++++++ .../ContainerAdjustableTransformer.java | 164 ++++ .../containers/ContainerAdvEmitter.java | 93 ++ .../containers/ContainerBatteryStation.java | 464 ++++++++++ .../containers/ContainerChargingBench.java | 600 +++++++++++++ .../containers/ContainerStorageMonitor.java | 451 ++++++++++ .../com/kaijin/AdvPowerMan/gui/CButton.java | 112 +++ .../gui/GuiAdjustableTransformer.java | 159 ++++ .../kaijin/AdvPowerMan/gui/GuiAdvEmitter.java | 115 +++ .../AdvPowerMan/gui/GuiBatteryStation.java | 142 +++ .../AdvPowerMan/gui/GuiChargingBench.java | 130 +++ .../AdvPowerMan/gui/GuiStorageMonitor.java | 146 +++ .../AdvPowerMan/items/ItemBenchTools.java | 170 ++++ .../AdvPowerMan/items/ItemBlockAdvPwrMan.java | 38 + .../AdvPowerMan/items/ItemCardBase.java | 81 ++ .../items/ItemStorageLinkCard.java | 75 ++ .../items/ItemStorageLinkCardCreator.java | 44 + .../AdvPowerMan/slots/SlotChargeable.java | 44 + .../kaijin/AdvPowerMan/slots/SlotCustom.java | 31 + .../AdvPowerMan/slots/SlotDrainable.java | 46 + .../kaijin/AdvPowerMan/slots/SlotInput.java | 37 + .../AdvPowerMan/slots/SlotLinkCard.java | 62 ++ .../AdvPowerMan/slots/SlotMachineUpgrade.java | 41 + .../kaijin/AdvPowerMan/slots/SlotOutput.java | 36 + .../AdvPowerMan/slots/SlotPlayerArmor.java | 47 + .../AdvPowerMan/slots/SlotPowerSource.java | 55 ++ .../tileentities/TEAdjustableTransformer.java | 404 +++++++++ .../tileentities/TEAdvEmitter.java | 285 ++++++ .../tileentities/TEBatteryStation.java | 580 ++++++++++++ .../tileentities/TEChargingBench.java | 838 ++++++++++++++++++ .../AdvPowerMan/tileentities/TECommon.java | 134 +++ .../tileentities/TECommonBench.java | 175 ++++ .../tileentities/TEStorageMonitor.java | 595 +++++++++++++ .../advancedpowermanagement/lang/en_US.lang | 51 ++ .../textures/GUIAdjustableTransformer.png | Bin 0 -> 1750 bytes .../textures/GUIAdvEmitter.png | Bin 0 -> 1879 bytes .../textures/GUIBatteryStation.png | Bin 0 -> 2027 bytes .../textures/GUIChargingBench.png | Bin 0 -> 2006 bytes .../textures/GUIStorageMonitor.png | Bin 0 -> 1886 bytes .../textures/blocks/Accepter.png | Bin 0 -> 485 bytes .../textures/blocks/BenchBottom.png | Bin 0 -> 262 bytes .../textures/blocks/EVEmitter.png | Bin 0 -> 274 bytes .../textures/blocks/Emitter.png | Bin 0 -> 616 bytes .../textures/blocks/HVBatteryStationOff.png | Bin 0 -> 253 bytes .../textures/blocks/HVBatteryStationOn.png | Bin 0 -> 254 bytes .../textures/blocks/HVBenchTop.png | Bin 0 -> 594 bytes .../textures/blocks/HVChargingBenchOff0.png | Bin 0 -> 342 bytes .../textures/blocks/HVChargingBenchOff1.png | Bin 0 -> 347 bytes .../textures/blocks/HVChargingBenchOff10.png | Bin 0 -> 343 bytes .../textures/blocks/HVChargingBenchOff11.png | Bin 0 -> 345 bytes .../textures/blocks/HVChargingBenchOff12.png | Bin 0 -> 337 bytes .../textures/blocks/HVChargingBenchOff2.png | Bin 0 -> 349 bytes .../textures/blocks/HVChargingBenchOff3.png | Bin 0 -> 349 bytes .../textures/blocks/HVChargingBenchOff4.png | Bin 0 -> 351 bytes .../textures/blocks/HVChargingBenchOff5.png | Bin 0 -> 350 bytes .../textures/blocks/HVChargingBenchOff6.png | Bin 0 -> 350 bytes .../textures/blocks/HVChargingBenchOff7.png | Bin 0 -> 349 bytes .../textures/blocks/HVChargingBenchOff8.png | Bin 0 -> 349 bytes .../textures/blocks/HVChargingBenchOff9.png | Bin 0 -> 346 bytes .../textures/blocks/HVChargingBenchOn0.png | Bin 0 -> 342 bytes .../textures/blocks/HVChargingBenchOn1.png | Bin 0 -> 346 bytes .../textures/blocks/HVChargingBenchOn10.png | Bin 0 -> 344 bytes .../textures/blocks/HVChargingBenchOn11.png | Bin 0 -> 345 bytes .../textures/blocks/HVChargingBenchOn12.png | Bin 0 -> 337 bytes .../textures/blocks/HVChargingBenchOn2.png | Bin 0 -> 349 bytes .../textures/blocks/HVChargingBenchOn3.png | Bin 0 -> 349 bytes .../textures/blocks/HVChargingBenchOn4.png | Bin 0 -> 348 bytes .../textures/blocks/HVChargingBenchOn5.png | Bin 0 -> 350 bytes .../textures/blocks/HVChargingBenchOn6.png | Bin 0 -> 349 bytes .../textures/blocks/HVChargingBenchOn7.png | Bin 0 -> 349 bytes .../textures/blocks/HVChargingBenchOn8.png | Bin 0 -> 347 bytes .../textures/blocks/HVChargingBenchOn9.png | Bin 0 -> 346 bytes .../textures/blocks/HVEmitter.png | Bin 0 -> 231 bytes .../textures/blocks/LVBatteryStationOff.png | Bin 0 -> 253 bytes .../textures/blocks/LVBatteryStationOn.png | Bin 0 -> 254 bytes .../textures/blocks/LVBenchTop.png | Bin 0 -> 568 bytes .../textures/blocks/LVChargingBenchOff0.png | Bin 0 -> 346 bytes .../textures/blocks/LVChargingBenchOff1.png | Bin 0 -> 347 bytes .../textures/blocks/LVChargingBenchOff10.png | Bin 0 -> 344 bytes .../textures/blocks/LVChargingBenchOff11.png | Bin 0 -> 345 bytes .../textures/blocks/LVChargingBenchOff12.png | Bin 0 -> 338 bytes .../textures/blocks/LVChargingBenchOff2.png | Bin 0 -> 349 bytes .../textures/blocks/LVChargingBenchOff3.png | Bin 0 -> 350 bytes .../textures/blocks/LVChargingBenchOff4.png | Bin 0 -> 351 bytes .../textures/blocks/LVChargingBenchOff5.png | Bin 0 -> 351 bytes .../textures/blocks/LVChargingBenchOff6.png | Bin 0 -> 350 bytes .../textures/blocks/LVChargingBenchOff7.png | Bin 0 -> 350 bytes .../textures/blocks/LVChargingBenchOff8.png | Bin 0 -> 349 bytes .../textures/blocks/LVChargingBenchOff9.png | Bin 0 -> 348 bytes .../textures/blocks/LVChargingBenchOn0.png | Bin 0 -> 343 bytes .../textures/blocks/LVChargingBenchOn1.png | Bin 0 -> 346 bytes .../textures/blocks/LVChargingBenchOn10.png | Bin 0 -> 344 bytes .../textures/blocks/LVChargingBenchOn11.png | Bin 0 -> 346 bytes .../textures/blocks/LVChargingBenchOn12.png | Bin 0 -> 337 bytes .../textures/blocks/LVChargingBenchOn2.png | Bin 0 -> 348 bytes .../textures/blocks/LVChargingBenchOn3.png | Bin 0 -> 351 bytes .../textures/blocks/LVChargingBenchOn4.png | Bin 0 -> 350 bytes .../textures/blocks/LVChargingBenchOn5.png | Bin 0 -> 350 bytes .../textures/blocks/LVChargingBenchOn6.png | Bin 0 -> 350 bytes .../textures/blocks/LVChargingBenchOn7.png | Bin 0 -> 350 bytes .../textures/blocks/LVChargingBenchOn8.png | Bin 0 -> 347 bytes .../textures/blocks/LVChargingBenchOn9.png | Bin 0 -> 346 bytes .../textures/blocks/LVEmitter.png | Bin 0 -> 364 bytes .../textures/blocks/MVBatteryStationOff.png | Bin 0 -> 253 bytes .../textures/blocks/MVBatteryStationOn.png | Bin 0 -> 254 bytes .../textures/blocks/MVBenchTop.png | Bin 0 -> 591 bytes .../textures/blocks/MVChargingBenchOff0.png | Bin 0 -> 345 bytes .../textures/blocks/MVChargingBenchOff1.png | Bin 0 -> 350 bytes .../textures/blocks/MVChargingBenchOff10.png | Bin 0 -> 346 bytes .../textures/blocks/MVChargingBenchOff11.png | Bin 0 -> 348 bytes .../textures/blocks/MVChargingBenchOff12.png | Bin 0 -> 339 bytes .../textures/blocks/MVChargingBenchOff2.png | Bin 0 -> 351 bytes .../textures/blocks/MVChargingBenchOff3.png | Bin 0 -> 353 bytes .../textures/blocks/MVChargingBenchOff4.png | Bin 0 -> 353 bytes .../textures/blocks/MVChargingBenchOff5.png | Bin 0 -> 353 bytes .../textures/blocks/MVChargingBenchOff6.png | Bin 0 -> 350 bytes .../textures/blocks/MVChargingBenchOff7.png | Bin 0 -> 350 bytes .../textures/blocks/MVChargingBenchOff8.png | Bin 0 -> 352 bytes .../textures/blocks/MVChargingBenchOff9.png | Bin 0 -> 349 bytes .../textures/blocks/MVChargingBenchOn0.png | Bin 0 -> 344 bytes .../textures/blocks/MVChargingBenchOn1.png | Bin 0 -> 349 bytes .../textures/blocks/MVChargingBenchOn10.png | Bin 0 -> 346 bytes .../textures/blocks/MVChargingBenchOn11.png | Bin 0 -> 346 bytes .../textures/blocks/MVChargingBenchOn12.png | Bin 0 -> 339 bytes .../textures/blocks/MVChargingBenchOn2.png | Bin 0 -> 351 bytes .../textures/blocks/MVChargingBenchOn3.png | Bin 0 -> 353 bytes .../textures/blocks/MVChargingBenchOn4.png | Bin 0 -> 350 bytes .../textures/blocks/MVChargingBenchOn5.png | Bin 0 -> 353 bytes .../textures/blocks/MVChargingBenchOn6.png | Bin 0 -> 352 bytes .../textures/blocks/MVChargingBenchOn7.png | Bin 0 -> 350 bytes .../textures/blocks/MVChargingBenchOn8.png | Bin 0 -> 351 bytes .../textures/blocks/MVChargingBenchOn9.png | Bin 0 -> 349 bytes .../textures/blocks/MVEmitter.png | Bin 0 -> 223 bytes .../textures/blocks/StorageMonitorBottom.png | Bin 0 -> 305 bytes .../textures/blocks/StorageMonitorInvalid.png | Bin 0 -> 321 bytes .../textures/blocks/StorageMonitorOff0.png | Bin 0 -> 297 bytes .../textures/blocks/StorageMonitorOff1.png | Bin 0 -> 300 bytes .../textures/blocks/StorageMonitorOff10.png | Bin 0 -> 307 bytes .../textures/blocks/StorageMonitorOff11.png | Bin 0 -> 303 bytes .../textures/blocks/StorageMonitorOff12.png | Bin 0 -> 296 bytes .../textures/blocks/StorageMonitorOff2.png | Bin 0 -> 302 bytes .../textures/blocks/StorageMonitorOff3.png | Bin 0 -> 304 bytes .../textures/blocks/StorageMonitorOff4.png | Bin 0 -> 304 bytes .../textures/blocks/StorageMonitorOff5.png | Bin 0 -> 305 bytes .../textures/blocks/StorageMonitorOff6.png | Bin 0 -> 304 bytes .../textures/blocks/StorageMonitorOff7.png | Bin 0 -> 307 bytes .../textures/blocks/StorageMonitorOff8.png | Bin 0 -> 308 bytes .../textures/blocks/StorageMonitorOff9.png | Bin 0 -> 307 bytes .../textures/blocks/StorageMonitorOn0.png | Bin 0 -> 297 bytes .../textures/blocks/StorageMonitorOn1.png | Bin 0 -> 301 bytes .../textures/blocks/StorageMonitorOn10.png | Bin 0 -> 308 bytes .../textures/blocks/StorageMonitorOn11.png | Bin 0 -> 303 bytes .../textures/blocks/StorageMonitorOn12.png | Bin 0 -> 297 bytes .../textures/blocks/StorageMonitorOn2.png | Bin 0 -> 303 bytes .../textures/blocks/StorageMonitorOn3.png | Bin 0 -> 305 bytes .../textures/blocks/StorageMonitorOn4.png | Bin 0 -> 305 bytes .../textures/blocks/StorageMonitorOn5.png | Bin 0 -> 306 bytes .../textures/blocks/StorageMonitorOn6.png | Bin 0 -> 305 bytes .../textures/blocks/StorageMonitorOn7.png | Bin 0 -> 307 bytes .../textures/blocks/StorageMonitorOn8.png | Bin 0 -> 308 bytes .../textures/blocks/StorageMonitorOn9.png | Bin 0 -> 308 bytes .../textures/blocks/StorageMonitorTop.png | Bin 0 -> 283 bytes .../textures/blocks/StorageMonitorX.png | Bin 0 -> 129 bytes .../textures/blocks/TransformerInput.png | Bin 0 -> 551 bytes .../textures/blocks/TransformerOutput1EV.png | Bin 0 -> 336 bytes .../textures/blocks/TransformerOutput1HV.png | Bin 0 -> 379 bytes .../textures/blocks/TransformerOutput1LV.png | Bin 0 -> 374 bytes .../textures/blocks/TransformerOutput1MV.png | Bin 0 -> 379 bytes .../textures/blocks/TransformerOutput3EV.png | Bin 0 -> 410 bytes .../textures/blocks/TransformerOutput3HV.png | Bin 0 -> 451 bytes .../textures/blocks/TransformerOutput3LV.png | Bin 0 -> 413 bytes .../textures/blocks/TransformerOutput3MV.png | Bin 0 -> 411 bytes .../textures/items/HV-kit.png | Bin 0 -> 406 bytes .../textures/items/LV-kit.png | Bin 0 -> 387 bytes .../textures/items/LinkCard.png | Bin 0 -> 222 bytes .../textures/items/LinkCardCreator.png | Bin 0 -> 226 bytes .../textures/items/MV-kit.png | Bin 0 -> 409 bytes .../textures/items/SlotChargeable.png | Bin 0 -> 100 bytes .../textures/items/SlotDrainable.png | Bin 0 -> 122 bytes .../textures/items/SlotInput.png | Bin 0 -> 95 bytes .../textures/items/SlotInput2.png | Bin 0 -> 133 bytes .../textures/items/SlotLinkCard.png | Bin 0 -> 126 bytes .../textures/items/SlotMachineUpgrade.png | Bin 0 -> 116 bytes .../textures/items/SlotOutput.png | Bin 0 -> 121 bytes .../textures/items/SlotPlayerArmor0.png | Bin 0 -> 107 bytes .../textures/items/SlotPlayerArmor1.png | Bin 0 -> 127 bytes .../textures/items/SlotPlayerArmor2.png | Bin 0 -> 102 bytes .../textures/items/SlotPlayerArmor3.png | Bin 0 -> 111 bytes .../textures/items/SlotPowerSource0.png | Bin 0 -> 112 bytes .../textures/items/SlotPowerSource1.png | Bin 0 -> 117 bytes .../textures/items/SlotPowerSource2.png | Bin 0 -> 126 bytes .../textures/items/toolkit.png | Bin 0 -> 192 bytes src/main/resources/mcmod.info | 16 + 203 files changed, 7955 insertions(+) create mode 100755 src/main/java/com/kaijin/AdvPowerMan/AdvPacket.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/AdvancedPowerManagement.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/ChannelHandler.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/ClientPacketHandler.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/ClientProxy.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/CommonProxy.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/Coords.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/Info.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/MovingAverage.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/Utils.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/blocks/BlockAdvPwrMan.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/containers/ContainerAdjustableTransformer.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/containers/ContainerAdvEmitter.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/containers/ContainerBatteryStation.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/containers/ContainerChargingBench.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/containers/ContainerStorageMonitor.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/gui/CButton.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/gui/GuiAdjustableTransformer.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/gui/GuiAdvEmitter.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/gui/GuiBatteryStation.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/gui/GuiChargingBench.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/gui/GuiStorageMonitor.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/items/ItemBenchTools.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/items/ItemBlockAdvPwrMan.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/items/ItemCardBase.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/items/ItemStorageLinkCard.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/items/ItemStorageLinkCardCreator.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/slots/SlotChargeable.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/slots/SlotCustom.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/slots/SlotDrainable.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/slots/SlotInput.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/slots/SlotLinkCard.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/slots/SlotMachineUpgrade.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/slots/SlotOutput.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/slots/SlotPlayerArmor.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/slots/SlotPowerSource.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/tileentities/TEAdjustableTransformer.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/tileentities/TEAdvEmitter.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/tileentities/TEBatteryStation.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/tileentities/TEChargingBench.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/tileentities/TECommon.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/tileentities/TECommonBench.java create mode 100755 src/main/java/com/kaijin/AdvPowerMan/tileentities/TEStorageMonitor.java create mode 100755 src/main/resources/assets/advancedpowermanagement/lang/en_US.lang create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/GUIAdjustableTransformer.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/GUIAdvEmitter.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/GUIBatteryStation.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/GUIChargingBench.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/GUIStorageMonitor.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/Accepter.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/BenchBottom.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/EVEmitter.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/Emitter.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVBatteryStationOff.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVBatteryStationOn.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVBenchTop.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff0.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff1.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff10.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff11.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff12.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff2.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff3.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff4.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff5.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff6.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff7.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff8.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff9.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn0.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn1.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn10.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn11.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn12.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn2.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn3.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn4.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn5.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn6.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn7.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn8.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn9.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/HVEmitter.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVBatteryStationOff.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVBatteryStationOn.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVBenchTop.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff0.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff1.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff10.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff11.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff12.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff2.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff3.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff4.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff5.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff6.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff7.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff8.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff9.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn0.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn1.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn10.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn11.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn12.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn2.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn3.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn4.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn5.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn6.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn7.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn8.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn9.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/LVEmitter.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVBatteryStationOff.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVBatteryStationOn.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVBenchTop.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff0.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff1.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff10.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff11.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff12.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff2.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff3.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff4.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff5.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff6.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff7.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff8.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff9.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn0.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn1.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn10.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn11.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn12.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn2.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn3.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn4.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn5.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn6.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn7.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn8.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn9.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/MVEmitter.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorBottom.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorInvalid.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff0.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff1.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff10.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff11.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff12.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff2.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff3.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff4.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff5.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff6.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff7.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff8.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff9.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn0.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn1.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn10.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn11.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn12.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn2.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn3.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn4.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn5.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn6.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn7.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn8.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn9.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorTop.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorX.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerInput.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput1EV.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput1HV.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput1LV.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput1MV.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput3EV.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput3HV.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput3LV.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput3MV.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/HV-kit.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/LV-kit.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/LinkCard.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/LinkCardCreator.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/MV-kit.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/SlotChargeable.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/SlotDrainable.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/SlotInput.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/SlotInput2.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/SlotLinkCard.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/SlotMachineUpgrade.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/SlotOutput.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/SlotPlayerArmor0.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/SlotPlayerArmor1.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/SlotPlayerArmor2.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/SlotPlayerArmor3.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/SlotPowerSource0.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/SlotPowerSource1.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/SlotPowerSource2.png create mode 100755 src/main/resources/assets/advancedpowermanagement/textures/items/toolkit.png create mode 100755 src/main/resources/mcmod.info diff --git a/src/main/java/com/kaijin/AdvPowerMan/AdvPacket.java b/src/main/java/com/kaijin/AdvPowerMan/AdvPacket.java new file mode 100755 index 0000000..d8eabaa --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/AdvPacket.java @@ -0,0 +1,16 @@ +package com.kaijin.AdvPowerMan; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + +public class AdvPacket +{ + byte[] data; + + public AdvPacket () {} + + public AdvPacket(byte[] packet) + { + this.data = packet.clone(); + } +} \ No newline at end of file diff --git a/src/main/java/com/kaijin/AdvPowerMan/AdvancedPowerManagement.java b/src/main/java/com/kaijin/AdvPowerMan/AdvancedPowerManagement.java new file mode 100755 index 0000000..a515c9e --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/AdvancedPowerManagement.java @@ -0,0 +1,226 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan; + +import ic2.api.item.IC2Items; + +import java.io.File; +import java.util.EnumMap; +import java.util.logging.Level; + +import org.apache.logging.log4j.Logger; + +import com.kaijin.AdvPowerMan.blocks.BlockAdvPwrMan; +import com.kaijin.AdvPowerMan.items.ItemBenchTools; +import com.kaijin.AdvPowerMan.items.ItemBlockAdvPwrMan; +import com.kaijin.AdvPowerMan.items.ItemStorageLinkCard; +import com.kaijin.AdvPowerMan.items.ItemStorageLinkCardCreator; +import com.kaijin.AdvPowerMan.tileentities.TEAdjustableTransformer; +import com.kaijin.AdvPowerMan.tileentities.TEAdvEmitter; +import com.kaijin.AdvPowerMan.tileentities.TEBatteryStation; +import com.kaijin.AdvPowerMan.tileentities.TEChargingBench; +import com.kaijin.AdvPowerMan.tileentities.TEStorageMonitor; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.config.Configuration; +import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.Mod.EventHandler; +import cpw.mods.fml.common.Mod.Instance; +import cpw.mods.fml.common.SidedProxy; +import cpw.mods.fml.common.event.FMLFingerprintViolationEvent; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; +import cpw.mods.fml.common.network.FMLEmbeddedChannel; +import cpw.mods.fml.common.network.FMLEventChannel; +import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; + +@Mod(modid = "AdvancedPowerManagement", name="Advanced Power Management", version="1.7.2.02", dependencies = "required-after:IC2") + +public class AdvancedPowerManagement // implements ICraftingHandler +{ + @SidedProxy(clientSide = "com.kaijin.AdvPowerMan.ClientProxy", serverSide = "com.kaijin.AdvPowerMan.CommonProxy") + public static CommonProxy proxy; //This object will be populated with the class that you choose for the environment + + @Instance("AdvancedPowerManagement") + public static AdvancedPowerManagement instance; //The instance of the mod that will be defined, populated, and callable + + //Channels for handling packages + public static EnumMap channels; + public static Logger logger; + + public static Block blockAdvPwrMan; + public static Item itemBenchTools; + public static Item itemStorageLinkCard; + public static Item itemStorageLinkCardCreator; + + @EventHandler + public static void preInit(FMLPreInitializationEvent event) + { + Info.isDebugging = false; + logger = event.getModLog(); + try + { + Configuration configuration = new Configuration(event.getSuggestedConfigurationFile()); + configuration.load(); + + // Read or create config file properties, reusing any block and item IDs discovered in old file, if it was present + Info.isDebugging = configuration.get(configuration.CATEGORY_GENERAL, "debug", Info.isDebugging).getBoolean(Info.isDebugging); + configuration.save(); + } + catch (Exception e) + { + logger.warn("Error while trying to access configuration!", e); + throw new RuntimeException(e); + } + } + + @EventHandler + public void load(FMLInitializationEvent event) + { + logger.info("Loading."); + + blockAdvPwrMan = new BlockAdvPwrMan(Material.ground); + GameRegistry.registerBlock(blockAdvPwrMan, ItemBlockAdvPwrMan.class, "blockAdvPwrMan"); + + // Charging Benches + GameRegistry.registerTileEntity(TEChargingBench.class, "LV Charging Bench"); // Legacy mappings for backward compatibility - we didn't know wtf we were doing when we started this mod :) + GameRegistry.registerTileEntity(TEChargingBench.class, "MV Charging Bench"); // Legacy + GameRegistry.registerTileEntity(TEChargingBench.class, "HV Charging Bench"); // Legacy + GameRegistry.registerTileEntity(TEChargingBench.class, "kaijin.chargingBench"); // Proper mapping + + // Battery Stations + GameRegistry.registerTileEntity(TEBatteryStation.class, "LV Battery Station"); // Legacy mappings + GameRegistry.registerTileEntity(TEBatteryStation.class, "MV Battery Station"); // Legacy + GameRegistry.registerTileEntity(TEBatteryStation.class, "HV Battery Station"); // Legacy + GameRegistry.registerTileEntity(TEBatteryStation.class, "kaijin.batteryStation"); // Proper mapping + + // Adjustable Transformer + GameRegistry.registerTileEntity(TEAdjustableTransformer.class, "kaijin.adjTransformer"); + + // Storage Monitor + GameRegistry.registerTileEntity(TEStorageMonitor.class, "kaijin.storageMonitor"); + + // Emitters + GameRegistry.registerTileEntity(TEAdvEmitter.class, "LV Emitter"); // Legacy mappings + GameRegistry.registerTileEntity(TEAdvEmitter.class, "MV Emitter"); // Legacy + GameRegistry.registerTileEntity(TEAdvEmitter.class, "HV Emitter"); // Legacy + GameRegistry.registerTileEntity(TEAdvEmitter.class, "EV Emitter"); // Legacy + GameRegistry.registerTileEntity(TEAdvEmitter.class, "kaijin.emitter"); // Now legacy as well + GameRegistry.registerTileEntity(TEAdvEmitter.class, "kaijin.advEmitter"); // Proper mapping + + // Items + itemBenchTools = new ItemBenchTools("benchTools.toolkit"); + + itemStorageLinkCard = new ItemStorageLinkCard("itemStorageLinkCard"); + + itemStorageLinkCardCreator = new ItemStorageLinkCardCreator("itemStorageLinkCardCreator"); + + //Info.registerTranslations(); + + //register channel handler + channels = NetworkRegistry.INSTANCE.newChannel("IC2NC", ChannelHandler.instance); + + if (event.getSide().isClient()) + { + FMLEventChannel events = NetworkRegistry.INSTANCE.newEventDrivenChannel("Test"); + events.register(new ClientPacketHandler()); + } + + NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy); + proxy.load(); + + // For returning charging benches and deconstructing them + Info.componentCopperCable = IC2Items.getItem("insulatedCopperCableItem").copy(); + Info.componentCopperCable.stackSize = 3; + Info.componentGoldCable = IC2Items.getItem("insulatedGoldCableItem").copy(); + Info.componentGoldCable.stackSize = 3; + Info.componentIronCable = IC2Items.getItem("insulatedIronCableItem").copy(); + Info.componentIronCable.stackSize = 3; + Info.componentBatBox = IC2Items.getItem("batBox").copy(); + Info.componentMFE = IC2Items.getItem("mfeUnit").copy(); + Info.componentMFSU = IC2Items.getItem("mfsUnit").copy(); + Info.componentCircuit = IC2Items.getItem("electronicCircuit").copy(); + + // For internal reference to verify items can be placed in inventory. + Info.ic2overclockerUpg = IC2Items.getItem("overclockerUpgrade").copy(); + Info.ic2transformerUpg = IC2Items.getItem("transformerUpgrade").copy(); + Info.ic2storageUpg = IC2Items.getItem("energyStorageUpgrade").copy(); + + Info.ic2WrenchID = Item.getIdFromItem(IC2Items.getItem("wrench").getItem()); + Info.ic2ElectricWrenchID = Item.getIdFromItem(IC2Items.getItem("electricWrench").getItem()); + + if (proxy.isServer()) + { + logger.info("Advanced Power Management 1.7.2.02 loaded."); + } + + if (Info.isDebugging) + { + logger.info("Debugging enabled."); + } + + logger.info("Done loading."); + } + + @EventHandler + public void modsLoaded(FMLPostInitializationEvent event) + { + logger.info("Adding crafting recipes."); + + // Charging Bench recipes + GameRegistry.addRecipe(new ItemStack(blockAdvPwrMan, 1, Info.CB_META + 0), new Object[] {"UUU", "WCW", "WBW", 'U', IC2Items.getItem("insulatedCopperCableItem"), 'W', Blocks.planks, 'C', IC2Items.getItem("electronicCircuit"), 'B', IC2Items.getItem("batBox")}); + GameRegistry.addRecipe(new ItemStack(blockAdvPwrMan, 1, Info.CB_META + 1), new Object[] {"UUU", "WCW", "WBW", 'U', IC2Items.getItem("insulatedGoldCableItem"), 'W', Blocks.planks, 'C', IC2Items.getItem("electronicCircuit"), 'B', IC2Items.getItem("mfeUnit")}); + GameRegistry.addRecipe(new ItemStack(blockAdvPwrMan, 1, Info.CB_META + 2), new Object[] {"UUU", "WCW", "WBW", 'U', IC2Items.getItem("insulatedIronCableItem"), 'W', Blocks.planks, 'C', IC2Items.getItem("electronicCircuit"), 'B', IC2Items.getItem("mfsUnit")}); + + // Battery Station recipes + GameRegistry.addRecipe(new ItemStack(blockAdvPwrMan, 1, Info.BS_META + 0), new Object[] {"UUU", "WCW", "WBW", 'U', IC2Items.getItem("insulatedCopperCableItem"), 'W', Blocks.planks, 'C', IC2Items.getItem("electronicCircuit"), 'B', IC2Items.getItem("lvTransformer")}); + GameRegistry.addRecipe(new ItemStack(blockAdvPwrMan, 1, Info.BS_META + 1), new Object[] {"UUU", "WCW", "WBW", 'U', IC2Items.getItem("insulatedGoldCableItem"), 'W', Blocks.planks, 'C', IC2Items.getItem("electronicCircuit"), 'B', IC2Items.getItem("mvTransformer")}); + GameRegistry.addRecipe(new ItemStack(blockAdvPwrMan, 1, Info.BS_META + 2), new Object[] {"UUU", "WCW", "WBW", 'U', IC2Items.getItem("insulatedIronCableItem"), 'W', Blocks.planks, 'C', IC2Items.getItem("electronicCircuit"), 'B', IC2Items.getItem("hvTransformer")}); + + // Adjustable Transformer recipe + GameRegistry.addRecipe(new ItemStack(blockAdvPwrMan, 1, Info.AT_META), new Object[] {"L", "C", "H", 'L', IC2Items.getItem("lvTransformer"), 'C', IC2Items.getItem("advancedCircuit"), 'H', IC2Items.getItem("hvTransformer")}); + GameRegistry.addRecipe(new ItemStack(blockAdvPwrMan, 1, Info.AT_META), new Object[] {"H", "C", "L", 'H', IC2Items.getItem("hvTransformer"), 'C', IC2Items.getItem("advancedCircuit"), 'L', IC2Items.getItem("lvTransformer")}); + + // Storage Monitor recipe + GameRegistry.addRecipe(new ItemStack(blockAdvPwrMan, 1, Info.SM_META), new Object[] {"WUW", "GCG", "WRW", 'W', Blocks.planks, 'U', IC2Items.getItem("goldCableItem"), 'G', Blocks.glass, 'C', IC2Items.getItem("electronicCircuit"), 'R', Items.redstone}); + + // Link Card Creator recipe + GameRegistry.addRecipe(new ItemStack(itemStorageLinkCardCreator, 1, 0), new Object[] {"U ", " C ", " V", 'U', IC2Items.getItem("insulatedCopperCableItem"), 'C', IC2Items.getItem("electronicCircuit"), 'V', Items.paper}); + + // Bench Toolkit recipe + GameRegistry.addRecipe(new ItemStack(itemBenchTools, 1, 0), new Object[] {" I ", "S S", 'I', Items.iron_ingot, 'S', Items.stick}); + + // LV, MV, HV Charging Bench Components recipes + GameRegistry.addShapelessRecipe(new ItemStack(itemBenchTools, 1, 1), new ItemStack(itemBenchTools, 1, 0), new ItemStack(blockAdvPwrMan, 1, 0)); + GameRegistry.addShapelessRecipe(new ItemStack(itemBenchTools, 1, 2), new ItemStack(itemBenchTools, 1, 0), new ItemStack(blockAdvPwrMan, 1, 1)); + GameRegistry.addShapelessRecipe(new ItemStack(itemBenchTools, 1, 3), new ItemStack(itemBenchTools, 1, 0), new ItemStack(blockAdvPwrMan, 1, 2)); + + // LV, MV, HV Charging Bench reassembly recipes + GameRegistry.addShapelessRecipe(new ItemStack(blockAdvPwrMan, 1, 0), new ItemStack(itemBenchTools, 1, 0), new ItemStack(itemBenchTools, 1, 1)); + GameRegistry.addShapelessRecipe(new ItemStack(blockAdvPwrMan, 1, 1), new ItemStack(itemBenchTools, 1, 0), new ItemStack(itemBenchTools, 1, 2)); + GameRegistry.addShapelessRecipe(new ItemStack(blockAdvPwrMan, 1, 2), new ItemStack(itemBenchTools, 1, 0), new ItemStack(itemBenchTools, 1, 3)); + } +/* + @EventHandler + public void certificateWarning(FMLFingerprintViolationEvent event) + { + FMLLog.warning("[AdvancedPowerManagement] " + "[Certificate Error] Fingerprint does not match! This mod's jar file has been modified from the original version."); + FMLLog.warning("[AdvancedPowerManagement] " + "[Certificate Error] Expected fingerprint: " + event.expectedFingerprint); + FMLLog.warning("[AdvancedPowerManagement] " + "[Certificate Error] File: " + event.source.getAbsolutePath()); + }*/ +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/ChannelHandler.java b/src/main/java/com/kaijin/AdvPowerMan/ChannelHandler.java new file mode 100755 index 0000000..2f28cf9 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/ChannelHandler.java @@ -0,0 +1,62 @@ +package com.kaijin.AdvPowerMan; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.NetHandlerPlayServer; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec; +import cpw.mods.fml.common.network.FMLOutboundHandler; +import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.relauncher.Side; +import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelHandlerContext; + +public class ChannelHandler extends FMLIndexedMessageToMessageCodec +{ + public static ChannelHandler instance = new ChannelHandler(); + + public ChannelHandler() + { + addDiscriminator(0, AdvPacket.class); + } + + @Override + public void encodeInto(ChannelHandlerContext ctx, AdvPacket msg, ByteBuf target) throws Exception + { + target.writeBytes(msg.data); + } + + @Override + public void decodeInto(ChannelHandlerContext ctx, ByteBuf source, AdvPacket msg) + { + switch (FMLCommonHandler.instance().getEffectiveSide()) + { + case CLIENT: + AdvancedPowerManagement.instance.proxy.onPacketDataClient(source, ClientProxy.getPlayer()); + break; + case SERVER: + NetHandlerPlayServer netHandler = (NetHandlerPlayServer)(ctx.channel().attr(NetworkRegistry.NET_HANDLER).get()); + AdvancedPowerManagement.instance.proxy.onPacketDataClient(source, netHandler.playerEntity); + break; + } + } + + public static void sendToServer(AdvPacket packet) + { + AdvancedPowerManagement.channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.TOSERVER); + AdvancedPowerManagement.channels.get(Side.CLIENT).writeOutbound(packet); + } + + public static void sendToPlayer(AdvPacket packet, EntityPlayer player) + { + AdvancedPowerManagement.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER); + AdvancedPowerManagement.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player); + AdvancedPowerManagement.channels.get(Side.SERVER).writeOutbound(packet); + } +/* + public static void sendToAllPlayers(Packet packet) + { + AdvancedPowerManagement.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL); + AdvancedPowerManagement.channels.get(Side.SERVER).writeOutbound(packet); + } +*/ +} \ No newline at end of file diff --git a/src/main/java/com/kaijin/AdvPowerMan/ClientPacketHandler.java b/src/main/java/com/kaijin/AdvPowerMan/ClientPacketHandler.java new file mode 100755 index 0000000..d7e5cac --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/ClientPacketHandler.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + +import java.io.DataInputStream; +import java.io.IOException; + +import com.kaijin.AdvPowerMan.tileentities.TECommon; + +import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent; + +public class ClientPacketHandler +{ + /* + * Packet format: + * 0: byte Packet Type + * 1: int x location of TileEntity + * 2: int y location of TileEntity + * 3: int z location of TileEntity + * + * Currently used packet types + * + * Server-to-Client: + * 0 = Universal description packet + * Charging Bench: + * 4: int charge level for texture + * 5: boolean activity state for texture + * + * Battery Station: + * 4: boolean activity state for texture + * + * Storage Monitor: + * 4: int charge level for texture + * 5: boolean power state for texture + * 6: boolean valid state for texture + */ + +// @Override +// public void onPacketData(INetworkManager network, Packet250CustomPayload packet, Player player) + @SubscribeEvent + public void onClientPacket(ClientCustomPacketEvent event) + { + ByteBuf stream = event.packet.payload(); + //DataInputStream stream = new DataInputStream(new ByteArrayInputStream(packet.data)); + + // Determine packet type and coordinates of affected tile entity + int packetType = -1; + int x = 0; + int y = 0; + int z = 0; + + packetType = stream.readInt(); + x = stream.readInt(); + y = stream.readInt(); + z = stream.readInt(); + + if (packetType == 0) + { + World world = FMLClientHandler.instance().getClient().theWorld; + TileEntity tile = world.getTileEntity(x, y, z); + + Exception e; + try + { + ((TECommon)tile).receiveDescriptionData(packetType, stream); + return; + } + catch (ClassCastException ex) + { + e = ex; + } + catch (NullPointerException ex) + { + e = ex; + } + FMLLog.getLogger().info("[AdvancedPowerManagement] " + "Client received description packet for " + x + ", " + y + ", " + z + + " but couldn't deliver to tile entity. (Details: " + e.toString() + ")"); + return; + } + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/ClientProxy.java b/src/main/java/com/kaijin/AdvPowerMan/ClientProxy.java new file mode 100755 index 0000000..2860c85 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/ClientProxy.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan; + +import io.netty.buffer.ByteBuf; + +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.IOException; +import java.util.Arrays; + +import com.kaijin.AdvPowerMan.tileentities.TECommon; + +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.common.FMLLog; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.client.MinecraftForgeClient; + +public class ClientProxy extends CommonProxy +{ + + public static EntityPlayer getPlayer() + { + return Minecraft.getMinecraft().thePlayer; + } + /* @Override + public void load() + { + // MinecraftForgeClient.preloadTexture(Info.ITEM_PNG); + // MinecraftForgeClient.preloadTexture(Info.BLOCK_PNG); + // MinecraftForgeClient.preloadTexture(Info.GUI1_PNG); + // MinecraftForgeClient.preloadTexture(Info.GUI2_PNG); + // MinecraftForgeClient.preloadTexture(Info.GUI3_PNG); + // MinecraftForgeClient.preloadTexture(Info.GUI4_PNG); + }*/ +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/CommonProxy.java b/src/main/java/com/kaijin/AdvPowerMan/CommonProxy.java new file mode 100755 index 0000000..b1d0c57 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/CommonProxy.java @@ -0,0 +1,176 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan; + +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.IOException; +import java.util.Arrays; + +import com.kaijin.AdvPowerMan.containers.ContainerAdjustableTransformer; +import com.kaijin.AdvPowerMan.containers.ContainerAdvEmitter; +import com.kaijin.AdvPowerMan.containers.ContainerBatteryStation; +import com.kaijin.AdvPowerMan.containers.ContainerChargingBench; +import com.kaijin.AdvPowerMan.containers.ContainerStorageMonitor; +import com.kaijin.AdvPowerMan.gui.GuiAdjustableTransformer; +import com.kaijin.AdvPowerMan.gui.GuiAdvEmitter; +import com.kaijin.AdvPowerMan.gui.GuiBatteryStation; +import com.kaijin.AdvPowerMan.gui.GuiChargingBench; +import com.kaijin.AdvPowerMan.gui.GuiStorageMonitor; +import com.kaijin.AdvPowerMan.tileentities.TEAdjustableTransformer; +import com.kaijin.AdvPowerMan.tileentities.TEAdvEmitter; +import com.kaijin.AdvPowerMan.tileentities.TEBatteryStation; +import com.kaijin.AdvPowerMan.tileentities.TEChargingBench; +import com.kaijin.AdvPowerMan.tileentities.TECommon; +import com.kaijin.AdvPowerMan.tileentities.TEStorageMonitor; + +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +//import net.minecraft.network.packet.Packet250CustomPayload; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.network.IGuiHandler; +//import cpw.mods.fml.common.network.PacketDispatcher; +//import cpw.mods.fml.common.network.Player; +import cpw.mods.fml.relauncher.Side; + +public class CommonProxy implements IGuiHandler +{ + public void load() {} + + public boolean isClient() + { + return FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT; + } + + public boolean isServer() + { + return FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER; + } + + @Override + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) + { + if (!world.blockExists(x, y, z)) return null; + + TileEntity tile = world.getTileEntity(x, y, z); + + if (ID == 1 && tile instanceof TEChargingBench) + { + return new ContainerChargingBench(player.inventory, (TEChargingBench)tile); + } + else if (ID == 2 && tile instanceof TEBatteryStation) + { + return new ContainerBatteryStation(player.inventory, (TEBatteryStation)tile); + } + else if (ID == 3 && tile instanceof TEStorageMonitor) + { + return new ContainerStorageMonitor(player.inventory, (TEStorageMonitor)tile); + } + else if (ID == 4 && tile instanceof TEAdvEmitter) + { + return new ContainerAdvEmitter((TEAdvEmitter)tile); + } + else if (ID == 5 && tile instanceof TEAdjustableTransformer) + { + return new ContainerAdjustableTransformer((TEAdjustableTransformer)tile); + } + + return null; + } + + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) + { + if (!world.blockExists(x, y, z)) return null; + + TileEntity tile = world.getTileEntity(x, y, z); + + if (ID == 1 && tile instanceof TEChargingBench) + { + return new GuiChargingBench(player.inventory, (TEChargingBench)tile); + } + else if (ID == 2 && tile instanceof TEBatteryStation) + { + return new GuiBatteryStation(player.inventory, (TEBatteryStation)tile); + } + else if (ID == 3 && tile instanceof TEStorageMonitor) + { + return new GuiStorageMonitor(player.inventory, (TEStorageMonitor)tile); + } + else if (ID == 4 && tile instanceof TEAdvEmitter) + { + return new GuiAdvEmitter((TEAdvEmitter)tile); + } + else if (ID == 5 && tile instanceof TEAdjustableTransformer) + { + return new GuiAdjustableTransformer((TEAdjustableTransformer)tile); + } + + return null; + } + + /* + * Packet format: + * 0: byte Packet Type + * 1: int x location of TileEntity + * 2: int y location of TileEntity + * 3: int z location of TileEntity + * + * Currently used packet types + * + * Client-to-Server: + * 0 = GUI button command + * 4: int Button ID clicked + */ + + public void onPacketDataClient(ByteBuf source, EntityPlayer entityPlayer) + { + DataInputStream stream = new DataInputStream(new ByteArrayInputStream(Arrays.copyOfRange(source.array(), 1, source.array().length))); + + // Determine packet type and coordinates of affected tile entity + int packetType = -1; + int x; + int y; + int z; + try + { + packetType = stream.readInt(); + x = stream.readInt(); + y = stream.readInt(); + z = stream.readInt(); + } + catch (IOException e) + { + FMLLog.getLogger().info("[AdvancedPowerManagement] " + "Failed to read packet from client. (Details: " + e.toString() + ")"); + return; + } + + if (packetType == 0) + { + Exception e; + try + { + World world = entityPlayer.worldObj; + TileEntity tile = world.getTileEntity(x, y, z); + + int buttonID = stream.readInt(); + + ((TECommon)tile).receiveGuiButton(buttonID); + return; + } + catch (ClassCastException ex) { e = ex; } + catch (NullPointerException ex) { e = ex; } + catch (IOException ex) { e = ex; } + + FMLLog.getLogger().info("[AdvancedPowerManagement] " + "Server received GUI button packet for " + x + ", " + y + ", " + z + + " but couldn't deliver to tile entity. (Details: " + e.toString() + ")"); + return; + } + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/Coords.java b/src/main/java/com/kaijin/AdvPowerMan/Coords.java new file mode 100755 index 0000000..a9eb4e5 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/Coords.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan; + +public class Coords +{ + public int x; + public int y; + public int z; + + public Coords(int x, int y, int z) + { + this.x = x; + this.y = y; + this.z = z; + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/Info.java b/src/main/java/com/kaijin/AdvPowerMan/Info.java new file mode 100755 index 0000000..502dcb2 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/Info.java @@ -0,0 +1,144 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import cpw.mods.fml.common.registry.LanguageRegistry; + +public class Info +{ + // Mod Info + public static final String TITLE_PACKED = "AdvancedPowerManagement"; + public static final String TITLE = "Advanced Power Management"; + public static final String TITLE_LOG = "[" + TITLE_PACKED + "] "; + + // Textures + public static final String TEX_BASE = "textures/"; + public static final String GUI_TEX_CHARGING_BENCH = TEX_BASE + "GUIChargingBench.png"; + public static final String GUI_TEX_BATTERY_STATION = TEX_BASE + "GUIBatteryStation.png"; + public static final String GUI_TEX_STORAGE_MONITOR = TEX_BASE + "GUIStorageMonitor.png"; + public static final String GUI_TEX_EMITTER = TEX_BASE + "GUIAdvEmitter.png"; + public static final String GUI_TEX_ADJ_TRANSFORMER = TEX_BASE + "GUIAdjustableTransformer.png"; + + public static final String[] KEY_BLOCK_NAMES = new String[] {"blockChargingBench1", "blockChargingBench2", "blockChargingBench3", + "blockEmitterBlock1", "blockEmitterBlock2", "blockEmitterBlock3", "blockAdjustableTransformer", "blockEmitterAdjustable", + "blockBatteryStation1", "blockBatteryStation2", "blockBatteryStation3", "blockStorageMonitor"}; + public static final String KEY_NAME_SUFFIX = ".name"; + + // Blocks + public static final String CHARGER_NAME = "Charging Bench"; + public static final String DISCHARGER_NAME = "Battery Station"; + public static final String MONITOR_NAME = "Storage Monitor"; + public static final String EMITTER_NAME = "Emitter"; + public static final String ADV_EMITTER_NAME = "Adjustable Emitter"; + public static final String ADJ_TRANSFORMER_NAME = "Adjustable Transformer"; + + // Items + public static final String TOOLKIT_NAME = CHARGER_NAME + " Toolkit"; + public static final String COMPONENTS_NAME = CHARGER_NAME + " Components"; + + public static final String LINK_CARD_NAME = "Energy Link Card"; + public static final String LINK_CREATOR_NAME = "Energy Link Card (Blank)"; + + // GUI IDs + public static final int GUI_ID_CHARGING_BENCH = 1; + public static final int GUI_ID_BATTERY_STATION = 2; + public static final int GUI_ID_STORAGE_MONITOR = 3; + public static final int GUI_ID_ADJUSTABLE_EMITTER = 4; + public static final int GUI_ID_ADJUSTABLE_TRANSFORMER = 5; + + // Other constants for use in multiple classes + public static final int LAST_META_VALUE = 11; + + public static final int CB_META = 0; // through 2 + // 3-5 are unused + public static final int AT_META = 6; + public static final int AE_META = 7; + public static final int BS_META = 8; // through 10 + public static final int SM_META = 11; + + public static final int CB_SLOT_INPUT = 0; + public static final int CB_SLOT_OUTPUT = 1; + public static final int CB_SLOT_POWER_SOURCE = 2; + public static final int CB_SLOT_CHARGING = 3; + public static final int CB_SLOT_UPGRADE = 15; + + public static final int BS_SLOT_INPUT = 0; + public static final int BS_SLOT_OUTPUT = 1; + public static final int BS_SLOT_POWER_START = 2; + + public static final int SM_SLOT_UNIVERSAL = 0; + + public static final int CB_INVENTORY_SIZE = 19; + public static final int BS_INVENTORY_SIZE = 14; + public static final int SM_INVENTORY_SIZE = 1; + + public static final int AE_MIN_PACKET = 4; + public static final int AE_MAX_PACKET = 8192; + public static final int AE_MIN_OUTPUT = 1; + public static final int AE_MAX_OUTPUT = 32768; + public static final int AE_PACKETS_TICK = 64; + + // GUI strings + public static final String KEY_TITLE = "AdvPwrMan.title"; + public static final String KEY_EU = "AdvPwrMan.misc.EU"; + public static final String KEY_IN = "AdvPwrMan.misc.in"; + public static final String KEY_OUT = "AdvPwrMan.misc.out"; + public static final String KEY_CHARGER_MAX = "AdvPwrMan.charger.maxEU"; + public static final String KEY_CHARGER_REQ = "AdvPwrMan.charger.requiredEU"; + public static final String KEY_CHARGER_PWR = "AdvPwrMan.charger.redstonePower"; + public static final String KEY_CHARGER_ETC = "AdvPwrMan.charger.estimatedTime"; + public static final String KEY_CHARGER_AVG = "AdvPwrMan.charger.averageInput"; + public static final String KEY_EMITTER_PACKET = "AdvPwrMan.emitter.packet"; + public static final String KEY_EMITTER_OUTPUT = "AdvPwrMan.emitter.output"; + public static final String KEY_TRANSFORMER_OUTPUT = "AdvPwrMan.transformer.limit"; + public static final String KEY_MONITOR_INVALID = "AdvPwrMan.monitor.invalid"; + public static final String KEY_MONITOR_UPPER = "AdvPwrMan.monitor.upper"; + public static final String KEY_MONITOR_LOWER = "AdvPwrMan.monitor.lower"; + public static final String KEY_DISCHARGER_MODE_LINE1 = "AdvPwrMan.station.modeline1"; + public static final String KEY_DISCHARGER_MODE_LINE2 = "AdvPwrMan.station.modeline2"; + public static final String KEY_STATS_AVERAGE_EU = "AdvPwrMan.station.average"; + public static final String KEY_STATS_TIME_REMAINING = "AdvPwrMan.station.remaining"; + public static final String KEY_STATS_DISPLAY_DAYS = "AdvPwrMan.station.led.days"; + public static final String KEY_STATS_DISPLAY_UNKNOWN = "AdvPwrMan.station.led.unknown"; + public static final String KEY_STATS_AVERAGE_INPUT = "AdvPwrMan.station.packetIn"; + public static final String KEY_EU_BUFFERED = "AdvPwrMan.station.EUbuffered"; + + public static final String AE_PACKET_RANGE = "[" + AE_MIN_PACKET + " - " + AE_MAX_PACKET + "]"; + public static final String AE_OUTPUT_RANGE = "[" + AE_MIN_OUTPUT + " - " + AE_MAX_OUTPUT + "]"; + + public static final String[] KEY_DIRECTION_NAMES = {"AdvPwrMan.dir.down", "AdvPwrMan.dir.up", "AdvPwrMan.dir.north", "AdvPwrMan.dir.south", "AdvPwrMan.dir.west", "AdvPwrMan.dir.east"}; + + // Some global variables + public static boolean isDebugging; + + public static int ic2WrenchID; + public static int ic2ElectricWrenchID; + + // For returning charging benches and deconstructing them + public static ItemStack componentCopperCable; + public static ItemStack componentGoldCable; + public static ItemStack componentIronCable; + public static ItemStack componentBatBox; + public static ItemStack componentMFE; + public static ItemStack componentMFSU; + public static ItemStack componentCircuit; + + // For internal reference to verify items can be placed in inventory. + public static ItemStack ic2overclockerUpg; + public static ItemStack ic2transformerUpg; + public static ItemStack ic2storageUpg; + + // Icons for GUI slots + public static IIcon iconSlotChargeable; + public static IIcon iconSlotDrainable; + public static IIcon iconSlotInput; + public static IIcon iconSlotOutput; + public static IIcon iconSlotMachineUpgrade; + public static IIcon iconSlotLinkCard; + public static IIcon[] iconSlotPowerSource; + public static IIcon[] iconSlotPlayerArmor; +} \ No newline at end of file diff --git a/src/main/java/com/kaijin/AdvPowerMan/MovingAverage.java b/src/main/java/com/kaijin/AdvPowerMan/MovingAverage.java new file mode 100755 index 0000000..cca84c5 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/MovingAverage.java @@ -0,0 +1,95 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan; + +public class MovingAverage +{ + protected int packets[] = null; + protected int delays[] = null; + protected int position; + //protected int packetTotal; + //protected int delayTotal; + protected int delay; + protected int window; + protected float average; + protected float delta; + + public MovingAverage(int size) + { + packets = new int[size]; + delays = new int[size]; + position = 0; + //packetTotal = 0; + //delayTotal = size; + delay = 1; + window = size; + average = 0F; + delta = 0F; + for (int i = 0; i < size; i++) + { + packets[i] = 0; + delays[i] = 600; + } + } + + public void tick(int value) + { + if (value > 0 || delay >= 600) // 600 ticks (30 sec) is long enough for 1 EU/t to have triggered a 512 EU packet by now + { + position++; + if (position >= packets.length) position = 0; + + //packetTotal -= packet[position]; + packets[position] = value; + //packetTotal += value; + + //delayTotal -= time[position]; + delays[position] = delay; + //delayTotal += delay; + delay = 1; + + window = sumDelays(); + final float newAvg = ((float)sumPackets()) / ((float)window); + delta = newAvg - average; + average = newAvg; + } + else + { + delay++; + // Estimate decline of average based on increased average delay + if (delays.length * delay > window) + { + window++; + average = ((float)sumPackets()) / ((float)window); + } + } + } + + protected int sumDelays() + { + if (delays == null) return 1; + int delayTotal = 0; + for (int d : delays) delayTotal += d; + return delayTotal; + } + + protected int sumPackets() + { + if (packets == null) return 0; + int packetTotal = 0; + for (int p : packets) packetTotal += p; + return packetTotal; + } + + public float getAverage() + { + return average; + } + + public int getWindow() + { + return window; + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/Utils.java b/src/main/java/com/kaijin/AdvPowerMan/Utils.java new file mode 100755 index 0000000..8edce76 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/Utils.java @@ -0,0 +1,228 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan; + +import ic2.api.item.IElectricItem; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class Utils +{ + public boolean isClient() + { + return FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT; + } + + public boolean isServer() + { + return FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER; + } + + /** + * + * @param fr - Font Renderer handle + * @param text - Text to display + * @param xLoc - x location + * @param yLoc - y location + * @param color - Color + */ + @SideOnly(Side.CLIENT) + public static void drawCenteredText(FontRenderer fr, String text, int xLoc, int yLoc, int color) + { + fr.drawString(text, xLoc - fr.getStringWidth(text) / 2, yLoc, color); + } + + /** + * + * @param fr - Font Renderer handle + * @param text - Text to display + * @param xLoc - x location + * @param yLoc - y location + * @param color - Color + */ + @SideOnly(Side.CLIENT) + public static void drawRightAlignedText(FontRenderer fr, String text, int xLoc, int yLoc, int color) + { + fr.drawString(text, xLoc - fr.getStringWidth(text), yLoc, color); + } + + /** + * + * @param fr - Font Renderer handle + * @param text - Text to display + * @param xLoc - x location + * @param yLoc - y location + * @param color - Color + */ + @SideOnly(Side.CLIENT) + public static void drawLeftAlignedText(FontRenderer fr, String text, int xLoc, int yLoc, int color) + { + fr.drawString(text, xLoc, yLoc, color); + } + + private static final int MASKR = 0xFF0000; + private static final int MASKG = 0x00FF00; + private static final int MASKB = 0x0000FF; + + /** + * Individually multiply R, G, B color components by scalar value to dim or brighten the color. + * Does not check for overflow. Beware when using values over 1.0F. + * @param color - original color + * @param brightnessFactor - should be positive and <> 1.0F + * @return - modified color + */ + public static int multiplyColorComponents(int color, float brightnessFactor) + { + return ((int)(brightnessFactor * (color & MASKR)) & MASKR) + | ((int)(brightnessFactor * (color & MASKG)) & MASKG) + | ((int)(brightnessFactor * (color & MASKB)) & MASKB); + } + + public static int interpolateColors(int a, int b, float lerp) + { + final int MASK1 = 0xff00ff; + final int MASK2 = 0x00ff00; + + int f2 = (int)(256 * lerp); + int f1 = 256 - f2; + + return ((((( a & MASK1 ) * f1 ) + ( ( b & MASK1 ) * f2 )) >> 8 ) & MASK1 ) + | ((((( a & MASK2 ) * f1 ) + ( ( b & MASK2 ) * f2 )) >> 8 ) & MASK2 ); + } + + public static final int GUIBACKGROUNDCOLOR = 0xC6C6C6; + + public static int overlayColors(int base, int over) + { + final float rDiff = 1F - ((float)(base & MASKR) / MASKR); + final float gDiff = 1F - ((float)(base & MASKG) / MASKG); + final float bDiff = 1F - ((float)(base & MASKB) / MASKB); + + final int r2 = (over & MASKR); + final int g2 = (over & MASKG); + final int b2 = (over & MASKB); + + return base + ((int)(rDiff * r2) & MASKR) + ((int)(gDiff * g2) & MASKG) + ((int)(bDiff * b2) & MASKB); + } + + private static final int oX[] = {0, -1, 0, 1}; + private static final int oY[] = {-1, 0, 1, 0}; + + /** + * Draws right-aligned text with a 'glow' surrounding it. + * @param fr - Font Renderer handle + * @param text - Text to display + * @param xLoc - x location (upper right corner) + * @param yLoc - y location (upper right corner) + * @param color - Main Color + * @param glowColor - Surrounding Color + */ + @SideOnly(Side.CLIENT) + public static void drawRightAlignedGlowingText(FontRenderer fr, String text, int xLoc, int yLoc, int color, int glowColor) + { + drawGlowingText(fr, text, xLoc - fr.getStringWidth(text), yLoc, color, glowColor); + } + + /** + * Draws centered text with a 'glow' surrounding it. + * @param fr - Font Renderer handle + * @param text - Text to display + * @param xLoc - x location (top center) + * @param yLoc - y location (top center) + * @param color - Main Color + * @param glowColor - Surrounding Color + */ + @SideOnly(Side.CLIENT) + public static void drawCenteredGlowingText(FontRenderer fr, String text, int xLoc, int yLoc, int color, int glowColor) + { + drawGlowingText(fr, text, xLoc - fr.getStringWidth(text) / 2, yLoc, color, glowColor); + } + + /** + * Draws left-aligned text with a 'glow' surrounding it. + * @param fr - Font Renderer handle + * @param text - Text to display + * @param xLoc - x location (upper left corner) + * @param yLoc - y location (upper left corner) + * @param color - Main Color + * @param glowColor - Surrounding Color + */ + @SideOnly(Side.CLIENT) + public static void drawGlowingText(FontRenderer fr, String text, int xLoc, int yLoc, int color, int glowColor) + { + for (int i = 0; i < 4; i++) + { + fr.drawString(text, xLoc + oX[i], yLoc + oY[i], glowColor); + } + fr.drawString(text, xLoc, yLoc, color); + } + + /* + * Convert desired side to actual side based on orientation of block + * I Meta + * D U N S W E 0 1 2 3 4 5 + * 0 F K T T T T 0 0 1 2 2 2 2 + * 1 K F B B B B 1 1 0 3 3 3 3 + * 2 T B F K L R 2 2 3 0 1 5 4 + * 3 B T K F R L 3 3 2 1 0 4 5 + * 4 L L L R F K 4 5 5 5 4 0 1 + * 5 R R R L K F 5 4 4 4 5 1 0 + * + */ + public static int lookupRotatedSide(int side, int orientation) + { + final int table[][] = + { + {0, 1, 2, 2, 2, 2}, + {1, 0, 3, 3, 3, 3}, + {2, 3, 0, 1, 5, 4}, + {3, 2, 1, 0, 4, 5}, + {5, 5, 5, 4, 0, 1}, + {4, 4, 4, 5, 1, 0} + }; + return table[side][orientation]; + } + + public static NBTTagCompound getOrCreateStackTag(ItemStack itemStack) + { + if (itemStack != null) + { + NBTTagCompound tag = itemStack.getTagCompound(); + if (tag == null) + { + tag = new NBTTagCompound(); + itemStack.setTagCompound(tag); + } + return tag; + } + return null; + } + + public static boolean isItemChargeable(ItemStack stack, int tier) + { + // Decide if the item is a valid IC2 electrical item + if (stack != null && stack.getItem() instanceof IElectricItem) + { + IElectricItem item = (IElectricItem)(stack.getItem()); + if (item.getTier(stack) <= tier) return true; + } + return false; + } + + public static boolean isItemDrainable(ItemStack stack, int tier) + { + // Decide if the item is a valid IC2 power source + if (stack != null && stack.getItem() instanceof IElectricItem) + { + IElectricItem item = (IElectricItem)(stack.getItem()); + if (item.canProvideEnergy(stack) && item.getTier(stack) <= tier) return true; + } + return false; + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/blocks/BlockAdvPwrMan.java b/src/main/java/com/kaijin/AdvPowerMan/blocks/BlockAdvPwrMan.java new file mode 100755 index 0000000..94cb90a --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/blocks/BlockAdvPwrMan.java @@ -0,0 +1,395 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.blocks; + +import java.util.List; +import java.util.Random; + +import com.kaijin.AdvPowerMan.AdvancedPowerManagement; +import com.kaijin.AdvPowerMan.Info; +import com.kaijin.AdvPowerMan.tileentities.TEAdjustableTransformer; +import com.kaijin.AdvPowerMan.tileentities.TEAdvEmitter; +import com.kaijin.AdvPowerMan.tileentities.TEBatteryStation; +import com.kaijin.AdvPowerMan.tileentities.TEChargingBench; +import com.kaijin.AdvPowerMan.tileentities.TECommon; +import com.kaijin.AdvPowerMan.tileentities.TEStorageMonitor; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockAdvPwrMan extends BlockContainer +{ + static final String[] tierPrefix = {"LV", "MV", "HV", "EV"}; + + protected IIcon benchBottom; + protected IIcon smTop; + protected IIcon smBottom; + protected IIcon smInvalid; + protected IIcon emitter; + protected IIcon atOut; + protected IIcon atInput; + protected IIcon[] atOutput; + protected IIcon[] benchTop; + protected IIcon[][][] cbSides; + protected IIcon[][] bsSides; + protected IIcon[][] smSides; + + public BlockAdvPwrMan( Material material) + { + super(material); + setHardness(0.75F); + setResistance(5F); + setStepSound(soundTypeStone); + //setUnlocalizedName("AdvPwrMan"); + setCreativeTab(CreativeTabs.tabDecorations); + } + + @SideOnly(Side.CLIENT) + @Override + public void getSubBlocks(Item block, CreativeTabs creativetabs, List list) + { + for (int i = 0; i <= Info.LAST_META_VALUE; ++i) + { + if (i >= 3 && i <= 5) continue; // Don't add legacy emitters to creative inventory + list.add(new ItemStack(block, 1, i)); + } + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int par6, float par7, float par8, float par9) + { + //int currentEquippedItemID = 0; //TODO We're not currently responding to wrenches + + //if (entityplayer.getCurrentEquippedItem() != null) + //{ + // currentEquippedItemID = entityplayer.getCurrentEquippedItem().itemID; + //} + + //if (entityplayer.isSneaking() || currentEquippedItemID == Info.ic2WrenchID || currentEquippedItemID == Info.ic2ElectricWrenchID) + if (entityplayer.isSneaking()) + { + // Prevent GUI popup when sneaking - this allows you to place things directly on blocks + return false; + } + + TileEntity tile = world.getTileEntity(x, y, z); + if (tile instanceof TECommon) + { + final int id = ((TECommon)tile).getGuiID(); + if (id < 1) return false; + if (AdvancedPowerManagement.proxy.isServer()) + { + entityplayer.openGui(AdvancedPowerManagement.instance, id, world, x, y, z); + } + } + + return true; + } + + @Override + public void registerBlockIcons(IIconRegister iconRegister) + { + cbSides = new IIcon[3][2][13]; + bsSides = new IIcon[3][2]; + smSides = new IIcon[2][13]; + benchTop = new IIcon[3]; + atOutput = new IIcon[4]; + + benchBottom = iconRegister.registerIcon(Info.TITLE_PACKED + ":BenchBottom"); + smTop = iconRegister.registerIcon(Info.TITLE_PACKED + ":StorageMonitorTop"); + smBottom = iconRegister.registerIcon(Info.TITLE_PACKED + ":StorageMonitorBottom"); + smInvalid = iconRegister.registerIcon(Info.TITLE_PACKED + ":StorageMonitorInvalid"); + emitter = iconRegister.registerIcon(Info.TITLE_PACKED + ":Emitter"); + atInput = iconRegister.registerIcon(Info.TITLE_PACKED + ":TransformerInput"); + + int i, j; + for (i = 0; i < 13; i++) + { + String temp = Integer.toString(i); + for (j = 0; j < 3; j++) + { + cbSides[j][0][i] = iconRegister.registerIcon(Info.TITLE_PACKED + ":" + tierPrefix[j] + "ChargingBenchOff" + temp); + cbSides[j][1][i] = iconRegister.registerIcon(Info.TITLE_PACKED + ":" + tierPrefix[j] + "ChargingBenchOn" + temp); + } + smSides[0][i] = iconRegister.registerIcon(Info.TITLE_PACKED + ":StorageMonitorOff" + temp); + smSides[1][i] = iconRegister.registerIcon(Info.TITLE_PACKED + ":StorageMonitorOn" + temp); + } + for (i = 0; i < 3; i++) + { + benchTop[i] = iconRegister.registerIcon(Info.TITLE_PACKED + ":" + tierPrefix[i] + "BenchTop"); + bsSides[i][0] = iconRegister.registerIcon(Info.TITLE_PACKED + ":" + tierPrefix[i] + "BatteryStationOff"); + bsSides[i][1] = iconRegister.registerIcon(Info.TITLE_PACKED + ":" + tierPrefix[i] + "BatteryStationOn"); + } + for (i = 0; i < 4; i++) + { + atOutput[i] = iconRegister.registerIcon(Info.TITLE_PACKED + ":TransformerOutput1" + tierPrefix[i]); + } + } + + //Textures in the world + @SideOnly(Side.CLIENT) + @Override + public IIcon getIcon(IBlockAccess blocks, int x, int y, int z, int side) + { + final int meta = blocks.getBlockMetadata(x, y, z); + TileEntity tile = blocks.getTileEntity(x, y, z); + if (tile instanceof TEChargingBench) + { + switch (side) + { + case 0: // bottom + return benchBottom; + + case 1: // top + return benchTop[meta - Info.CB_META]; + + default: + return cbSides[meta - Info.CB_META][((TEChargingBench)tile).doingWork ? 1 : 0][((TEChargingBench)tile).chargeLevel]; + } + } + else if (tile instanceof TEAdvEmitter) + { + return emitter; + } + else if (tile instanceof TEAdjustableTransformer) + { + final byte flags = ((TEAdjustableTransformer)tile).sideSettings[side]; + if ((flags & 1) == 0) return atInput; + return atOutput[(flags >>> 1) & 3]; + } + else if (tile instanceof TEBatteryStation) + { + switch (side) + { + case 0: // bottom + return benchBottom; + + case 1: // top + return benchTop[meta - Info.BS_META]; + + default: + return bsSides[meta - Info.BS_META][((TEBatteryStation)tile).doingWork ? 1 : 0]; + } + } + else if (tile instanceof TEStorageMonitor) + { + switch (side) + { + case 0: // bottom + return smBottom; + + case 1: // top + return smTop; + + default: + if (((TEStorageMonitor)tile).blockState) + { + return smSides[((TEStorageMonitor)tile).isPowering ? 1 : 0][((TEStorageMonitor)tile).chargeLevel]; + } + else return smInvalid; + } + } + + //If we're here, something is wrong + return benchBottom; + } + + //Textures in your inventory + @Override + public IIcon getIcon(int side, int meta) + { + if (meta == Info.AE_META) + { + return emitter; + } + if (meta == Info.AT_META) + { + // TODO: Give transformer better textures + return atInput; + } + switch (side) + { + case 0: // bottom + return meta == Info.SM_META ? smBottom : benchBottom; + + case 1: // top + if (meta < 3) // CB tops + { + return benchTop[meta - Info.CB_META]; + } + else if (meta < 11) // Battery Station top + { + return benchTop[meta - Info.BS_META]; + } + else + { + return smTop; + } + + default: // side + if (meta < 3) // Charging Bench + { + return cbSides[meta - Info.CB_META][0][0]; + } + else if (meta < 11) // Battery Station + { + return bsSides[meta - Info.BS_META][0]; + } + else + { + return smInvalid; + } + } + } + + @Override + public int isProvidingWeakPower(IBlockAccess block, int x, int y, int z, int side) + { + TileEntity tile = block.getTileEntity(x, y, z); + return tile instanceof TEStorageMonitor && ((TEStorageMonitor)tile).isPowering ? 15 : 0; // TODO Verify this works properly + } + + @Override + public int isProvidingStrongPower(IBlockAccess block, int x, int y, int z, int side) + { + return 0; + } + + @Override + public boolean canProvidePower() + { + return false; // Old means of causing visual RedPower wire connections. + } + + @Override + public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int direction) + { + return true; + } + + @Override + public boolean isBlockNormalCube() + { + return false; + } + + @Override + public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) + { + return true; + } + + @Override + public TileEntity createNewTileEntity(World world, int i) + { + return null; + } + + @Override + public TileEntity createTileEntity(World world, int metadata) + { + //if (ChargingBench.isDebugging) System.out.println("BlockAdvPwrMan.createTileEntity"); + switch (metadata) + { + case 0: + return new TEChargingBench(1); + + case 1: + return new TEChargingBench(2); + + case 2: + return new TEChargingBench(3); + + case 3: + return new TEAdvEmitter(1); // Update old emitter tier 1 + + case 4: + return new TEAdvEmitter(2); // Update old emitter tier 2 + + case 5: + return new TEAdvEmitter(3); // Update old emitter tier 3 + + case 6: + return new TEAdjustableTransformer(); + + case 7: + return new TEAdvEmitter(); + + case 8: + return new TEBatteryStation(1); + + case 9: + return new TEBatteryStation(2); + + case 10: + return new TEBatteryStation(3); + + case 11: + return new TEStorageMonitor(); + + default: + return null; + } + } + + @Override + public boolean hasTileEntity(int metadata) + { + return metadata >= 0 && metadata <= Info.LAST_META_VALUE; + } +/* + @Override + public Item getItemDropped(int var1, Random var2, int var3) + { + //if (ChargingBench.isDebugging) System.out.println("BlockAdvPwrMan.idDropped"); + return blockID; + } +*/ + @Override + public int damageDropped(int meta) + { + //if (ChargingBench.isDebugging) System.out.println("BlockAdvPwrMan.damageDropped"); + return meta; + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) + { + preDestroyBlock(world, x, y, z); + } + + public static void preDestroyBlock(World world, int i, int j, int k) + { + if (!AdvancedPowerManagement.proxy.isClient()) + { + TileEntity tile = world.getTileEntity(i, j, k); + if (tile == null) return; + try + { + ((TECommon)tile).dropContents(); + } + catch (ClassCastException e) + { + FMLLog.warning("[AdvancedPowerManagement] " + "Attempted to destroy APM block with non-APM tile entity at: " + i + ", " + j + ", " + k); + } + tile.invalidate(); + } + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/containers/ContainerAdjustableTransformer.java b/src/main/java/com/kaijin/AdvPowerMan/containers/ContainerAdjustableTransformer.java new file mode 100755 index 0000000..812b8c0 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/containers/ContainerAdjustableTransformer.java @@ -0,0 +1,164 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.containers; + +import com.kaijin.AdvPowerMan.tileentities.TEAdjustableTransformer; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ContainerAdjustableTransformer extends Container +{ + private final int playerInventoryStartSlot = 1; + + public TEAdjustableTransformer tile; + public int outputRate; + public int packetSize; + public byte[] sideSettings = {0, 0, 0, 0, 0, 0}; // DOWN, UP, NORTH, SOUTH, WEST, EAST + public int outputAvg; + public int inputAvg; + public int energyBuffer; + + public ContainerAdjustableTransformer(TEAdjustableTransformer tileentity) + { + //if (Info.isDebugging) System.out.println("ContainerAdjustableTransformer"); + tile = tileentity; + outputRate = -1; + packetSize = -1; + for (int i : sideSettings) + i = (byte)255; + outputAvg = -1; + inputAvg = -1; + energyBuffer = -1; + } + + @Override + public void detectAndSendChanges() + { + final int syncOutAvg = (int)(tile.outputTracker.getAverage() * 100); + final int syncInAvg = (int)(tile.inputTracker.getAverage() * 100); + + for (int crafterIndex = 0; crafterIndex < crafters.size(); ++crafterIndex) + { + ICrafting crafter = (ICrafting)crafters.get(crafterIndex); + + if (this.outputRate != tile.outputRate) + { + crafter.sendProgressBarUpdate(this, 0, tile.outputRate & 65535); + crafter.sendProgressBarUpdate(this, 1, tile.outputRate >>> 16); + } + + if (this.packetSize != tile.packetSize) + { + crafter.sendProgressBarUpdate(this, 2, tile.packetSize & 65535); + crafter.sendProgressBarUpdate(this, 3, tile.packetSize >>> 16); + } + + for (int i = 0; i < 6; i++) + if (this.sideSettings[i] != tile.sideSettings[i]) + { + crafter.sendProgressBarUpdate(this, 4 + i, tile.sideSettings[i]); + } + + if (outputAvg != syncOutAvg) + { + crafter.sendProgressBarUpdate(this, 10, syncOutAvg & 65535); + crafter.sendProgressBarUpdate(this, 11, syncOutAvg >>> 16); + } + + if (inputAvg != syncInAvg) + { + crafter.sendProgressBarUpdate(this, 12, syncInAvg & 65535); + crafter.sendProgressBarUpdate(this, 13, syncInAvg >>> 16); + } + + if (this.energyBuffer != tile.energyBuffer) + { + crafter.sendProgressBarUpdate(this, 14, tile.energyBuffer & 65535); + crafter.sendProgressBarUpdate(this, 15, tile.energyBuffer >>> 16); + } + } + + // Done sending updates, record the new current values + this.outputRate = tile.outputRate; + this.packetSize = tile.packetSize; + for (int i = 0; i < 6; i++) + { + this.sideSettings[i] = tile.sideSettings[i]; + } + outputAvg = syncOutAvg; + inputAvg = syncInAvg; + this.energyBuffer = tile.energyBuffer; + } + + @SideOnly(Side.CLIENT) + @Override + public void updateProgressBar(int param, int value) + { + switch (param) + { + case 0: + tile.outputRate = tile.outputRate & -65536 | value; + break; + + case 1: + tile.outputRate = tile.outputRate & 65535 | (value << 16); + break; + + case 2: + tile.packetSize = tile.packetSize & -65536 | value; + break; + + case 3: + tile.packetSize = tile.packetSize & 65535 | (value << 16); + break; + + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + tile.sideSettings[param - 4] = (byte)value; + break; + + case 10: + outputAvg = outputAvg & -65536 | value; + break; + + case 11: + outputAvg = outputAvg & 65535 | (value << 16); + break; + + case 12: + inputAvg = inputAvg & -65536 | value; + break; + + case 13: + inputAvg = inputAvg & 65535 | (value << 16); + break; + + case 14: + tile.energyBuffer = tile.energyBuffer & -65536 | value; + break; + + case 15: + tile.energyBuffer = tile.energyBuffer & 65535 | (value << 16); + break; + + default: + System.out.println("ContainerAdvEmitter.updateProgressBar - Warning: default case!"); + } + } + + @Override + public boolean canInteractWith(EntityPlayer var1) + { + return tile.isUseableByPlayer(var1); + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/containers/ContainerAdvEmitter.java b/src/main/java/com/kaijin/AdvPowerMan/containers/ContainerAdvEmitter.java new file mode 100755 index 0000000..da5c884 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/containers/ContainerAdvEmitter.java @@ -0,0 +1,93 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.containers; + +import com.kaijin.AdvPowerMan.tileentities.TEAdvEmitter; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ContainerAdvEmitter extends Container +{ + private final int playerInventoryStartSlot = 1; + + public TEAdvEmitter te; + public int outputRate; + public int packetSize; + + public ContainerAdvEmitter(TEAdvEmitter tile) + { + //if (Info.isDebugging) System.out.println("ContainerAdvEmitter"); + te = tile; + outputRate = -1; + packetSize = -1; + } + + @Override + public void detectAndSendChanges() + { + // if (ChargingBench.isDebugging) System.out.println("ContainerChargingBench.updateCraftingResults"); + for (int crafterIndex = 0; crafterIndex < crafters.size(); ++crafterIndex) + { + ICrafting crafter = (ICrafting)crafters.get(crafterIndex); + + if (this.outputRate != te.outputRate) + { + crafter.sendProgressBarUpdate(this, 0, te.outputRate & 65535); + crafter.sendProgressBarUpdate(this, 1, te.outputRate >>> 16); + } + + if (this.packetSize != te.packetSize) + { + crafter.sendProgressBarUpdate(this, 2, te.packetSize & 65535); + crafter.sendProgressBarUpdate(this, 3, te.packetSize >>> 16); + } + } + + // Done sending updates, record the new current values + this.outputRate = te.outputRate; + this.packetSize = te.packetSize; + } + + @SideOnly(Side.CLIENT) + @Override + public void updateProgressBar(int param, int value) + { + switch (param) + { + case 0: + //if (ChargingBench.isDebugging) System.out.println("ContainerChargingBench.updateProgressBar case 0 tileentity.currentEnergy = " + (this.tileentity.currentEnergy & -65536) + " | " + value); + te.outputRate = te.outputRate & -65536 | value; + break; + + case 1: + //if (ChargingBench.isDebugging) System.out.println("ContainerChargingBench.updateProgressBar case 1 tileentity.currentEnergy = " + (this.tileentity.currentEnergy & 65535) + " | " + (value << 16)); + te.outputRate = te.outputRate & 65535 | (value << 16); + break; + + case 2: + //if (ChargingBench.isDebugging) System.out.println("ContainerChargingBench.updateProgressBar case 3 tileentity.adjustedStorage = " + (this.tileentity.adjustedStorage & -65536) + " | " + value); + te.packetSize = te.packetSize & -65536 | value; + break; + + case 3: + //if (ChargingBench.isDebugging) System.out.println("ContainerChargingBench.updateProgressBar case 4 tileentity.adjustedStorage = " + (this.tileentity.adjustedStorage & 65535) + " | " + (value << 16)); + te.packetSize = te.packetSize & 65535 | (value << 16); + break; + + default: + System.out.println("ContainerAdvEmitter.updateProgressBar - Warning: default case!"); + } + } + + @Override + public boolean canInteractWith(EntityPlayer var1) + { + return te.isUseableByPlayer(var1); + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/containers/ContainerBatteryStation.java b/src/main/java/com/kaijin/AdvPowerMan/containers/ContainerBatteryStation.java new file mode 100755 index 0000000..4e1e5c5 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/containers/ContainerBatteryStation.java @@ -0,0 +1,464 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.containers; + +import com.kaijin.AdvPowerMan.slots.SlotDrainable; +import com.kaijin.AdvPowerMan.slots.SlotOutput; +import com.kaijin.AdvPowerMan.slots.SlotPowerSource; +import com.kaijin.AdvPowerMan.tileentities.TEBatteryStation; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ContainerBatteryStation extends Container +{ + private static final int shiftClickRange = 13; + private static final int playerInventoryStartSlot = 14; + + public TEBatteryStation tileentity; + public int opMode; + public int average; + public int itemsEnergyTotal; + + public ContainerBatteryStation(InventoryPlayer player, TEBatteryStation tile) + { + tileentity = tile; + opMode = -1; + average = -1; + itemsEnergyTotal = -1; + + final int topOffset = 24; // Got tired of forgetting to manually alter ALL of the constants. (This won't affect the energy bar!) + + int xCol; + int yRow; + + // Discharging slots, in reverse order + for (yRow = 3; yRow >= 0; yRow--) // 4 rows high + { + for (xCol = 2; xCol >= 0; xCol--) // 3 columns across + { + this.addSlotToContainer(new SlotDrainable(tile, 2 + 11 - xCol - 3 * yRow, 62 + xCol * 18, topOffset + yRow * 18, tile.powerTier)); // 52, 32 is upper left input slot + } + } + + // Input Slot + this.addSlotToContainer(new SlotPowerSource(tile, 0, 17, topOffset, tile.powerTier)); + + // Output slot + this.addSlotToContainer(new SlotOutput(tile, 1, 143, topOffset + 54)); + + // Player inventory + for (yRow = 0; yRow < 3; ++yRow) + { + for (xCol = 0; xCol < 9; ++xCol) + { + this.addSlotToContainer(new Slot(player, xCol + yRow * 9 + 9, 8 + xCol * 18, topOffset + 76 + yRow * 18)); + } + } + + // Player hot bar + for (yRow = 0; yRow < 9; ++yRow) + { + this.addSlotToContainer(new Slot(player, yRow, 8 + yRow * 18, topOffset + 134)); + } + } + + @Override + public void detectAndSendChanges() + { + // if (ChargingBench.isDebugging) System.out.println("ContainerChargingBench.updateCraftingResults"); + super.detectAndSendChanges(); + + final int syncAvg = (int)(tileentity.outputTracker.getAverage() * 100); + final int energy = tileentity.getTotalEnergy(); + for (int crafterIndex = 0; crafterIndex < crafters.size(); ++crafterIndex) + { + ICrafting crafter = (ICrafting)this.crafters.get(crafterIndex); + + if (average != syncAvg) + { + crafter.sendProgressBarUpdate(this, 0, syncAvg & 65535); + crafter.sendProgressBarUpdate(this, 1, syncAvg >>> 16); + } + + if (itemsEnergyTotal != energy) + { + crafter.sendProgressBarUpdate(this, 2, energy & 65535); + crafter.sendProgressBarUpdate(this, 3, energy >>> 16); + } + + if (opMode != tileentity.opMode) + { + crafter.sendProgressBarUpdate(this, 4, tileentity.opMode); + } + } + opMode = tileentity.opMode; + average = syncAvg; + itemsEnergyTotal = energy; + } + + @SideOnly(Side.CLIENT) + @Override + public void updateProgressBar(int param, int value) + { + super.updateProgressBar(param, value); + + switch (param) + { + case 0: + average = average & -65536 | value; + break; + + case 1: + average = average & 65535 | (value << 16); + break; + + case 2: + itemsEnergyTotal = itemsEnergyTotal & -65536 | value; + break; + + case 3: + itemsEnergyTotal = itemsEnergyTotal & 65535 | (value << 16); + break; + + case 4: + this.opMode = value; + break; + + default: + System.out.println("ContainerBatteryStation.updateProgressBar - Warning: default case!"); + } + } + + /** + * Merges provided ItemStack with the first available one in the container/player inventory + */ + @Override + protected boolean mergeItemStack(ItemStack stack, int startSlot, int endSlot, boolean reverseOrder) + { + boolean result = false; + int slotID = startSlot; + + if (reverseOrder) + { + slotID = endSlot - 1; + } + + Slot currentSlot; + ItemStack currentStack; + + if (stack.isStackable()) + { + while (stack.stackSize > 0 && (!reverseOrder && slotID < endSlot || reverseOrder && slotID >= startSlot)) + { + currentSlot = (Slot)inventorySlots.get(slotID); + currentStack = currentSlot.getStack(); + + if (currentStack != null && Item.getIdFromItem(currentStack.getItem()) == Item.getIdFromItem(stack.getItem()) + && (!stack.getHasSubtypes() || stack.getItemDamage() == currentStack.getItemDamage()) + && ItemStack.areItemStackTagsEqual(stack, currentStack) + && currentSlot.isItemValid(stack)) + { + int limit = Math.min(stack.getMaxStackSize(), currentSlot.getSlotStackLimit()); + int sum = currentStack.stackSize + stack.stackSize; + if (sum <= limit) + { + stack.stackSize = 0; + currentStack.stackSize = sum; + currentSlot.onSlotChanged(); + result = true; + } + else if (currentStack.stackSize < limit) + { + int diff = limit - currentStack.stackSize; + stack.stackSize -= diff; + currentStack.stackSize = limit; + currentSlot.onSlotChanged(); + result = true; + } + } + + if (reverseOrder) + { + --slotID; + } + else + { + ++slotID; + } + } + } + + if (stack.stackSize > 0) + { + if (reverseOrder) + { + slotID = endSlot - 1; + } + else + { + slotID = startSlot; + } + + while (!reverseOrder && slotID < endSlot || reverseOrder && slotID >= startSlot) + { + currentSlot = (Slot)inventorySlots.get(slotID); + currentStack = currentSlot.getStack(); + + if (currentStack == null && currentSlot.isItemValid(stack)) + { + int limit = currentSlot.getSlotStackLimit(); + if (stack.stackSize <= limit) + { + currentSlot.putStack(stack.copy()); + currentSlot.onSlotChanged(); + stack.stackSize = 0; + result = true; + break; + } + else + { + currentSlot.putStack(stack.splitStack(limit)); + currentSlot.onSlotChanged(); + result = true; + } + } + + if (reverseOrder) + { + --slotID; + } + else + { + ++slotID; + } + } + } + + return result; + } + + /** + * transferStackInSlot with a new signature, not yet mapped to the proper method name + */ + @Override + public ItemStack transferStackInSlot(EntityPlayer p, int slotID) + { + ItemStack original = null; + Slot slotclicked = (Slot)inventorySlots.get(slotID); + + if (slotclicked != null && slotclicked.getHasStack()) + { + ItemStack sourceStack = slotclicked.getStack(); + original = sourceStack.copy(); + + if (slotID < playerInventoryStartSlot) + { + // Move stuff to the player's inventory + if (!this.mergeItemStack(sourceStack, playerInventoryStartSlot, inventorySlots.size(), true)) + { + return null; + } + } + else + { + // Move stuff to the battery station's inventory + if (!this.mergeItemStack(sourceStack, 0, shiftClickRange, false)) + { + return null; + } + } + + if (sourceStack.stackSize == 0) + { + slotclicked.putStack((ItemStack)null); + } + else + { + slotclicked.onSlotChanged(); + } + } + return original; + } + +/* @Override + public ItemStack slotClick(int slotID, int button, int shiftclick, EntityPlayer par4EntityPlayer) + { + ItemStack result = null; + + //if (ChargingBench.isDebugging && ChargingBench.proxy.isServer()) System.out.println("ContainerBatteryStation.slotClick(slotID=" + slotID + ", button=" + button + ", shift=" + shiftclick + ");"); + + if (button > 1) + { + return null; + } + else + { + if (button == 0 || button == 1) + { + InventoryPlayer invPlayer = par4EntityPlayer.inventory; + + if (slotID == -999) // Dropping items outside GUI, identical to vanilla behavior + { + if (invPlayer.getItemStack() != null && slotID == -999) + { + if (button == 0) + { + par4EntityPlayer.dropPlayerItem(invPlayer.getItemStack()); + invPlayer.setItemStack((ItemStack)null); + } + + if (button == 1) + { + par4EntityPlayer.dropPlayerItem(invPlayer.getItemStack().splitStack(1)); + + if (invPlayer.getItemStack().stackSize == 0) + { + invPlayer.setItemStack((ItemStack)null); + } + } + } + } + else if (shiftclick == 1) + { + ItemStack original = this.transferStackInSlot(par4EntityPlayer, slotID); + + // For crafting and other situations where a new stack could appear in the slot after each click; may be useful for output slot + if (original != null) + { + int originalID = original.itemID; + result = original.copy(); + Slot slot = (Slot)inventorySlots.get(slotID); + + if (slot != null && slot.getStack() != null && slot.getStack().itemID == originalID) + { + this.retrySlotClick(slotID, button, true, par4EntityPlayer); + } + } + } + else + { + if (slotID < 0) + { + return null; + } + + Slot slot = (Slot)inventorySlots.get(slotID); + + if (slot != null) + { + ItemStack clickedStack = slot.getStack(); + ItemStack mouseStack = invPlayer.getItemStack(); + + if (clickedStack != null) + { + //if (ChargingBench.isDebugging) System.out.println("Clicked stack tag: " + clickedStack.stackTagCompound + " / Item ID: " + clickedStack.itemID); + result = clickedStack.copy(); + } + + int quantity; + + if (clickedStack == null) + { // There's nothing in the slot, place the held item there if possible + if (mouseStack != null && slot.isItemValid(mouseStack)) + { + quantity = button == 0 ? mouseStack.stackSize : 1; + if (quantity > slot.getSlotStackLimit()) quantity = slot.getSlotStackLimit(); + + ItemStack temp = mouseStack.splitStack(quantity); + slot.putStack(temp); + + if (mouseStack.stackSize == 0) + { + invPlayer.setItemStack((ItemStack)null); + } + } + } + else if (mouseStack == null) + { // Pick up what's in the slot + quantity = button == 0 ? clickedStack.stackSize : (clickedStack.stackSize + 1) / 2; + ItemStack remainder = slot.decrStackSize(quantity); + invPlayer.setItemStack(remainder); + + if (clickedStack.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + + slot.onPickupFromSlot(par4EntityPlayer, invPlayer.getItemStack()); + } + else if (slot.isItemValid(mouseStack)) + { // Both the mouse and the slot contain items, run this code if the item can be placed here + if (clickedStack.itemID == mouseStack.itemID && (!clickedStack.getHasSubtypes() || clickedStack.getItemDamage() == mouseStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(clickedStack, mouseStack)) + { + quantity = button == 0 ? mouseStack.stackSize : 1; + + if (quantity > slot.getSlotStackLimit() - clickedStack.stackSize) + { + quantity = slot.getSlotStackLimit() - clickedStack.stackSize; + } + + if (quantity > mouseStack.getMaxStackSize() - clickedStack.stackSize) + { + quantity = mouseStack.getMaxStackSize() - clickedStack.stackSize; + } + + mouseStack.splitStack(quantity); + + if (mouseStack.stackSize == 0) + { + invPlayer.setItemStack((ItemStack)null); + } + + clickedStack.stackSize += quantity; + } + else if (mouseStack.stackSize <= slot.getSlotStackLimit()) + { // Exchange the items since they don't match + slot.putStack(mouseStack); + invPlayer.setItemStack(clickedStack); + } + } + else if (clickedStack.itemID == mouseStack.itemID && mouseStack.getMaxStackSize() > 1 && (!clickedStack.getHasSubtypes() || clickedStack.getItemDamage() == mouseStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(clickedStack, mouseStack)) + { // Both the mouse and the slot contain items, run this code if they match + quantity = clickedStack.stackSize; + + if (quantity > 0 && quantity + mouseStack.stackSize <= mouseStack.getMaxStackSize()) + { + mouseStack.stackSize += quantity; + clickedStack = slot.decrStackSize(quantity); + + if (clickedStack.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + + slot.onPickupFromSlot(par4EntityPlayer, invPlayer.getItemStack()); + } + } + + slot.onSlotChanged(); + + } + } + } + + return result; + } + } +*/ + + public boolean canInteractWith(EntityPlayer var1) + { + // if (ChargingBench.isDebugging) System.out.println("ContainerChargingBench.canInteractWith"); + return tileentity.isUseableByPlayer(var1); + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/containers/ContainerChargingBench.java b/src/main/java/com/kaijin/AdvPowerMan/containers/ContainerChargingBench.java new file mode 100755 index 0000000..1baa256 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/containers/ContainerChargingBench.java @@ -0,0 +1,600 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.containers; + +import com.kaijin.AdvPowerMan.Info; +import com.kaijin.AdvPowerMan.slots.SlotChargeable; +import com.kaijin.AdvPowerMan.slots.SlotInput; +import com.kaijin.AdvPowerMan.slots.SlotMachineUpgrade; +import com.kaijin.AdvPowerMan.slots.SlotOutput; +import com.kaijin.AdvPowerMan.slots.SlotPlayerArmor; +import com.kaijin.AdvPowerMan.slots.SlotPowerSource; +import com.kaijin.AdvPowerMan.tileentities.TEChargingBench; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ic2.api.item.IElectricItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; + +public class ContainerChargingBench extends Container +{ + private static final int topOffset = 68; // Got tired of forgetting to manually alter ALL of the constants. (This won't affect the energy bar!) + + protected final int benchShiftClickRange = 17; + protected final int playerInventoryStartSlot = 19; + protected final int playerArmorStartSlot = 55; + + protected TEChargingBench tileentity; + protected int currentEnergy; + protected int adjustedStorage; + protected short adjustedMaxInput; + protected short powerTier; + protected int energyRequired; + protected int ticksRequired; + public int averageInput; + protected SlotPowerSource powerSlot; + + public ContainerChargingBench(InventoryPlayer player, TEChargingBench tile) + { + //if (ChargingBench.isDebugging) System.out.println("ContainerChargingBench"); + tileentity = tile; + currentEnergy = -1; + adjustedMaxInput = -1; + adjustedStorage = -1; + powerTier = -1; + energyRequired = -1; + ticksRequired = -1; + averageInput = -1; + + int xCol; + int yRow; + + // Input charging slots + for (yRow = 0; yRow < 4; ++yRow) // 4 rows high + { + for (xCol = 0; xCol < 3; ++xCol) // 3 columns across + { + this.addSlotToContainer(new SlotChargeable(tile, 3 + xCol + 3 * yRow, 52 + xCol * 18, topOffset + yRow * 18, tile.baseTier)); // 52, 32 is upper left input slot + } + } + + // Upgrade slots (Overclocker, storage) + for (yRow = 0; yRow < 4; ++yRow) // 4 rows high + { + this.addSlotToContainer(new SlotMachineUpgrade(tile, 15 + yRow, 152, topOffset + yRow * 18)); + } + + // Input Slot + this.addSlotToContainer(new SlotInput(tile, 0, 130, topOffset, tile.baseTier)); + + // Output slot + this.addSlotToContainer(new SlotOutput(tile, 1, 130, topOffset + 54)); + + // Power source slot + powerSlot = new SlotPowerSource(tile, Info.CB_SLOT_POWER_SOURCE, 130, topOffset + 27, tile.powerTier); + this.addSlotToContainer(powerSlot); + + // Player inventory + for (yRow = 0; yRow < 3; ++yRow) + { + for (xCol = 0; xCol < 9; ++xCol) + { + this.addSlotToContainer(new Slot(player, xCol + yRow * 9 + 9, 8 + xCol * 18, topOffset + 76 + yRow * 18)); + } + } + + // Player hot bar + for (yRow = 0; yRow < 9; ++yRow) + { + this.addSlotToContainer(new Slot(player, yRow, 8 + yRow * 18, topOffset + 134)); + } + + // Player armor + for (yRow = 0; yRow < 4; ++yRow) + { + this.addSlotToContainer(new SlotPlayerArmor(player, player.getSizeInventory() - 1 - yRow, 8, topOffset + yRow * 18, yRow)); + } + } + + @Override + public void detectAndSendChanges() + { + // if (ChargingBench.isDebugging) System.out.println("ContainerChargingBench.updateCraftingResults"); + super.detectAndSendChanges(); + + final int syncAvg = (int)(tileentity.inputTracker.getAverage() * 100); + for (int crafterIndex = 0; crafterIndex < crafters.size(); ++crafterIndex) + { + ICrafting crafter = (ICrafting)crafters.get(crafterIndex); + + if (this.currentEnergy != tileentity.currentEnergy) + { + crafter.sendProgressBarUpdate(this, 0, tileentity.currentEnergy & 65535); + crafter.sendProgressBarUpdate(this, 1, tileentity.currentEnergy >>> 16); + } + + if (this.adjustedMaxInput != tileentity.adjustedMaxInput) + { + crafter.sendProgressBarUpdate(this, 2, tileentity.adjustedMaxInput); + } + + if (this.adjustedStorage != tileentity.adjustedStorage) + { + crafter.sendProgressBarUpdate(this, 3, tileentity.adjustedStorage & 65535); + crafter.sendProgressBarUpdate(this, 4, tileentity.adjustedStorage >>> 16); + } + + if (this.powerTier != tileentity.powerTier) + { + crafter.sendProgressBarUpdate(this, 5, tileentity.powerTier); + } + + if (this.energyRequired != tileentity.energyRequired) + { + crafter.sendProgressBarUpdate(this, 6, tileentity.energyRequired & 65535); + crafter.sendProgressBarUpdate(this, 7, tileentity.energyRequired >>> 16); + } + + if (this.ticksRequired != tileentity.ticksRequired) + { + crafter.sendProgressBarUpdate(this, 8, tileentity.ticksRequired & 65535); + crafter.sendProgressBarUpdate(this, 9, tileentity.ticksRequired >>> 16); + } + + if (averageInput != syncAvg) + { + crafter.sendProgressBarUpdate(this, 10, syncAvg & 65535); + crafter.sendProgressBarUpdate(this, 11, syncAvg >>> 16); + } + } + this.currentEnergy = tileentity.currentEnergy; + this.adjustedStorage = tileentity.adjustedStorage; + this.adjustedMaxInput = (short)tileentity.adjustedMaxInput; + this.powerTier = (short)tileentity.powerTier; + this.energyRequired = tileentity.energyRequired; + this.ticksRequired = tileentity.ticksRequired; + this.averageInput = syncAvg; + powerSlot.setTier(powerTier); + } + + @SideOnly(Side.CLIENT) + @Override + public void updateProgressBar(int param, int value) + { + //super.updateProgressBar(param, value); + switch (param) + { + case 0: + tileentity.currentEnergy = tileentity.currentEnergy & -65536 | value; + break; + + case 1: + tileentity.currentEnergy = tileentity.currentEnergy & 65535 | (value << 16); + break; + + case 2: + tileentity.adjustedMaxInput = value; + break; + + case 3: + tileentity.adjustedStorage = tileentity.adjustedStorage & -65536 | value; + break; + + case 4: + tileentity.adjustedStorage = tileentity.adjustedStorage & 65535 | (value << 16); + break; + + case 5: + tileentity.powerTier = value; + powerSlot.setTier(value); + break; + + case 6: + tileentity.energyRequired = tileentity.energyRequired & -65536 | value; + break; + + case 7: + tileentity.energyRequired = tileentity.energyRequired & 65535 | (value << 16); + break; + + case 8: + tileentity.ticksRequired = tileentity.ticksRequired & -65536 | value; + break; + + case 9: + tileentity.ticksRequired = tileentity.ticksRequired & 65535 | (value << 16); + break; + + case 10: + averageInput = averageInput & -65536 | value; + break; + + case 11: + averageInput = averageInput & 65535 | (value << 16); + break; + + default: + System.out.println("ContainerChargingBench.updateProgressBar - Warning: default case!"); + } + } + + /** + * Merges provided ItemStack with the first available one in the container/player inventory + */ + @Override + protected boolean mergeItemStack(ItemStack stack, int startSlot, int endSlot, boolean reverseOrder) + { + boolean result = false; + int slotID = startSlot; + + if (reverseOrder) + { + slotID = endSlot - 1; + } + + Slot currentSlot; + ItemStack currentStack; + + if (stack.isStackable()) + { + while (stack.stackSize > 0 && (!reverseOrder && slotID < endSlot || reverseOrder && slotID >= startSlot)) + { + currentSlot = (Slot)inventorySlots.get(slotID); + currentStack = currentSlot.getStack(); + + if (currentStack != null && Item.getIdFromItem(currentStack.getItem()) == Item.getIdFromItem(stack.getItem()) + && (!stack.getHasSubtypes() || stack.getItemDamage() == currentStack.getItemDamage()) + && ItemStack.areItemStackTagsEqual(stack, currentStack) + && currentSlot.isItemValid(stack)) + { + int limit = Math.min(stack.getMaxStackSize(), currentSlot.getSlotStackLimit()); + int sum = currentStack.stackSize + stack.stackSize; + if (sum <= limit) + { + stack.stackSize = 0; + currentStack.stackSize = sum; + currentSlot.onSlotChanged(); + result = true; + } + else if (currentStack.stackSize < limit) + { + int diff = limit - currentStack.stackSize; + stack.stackSize -= diff; + currentStack.stackSize = limit; + currentSlot.onSlotChanged(); + result = true; + } + } + + if (reverseOrder) + { + --slotID; + } + else + { + ++slotID; + } + } + } + + if (stack.stackSize > 0) + { + if (reverseOrder) + { + slotID = endSlot - 1; + } + else + { + slotID = startSlot; + } + + while (!reverseOrder && slotID < endSlot || reverseOrder && slotID >= startSlot) + { + currentSlot = (Slot)inventorySlots.get(slotID); + currentStack = currentSlot.getStack(); + + if (currentStack == null && currentSlot.isItemValid(stack)) + { + int limit = currentSlot.getSlotStackLimit(); + if (stack.stackSize <= limit) + { + currentSlot.putStack(stack.copy()); + currentSlot.onSlotChanged(); + stack.stackSize = 0; + result = true; + break; + } + else + { + currentSlot.putStack(stack.splitStack(limit)); + currentSlot.onSlotChanged(); + result = true; + } + } + + if (reverseOrder) + { + --slotID; + } + else + { + ++slotID; + } + } + } + + return result; + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer p, int slotID) + { + ItemStack original = null; + Slot slotclicked = (Slot)inventorySlots.get(slotID); + + if (slotclicked != null && slotclicked.getHasStack()) + { + ItemStack sourceStack = slotclicked.getStack(); + original = sourceStack.copy(); + + // Charging Bench Slots + if (slotID < playerInventoryStartSlot) + { + // Look for electric armor to move into armor equipped slots from inside our charging bench + if (original.getItem() instanceof ItemArmor && original.getItem() instanceof IElectricItem && !((Slot)inventorySlots.get(55 + ((ItemArmor)original.getItem()).armorType)).getHasStack()) + { + int armorType = 55 + ((ItemArmor)original.getItem()).armorType; + if (!this.mergeItemStack(sourceStack, armorType, armorType + 1, false)) + { + return null; + } + } + // If there wasn't room, or it isn't armor, toss it into the player inventory + else if (!this.mergeItemStack(sourceStack, playerInventoryStartSlot, inventorySlots.size(), false)) // False to not use the stupid reverse order item placement + { + return null; + } + } + else if (slotID >= playerArmorStartSlot && slotID < playerArmorStartSlot + 4) + { + // Player Armor Slots + if ((original.getItem() instanceof ItemArmor) && !(original.getItem() instanceof IElectricItem)) + { + // Move regular armor from armor slots into main inventory + if (!this.mergeItemStack(sourceStack, playerInventoryStartSlot, inventorySlots.size(), false)) // False to not use the stupid reverse order item placement + { + return null; + } + } + else if (!this.mergeItemStack(sourceStack, 0, benchShiftClickRange, false)) + { + // Put electrical armor items from armor slots into bench + // if that fails, try to put them into our main inventory instead + if (!this.mergeItemStack(sourceStack, playerInventoryStartSlot, inventorySlots.size(), false)) // False to not use the stupid reverse order item placement) + { + return null; + } + } + } + else if ((original.getItem() instanceof ItemArmor) && !(original.getItem() instanceof IElectricItem) && !((Slot)inventorySlots.get(55 + ((ItemArmor)original.getItem()).armorType)).getHasStack()) + { + // Move regular armor from main inventory into armor slots + int armorType = 55 + ((ItemArmor)original.getItem()).armorType; + if (!this.mergeItemStack(sourceStack, armorType, armorType + 1, false)) + { + return null; + } + } + else + { + // Move stuff from anywhere not caught above to our charging bench inventory + if (!this.mergeItemStack(sourceStack, 0, benchShiftClickRange, false)) + { + if (original.getItem() instanceof ItemArmor && original.getItem() instanceof IElectricItem && !((Slot)inventorySlots.get(55 + ((ItemArmor)original.getItem()).armorType)).getHasStack()) + { + // Move electric armor from main inventory into armor slots + int armorType = 55 + ((ItemArmor)original.getItem()).armorType; + if (!this.mergeItemStack(sourceStack, armorType, armorType + 1, false)) + { + return null; + } + } + else + { + return null; + } + } + } + + if (sourceStack.stackSize == 0) + { + slotclicked.putStack((ItemStack)null); + } + else + { + slotclicked.onSlotChanged(); + } + } + return original; + } + +/* @Override + public ItemStack slotClick(int slotID, int button, int shiftclick, EntityPlayer par4EntityPlayer) + { + ItemStack result = null; + + if (Info.isDebugging) System.out.println("ContainerChargingBench.slotClick(slotID=" + slotID + ", button=" + button + ", shift=" + shiftclick + ") by " + (AdvancedPowerManagement.proxy.isClient() ? "client" : "server")); + + if (button > 1) + { + return null; + } + else + { + if (button == 0 || button == 1) + { + InventoryPlayer invPlayer = par4EntityPlayer.inventory; + + if (slotID == -999) // Dropping items outside GUI, identical to vanilla behavior + { + if (invPlayer.getItemStack() != null && slotID == -999) + { + if (button == 0) + { + par4EntityPlayer.dropPlayerItem(invPlayer.getItemStack()); + invPlayer.setItemStack((ItemStack)null); + } + + if (button == 1) + { + par4EntityPlayer.dropPlayerItem(invPlayer.getItemStack().splitStack(1)); + + if (invPlayer.getItemStack().stackSize == 0) + { + invPlayer.setItemStack((ItemStack)null); + } + } + } + } + else if (shiftclick == 1) + { + ItemStack original = this.transferStackInSlot(par4EntityPlayer, slotID); + + // For crafting and other situations where a new stack could appear in the slot after each click; may be useful for output slot + if (original != null) + { + int originalID = original.itemID; + result = original.copy(); + Slot slot = (Slot)inventorySlots.get(slotID); + + if (slot != null && slot.getStack() != null && slot.getStack().itemID == originalID) + { + this.retrySlotClick(slotID, button, true, par4EntityPlayer); + } + } + } + else + { + if (slotID < 0) + { + return null; + } + + Slot slot = (Slot)inventorySlots.get(slotID); + + if (slot != null) + { + ItemStack clickedStack = slot.getStack(); + ItemStack mouseStack = invPlayer.getItemStack(); + + if (clickedStack != null) + { + //if (ChargingBench.isDebugging) System.out.println("Clicked stack tag: " + clickedStack.stackTagCompound + " / Item ID: " + clickedStack.itemID); + result = clickedStack.copy(); + } + + int quantity; + + if (clickedStack == null) + { // There's nothing in the slot, place the held item there if possible + if (mouseStack != null && slot.isItemValid(mouseStack)) + { + quantity = button == 0 ? mouseStack.stackSize : 1; + if (quantity > slot.getSlotStackLimit()) quantity = slot.getSlotStackLimit(); + + ItemStack temp = mouseStack.splitStack(quantity); + slot.putStack(temp); + + if (mouseStack.stackSize == 0) + { + invPlayer.setItemStack((ItemStack)null); + } + } + } + else if (mouseStack == null) + { // Pick up what's in the slot + quantity = button == 0 ? clickedStack.stackSize : (clickedStack.stackSize + 1) / 2; + ItemStack remainder = slot.decrStackSize(quantity); + invPlayer.setItemStack(remainder); + + if (clickedStack.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + + slot.onPickupFromSlot(par4EntityPlayer, invPlayer.getItemStack()); + } + else if (slot.isItemValid(mouseStack)) + { // Both the mouse and the slot contain items, run this code if the item can be placed here + if (clickedStack.itemID == mouseStack.itemID && (!clickedStack.getHasSubtypes() || clickedStack.getItemDamage() == mouseStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(clickedStack, mouseStack)) + { + quantity = button == 0 ? mouseStack.stackSize : 1; + + if (quantity > slot.getSlotStackLimit() - clickedStack.stackSize) + { + quantity = slot.getSlotStackLimit() - clickedStack.stackSize; + } + + if (quantity > mouseStack.getMaxStackSize() - clickedStack.stackSize) + { + quantity = mouseStack.getMaxStackSize() - clickedStack.stackSize; + } + + mouseStack.splitStack(quantity); + + if (mouseStack.stackSize == 0) + { + invPlayer.setItemStack((ItemStack)null); + } + + clickedStack.stackSize += quantity; + } + else if (mouseStack.stackSize <= slot.getSlotStackLimit()) + { // Exchange the items since they don't match + slot.putStack(mouseStack); + invPlayer.setItemStack(clickedStack); + } + } + else if (clickedStack.itemID == mouseStack.itemID && mouseStack.getMaxStackSize() > 1 && (!clickedStack.getHasSubtypes() || clickedStack.getItemDamage() == mouseStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(clickedStack, mouseStack)) + { // Both the mouse and the slot contain items, run this code if they match + quantity = clickedStack.stackSize; + + if (quantity > 0 && quantity + mouseStack.stackSize <= mouseStack.getMaxStackSize()) + { + mouseStack.stackSize += quantity; + clickedStack = slot.decrStackSize(quantity); + + if (clickedStack.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + + slot.onPickupFromSlot(par4EntityPlayer, invPlayer.getItemStack()); + } + } + + slot.onSlotChanged(); + + } + } + } + + return result; + } + } +*/ + public boolean canInteractWith(EntityPlayer var1) + { + // if (ChargingBench.isDebugging) System.out.println("ContainerChargingBench.canInteractWith"); + return tileentity.isUseableByPlayer(var1); + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/containers/ContainerStorageMonitor.java b/src/main/java/com/kaijin/AdvPowerMan/containers/ContainerStorageMonitor.java new file mode 100755 index 0000000..bf41196 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/containers/ContainerStorageMonitor.java @@ -0,0 +1,451 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.containers; + +import com.kaijin.AdvPowerMan.Info; +import com.kaijin.AdvPowerMan.slots.SlotLinkCard; +import com.kaijin.AdvPowerMan.tileentities.TEStorageMonitor; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ContainerStorageMonitor extends Container +{ + private final int playerInventoryStartSlot = 1; + + public TEStorageMonitor te; + public int energyStored; + public int energyCapacity; + public int lowerBoundary; + public int upperBoundary; + + public ContainerStorageMonitor(InventoryPlayer player, TEStorageMonitor tile) + { + if (Info.isDebugging) System.out.println("ContainerStorageMonitor"); + this.te = tile; + this.energyStored = -1; + this.energyCapacity = -1; + this.lowerBoundary = -1; + this.upperBoundary = -1; + + final int topOffset = 32; // Got tired of forgetting to manually alter ALL of the constants. (This won't affect the energy bar!) + + int xCol; + int yRow; + + // Link Card slot + this.addSlotToContainer(new SlotLinkCard(tile, Info.SM_SLOT_UNIVERSAL, 8, 9)); + + // Player inventory + for (yRow = 0; yRow < 3; ++yRow) + { + for (xCol = 0; xCol < 9; ++xCol) + { + this.addSlotToContainer(new Slot(player, xCol + yRow * 9 + 9, 8 + xCol * 18, topOffset + 76 + yRow * 18)); + } + } + + // Player hot bar + for (yRow = 0; yRow < 9; ++yRow) + { + this.addSlotToContainer(new Slot(player, yRow, 8 + yRow * 18, topOffset + 134)); + } + + } + + @Override + public void detectAndSendChanges() + { + // if (ChargingBench.isDebugging) System.out.println("ContainerChargingBench.updateCraftingResults"); + super.detectAndSendChanges(); + + for (int crafterIndex = 0; crafterIndex < crafters.size(); ++crafterIndex) + { + ICrafting crafter = (ICrafting)crafters.get(crafterIndex); + + if (this.energyStored != te.energyStored) + { + crafter.sendProgressBarUpdate(this, 0, te.energyStored & 65535); + crafter.sendProgressBarUpdate(this, 1, te.energyStored >>> 16); + } + + if (this.energyCapacity != te.energyCapacity) + { + crafter.sendProgressBarUpdate(this, 2, te.energyCapacity & 65535); + crafter.sendProgressBarUpdate(this, 3, te.energyCapacity >>> 16); + } + + if (this.lowerBoundary != te.lowerBoundary) + { + crafter.sendProgressBarUpdate(this, 4, te.lowerBoundary); + } + if (this.upperBoundary != te.upperBoundary) + { + crafter.sendProgressBarUpdate(this, 5, te.upperBoundary); + } + } + this.energyStored = te.energyStored; + this.energyCapacity = te.energyCapacity; + this.lowerBoundary = te.lowerBoundary; + this.upperBoundary = te.upperBoundary; + } + + @SideOnly(Side.CLIENT) + @Override + public void updateProgressBar(int param, int value) + { + super.updateProgressBar(param, value); + + switch (param) + { + case 0: + te.energyStored = te.energyStored & -65536 | value; + break; + + case 1: + te.energyStored = te.energyStored & 65535 | (value << 16); + break; + + case 2: + te.energyCapacity = te.energyCapacity & -65536 | value; + break; + + case 3: + te.energyCapacity = te.energyCapacity & 65535 | (value << 16); + break; + + case 4: + te.lowerBoundary = value; + break; + + case 5: + te.upperBoundary = value; + break; + + default: + System.out.println("ContainerStorageMonitor.updateProgressBar - Warning: default case!"); + } + } + + /** + * Merges provided ItemStack with the first available one in the container/player inventory + */ + @Override + protected boolean mergeItemStack(ItemStack stack, int startSlot, int endSlot, boolean reverseOrder) + { + boolean result = false; + int slotID = startSlot; + + if (reverseOrder) + { + slotID = endSlot - 1; + } + + Slot currentSlot; + ItemStack currentStack; + + if (stack.isStackable()) + { + while (stack.stackSize > 0 && (!reverseOrder && slotID < endSlot || reverseOrder && slotID >= startSlot)) + { + currentSlot = (Slot)inventorySlots.get(slotID); + currentStack = currentSlot.getStack(); + + if (currentStack != null && Item.getIdFromItem(currentStack.getItem()) == Item.getIdFromItem(stack.getItem()) + && (!stack.getHasSubtypes() || stack.getItemDamage() == currentStack.getItemDamage()) + && ItemStack.areItemStackTagsEqual(stack, currentStack) + && currentSlot.isItemValid(stack)) + { + int limit = Math.min(stack.getMaxStackSize(), currentSlot.getSlotStackLimit()); + int sum = currentStack.stackSize + stack.stackSize; + if (sum <= limit) + { + stack.stackSize = 0; + currentStack.stackSize = sum; + currentSlot.onSlotChanged(); + result = true; + } + else if (currentStack.stackSize < limit) + { + int diff = limit - currentStack.stackSize; + stack.stackSize -= diff; + currentStack.stackSize = limit; + currentSlot.onSlotChanged(); + result = true; + } + } + + if (reverseOrder) + { + --slotID; + } + else + { + ++slotID; + } + } + } + + if (stack.stackSize > 0) + { + if (reverseOrder) + { + slotID = endSlot - 1; + } + else + { + slotID = startSlot; + } + + while (!reverseOrder && slotID < endSlot || reverseOrder && slotID >= startSlot) + { + currentSlot = (Slot)inventorySlots.get(slotID); + currentStack = currentSlot.getStack(); + + if (currentStack == null && currentSlot.isItemValid(stack)) + { + int limit = currentSlot.getSlotStackLimit(); + if (stack.stackSize <= limit) + { + currentSlot.putStack(stack.copy()); + currentSlot.onSlotChanged(); + stack.stackSize = 0; + result = true; + break; + } + else + { + currentSlot.putStack(stack.splitStack(limit)); + currentSlot.onSlotChanged(); + result = true; + } + } + + if (reverseOrder) + { + --slotID; + } + else + { + ++slotID; + } + } + } + + return result; + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer p, int par1) + { + ItemStack original = null; + Slot slotclicked = (Slot)inventorySlots.get(par1); + + if (slotclicked != null && slotclicked.getHasStack()) + { + ItemStack sourceStack = slotclicked.getStack(); + original = sourceStack.copy(); + + if (par1 < playerInventoryStartSlot) + { + if (!this.mergeItemStack(sourceStack, playerInventoryStartSlot, inventorySlots.size(), true)) + { + return null; + } + } + else if (!this.mergeItemStack(sourceStack, 0, playerInventoryStartSlot, false)) + { + return null; + } + + if (sourceStack.stackSize == 0) + { + slotclicked.putStack((ItemStack)null); + } + else + { + slotclicked.onSlotChanged(); + } + } + return original; + } + +/* @Override + public ItemStack slotClick(int slotID, int button, int shiftclick, EntityPlayer par4EntityPlayer) + { + ItemStack result = null; + + if (Info.isDebugging && AdvancedPowerManagement.proxy.isServer()) System.out.println("ContainerChargingBench.slotClick(slotID=" + slotID + ", button=" + button + ", shift=" + shiftclick + ");"); + + if (button > 1) + { + return null; + } + else + { + if (button == 0 || button == 1) + { + InventoryPlayer invPlayer = par4EntityPlayer.inventory; + + if (slotID == -999) // Dropping items outside GUI, identical to vanilla behavior + { + if (invPlayer.getItemStack() != null && slotID == -999) + { + if (button == 0) + { + par4EntityPlayer.dropPlayerItem(invPlayer.getItemStack()); + invPlayer.setItemStack((ItemStack)null); + } + + if (button == 1) + { + par4EntityPlayer.dropPlayerItem(invPlayer.getItemStack().splitStack(1)); + + if (invPlayer.getItemStack().stackSize == 0) + { + invPlayer.setItemStack((ItemStack)null); + } + } + } + } + else if (shiftclick == 1) + { + ItemStack original = this.transferStackInSlot(par4EntityPlayer, slotID); + + // For crafting and other situations where a new stack could appear in the slot after each click; may be useful for output slot + if (original != null) + { + int originalID = original.itemID; + result = original.copy(); + Slot slot = (Slot)inventorySlots.get(slotID); + + if (slot != null && slot.getStack() != null && slot.getStack().itemID == originalID) + { + this.retrySlotClick(slotID, button, true, par4EntityPlayer); + } + } + } + else + { + if (slotID < 0) + { + return null; + } + + Slot slot = (Slot)this.inventorySlots.get(slotID); + + if (slot != null) + { + ItemStack clickedStack = slot.getStack(); + ItemStack mouseStack = invPlayer.getItemStack(); + + if (clickedStack != null) + { + if (Info.isDebugging) System.out.println("Clicked stack tag: " + clickedStack.stackTagCompound + " / Item ID: " + clickedStack.itemID); + result = clickedStack.copy(); + } + + int quantity; + + if (clickedStack == null) + { // There's nothing in the slot, place the held item there if possible + if (mouseStack != null && slot.isItemValid(mouseStack)) + { + quantity = button == 0 ? mouseStack.stackSize : 1; + if (quantity > slot.getSlotStackLimit()) quantity = slot.getSlotStackLimit(); + + ItemStack temp = mouseStack.splitStack(quantity); + slot.putStack(temp); + + if (mouseStack.stackSize == 0) + { + invPlayer.setItemStack((ItemStack)null); + } + } + } + else if (mouseStack == null) + { // Pick up what's in the slot + quantity = button == 0 ? clickedStack.stackSize : (clickedStack.stackSize + 1) / 2; + ItemStack remainder = slot.decrStackSize(quantity); + invPlayer.setItemStack(remainder); + + if (clickedStack.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + + slot.onPickupFromSlot(par4EntityPlayer, invPlayer.getItemStack()); + } + else if (slot.isItemValid(mouseStack)) + { // Both the mouse and the slot contain items, run this code if the item can be placed here + if (clickedStack.itemID == mouseStack.itemID && (!clickedStack.getHasSubtypes() || clickedStack.getItemDamage() == mouseStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(clickedStack, mouseStack)) + { + quantity = button == 0 ? mouseStack.stackSize : 1; + + if (quantity > slot.getSlotStackLimit() - clickedStack.stackSize) + { + quantity = slot.getSlotStackLimit() - clickedStack.stackSize; + } + + if (quantity > mouseStack.getMaxStackSize() - clickedStack.stackSize) + { + quantity = mouseStack.getMaxStackSize() - clickedStack.stackSize; + } + + mouseStack.splitStack(quantity); + + if (mouseStack.stackSize == 0) + { + invPlayer.setItemStack((ItemStack)null); + } + + clickedStack.stackSize += quantity; + } + else if (mouseStack.stackSize <= slot.getSlotStackLimit()) + { // Exchange the items since they don't match + slot.putStack(mouseStack); + invPlayer.setItemStack(clickedStack); + } + } + else if (clickedStack.itemID == mouseStack.itemID && mouseStack.getMaxStackSize() > 1 && (!clickedStack.getHasSubtypes() || clickedStack.getItemDamage() == mouseStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(clickedStack, mouseStack)) + { // Both the mouse and the slot contain items, run this code if they match + quantity = clickedStack.stackSize; + + if (quantity > 0 && quantity + mouseStack.stackSize <= mouseStack.getMaxStackSize()) + { + mouseStack.stackSize += quantity; + clickedStack = slot.decrStackSize(quantity); + + if (clickedStack.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + + slot.onPickupFromSlot(par4EntityPlayer, invPlayer.getItemStack()); + } + } + + slot.onSlotChanged(); + } + } + } + return result; + } + } +*/ + + public boolean canInteractWith(EntityPlayer var1) + { + // if (ChargingBench.isDebugging) System.out.println("ContainerChargingBench.canInteractWith"); + return this.te.isUseableByPlayer(var1); + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/gui/CButton.java b/src/main/java/com/kaijin/AdvPowerMan/gui/CButton.java new file mode 100755 index 0000000..887a717 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/gui/CButton.java @@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +import com.kaijin.AdvPowerMan.Info; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class CButton extends GuiButton +{ + /** Path to custom texture for button */ + protected String texture; + + protected int uLoc; + protected int vLoc; + protected int uHoverLoc; + protected int vHoverLoc; + protected int color; + protected int hoverColor; + protected boolean isHovering; + + /** CButton will assume the texture size is equal to the width and height of the button + * + * @param id - ID of button + * @param xLoc - x location of button on screen + * @param yLoc - y location of button on screen + * @param width - width of button + * @param height - height of button + * @param uLoc - x location of start of texture in texture file + * @param vLoc - y location of start of texture in texture file + * @param uHoverLoc - x location of start of texture for mouse over in texture file + * @param vHoverLoc - x location of start of texture for mouse over in texture file + * @param text - text to display on button + * @param color - color for the text + * @param hoverColor - color for the text while hovering + * @param texture - path to texture file + */ + public CButton(int id, int xLoc, int yLoc, int width, int height, int uLoc, int vLoc, int uHoverLoc, int vHoverLoc, String text, int color, int hoverColor, String texture) + { + super(id, xLoc, yLoc, width, height, text); + this.enabled = true; + this.visible = true; + this.id = id; + this.xPosition = xLoc; + this.yPosition = yLoc; + this.width = width; + this.height = height; + this.uLoc = uLoc; + this.vLoc = vLoc; + this.uHoverLoc = uHoverLoc; + this.vHoverLoc = vHoverLoc; + this.displayString = text; + this.color = color; + this.hoverColor = hoverColor; + this.texture = texture; + } + + /** + * Draws this button to the screen. + */ + @Override + public void drawButton(Minecraft mc, int xLoc, int yLoc) + { + if (visible) + { + FontRenderer fr = mc.fontRenderer; + + if (texture != null) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(new ResourceLocation(Info.TITLE_PACKED.toLowerCase(), texture)); + } + + isHovering = xLoc >= xPosition && yLoc >= yPosition && xLoc < xPosition + width && yLoc < yPosition + height; + + int hoverState = this.getHoverState(isHovering); + if (hoverState == 2) + { + this.drawTexturedModalRect(xPosition, yPosition, uHoverLoc, vHoverLoc, width, height); + } + else + { + this.drawTexturedModalRect(xPosition, yPosition, uLoc, vLoc, width, height); + } + + int defaultColor = color; + int renderColor = defaultColor; + + if (!enabled) + { + renderColor = -6250336; + } + else if (isHovering) + { + renderColor = hoverColor; + } + + fr.drawString(displayString, xPosition + (width - fr.getStringWidth(displayString)) / 2, yPosition + (height - 7) / 2, renderColor); + } + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/gui/GuiAdjustableTransformer.java b/src/main/java/com/kaijin/AdvPowerMan/gui/GuiAdjustableTransformer.java new file mode 100755 index 0000000..326e072 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/gui/GuiAdjustableTransformer.java @@ -0,0 +1,159 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.gui; + +import java.text.DecimalFormat; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.inventory.IInventory; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +import com.kaijin.AdvPowerMan.Info; +import com.kaijin.AdvPowerMan.Utils; +import com.kaijin.AdvPowerMan.containers.ContainerAdjustableTransformer; +import com.kaijin.AdvPowerMan.tileentities.TEAdjustableTransformer; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class GuiAdjustableTransformer extends GuiContainer +{ + IInventory playerInventory; + public TEAdjustableTransformer tile; + private CButton buttons[] = new CButton[16]; + private CButton dirButtons[] = new CButton[6]; + + private int xLoc; + private int yLoc; + private final int yOff = 30; + + private static final String displayStrings[] = {"+1", "+10", "+64", "x2", "-1", "-10", "-64", "/2"}; + private static final int GREEN = 0x55FF55; + private static final int GREENGLOW = Utils.multiplyColorComponents(GREEN, 0.16F); + + private DecimalFormat fraction = new DecimalFormat("##0.00"); + + public GuiAdjustableTransformer(TEAdjustableTransformer tileentity) + { + super(new ContainerAdjustableTransformer(tileentity)); + tile = tileentity; + xSize = 240; // The X size of the GUI window in pixels. + ySize = 140; // The Y size of the GUI window in pixels. + + //Button definition - mouse over CButton for details + for (int i = 0; i < buttons.length; i++) + { + //16777120 old highlight color code, saved here for reference + buttons[i] = new CButton(i, 0, 0, 24, 13, 1, 192, 1, 207, displayStrings[i % 8], 4210752, 16777120, Info.GUI_TEX_ADJ_TRANSFORMER); + } + for (int i = 0; i < dirButtons.length; i++) + { + dirButtons[i] = new CButton(i + 16, 0, 0, 32, 13, 27, 192, 27, 207, I18n.format(Info.KEY_DIRECTION_NAMES[i]), 4210752, 16777120, Info.GUI_TEX_ADJ_TRANSFORMER); + } + } + + @Override + public void initGui() + { + super.initGui(); // Don't forget this or MC will crash + + // Upper left corner of GUI panel + xLoc = (width - xSize) / 2; // Half the difference between screen width and GUI width + yLoc = (height - ySize) / 2; // Half the difference between screen height and GUI height + + for (int i = 0; i < 16; i++) + { + buttons[i].xPosition = xLoc + 8 + 24 * (i % 4); + buttons[i].yPosition = yLoc + yOff + 33 + 13 * (i / 4) + 17 * (i / 8); + } + for (int i = 0; i < 6; i++) + { + dirButtons[i].xPosition = xLoc + 173; + dirButtons[i].yPosition = yLoc + yOff + 24 + 13 * i; + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(float var1, int mouseX, int mouseY) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(new ResourceLocation(Info.TITLE_PACKED.toLowerCase(), Info.GUI_TEX_ADJ_TRANSFORMER)); + + // Draw GUI background graphic + drawTexturedModalRect(xLoc, yLoc, 0, 0, xSize, ySize); + + // Draw title text + Utils.drawCenteredText(fontRendererObj, I18n.format(tile.getInvName()), width / 2, yLoc + 6, 4210752); + + // Draw stats text + Utils.drawRightAlignedText(fontRendererObj, I18n.format(Info.KEY_STATS_AVERAGE_EU), xLoc + 180, yLoc + 26, 4210752); + Utils.drawRightAlignedText(fontRendererObj, I18n.format(Info.KEY_STATS_AVERAGE_INPUT), xLoc + 180, yLoc + 36, 4210752); + Utils.drawLeftAlignedText(fontRendererObj, I18n.format(Info.KEY_EU_BUFFERED), xLoc + 49, yLoc + 26, 4210752); + + Utils.drawRightAlignedGlowingText(fontRendererObj, Integer.toString(tile.energyBuffer), xLoc + 44, yLoc + 26, GREEN, GREENGLOW); + // Factor of 100 because data is in fixed point (x100) + final float outAvg = (float)(((ContainerAdjustableTransformer)inventorySlots).outputAvg) / 100F; + final float inAvg = (float)(((ContainerAdjustableTransformer)inventorySlots).inputAvg) / 100F; + Utils.drawRightAlignedGlowingText(fontRendererObj, fraction.format(outAvg), xLoc + 230, yLoc + 26, GREEN, GREENGLOW); + Utils.drawRightAlignedGlowingText(fontRendererObj, fraction.format(inAvg), xLoc + 230, yLoc + 36, GREEN, GREENGLOW); + + // Packet size section text + Utils.drawCenteredText(fontRendererObj, I18n.format(Info.KEY_EMITTER_PACKET), xLoc + 88, yLoc + yOff + 21, 0xB00000); + Utils.drawRightAlignedGlowingText(fontRendererObj, Integer.toString(tile.packetSize), xLoc + 146, yLoc + yOff + 49, GREEN, GREENGLOW); + fontRendererObj.drawString(Info.AE_PACKET_RANGE, xLoc + 110, yLoc + yOff + 35, 4210752); + fontRendererObj.drawString(I18n.format(Info.KEY_EU), xLoc + 152, yLoc + yOff + 49, 4210752); + + // Transfer rate section text + Utils.drawCenteredText(fontRendererObj, I18n.format(Info.KEY_TRANSFORMER_OUTPUT), xLoc + 88, yLoc + yOff + 64, 0xB00000); + Utils.drawRightAlignedGlowingText(fontRendererObj, Integer.toString(tile.outputRate), xLoc + 146, yLoc + yOff + 92, GREEN, GREENGLOW); + fontRendererObj.drawString(Info.AE_OUTPUT_RANGE, xLoc + 110, yLoc + yOff + 78, 4210752); + fontRendererObj.drawString(I18n.format(Info.KEY_EU), xLoc + 152, yLoc + yOff + 92, 4210752); + + // Side input/output settings text + for (int i = 0; i < 6; i++) + { + Utils.drawGlowingText(fontRendererObj, I18n.format((tile.sideSettings[i] & 1) == 0 ? Info.KEY_IN : Info.KEY_OUT), xLoc + 214, yLoc + yOff + 27 + 13 * i, GREEN, GREENGLOW); + } + + //Buttons MUST be drawn after other texture stuff or it will not draw the battery meter correctly + for (CButton button : buttons) + { + button.drawButton(mc, mouseX, mouseY); + } + for (CButton button : dirButtons) + { + button.drawButton(mc, mouseX, mouseY); + } + } + + @Override + protected void mouseClicked(int par1, int par2, int par3) + { + if (par3 == 0) // On a left click, + { + for (CButton b : buttons) // For each item in buttons, + { + if (b.enabled && b.mousePressed(this.mc, par1, par2)) // if it's enabled and was under the pointer, + { + //mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F); // provide audio feedback, + tile.sendGuiButton(b.id); // and inform the server of the button click. + } + } + for (CButton b : dirButtons) + { + if (b.enabled && b.mousePressed(this.mc, par1, par2)) // if it's enabled and was under the pointer, + { + //mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F); // provide audio feedback, + tile.sendGuiButton(b.id); // and inform the server of the button click. + } + } + } + super.mouseClicked(par1, par2, par3); // Finally, do all that other normal stuff. + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/gui/GuiAdvEmitter.java b/src/main/java/com/kaijin/AdvPowerMan/gui/GuiAdvEmitter.java new file mode 100755 index 0000000..aedaab0 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/gui/GuiAdvEmitter.java @@ -0,0 +1,115 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.gui; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.inventory.IInventory; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +import com.kaijin.AdvPowerMan.Info; +import com.kaijin.AdvPowerMan.Utils; +import com.kaijin.AdvPowerMan.containers.ContainerAdvEmitter; +import com.kaijin.AdvPowerMan.tileentities.TEAdvEmitter; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class GuiAdvEmitter extends GuiContainer +{ + IInventory playerInventory; + public TEAdvEmitter tile; + private CButton buttons[] = new CButton[16]; + + private int xLoc; + private int yLoc; + + private static final String displayStrings[] = {"+1", "+10", "+64", "x2", "-1", "-10", "-64", "/2"}; + private static final int GREEN = 0x55FF55; + private static final int GREENGLOW = Utils.multiplyColorComponents(GREEN, 0.16F); + + public GuiAdvEmitter(TEAdvEmitter tileentity) + { + super(new ContainerAdvEmitter(tileentity)); + tile = tileentity; + xSize = 176; // The X size of the GUI window in pixels. + ySize = 110; // The Y size of the GUI window in pixels. + + //Button definition - mouse over CButton for details + for (int i = 0; i < buttons.length; i++) + { + //16777120 old highlight color code, saved here for reference + buttons[i] = new CButton(i, 0, 0, 24, 13, 1, 192, 1, 207, displayStrings[i % 8], 4210752, 16777120, Info.GUI_TEX_EMITTER); + } + } + + @Override + public void initGui() + { + super.initGui(); // Don't forget this or MC will crash + + // Upper left corner of GUI panel + xLoc = (width - xSize) / 2; // Half the difference between screen width and GUI width + yLoc = (height - ySize) / 2; // Half the difference between screen height and GUI height + + for (int i = 0; i < 16; i++) + { + buttons[i].xPosition = xLoc + 8 + 24 * (i % 4); + buttons[i].yPosition = yLoc + 33 + 13 * (i / 4) + 17 * (i / 8); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(float var1, int mouseX, int mouseY) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(new ResourceLocation(Info.TITLE_PACKED.toLowerCase(), Info.GUI_TEX_EMITTER)); + + // Draw GUI background graphic + drawTexturedModalRect(xLoc, yLoc, 0, 0, xSize, ySize); + + // Draw title text + Utils.drawCenteredText(fontRendererObj, I18n.format(tile.getInvName()), width / 2, yLoc + 7, 4210752); + + // Packet size section text + Utils.drawCenteredText(fontRendererObj, I18n.format(Info.KEY_EMITTER_PACKET), width / 2, yLoc + 21, 0xB00000); + Utils.drawRightAlignedGlowingText(fontRendererObj, Integer.toString(tile.packetSize), xLoc + 146, yLoc + 49, GREEN, GREENGLOW); + fontRendererObj.drawString(Info.AE_PACKET_RANGE, xLoc + 110, yLoc + 35, 4210752); + fontRendererObj.drawString(I18n.format(Info.KEY_EU), xLoc + 152, yLoc + 49, 4210752); + + // Output rate section text + Utils.drawCenteredText(fontRendererObj, I18n.format(Info.KEY_EMITTER_OUTPUT), width / 2, yLoc + 64, 0xB00000); + Utils.drawRightAlignedGlowingText(fontRendererObj, Integer.toString(tile.outputRate), xLoc + 146, yLoc + 92, GREEN, GREENGLOW); + fontRendererObj.drawString(Info.AE_OUTPUT_RANGE, xLoc + 110, yLoc + 78, 4210752); + fontRendererObj.drawString(I18n.format(Info.KEY_EU), xLoc + 152, yLoc + 92, 4210752); + + //Buttons MUST be drawn after other texture stuff or it will not draw the battery meter correctly + for (CButton button : buttons) + { + button.drawButton(mc, mouseX, mouseY); + } + } + + @Override + protected void mouseClicked(int par1, int par2, int par3) + { + if (par3 == 0) // On a left click, + { + for (CButton b : buttons) // For each item in buttons, + { + if (b.enabled && b.mousePressed(this.mc, par1, par2)) // if it's enabled and was under the pointer, + { + //mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F); // provide audio feedback, + tile.sendGuiButton(b.id); // and inform the server of the button click. + } + } + } + super.mouseClicked(par1, par2, par3); // Finally, do all that other normal stuff. + } + +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/gui/GuiBatteryStation.java b/src/main/java/com/kaijin/AdvPowerMan/gui/GuiBatteryStation.java new file mode 100755 index 0000000..e8e9192 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/gui/GuiBatteryStation.java @@ -0,0 +1,142 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.gui; + +import java.text.DecimalFormat; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +import com.kaijin.AdvPowerMan.Info; +import com.kaijin.AdvPowerMan.Utils; +import com.kaijin.AdvPowerMan.containers.ContainerBatteryStation; +import com.kaijin.AdvPowerMan.tileentities.TEBatteryStation; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class GuiBatteryStation extends GuiContainer +{ + IInventory playerInventory; + public TEBatteryStation tile; + private CButton button; + private int mode = -1; + + private int xLoc; + private int yLoc; + private int xCenter; + + private DecimalFormat fraction = new DecimalFormat("##0.00"); + private DecimalFormat time = new DecimalFormat("00"); + private DecimalFormat days = new DecimalFormat("#0"); + private DecimalFormat dayFrac = new DecimalFormat("0.#"); + + private static final int GREEN = 0x55FF55; + private static final int GREENGLOW = Utils.multiplyColorComponents(GREEN, 0.16F); + + public GuiBatteryStation(InventoryPlayer player, TEBatteryStation tileentity) + { + super(new ContainerBatteryStation(player, tileentity)); + tile = tileentity; + xSize = 176; // The X size of the GUI window in pixels. + ySize = 182; // The Y size of the GUI window in pixels. + button = new CButton(0, 0, 0, 18, 12, 30, 200, 30, 200, "", 4210752, 16777120, Info.GUI_TEX_BATTERY_STATION); + } + + @Override + public void initGui() + { + super.initGui(); // Don't forget this or MC will crash + + // Upper left corner of GUI panel + xLoc = (width - xSize) / 2; // Half the difference between screen width and GUI width + yLoc = (height - ySize) / 2; // Half the difference between screen height and GUI height + xCenter = width / 2; + button.xPosition = xLoc + 16; + button.yPosition = yLoc + 44; + mode = -1; + } + + @Override + protected void drawGuiContainerBackgroundLayer(float var1, int mouseX, int mouseY) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(new ResourceLocation(Info.TITLE_PACKED.toLowerCase(), Info.GUI_TEX_BATTERY_STATION)); + + this.drawTexturedModalRect(xLoc, yLoc, 0, 0, xSize, ySize); + + // Draw title text + Utils.drawCenteredText(fontRendererObj, I18n.format(tile.getInventoryName()), xCenter, yLoc + 8, 4210752); + + if (mode != ((ContainerBatteryStation)inventorySlots).opMode) + { + mode = ((ContainerBatteryStation)inventorySlots).opMode; + if (mode == 0) + { + button.vLoc = 200; + button.vHoverLoc = 200; + } + else + { + button.vLoc = 185; + button.vHoverLoc = 185; + } + } + + Utils.drawLeftAlignedText(fontRendererObj, I18n.format(Info.KEY_DISCHARGER_MODE_LINE1), xLoc + 7, yLoc + 59, 4210752); + Utils.drawLeftAlignedText(fontRendererObj, I18n.format(Info.KEY_DISCHARGER_MODE_LINE2), xLoc + 7, yLoc + 70, 4210752); + Utils.drawCenteredText(fontRendererObj, I18n.format(Info.KEY_STATS_AVERAGE_EU), xLoc + 144, yLoc + 27, 4210752); + Utils.drawCenteredText(fontRendererObj, I18n.format(Info.KEY_STATS_TIME_REMAINING), xLoc + 144, yLoc + 65, 4210752); + + // Factor of 100 because data is in fixed point (x100) + final float rate = (float)(((ContainerBatteryStation)inventorySlots).average) / 100F; + Utils.drawRightAlignedGlowingText(fontRendererObj, fraction.format(rate), xLoc + 166, yLoc + 41, GREEN, GREENGLOW); + + String clock; + if (rate > 0) + { + // Rate * 20 to convert per tick to per second + int timeScratch = (int)((float)(((ContainerBatteryStation)inventorySlots).itemsEnergyTotal) / (rate * 20)); + if (timeScratch <= 345600) // 60 * 60 * 96 or 4 days + { + final int sec = timeScratch % 60; + timeScratch /= 60; + final int min = timeScratch % 60; + timeScratch /= 60; + clock = time.format(timeScratch) + ":" + time.format(min) + ":" + time.format(sec); + } + else + { + float dayScratch = ((float)timeScratch) / 86400F; // 60 * 60 * 24 or 1 day + clock = (dayScratch < 10F ? dayFrac.format(dayScratch) : dayScratch < 100 ? days.format((int)dayScratch) : "??") + I18n.format(Info.KEY_STATS_DISPLAY_DAYS); + } + } + else clock = I18n.format(Info.KEY_STATS_DISPLAY_UNKNOWN); + Utils.drawRightAlignedGlowingText(fontRendererObj, clock, xLoc + 166, yLoc + 51, GREEN, GREENGLOW); + + button.drawButton(mc, mouseX, mouseY); + } + + @Override + protected void mouseClicked(int par1, int par2, int par3) + { + if (par3 == 0) // On a left click, + { + if (button.enabled && button.mousePressed(this.mc, par1, par2)) // if it's enabled and was under the pointer, + { + //mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F); // provide audio feedback, + tile.sendGuiButton(button.id); // and inform the server of the button click. + } + } + super.mouseClicked(par1, par2, par3); // Finally, do all that other normal stuff. + } + +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/gui/GuiChargingBench.java b/src/main/java/com/kaijin/AdvPowerMan/gui/GuiChargingBench.java new file mode 100755 index 0000000..cd3a618 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/gui/GuiChargingBench.java @@ -0,0 +1,130 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.gui; + +import java.text.DecimalFormat; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +import com.kaijin.AdvPowerMan.Info; +import com.kaijin.AdvPowerMan.Utils; +import com.kaijin.AdvPowerMan.containers.ContainerChargingBench; +import com.kaijin.AdvPowerMan.tileentities.TEChargingBench; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class GuiChargingBench extends GuiContainer +{ + IInventory playerInventory; + public TEChargingBench tile; + + private int xLoc; + private int yLoc; + private int xCenter; + + private DecimalFormat fraction = new DecimalFormat("##0.00"); + private DecimalFormat time = new DecimalFormat("00"); + private DecimalFormat days = new DecimalFormat("#0"); + private DecimalFormat dayFrac = new DecimalFormat("0.#"); + + private static final int GREEN = 0x55FF55; + private static final int GREENGLOW = Utils.multiplyColorComponents(GREEN, 0.16F); + + public GuiChargingBench(InventoryPlayer player, TEChargingBench tileentity) + { + super(new ContainerChargingBench(player, tileentity)); + tile = tileentity; + xSize = 176; // The X size of the GUI window in pixels. + ySize = 226; // The Y size of the GUI window in pixels. + } + + @Override + public void initGui() + { + super.initGui(); // Don't forget this or MC will crash + + // Upper left corner of GUI panel + xLoc = (width - xSize) / 2; // Half the difference between screen width and GUI width + yLoc = (height - ySize) / 2; // Half the difference between screen height and GUI height + xCenter = width / 2; + } + + @Override + protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(new ResourceLocation(Info.TITLE_PACKED.toLowerCase(), Info.GUI_TEX_CHARGING_BENCH)); + + // Draw GUI background + drawTexturedModalRect(xLoc, yLoc, 0, 0, xSize, ySize); + + // Energy bar + if (tile.currentEnergy > 0) + { + // Make each box light up all at once like a LED instead of gradually using barLength = tile.gaugeEnergyScaled(66); + int barLength = 5 * tile.gaugeEnergyScaled(13); + if (barLength > 0) barLength++; + drawTexturedModalRect(xLoc + 32, yLoc + 136 - barLength, 176, 66 - barLength, 12, barLength); + } + + // Redstone power indicator + drawTexturedModalRect(xLoc + 129, yLoc + 48, tile.receivingRedstoneSignal() ? 188 : 206, 0, 18, 15); + + // Draw labels + Utils.drawCenteredText(fontRendererObj, I18n.format(tile.getInventoryName()), xCenter, yLoc + 7, 4210752); + + Utils.drawRightAlignedText(fontRendererObj, I18n.format(Info.KEY_EU), xLoc + 25, yLoc + 23, 4210752); + Utils.drawLeftAlignedText(fontRendererObj, I18n.format(Info.KEY_CHARGER_MAX), xLoc + 151, yLoc + 23, 4210752); + + Utils.drawRightAlignedText(fontRendererObj, I18n.format(Info.KEY_CHARGER_REQ), xLoc + 25, yLoc + 33, 4210752); + Utils.drawLeftAlignedText(fontRendererObj, I18n.format(Info.KEY_CHARGER_ETC), xLoc + 151, yLoc + 33, 4210752); + + Utils.drawRightAlignedText(fontRendererObj, I18n.format(Info.KEY_CHARGER_AVG), xLoc + 70, yLoc + 52, 4210752); + Utils.drawLeftAlignedText(fontRendererObj, I18n.format(Info.KEY_CHARGER_PWR), xLoc + 151, yLoc + 52, 4210752); + + // Draw current and max storage + Utils.drawRightAlignedGlowingText(fontRendererObj, Integer.toString(tile.currentEnergy), xCenter - 7, yLoc + 23, GREEN, GREENGLOW); + Utils.drawGlowingText(fontRendererObj, " / " + Integer.toString(tile.adjustedStorage), xCenter - 7, yLoc + 23, GREEN, GREENGLOW); + + // Factor of 100 because data is in fixed point (x100) + final float rate = (float)(((ContainerChargingBench)inventorySlots).averageInput) / 100F; + Utils.drawRightAlignedGlowingText(fontRendererObj, fraction.format(rate), xLoc + 122, yLoc + 52, GREEN, GREENGLOW); + + // Charging stats (only displayed while charging items) + if (tile.energyRequired > 0) + { + final String clock; + if (tile.ticksRequired > 0) + { + int timeScratch = tile.ticksRequired / 20; + if (timeScratch <= 345600) // 60 * 60 * 96 or 4 days + { + final int sec = timeScratch % 60; + timeScratch /= 60; + final int min = timeScratch % 60; + timeScratch /= 60; + clock = time.format(timeScratch) + ":" + time.format(min) + ":" + time.format(sec); + } + else + { + float dayScratch = ((float)timeScratch) / 86400F; // 60 * 60 * 24 or 1 day + clock = (dayScratch < 10F ? dayFrac.format(dayScratch) : dayScratch < 100 ? days.format((int)dayScratch) : "??") + I18n.format(Info.KEY_STATS_DISPLAY_DAYS); + } + } + else clock = I18n.format(Info.KEY_STATS_DISPLAY_UNKNOWN); + final String energyReq = tile.energyRequired > 9999999 ? dayFrac.format(((float)tile.energyRequired) / 1000000F) + "M" : Integer.toString(tile.energyRequired); + Utils.drawRightAlignedGlowingText(fontRendererObj, energyReq, xCenter - 7, yLoc + 33, GREEN, GREENGLOW); + Utils.drawRightAlignedGlowingText(fontRendererObj, clock, xLoc + 144, yLoc + 33, GREEN, GREENGLOW); + } + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/gui/GuiStorageMonitor.java b/src/main/java/com/kaijin/AdvPowerMan/gui/GuiStorageMonitor.java new file mode 100755 index 0000000..2f59603 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/gui/GuiStorageMonitor.java @@ -0,0 +1,146 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.gui; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +import com.kaijin.AdvPowerMan.Info; +import com.kaijin.AdvPowerMan.Utils; +import com.kaijin.AdvPowerMan.containers.ContainerStorageMonitor; +import com.kaijin.AdvPowerMan.tileentities.TEStorageMonitor; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class GuiStorageMonitor extends GuiContainer +{ + IInventory playerInventory; + public TEStorageMonitor tile; + private CButton buttons[] = new CButton[8]; + + private int xLoc; + private int yLoc; + + private static final String DISPLAYSTRINGS[] = {"-10", "-1", "+1", "+10"}; + private static final int HORIZONTALOFFSETS[] = {-57, -33, 25, 49}; + private static final int RED = 0xFF5555; + private static final int GREEN = 0x55FF55; + private static final int REDGLOW = Utils.multiplyColorComponents(RED, 0.16F); + private static final int GREENGLOW = Utils.multiplyColorComponents(GREEN, 0.16F); + + public GuiStorageMonitor(InventoryPlayer player, TEStorageMonitor tileentity) + { + super(new ContainerStorageMonitor(player, tileentity)); + tile = tileentity; + xSize = 176; // The X size of the GUI window in pixels. + ySize = 190; // The Y size of the GUI window in pixels. + + //Button definition - mouse over CButton for details + for (int i = 0; i < buttons.length; i++) + { + //16777120 old highlight color code, saved here for reference + buttons[i] = new CButton(i, 0, 0, 24, 13, 1, 192, 1, 207, DISPLAYSTRINGS[i % 4], 4210752, 0xFFFFAF, Info.GUI_TEX_STORAGE_MONITOR); + } + } + + @Override + public void initGui() + { + super.initGui(); // Don't forget this or MC will crash + + // Upper left corner of GUI panel + xLoc = (width - xSize) / 2; // Half the difference between screen width and GUI width + yLoc = (height - ySize) / 2; // Half the difference between screen height and GUI height + + // Reposition buttons + for (int i = 0; i < 8; i++) + { + buttons[i].xPosition = width / 2 + HORIZONTALOFFSETS[i % 4]; + buttons[i].yPosition = yLoc + 60 + 29 * (i / 4); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(float var1, int mouseX, int mouseY) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(new ResourceLocation(Info.TITLE_PACKED.toLowerCase(), Info.GUI_TEX_STORAGE_MONITOR)); + + // Draw GUI background + drawTexturedModalRect(xLoc, yLoc, 0, 0, xSize, ySize); + + // Draw energy meter + if (tile.energyStored > 0) + { + // Which color energy meter should be used? + final int offset = tile.isPowering ? 12 : 0; + + // Make each box light up all at once like a LED instead of gradually using barLength = this.tile.gaugeEnergyScaled(66); + int barLength = 5 * tile.gaugeEnergyScaled(13); + if (barLength > 0) barLength++; + + drawTexturedModalRect(xLoc + 10, yLoc + 100 - barLength, 176 + offset, 66 - barLength, 12, barLength); + } + + // Draw title text + Utils.drawCenteredText(fontRendererObj, I18n.format(tile.getInventoryName()), xLoc + 96, yLoc + 12, 4210752); + + if (tile.energyCapacity <= 0) + { + // Error message: No card or storage unit not found + Utils.drawCenteredGlowingText(fontRendererObj, I18n.format(Info.KEY_MONITOR_INVALID), xLoc + 96, yLoc + 35, RED, REDGLOW); + } + else + { + // Draw right-aligned current energy number + Utils.drawRightAlignedGlowingText(fontRendererObj, Integer.toString(tile.energyStored), xLoc + 90, yLoc + 35, GREEN, GREENGLOW); + + // Draw separator and left-aligned max energy number + Utils.drawGlowingText(fontRendererObj, " / " + Integer.toString(tile.energyCapacity), xLoc + 90, yLoc + 35, GREEN, GREENGLOW); + + // Test strings + //Utils.drawCenteredGlowingText(fontRenderer, " / ", xLoc + 96, yLoc + 35, 0x55FF55, glowFactor); + //Utils.drawRightAlignedGlowingText(fontRenderer, "123456789", xLoc + 90, yLoc + 35, 0x55FF55, 0.15F); + //Utils.drawGlowingText(fontRenderer, " / 123456789", xLoc + 90, yLoc + 35, 0x55FF55, 0.15F); + } + + // Draw control section labels and readouts + Utils.drawCenteredText(fontRendererObj, I18n.format(Info.KEY_MONITOR_UPPER), xLoc + 96, yLoc + 49, 0xB00000); + Utils.drawRightAlignedGlowingText(fontRendererObj, Integer.toString(tile.upperBoundary) + "%", xLoc + 109, yLoc + 63, GREEN, GREENGLOW); + + Utils.drawCenteredText(fontRendererObj, I18n.format(Info.KEY_MONITOR_LOWER), xLoc + 96, yLoc + 78, 0xB00000); + Utils.drawRightAlignedGlowingText(fontRendererObj, Integer.toString(tile.lowerBoundary) + "%", xLoc + 109, yLoc + 92, GREEN, GREENGLOW); + + for (CButton button : /* Who's got the */ buttons) + { + // Draw ALL of the things?! :o + button.drawButton(mc, mouseX, mouseY); + } + } + + @Override + protected void mouseClicked(int par1, int par2, int par3) + { + if (par3 == 0) // On a left click, + { + for (CButton b : buttons) // For each item in buttons, + { + if (b.enabled && b.mousePressed(this.mc, par1, par2)) // if it's enabled and was under the pointer, + { + //mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F); // provide audio feedback, + tile.sendGuiButton(b.id); // and inform the server of the button click. + } + } + } + super.mouseClicked(par1, par2, par3); // Finally, do all that other normal stuff. + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/items/ItemBenchTools.java b/src/main/java/com/kaijin/AdvPowerMan/items/ItemBenchTools.java new file mode 100755 index 0000000..e368b78 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/items/ItemBenchTools.java @@ -0,0 +1,170 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.items; + +import java.util.List; + +import com.kaijin.AdvPowerMan.AdvancedPowerManagement; +import com.kaijin.AdvPowerMan.Info; +import com.kaijin.AdvPowerMan.tileentities.TEChargingBench; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ItemBenchTools extends Item +{ + public static final String[] benchToolsNames = new String[] {"toolkit", "LV-kit", "MV-kit", "HV-kit"}; + protected IIcon[] itemIcons; + + public ItemBenchTools(String name) + { + super(); + this.setHasSubtypes(true); + this.setMaxDamage(0); + this.setMaxStackSize(1); + this.setCreativeTab(CreativeTabs.tabMisc); + GameRegistry.registerItem(this, name); + } + + /** + * Gets an icon based on an item's damage value + */ + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int par1) + { + return itemIcons[MathHelper.clamp_int(par1, 0, 3)]; + } + + @Override + public void registerIcons(IIconRegister iconRegister) + { + itemIcons = new IIcon[benchToolsNames.length]; + for (int i = 0; i < itemIcons.length; i++) + { + itemIcons[i] = iconRegister.registerIcon(Info.TITLE_PACKED + ":" + benchToolsNames[i]); + } + + // Until/unless a better way is found, register GUI slot backgrounds here. + Info.iconSlotChargeable = iconRegister.registerIcon(Info.TITLE_PACKED + ":SlotChargeable"); + Info.iconSlotDrainable = iconRegister.registerIcon(Info.TITLE_PACKED + ":SlotDrainable"); + Info.iconSlotInput = iconRegister.registerIcon(Info.TITLE_PACKED + ":SlotInput"); + Info.iconSlotOutput = iconRegister.registerIcon(Info.TITLE_PACKED + ":SlotOutput"); + Info.iconSlotMachineUpgrade = iconRegister.registerIcon(Info.TITLE_PACKED + ":SlotMachineUpgrade"); + Info.iconSlotLinkCard = iconRegister.registerIcon(Info.TITLE_PACKED + ":SlotLinkCard"); + Info.iconSlotPowerSource = new IIcon[3]; + Info.iconSlotPlayerArmor = new IIcon[4]; + for (int i = 0; i < 3; i++) + Info.iconSlotPowerSource[i] = iconRegister.registerIcon(Info.TITLE_PACKED + ":SlotPowerSource" + Integer.toString(i)); + for (int i = 0; i < 4; i++) + Info.iconSlotPlayerArmor[i] = iconRegister.registerIcon(Info.TITLE_PACKED + ":SlotPlayerArmor" + Integer.toString(i)); + } + + @Override + public boolean isRepairable() + { + return false; + } + + @Override + public String getUnlocalizedName(ItemStack par1ItemStack) + { + int meta = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, 3); + return "item.benchTools." + benchToolsNames[meta]; + } + + protected void generateItemStack(ItemStack stack, EntityPlayer player) + { + EntityItem entityitem = player.dropPlayerItemWithRandomChoice(stack, false); + entityitem.delayBeforeCanPickup = 0; + } + + /** + * This is called when the item is used, before the block is activated. + * @param stack The Item Stack + * @param player The Player that used the item + * @param world The Current World + * @param x Target X Position + * @param y Target Y Position + * @param z Target Z Position + * @param side The side of the target hit + * @return Return true to prevent any further processing. + */ + @Override + public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) + { + if (AdvancedPowerManagement.proxy.isClient()) return false; + + // Test if the target is a charging bench and the item is a component kit. If so, do the upgrade and return true. + if (world.getBlock(x, y, z) != AdvancedPowerManagement.blockAdvPwrMan || stack.getItemDamage() < 1 || stack.getItemDamage() > 3 || player == null) + { + return false; + } + + TileEntity tile = world.getTileEntity(x, y, z); + if (!(tile instanceof TEChargingBench)) + { + return false; + } + + int recoveredTier = ((TEChargingBench)tile).swapBenchComponents(stack.getItemDamage()); + generateItemStack(new ItemStack(AdvancedPowerManagement.itemBenchTools, 1, recoveredTier), player); + stack.stackSize--; + return true; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) + { + if (player.isSneaking() && stack.getItemDamage() > 0 && stack.getItemDamage() < 4) + { + switch (stack.getItemDamage()) + { + case 1: + generateItemStack(Info.componentCopperCable.copy(), player); + generateItemStack(Info.componentBatBox.copy(), player); + break; + case 2: + generateItemStack(Info.componentGoldCable.copy(), player); + generateItemStack(Info.componentMFE.copy(), player); + break; + case 3: + generateItemStack(Info.componentIronCable.copy(), player); + generateItemStack(Info.componentMFSU.copy(), player); + break; + } + generateItemStack(Info.componentCircuit.copy(), player); + stack.stackSize--; + } + return stack; + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) + { + for (int meta = 0; meta < 4; ++meta) + { + par3List.add(new ItemStack(par1, 1, meta)); + } + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/items/ItemBlockAdvPwrMan.java b/src/main/java/com/kaijin/AdvPowerMan/items/ItemBlockAdvPwrMan.java new file mode 100755 index 0000000..41eab7e --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/items/ItemBlockAdvPwrMan.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.items; + + +import com.kaijin.AdvPowerMan.Info; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +public class ItemBlockAdvPwrMan extends ItemBlock +{ + public ItemBlockAdvPwrMan(Block block) + { + super(block); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + public int getMetadata(int meta) + { + //if (meta >= 3 && meta <= 6) return 7; + return meta; + } + + @Override + public String getUnlocalizedName(ItemStack var1) + { + int var2 = var1.getItemDamage(); + + if (var2 >= 0 && var2 <= Info.LAST_META_VALUE) return Info.KEY_BLOCK_NAMES[var2]; + + return null; + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/items/ItemCardBase.java b/src/main/java/com/kaijin/AdvPowerMan/items/ItemCardBase.java new file mode 100755 index 0000000..c891ae4 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/items/ItemCardBase.java @@ -0,0 +1,81 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.items; + +import com.kaijin.AdvPowerMan.Utils; + +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class ItemCardBase extends Item +{ + + protected ItemCardBase(String name) + { + super(); + setUnlocalizedName(name); + GameRegistry.registerItem(this, name); + } + + @Override + public boolean isRepairable() + { + return false; + } + + public static int[] getCoordinates(ItemStack itemStack) + { + if (!(itemStack.getItem() instanceof ItemStorageLinkCard)) + return null; + NBTTagCompound nbtTagCompound = itemStack.getTagCompound(); + if (nbtTagCompound == null) + { + return null; + } + int[] coordinates = new int[]{ + nbtTagCompound.getInteger("x"), + nbtTagCompound.getInteger("y"), + nbtTagCompound.getInteger("z"), + nbtTagCompound.getInteger("dim") + }; + return coordinates; + } + + public static void setCoordinates(ItemStack itemStack, int[] coords) + { + final String tags[] = {"x", "y", "z", "dim"}; + NBTTagCompound nbtTagCompound = Utils.getOrCreateStackTag(itemStack); + for (int i = 0; i < coords.length && i < 4; i++) + { + nbtTagCompound.setInteger(tags[i], coords[i]); + } + } + + public static void setCoordinates(ItemStack itemStack, int x, int y, int z, int dim) + { + NBTTagCompound nbtTagCompound = Utils.getOrCreateStackTag(itemStack); + nbtTagCompound.setInteger("x", x); + nbtTagCompound.setInteger("y", y); + nbtTagCompound.setInteger("z", z); + nbtTagCompound.setInteger("dim", dim); + } + + public String getTitle(ItemStack stack) + { + if (!(stack.getItem() instanceof ItemStorageLinkCard)) + return ""; + NBTTagCompound nbtTagCompound = stack.getTagCompound(); + if (nbtTagCompound == null) + return ""; + return nbtTagCompound.getString("title"); + } + + public void setTitle(ItemStack stack, String title) + { + Utils.getOrCreateStackTag(stack).setString("title", title); + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/items/ItemStorageLinkCard.java b/src/main/java/com/kaijin/AdvPowerMan/items/ItemStorageLinkCard.java new file mode 100755 index 0000000..d3cb44d --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/items/ItemStorageLinkCard.java @@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.items; + +import java.util.List; + +import com.kaijin.AdvPowerMan.AdvancedPowerManagement; +import com.kaijin.AdvPowerMan.Info; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ItemStorageLinkCard extends ItemCardBase +{ + private static final String HINT_TEMPLATE = "X: %d, Y: %d, Z: %d, Dim: %d"; + + public ItemStorageLinkCard(String name) + { + super(name); + setMaxStackSize(1); + setTextureName(Info.TITLE_PACKED + ":LinkCard"); + // This shouldn't be easily spawnable, so don't show in creative tabs + // setTabToDisplayOn(CreativeTabs.tabMisc); + } + + @Override + @SideOnly(Side.SERVER) + public boolean getShareTag() + { + return true; + } + + @Override + @SideOnly(Side.CLIENT) + @SuppressWarnings({ "rawtypes", "unchecked" }) + public void addInformation(ItemStack itemStack, EntityPlayer player, List info, boolean bool) + { + int[] coordinates = getCoordinates(itemStack); + if (coordinates != null) + { + NBTTagCompound nbtTagCompound = itemStack.getTagCompound(); + String title = nbtTagCompound.getString("title"); + if (title != null && !title.isEmpty()) + { + info.add(title); + } + String hint = String.format(HINT_TEMPLATE, coordinates[0], coordinates[1], coordinates[2], coordinates [3]); + info.add(hint); + } + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + * @return The ItemStack to replace it with. + */ + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) + { + if (player.isSneaking()) + { + return new ItemStack(AdvancedPowerManagement.itemStorageLinkCardCreator); + } + else + { + return stack; + } + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/items/ItemStorageLinkCardCreator.java b/src/main/java/com/kaijin/AdvPowerMan/items/ItemStorageLinkCardCreator.java new file mode 100755 index 0000000..9dc8c52 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/items/ItemStorageLinkCardCreator.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.items; + +import com.kaijin.AdvPowerMan.AdvancedPowerManagement; +import com.kaijin.AdvPowerMan.Info; + +import ic2.api.tile.IEnergyStorage; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class ItemStorageLinkCardCreator extends ItemCardBase +{ + public ItemStorageLinkCardCreator(String name) + { + super(name); + setMaxStackSize(1); + setCreativeTab(CreativeTabs.tabMisc); + setTextureName(Info.TITLE_PACKED + ":LinkCardCreator"); + } + + @Override + public boolean onItemUseFirst(ItemStack itemstack, EntityPlayer entityplayer, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) + { + TileEntity tile = world.getTileEntity(x, y, z); + + if (entityplayer instanceof EntityPlayerMP && tile instanceof IEnergyStorage) + { + //if (Info.isDebugging) System.out.println("Clicked on X:" + x + " Y:" + y + " Z:" + z + " Dim:" + world.provider.dimensionId); + ItemStack newcard = new ItemStack(AdvancedPowerManagement.itemStorageLinkCard); + setCoordinates(newcard, x, y, z, world.provider.dimensionId); + entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = newcard; + return true; + } + return false; + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/slots/SlotChargeable.java b/src/main/java/com/kaijin/AdvPowerMan/slots/SlotChargeable.java new file mode 100755 index 0000000..2127d24 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/slots/SlotChargeable.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.slots; + +import com.kaijin.AdvPowerMan.Info; +import com.kaijin.AdvPowerMan.Utils; + +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class SlotChargeable extends SlotCustom +{ + public int chargeTier; + + public SlotChargeable(IInventory inv, int index, int xpos, int ypos, int tier) + { + super(inv, index, xpos, ypos); + chargeTier = tier; + } + + @Override + public boolean isItemValid(ItemStack stack) + { + // Decide if the item is a valid IC2 electrical item + return Utils.isItemChargeable(stack, chargeTier); + } + + @Override + public int getSlotStackLimit() + { + return 1; + } + + @Override + public IIcon getBackgroundIconIndex() + { + return Info.iconSlotChargeable; + //return 247; + } +} + diff --git a/src/main/java/com/kaijin/AdvPowerMan/slots/SlotCustom.java b/src/main/java/com/kaijin/AdvPowerMan/slots/SlotCustom.java new file mode 100755 index 0000000..b5f6a51 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/slots/SlotCustom.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.slots; + +import com.kaijin.AdvPowerMan.tileentities.TECommon; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; + +public class SlotCustom extends Slot +{ + public SlotCustom(IInventory inv, int index, int xpos, int ypos) + { + super(inv, index, xpos, ypos); + } + + @Override + public void onSlotChanged() + { + if (inventory instanceof TECommon) + { + ((TECommon)inventory).markDirty(this.getSlotIndex()); + } + else + { + inventory.markDirty(); + } + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/slots/SlotDrainable.java b/src/main/java/com/kaijin/AdvPowerMan/slots/SlotDrainable.java new file mode 100755 index 0000000..6dcdd90 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/slots/SlotDrainable.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.slots; + +import com.kaijin.AdvPowerMan.Info; +import com.kaijin.AdvPowerMan.Utils; + +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class SlotDrainable extends SlotCustom +{ + protected int powerTier; + + public SlotDrainable(IInventory inv, int index, int xpos, int ypos, int tier) + { + super(inv, index, xpos, ypos); + powerTier = tier; + } + + /** + * Check if the stack is a valid item for this slot. + */ + @Override + public boolean isItemValid(ItemStack stack) + { + // Decide if the item is a valid IC2 power source + return Utils.isItemDrainable(stack, powerTier); + } + + @Override + public int getSlotStackLimit() + { + return 1; + } + + @Override + public IIcon getBackgroundIconIndex() + { + return Info.iconSlotDrainable; + // return -1; // 232; + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/slots/SlotInput.java b/src/main/java/com/kaijin/AdvPowerMan/slots/SlotInput.java new file mode 100755 index 0000000..fc47332 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/slots/SlotInput.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.slots; + +import com.kaijin.AdvPowerMan.Info; +import com.kaijin.AdvPowerMan.Utils; + +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class SlotInput extends SlotCustom +{ + public int chargeTier; + + public SlotInput(IInventory inv, int index, int xpos, int ypos, int tier) + { + super(inv, index, xpos, ypos); + chargeTier = tier; + } + + @Override + public boolean isItemValid(ItemStack stack) + { + // Decide if the item is a valid IC2 electrical item + return Utils.isItemChargeable(stack, chargeTier); + } + + @Override + public IIcon getBackgroundIconIndex() + { + return Info.iconSlotInput; + // return 249; + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/slots/SlotLinkCard.java b/src/main/java/com/kaijin/AdvPowerMan/slots/SlotLinkCard.java new file mode 100755 index 0000000..b83c474 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/slots/SlotLinkCard.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.slots; + +import com.kaijin.AdvPowerMan.Info; +import com.kaijin.AdvPowerMan.items.ItemStorageLinkCard; +import com.kaijin.AdvPowerMan.tileentities.TECommon; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class SlotLinkCard extends Slot +{ + public SlotLinkCard(IInventory inv, int index, int xpos, int ypos) + { + super(inv, index, xpos, ypos); + } + + /** + * Check if the stack is a valid item for this slot. + */ + @Override + public boolean isItemValid(ItemStack stack) + { + // Decide if the item is a link card + if (stack != null && stack.getItem() instanceof ItemStorageLinkCard) + { + return true; + } + return false; + } + + @Override + public int getSlotStackLimit() + { + return 1; + } + + @Override + public IIcon getBackgroundIconIndex() + { + return Info.iconSlotLinkCard; + // return 246; + } + + @Override + public void onSlotChanged() + { + if (this.inventory instanceof TECommon) + { + ((TECommon)inventory).markDirty(this.getSlotIndex()); + } + else + { + inventory.markDirty(); + } + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/slots/SlotMachineUpgrade.java b/src/main/java/com/kaijin/AdvPowerMan/slots/SlotMachineUpgrade.java new file mode 100755 index 0000000..210ae1e --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/slots/SlotMachineUpgrade.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.slots; + +import com.kaijin.AdvPowerMan.Info; + +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class SlotMachineUpgrade extends SlotCustom +{ + public SlotMachineUpgrade(IInventory inv, int index, int xpos, int ypos) + { + super(inv, index, xpos, ypos); + } + + /** + * Check if the stack is a valid item for this slot. + */ + @Override + public boolean isItemValid(ItemStack stack) + { + // Decide if the item is a valid IC2 machine upgrade + if (stack == null) return false; + if (stack.isItemEqual(Info.ic2overclockerUpg) || stack.isItemEqual(Info.ic2transformerUpg) || stack.isItemEqual(Info.ic2storageUpg)) + { + return true; + } + return false; + } + + @Override + public IIcon getBackgroundIconIndex() + { + return Info.iconSlotMachineUpgrade; + // return 245; + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/slots/SlotOutput.java b/src/main/java/com/kaijin/AdvPowerMan/slots/SlotOutput.java new file mode 100755 index 0000000..76e6d0d --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/slots/SlotOutput.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.slots; + +import com.kaijin.AdvPowerMan.Info; + +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class SlotOutput extends SlotCustom +{ + public SlotOutput(IInventory inv, int index, int xpos, int ypos) + { + super(inv, index, xpos, ypos); + } + + /** + * Check if the stack is a valid item for this slot. + */ + @Override + public boolean isItemValid(ItemStack stack) + { + // No items may be placed here, parameter is ignored + return false; + } + + @Override + public IIcon getBackgroundIconIndex() + { + return Info.iconSlotOutput; + // return -1; // 250 + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/slots/SlotPlayerArmor.java b/src/main/java/com/kaijin/AdvPowerMan/slots/SlotPlayerArmor.java new file mode 100755 index 0000000..f6ef9a4 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/slots/SlotPlayerArmor.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.slots; + +import com.kaijin.AdvPowerMan.Info; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class SlotPlayerArmor extends SlotCustom +{ + // The armor type that can be placed on that slot, it uses the same values of armorType field on ItemArmor. + final int armorType; + + public SlotPlayerArmor(IInventory inv, int index, int xpos, int ypos, int armorType) + { + super(inv, index, xpos, ypos); + this.armorType = armorType; + } + + @Override + public int getSlotStackLimit() + { + return 1; + } + + @Override + public boolean isItemValid(ItemStack stack) + { + if (stack == null) return false; + return stack.getItem() instanceof ItemArmor ? ((ItemArmor)stack.getItem()).armorType == this.armorType : (Item.getIdFromItem(stack.getItem()) == Item.getIdFromItem(Item.getItemFromBlock(Blocks.pumpkin)) ? this.armorType == 0 : false); + } + + @Override + public IIcon getBackgroundIconIndex() + { + return Info.iconSlotPlayerArmor[armorType]; + // return 240 + armorType; + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/slots/SlotPowerSource.java b/src/main/java/com/kaijin/AdvPowerMan/slots/SlotPowerSource.java new file mode 100755 index 0000000..d9c92b2 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/slots/SlotPowerSource.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.slots; + +import com.kaijin.AdvPowerMan.Info; +import com.kaijin.AdvPowerMan.Utils; + +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class SlotPowerSource extends SlotCustom +{ + private int powerTier; + //private int iconIndex; + + public SlotPowerSource(IInventory inv, int index, int xpos, int ypos, int tier) + { + super(inv, index, xpos, ypos); + setTier(tier); + } + + public void setTier(int tier) + { + if (tier < 1) tier = 1; + if (tier > 3) tier = 3; + powerTier = tier; + //iconIndex = 223 + tier; + } + + /** + * Check if the stack is a valid item for this slot. + */ + @Override + public boolean isItemValid(ItemStack stack) + { + // Decide if the item is a valid IC2 power source + return Utils.isItemDrainable(stack, powerTier); + } + + @Override + public int getSlotStackLimit() + { + return 1; + } + + @Override + public IIcon getBackgroundIconIndex() + { + return Info.iconSlotPowerSource[powerTier - 1]; + // return iconIndex; + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/tileentities/TEAdjustableTransformer.java b/src/main/java/com/kaijin/AdvPowerMan/tileentities/TEAdjustableTransformer.java new file mode 100755 index 0000000..311beee --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/tileentities/TEAdjustableTransformer.java @@ -0,0 +1,404 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.tileentities; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +import com.kaijin.AdvPowerMan.AdvancedPowerManagement; +import com.kaijin.AdvPowerMan.Info; +import com.kaijin.AdvPowerMan.MovingAverage; + +import ic2.api.Direction; +import ic2.api.energy.EnergyNet; +import ic2.api.energy.event.EnergyTileLoadEvent; +//import ic2.api.energy.event.EnergyTileSourceEvent; +import ic2.api.energy.event.EnergyTileUnloadEvent; +import ic2.api.energy.tile.IEnergySink; +import ic2.api.energy.tile.IEnergySource; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.Constants; +import net.minecraftforge.common.util.ForgeDirection; +import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class TEAdjustableTransformer extends TECommon implements IEnergySource, IEnergySink +{ + protected boolean initialized = false; + + public MovingAverage outputTracker = new MovingAverage(12); + public MovingAverage inputTracker = new MovingAverage(12); + + protected int maxInput = 8192; + public int energyBuffer = 0; + public int energyReceived = 0; + + public int outputRate = 32; + public int packetSize = 32; + public int energyCap = 32; + + public byte[] sideSettings = {0, 0, 0, 0, 0, 0}; // DOWN, UP, NORTH, SOUTH, WEST, EAST + + public TEAdjustableTransformer() // Constructor used when placing a new tile entity, to set up correct parameters + { + super(); + } + + /** + * Reads a tile entity from NBT. + */ + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) + { + super.readFromNBT(nbttagcompound); + + outputRate = nbttagcompound.getInteger("outputRate"); + packetSize = nbttagcompound.getInteger("packetSize"); + energyBuffer = nbttagcompound.getInteger("energyBuffer"); + if (packetSize > Info.AE_MAX_PACKET) packetSize = Info.AE_MAX_PACKET; + if (packetSize < Info.AE_MIN_PACKET) packetSize = Info.AE_MIN_PACKET; + if (outputRate > packetSize * Info.AE_PACKETS_TICK) outputRate = packetSize * Info.AE_PACKETS_TICK; + if (outputRate > Info.AE_MAX_OUTPUT) outputRate = Info.AE_MAX_OUTPUT; + if (outputRate < Info.AE_MIN_OUTPUT) outputRate = Info.AE_MIN_OUTPUT; + if (energyBuffer > packetSize * Info.AE_PACKETS_TICK) energyBuffer = packetSize * Info.AE_PACKETS_TICK; + energyCap = Math.max(packetSize, outputRate); + + NBTTagList nbttaglist = nbttagcompound.getTagList("SideSettings", Constants.NBT.TAG_COMPOUND); + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound entry = (NBTTagCompound)nbttaglist.getCompoundTagAt(i); + if (i >= 0 && i < sideSettings.length) + { + sideSettings[i] = (byte)(entry.getByte("Flags") & 255); + } + } + } + + /** + * Writes a tile entity to NBT. + */ + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) + { + super.writeToNBT(nbttagcompound); + nbttagcompound.setInteger("outputRate", outputRate); + nbttagcompound.setInteger("packetSize", packetSize); + nbttagcompound.setInteger("energyBuffer", energyBuffer); + + NBTTagList nbttaglist = new NBTTagList(); + for (int i = 0; i < sideSettings.length; ++i) + { + NBTTagCompound entry = new NBTTagCompound(); + entry.setByte("Flags", sideSettings[i]); + nbttaglist.appendTag(entry); + } + nbttagcompound.setTag("SideSettings", nbttaglist); + } + + @Override + public void invalidate() + { + if (worldObj != null && initialized) + { + EnergyTileUnloadEvent unloadEvent = new EnergyTileUnloadEvent(this); + MinecraftForge.EVENT_BUS.post(unloadEvent); + } + super.invalidate(); + } + + @Override + public int getGuiID() + { + return Info.GUI_ID_ADJUSTABLE_TRANSFORMER; + } + + @Override + public void updateEntity() + { + if (AdvancedPowerManagement.proxy.isClient()) return; + + if (!initialized) + { + if (worldObj == null) return; + + MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); + initialized = true; + } + } + + protected boolean receivingRedstoneSignal() + { + return worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord); + } + + public String getInvName() + { + return Info.KEY_BLOCK_NAMES[6] + Info.KEY_NAME_SUFFIX; + } + + public boolean isUseableByPlayer(EntityPlayer entityplayer) + { + if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) + { + return false; + } + + return entityplayer.getDistanceSq((double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D) <= 64D; + } + + protected void selfDestroy() + { + //dropContents(); + ItemStack stack = new ItemStack(AdvancedPowerManagement.blockAdvPwrMan, 1, Info.AT_META); + worldObj.setBlockToAir(xCoord, yCoord, zCoord); + this.invalidate(); + } + + // IC2 API stuff + + //@Override - this method doesn't exist anymore + public boolean isAddedToEnergyNet() + { + return initialized; + } + + @Override + public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction) + { + // TODO Side I/O + //System.out.println("emit - direction.toSideValue() = " + direction.toSideValue() + " setting = " + ((sideSettings[direction.toSideValue()] & 1) == 1)); + return (sideSettings[direction.ordinal()] & 1) == 1; + } + + @Override + public double getOfferedEnergy() + { + return (!receivingRedstoneSignal()) ? Math.min(energyBuffer, outputRate) : 0; + } + + @Override + public void drawEnergy(double amount) + { + if (!receivingRedstoneSignal()) + { + // Reset input limiter + if (energyReceived > outputRate) energyReceived -= outputRate; + else energyReceived = 0; + + energyBuffer -= amount; + + outputTracker.tick((int)amount); + } + } + + @Override + public int getMaxSafeInput() + { + return maxInput; + } + + @Override + public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) + { + // TODO Side I/O + //System.out.println("accept - direction.toSideValue() = " + direction.toSideValue() + " setting = " + ((sideSettings[direction.toSideValue()] & 1) == 0)); + return (sideSettings[direction.ordinal()] & 1) == 0; + } + + @Override + public double demandedEnergyUnits() + { + if(!receivingRedstoneSignal()) + { + final int tickAmt = Math.max(outputRate - energyReceived, 0); + final int capAmt = Math.max(energyCap - energyBuffer, 0); + //System.out.println("demandsEnergy: " + amt); + return Math.min(tickAmt, capAmt); + } + return 0; + } + + @Override + public double injectEnergyUnits(ForgeDirection directionFrom, double supply) + { + //System.out.println("energyBuffer: " + energyBuffer); + if (AdvancedPowerManagement.proxy.isServer()) + { + // if supply is greater than the max we can take per tick + if (supply > maxInput) + { + //If the supplied EU is over the baseMaxInput, we're getting + //supplied higher than acceptable current. Pop ourselves off + //into the world and return all but 1 EU, or if the supply + //somehow was 1EU, return zero to keep IC2 from spitting out + //massive errors in the log + selfDestroy(); + if (supply <= 1) + return 0; + else + return supply - 1; + } + else + { + energyReceived += supply; + energyBuffer += supply; + inputTracker.tick((int)supply); + } + } + return 0; + } + + // Networking stuff + + @SideOnly(Side.CLIENT) + @Override + public void receiveDescriptionData(int packetID, ByteBuf stream) + { + //try + //{ + for (int i = 0; i < 6; i++) + { + sideSettings[i] = stream.readByte(); + } + /*} + catch (IOException e) + { + logDescPacketError(e); + return; + }*/ + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + + @Override + public Packet getDescriptionPacket() + { + createDescPacket(); + return null; + } + + @Override + protected void addUniqueDescriptionData(ByteBuf data) throws IOException + { + for (int i = 0; i < 6; i++) + { + data.writeByte(sideSettings[i]); + } + } + + /** + * Packet reception by server of what button was clicked on the client's GUI. + * @param id = the button ID + */ + @Override + public void receiveGuiButton(int id) + { + switch (id) + { + case 0: + packetSize += 1; + if (packetSize > Info.AE_MAX_PACKET) packetSize = Info.AE_MAX_PACKET; + break; + case 1: + packetSize += 10; + if (packetSize > Info.AE_MAX_PACKET) packetSize = Info.AE_MAX_PACKET; + break; + case 2: + packetSize += 64; + if (packetSize == 68) packetSize = 64; + if (packetSize > Info.AE_MAX_PACKET) packetSize = Info.AE_MAX_PACKET; + break; + case 3: + packetSize *= 2; + if (packetSize > Info.AE_MAX_PACKET) packetSize = Info.AE_MAX_PACKET; + break; + case 4: + packetSize -= 1; + if (packetSize < Info.AE_MIN_PACKET) packetSize = Info.AE_MIN_PACKET; + if (outputRate > packetSize * Info.AE_PACKETS_TICK) outputRate = packetSize * Info.AE_PACKETS_TICK; + break; + case 5: + packetSize -= 10; + if (packetSize < Info.AE_MIN_PACKET) packetSize = Info.AE_MIN_PACKET; + if (outputRate > packetSize * Info.AE_PACKETS_TICK) outputRate = packetSize * Info.AE_PACKETS_TICK; + break; + case 6: + packetSize -= 64; + if (packetSize < Info.AE_MIN_PACKET) packetSize = Info.AE_MIN_PACKET; + if (outputRate > packetSize * Info.AE_PACKETS_TICK) outputRate = packetSize * Info.AE_PACKETS_TICK; + break; + case 7: + packetSize /= 2; + if (packetSize < Info.AE_MIN_PACKET) packetSize = Info.AE_MIN_PACKET; + if (outputRate > packetSize * Info.AE_PACKETS_TICK) outputRate = packetSize * Info.AE_PACKETS_TICK; + break; + case 8: + outputRate += 1; + if (outputRate > packetSize * Info.AE_PACKETS_TICK) outputRate = packetSize * Info.AE_PACKETS_TICK; + if (outputRate > Info.AE_MAX_OUTPUT) outputRate = Info.AE_MAX_OUTPUT; + break; + case 9: + outputRate += 10; + if (outputRate > packetSize * Info.AE_PACKETS_TICK) outputRate = packetSize * Info.AE_PACKETS_TICK; + if (outputRate > Info.AE_MAX_OUTPUT) outputRate = Info.AE_MAX_OUTPUT; + break; + case 10: + outputRate += 64; + if (outputRate == 65) outputRate = 64; + if (outputRate > packetSize * Info.AE_PACKETS_TICK) outputRate = packetSize * Info.AE_PACKETS_TICK; + if (outputRate > Info.AE_MAX_OUTPUT) outputRate = Info.AE_MAX_OUTPUT; + break; + case 11: + outputRate *= 2; + if (outputRate > packetSize * Info.AE_PACKETS_TICK) outputRate = packetSize * Info.AE_PACKETS_TICK; + if (outputRate > Info.AE_MAX_OUTPUT) outputRate = Info.AE_MAX_OUTPUT; + break; + case 12: + outputRate -= 1; + if (outputRate < Info.AE_MIN_OUTPUT) outputRate = Info.AE_MIN_OUTPUT; + break; + case 13: + outputRate -= 10; + if (outputRate < Info.AE_MIN_OUTPUT) outputRate = Info.AE_MIN_OUTPUT; + break; + case 14: + outputRate -= 64; + if (outputRate < Info.AE_MIN_OUTPUT) outputRate = Info.AE_MIN_OUTPUT; + break; + case 15: + outputRate /= 2; + if (outputRate < Info.AE_MIN_OUTPUT) outputRate = Info.AE_MIN_OUTPUT; + break; + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + //TODO How can we make IC2 check the new emit/accept values without doing a reload? + if (initialized) MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); + initialized = false; + sideSettings[id - 16] ^= 1; + MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); + initialized = true; + //worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + break; + } + energyCap = Math.max(packetSize, outputRate); + final byte voltLevel = (byte)(packetSize <= 32 ? 0 : packetSize <= 128 ? 2 : packetSize <= 512 ? 4 : 6); + for (int i = 0; i < 6; i++) + sideSettings[i] = (byte)(sideSettings[i] & 249 | voltLevel); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/tileentities/TEAdvEmitter.java b/src/main/java/com/kaijin/AdvPowerMan/tileentities/TEAdvEmitter.java new file mode 100755 index 0000000..879b0a0 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/tileentities/TEAdvEmitter.java @@ -0,0 +1,285 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.tileentities; + +import com.kaijin.AdvPowerMan.AdvancedPowerManagement; +import com.kaijin.AdvPowerMan.Info; + +import ic2.api.Direction; +import ic2.api.energy.EnergyNet; +import ic2.api.energy.event.EnergyTileLoadEvent; +//import ic2.api.energy.event.EnergyTileSourceEvent; +import ic2.api.energy.event.EnergyTileUnloadEvent; +import ic2.api.energy.tile.IEnergySource; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.ForgeDirection; +import cpw.mods.fml.common.FMLLog; + +public class TEAdvEmitter extends TECommon implements IEnergySource +{ + protected boolean initialized; + + public int outputRate = 32; + public int packetSize = 32; + private int energyBuffer = 0; + + public TEAdvEmitter() // Constructor used when placing a new tile entity, to set up correct parameters + { + super(); + } + + public TEAdvEmitter(int i) // Constructor used when placing a new tile entity, to set up correct parameters + { + super(); + packetSize = outputRate = (int)Math.pow(2.0D, (double)(2 * i + 3)); + FMLLog.info("[AdvancedPowerManagement] " + "Updating old Emitter block of tier " + i); + } + + /** + * Reads a tile entity from NBT. + */ + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) + { + super.readFromNBT(nbttagcompound); + + // Test if block used to be an old style emitter and if so use appropriate settings + int baseTier = nbttagcompound.getInteger("baseTier"); + if (baseTier > 0) + { + packetSize = outputRate = (int)Math.pow(2.0D, (double)(2 * baseTier + 3)); + FMLLog.info("[AdvancedPowerManagement] " + "Loading NBT data for old Emitter block with baseTier of " + baseTier + " and setting output to " + packetSize); + + } + else + { + // Normal load + outputRate = nbttagcompound.getInteger("outputRate"); + packetSize = nbttagcompound.getInteger("packetSize"); + energyBuffer = nbttagcompound.getInteger("energyBuffer"); + if (packetSize > Info.AE_MAX_PACKET) packetSize = Info.AE_MAX_PACKET; + if (packetSize < Info.AE_MIN_PACKET) packetSize = Info.AE_MIN_PACKET; + if (outputRate > packetSize * Info.AE_PACKETS_TICK) outputRate = packetSize * Info.AE_PACKETS_TICK; + if (outputRate > Info.AE_MAX_OUTPUT) outputRate = Info.AE_MAX_OUTPUT; + if (outputRate < Info.AE_MIN_OUTPUT) outputRate = Info.AE_MIN_OUTPUT; + if (energyBuffer > packetSize * Info.AE_PACKETS_TICK) energyBuffer = packetSize * Info.AE_PACKETS_TICK; + } + } + + /** + * Writes a tile entity to NBT. + */ + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) + { + super.writeToNBT(nbttagcompound); + nbttagcompound.setInteger("outputRate", outputRate); + nbttagcompound.setInteger("packetSize", packetSize); + nbttagcompound.setInteger("energyBuffer", energyBuffer); + } + + @Override + public void invalidate() + { + if (worldObj != null && initialized) + { + EnergyTileUnloadEvent unloadEvent = new EnergyTileUnloadEvent(this); + MinecraftForge.EVENT_BUS.post(unloadEvent); + // EnergyNet.getForWorld(worldObj).removeTileEntity(this); + } + super.invalidate(); + } + + @Override + public boolean canUpdate() + { + return true; + } + + @Override + public int getGuiID() + { + return Info.GUI_ID_ADJUSTABLE_EMITTER; + } + + @Override + public void updateEntity() + { + if (AdvancedPowerManagement.proxy.isClient()) return; + + if (!initialized) + { + if (worldObj == null) return; + + // Test if this is an old emitter block and needs its meta value adjusted + final int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); + if (meta != 7) + { + FMLLog.info("[AdvancedPowerManagement] " + "Resetting Emitter block meta value from " + meta + " to 7"); + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 7, 3); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + return; + } + EnergyTileLoadEvent loadEvent = new EnergyTileLoadEvent(this); + MinecraftForge.EVENT_BUS.post(loadEvent); + // EnergyNet.getForWorld(worldObj).addTileEntity(this); + initialized = true; + } + +/* if (receivingRedstoneSignal()) + { + energyBuffer += outputRate; + EnergyNet net = EnergyNet.getForWorld(worldObj); + while (energyBuffer >= packetSize) + { + EnergyTileSourceEvent sourceEvent = new EnergyTileSourceEvent(this, packetSize); + MinecraftForge.EVENT_BUS.post(sourceEvent); + // net.emitEnergyFrom(this, packetSize); // No reason to save any surplus. Output is always the same. + energyBuffer -= packetSize; + } + }*/ + } + + protected boolean receivingRedstoneSignal() + { + return worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord); + } + + public String getInvName() + { + return Info.KEY_BLOCK_NAMES[7] + Info.KEY_NAME_SUFFIX; + } + + public boolean isUseableByPlayer(EntityPlayer entityplayer) + { + if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) + { + return false; + } + + return entityplayer.getDistanceSq((double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D) <= 64D; + } + + // IC2 API stuff + + //@Override - this method doesn't exist anymore + public boolean isAddedToEnergyNet() + { + return initialized; + } + + @Override + public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction) + { + return true; + } + + @Override + public double getOfferedEnergy() + { + return Math.min(packetSize, outputRate); + } + + @Override + public void drawEnergy(double amount) + { + if (receivingRedstoneSignal()) + { + energyBuffer += outputRate; + energyBuffer -= packetSize; + } + } + + // Networking stuff + + /** + * Packet reception by server of what button was clicked on the client's GUI. + * @param id = the button ID + */ + @Override + public void receiveGuiButton(int id) + { + switch (id) + { + case 0: + packetSize += 1; + if (packetSize > Info.AE_MAX_PACKET) packetSize = Info.AE_MAX_PACKET; + break; + case 1: + packetSize += 10; + if (packetSize > Info.AE_MAX_PACKET) packetSize = Info.AE_MAX_PACKET; + break; + case 2: + packetSize += 64; + if (packetSize == 68) packetSize = 64; + if (packetSize > Info.AE_MAX_PACKET) packetSize = Info.AE_MAX_PACKET; + break; + case 3: + packetSize *= 2; + if (packetSize > Info.AE_MAX_PACKET) packetSize = Info.AE_MAX_PACKET; + break; + case 4: + packetSize -= 1; + if (packetSize < Info.AE_MIN_PACKET) packetSize = Info.AE_MIN_PACKET; + if (outputRate > packetSize * Info.AE_PACKETS_TICK) outputRate = packetSize * Info.AE_PACKETS_TICK; + break; + case 5: + packetSize -= 10; + if (packetSize < Info.AE_MIN_PACKET) packetSize = Info.AE_MIN_PACKET; + if (outputRate > packetSize * Info.AE_PACKETS_TICK) outputRate = packetSize * Info.AE_PACKETS_TICK; + break; + case 6: + packetSize -= 64; + if (packetSize < Info.AE_MIN_PACKET) packetSize = Info.AE_MIN_PACKET; + if (outputRate > packetSize * Info.AE_PACKETS_TICK) outputRate = packetSize * Info.AE_PACKETS_TICK; + break; + case 7: + packetSize /= 2; + if (packetSize < Info.AE_MIN_PACKET) packetSize = Info.AE_MIN_PACKET; + if (outputRate > packetSize * Info.AE_PACKETS_TICK) outputRate = packetSize * Info.AE_PACKETS_TICK; + break; + case 8: + outputRate += 1; + if (outputRate > packetSize * Info.AE_PACKETS_TICK) outputRate = packetSize * Info.AE_PACKETS_TICK; + if (outputRate > Info.AE_MAX_OUTPUT) outputRate = Info.AE_MAX_OUTPUT; + break; + case 9: + outputRate += 10; + if (outputRate > packetSize * Info.AE_PACKETS_TICK) outputRate = packetSize * Info.AE_PACKETS_TICK; + if (outputRate > Info.AE_MAX_OUTPUT) outputRate = Info.AE_MAX_OUTPUT; + break; + case 10: + outputRate += 64; + if (outputRate == 65) outputRate = 64; + if (outputRate > packetSize * Info.AE_PACKETS_TICK) outputRate = packetSize * Info.AE_PACKETS_TICK; + if (outputRate > Info.AE_MAX_OUTPUT) outputRate = Info.AE_MAX_OUTPUT; + break; + case 11: + outputRate *= 2; + if (outputRate > packetSize * Info.AE_PACKETS_TICK) outputRate = packetSize * Info.AE_PACKETS_TICK; + if (outputRate > Info.AE_MAX_OUTPUT) outputRate = Info.AE_MAX_OUTPUT; + break; + case 12: + outputRate -= 1; + if (outputRate < Info.AE_MIN_OUTPUT) outputRate = Info.AE_MIN_OUTPUT; + break; + case 13: + outputRate -= 10; + if (outputRate < Info.AE_MIN_OUTPUT) outputRate = Info.AE_MIN_OUTPUT; + break; + case 14: + outputRate -= 64; + if (outputRate < Info.AE_MIN_OUTPUT) outputRate = Info.AE_MIN_OUTPUT; + break; + case 15: + outputRate /= 2; + if (outputRate < Info.AE_MIN_OUTPUT) outputRate = Info.AE_MIN_OUTPUT; + break; + } + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/tileentities/TEBatteryStation.java b/src/main/java/com/kaijin/AdvPowerMan/tileentities/TEBatteryStation.java new file mode 100755 index 0000000..bb2eb93 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/tileentities/TEBatteryStation.java @@ -0,0 +1,580 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.tileentities; + +import ic2.api.Direction; +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import ic2.api.energy.event.EnergyTileLoadEvent; +import ic2.api.energy.tile.IEnergySource; +import io.netty.buffer.ByteBuf; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +import com.kaijin.AdvPowerMan.AdvancedPowerManagement; +import com.kaijin.AdvPowerMan.Info; +import com.kaijin.AdvPowerMan.MovingAverage; +import com.kaijin.AdvPowerMan.Utils; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.Constants; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class TEBatteryStation extends TECommonBench implements IEnergySource, IInventory, ISidedInventory +{ + public int opMode; + + // Base values + public int packetSize; + public int currentEnergy = 0; + + private boolean invChanged = false; + private boolean hasEnoughItems = false; + + //For outside texture display + public boolean doingWork; + + private int energyOut = 0; + public MovingAverage outputTracker = new MovingAverage(12); + + private static final int[] BatteryStationSideInput = {Info.BS_SLOT_INPUT}; + private static final int[] BatteryStationSideOutput = {Info.BS_SLOT_OUTPUT}; + private static final int[] BatteryStationSideInOut = {Info.BS_SLOT_INPUT, Info.BS_SLOT_OUTPUT}; + + public TEBatteryStation() // Default constructor used only when loading tile entity from world save + { + super(); + // Do nothing else; Creating the inventory array and loading previous values will be handled in NBT read method momentarily. + } + + public TEBatteryStation(int i) // Constructor used when placing a new tile entity, to set up correct parameters + { + super(); + contents = new ItemStack[14]; + + //base tier = what we're passed, so 1, 2 or 3 + baseTier = i; + opMode = 1; + initializeValues(); + } + + private void initializeValues() + { + powerTier = baseTier; + //Output math = 32 for tier 1, 128 for tier 2, 512 for tier 3 + packetSize = (int)Math.pow(2.0D, (double)(2 * baseTier + 3)); + + } + + // IC2 API functions + + @Override + public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction) + { + return true; + } + + @Override + public double getOfferedEnergy() { + return (!receivingRedstoneSignal()) ? Math.min(currentEnergy, packetSize) : 0; + } + + @Override + public void drawEnergy(double amount) { + if (!receivingRedstoneSignal()) + { + drainPowerSource(); + outputTracker.tick((int) amount); + currentEnergy -= amount; + } + } + + // End IC2 API + + @Override + public int getGuiID() + { + return Info.GUI_ID_BATTERY_STATION; + } + + /** + * This will cause the block to drop anything inside it, create a new item in the + * world of its type, invalidate the tile entity, remove itself from the IC2 + * EnergyNet and clear the block space (set it to air) + */ + @Override + protected void selfDestroy() + { + dropContents(); + ItemStack stack = new ItemStack(AdvancedPowerManagement.blockAdvPwrMan, 1, Info.BS_META + baseTier - 1); + dropItem(stack); + worldObj.setBlockToAir(xCoord, yCoord, zCoord); + this.invalidate(); + } + + public boolean isItemValid(int slot, ItemStack stack) + { + // Decide if the item is a valid IC2 electrical item + if (stack != null && stack.getItem() instanceof IElectricItem) + { + IElectricItem item = (IElectricItem)(stack.getItem()); + // Is the item appropriate for this slot? + if (slot == Info.BS_SLOT_OUTPUT) return true; // GUI won't allow placement of items here, but if the bench or an external machine does, it should at least let it sit there as long as it's an electrical item. + if (item.canProvideEnergy(stack) && item.getTier(stack) <= powerTier) + { + if ((slot >= Info.BS_SLOT_POWER_START && slot < Info.BS_SLOT_POWER_START + 12) || slot == Info.BS_SLOT_INPUT) return true; + } + } + return false; + } + + /** + * Reads a tile entity from NBT. + */ + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) + { + super.readFromNBT(nbttagcompound); + + if (Info.isDebugging) System.out.println("BS ID: " + nbttagcompound.getString("id")); + + baseTier = nbttagcompound.getInteger("baseTier"); + opMode = nbttagcompound.getInteger("opMode"); + currentEnergy = nbttagcompound.getInteger("currentEnergy"); + + // Our inventory + contents = new ItemStack[Info.BS_INVENTORY_SIZE]; + NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound1.getByte("Slot") & 255; + + if (j >= 0 && j < contents.length) + { + contents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } + } + + // We can calculate these, no need to save/load them. + initializeValues(); + } + + /** + * Writes a tile entity to NBT. + */ + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) + { + super.writeToNBT(nbttagcompound); + + nbttagcompound.setInteger("baseTier", baseTier); + nbttagcompound.setInteger("opMode", opMode); + nbttagcompound.setInteger("currentEnergy", currentEnergy); + + // Our inventory + NBTTagList nbttaglist = new NBTTagList(); + for (int i = 0; i < contents.length; ++i) + { + if (contents[i] != null) + { + //if (ChargingBench.isDebugging) System.out.println("WriteNBT contents[" + i + "] stack tag: " + contents[i].stackTagCompound); + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte)i); + contents[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + } + nbttagcompound.setTag("Items", nbttaglist); + } + + @Override + public void updateEntity() //TODO Marked for easy access + { + if (AdvancedPowerManagement.proxy.isClient()) return; + + if (!initialized && worldObj != null) + { + EnergyTileLoadEvent loadEvent = new EnergyTileLoadEvent(this); + MinecraftForge.EVENT_BUS.post(loadEvent); + // EnergyNet.getForWorld(worldObj).addTileEntity(this); + initialized = true; + } + + + boolean lastWorkState = doingWork; + doingWork = false; + invChanged = false; + hasEnoughItems = true; + + if (!receivingRedstoneSignal()) + { + // Work done only when not redstone powered + drainPowerSource(); + } + + // Work done every tick + moveOutputItems(); + repositionItems(); + acceptInputItems(); + + + if (invChanged) + { + this.markDirty(); // This doesn't need to be called multiple times, so it gets flagged to happen here if needed. + } + + // Trigger this only when it would need to update the client texture + if (lastWorkState != doingWork) + { + //if (ChargingBench.isDebugging) System.out.println("TE oldChargeLevel: " + oldChargeLevel + " chargeLevel: " + chargeLevel); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + } + + private void drainPowerSource() + { + hasEnoughItems = false; + for (int i = Info.BS_SLOT_POWER_START; i < Info.BS_SLOT_POWER_START + 12; i++) + { + //if (ChargingBench.isDebugging) System.out.println("currentEnergy: " + currentEnergy + " baseMaxOutput: " + baseMaxOutput); + if (currentEnergy >= packetSize) + { + hasEnoughItems = true; + break; + } + + ItemStack stack = contents[i]; + if (stack != null && stack.getItem() instanceof IElectricItem && stack.stackSize == 1) + { + IElectricItem item = (IElectricItem)(stack.getItem()); + if (item.getTier(stack) <= powerTier && item.canProvideEnergy(stack)) + { + Item emptyItem = item.getEmptyItem(stack); + int chargedItemID = Item.getIdFromItem(item.getChargedItem(stack)); + + if (Item.getIdFromItem(stack.getItem()) == chargedItemID) + { + int transferLimit = item.getTransferLimit(stack); + //int amountNeeded = baseMaxOutput - currentEnergy; + if (transferLimit == 0) transferLimit = packetSize; + //if (transferLimit > amountNeeded) transferLimit = amountNeeded; + + int chargeReturned = ElectricItem.manager.discharge(stack, transferLimit, powerTier, false, false); + if (chargeReturned > 0) + { + // Add the energy we received to our current energy level + currentEnergy += chargeReturned; + doingWork = true; + } + + // Workaround for buggy IC2 API .discharge that automatically switches stack to emptyItemID but leaves a stackTagCompound on it, so it can't be stacked with never-used empties + if (chargedItemID != Item.getIdFromItem(emptyItem) && (chargeReturned < transferLimit || ElectricItem.manager.discharge(stack, 1, powerTier, false, true) == 0)) + { + //if (ChargingBench.isDebugging) System.out.println("Switching to emptyItemID: " + emptyItemID + " from stack.itemID: " + stack.itemID + " - chargedItemID: " + chargedItemID); + setInventorySlotContents(i, new ItemStack(emptyItem, 1, 0)); + } + } + } + } + } + } + + /** + * First, check the output slot to see if it's empty. If so, look to see if there are any fully + * DIScharged items in the main inventory. Move the first empty item to the output slot. + * If output slot contains stackable empties, check for matching empties to add to that stack. + */ + private void moveOutputItems() + { + rejectInvalidInput(); + + ItemStack outputStack = contents[Info.BS_SLOT_OUTPUT]; + if (outputStack == null || (outputStack.isStackable() && outputStack.stackSize < outputStack.getMaxStackSize())) + { + // Output slot could receive item(s). Try to find something to move there. + for (int slot = 0; slot < contents.length; ++slot) + { + if (slot == Info.BS_SLOT_OUTPUT) continue; + + ItemStack currentStack = contents[slot]; + if (currentStack != null && currentStack.getItem() instanceof IElectricItem) + { + IElectricItem powerSource = (IElectricItem)(currentStack.getItem()); + if (powerSource.getTier(currentStack) <= powerTier) // && powerSource.canProvideEnergy() + { + int emptyItemID = Item.getIdFromItem(powerSource.getEmptyItem(currentStack)); + int chargedItemID = Item.getIdFromItem(powerSource.getChargedItem(currentStack)); + if (emptyItemID != chargedItemID) + { + if (Item.getIdFromItem(currentStack.getItem()) == emptyItemID) + { + // Pick Me + if (outputStack == null) + { + contents[Info.BS_SLOT_OUTPUT] = currentStack; + contents[slot] = null; + } + else + { + // We already know the stack isn't full yet + contents[Info.BS_SLOT_OUTPUT].stackSize++; + contents[slot].stackSize--; + if (contents[slot].stackSize < 1) contents[slot] = null; + } + invChanged = true; + break; + } + } + else if (outputStack == null) + { + boolean empty = ElectricItem.manager.discharge(currentStack, 1, powerTier, true, true) == 0; + if (empty) + { + // Pick Me + contents[Info.BS_SLOT_OUTPUT] = currentStack; + contents[slot] = null; + invChanged = true; + break; + } + } + } + } + } + } + } + + /** + * Adjust positions of items in inventory to preserve FIFO order where possible. + */ + private void repositionItems() + { + final int lastIndex = Info.BS_SLOT_POWER_START + 11; + int vacancy = Info.BS_SLOT_POWER_START; + while (vacancy < lastIndex && contents[vacancy] != null) + { + vacancy++; + } + int hunt = vacancy + 1; + while (vacancy < lastIndex && hunt <= lastIndex) // Mix of < and <= is not an error: Avoids needing +1 or -1 added to something. + { + if (contents[vacancy] == null && contents[hunt] != null) + { + contents[vacancy] = contents[hunt]; + contents[hunt] = null; + invChanged = true; + vacancy++; + } + hunt++; + } + } + + /** + * Check to see if there are any items in the input slot. If so, check to see if there are any + * free discharging slots. If so, move one from the input slot to a free discharging slot. + */ + private void acceptInputItems() + { + //System.out.println("aII: opMode " + opMode); + ItemStack stack = contents[Info.BS_SLOT_INPUT]; + if (stack == null || !(stack.getItem() instanceof IElectricItem) || (opMode == 1 && hasEnoughItems)) return; + + IElectricItem item = (IElectricItem)stack.getItem(); + if (item.canProvideEnergy(stack)) + { + // Input slot contains a power source. If possible, move one of it into the discharging area. + for (int slot = Info.BS_SLOT_POWER_START; slot < Info.BS_SLOT_POWER_START + 12; ++slot) + { + if (contents[slot] == null) + { + // Grab one unit from input and move it to the selected slot. + contents[slot] = decrStackSize(Info.BS_SLOT_INPUT, 1); + break; + } + } + } + } + + private void rejectInvalidInput() + { + // Move item from input to output if not valid. (Wrong tier or not electric item.) + if (contents[Info.BS_SLOT_INPUT] != null && contents[Info.BS_SLOT_OUTPUT] == null) + { + if (!isItemValid(Info.BS_SLOT_INPUT, contents[Info.BS_SLOT_INPUT])) + { + contents[Info.BS_SLOT_OUTPUT] = contents[Info.BS_SLOT_INPUT]; + contents[Info.BS_SLOT_INPUT] = null; + invChanged = true; + } + } + } + + // Add up amount of energy stored in items in all slots except output and return that value + public int getTotalEnergy() + { + int energySum = 0; + for (int i = 0; i < Info.BS_SLOT_POWER_START + 12; i++) + { + if (i == Info.BS_SLOT_OUTPUT) continue; + + final ItemStack stack = contents[i]; + if (stack != null && stack.getItem() instanceof IElectricItem && stack.stackSize == 1) + { + final IElectricItem item = (IElectricItem)(stack.getItem()); + if (item.getTier(stack) <= powerTier && item.canProvideEnergy(stack) && Item.getIdFromItem(stack.getItem()) == Item.getIdFromItem(item.getChargedItem(stack))) + { + final int chargeReturned = ElectricItem.manager.discharge(stack, Integer.MAX_VALUE, powerTier, true, true); + if (chargeReturned > 0) + { + // Add the energy we received to our current energy level + energySum += chargeReturned; + } + } + } + } + return energySum; + } + + //Networking stuff + + @Override + public Packet getDescriptionPacket() + { + return createDescPacket(); + } + + @Override + protected void addUniqueDescriptionData(ByteBuf data) throws IOException + { + data.writeBoolean(doingWork); + } + + @SideOnly(Side.CLIENT) + @Override + public void receiveDescriptionData(int packetID, ByteBuf stream) + { + boolean b = doingWork; + //try + //{ + b = stream.readBoolean(); + /*} + catch (IOException e) + { + logDescPacketError(e); + return; + }*/ + doingWork = b; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + + @Override + public void receiveGuiButton(int buttonID) + { + if (buttonID == 0) + { + opMode ^= 1; + } + } + + // ISidedInventory + + /* + @Override + public int getStartInventorySide(ForgeDirection side) + { + switch (side) + { + case UP: + case DOWN: + return Info.BS_SLOT_INPUT; + default: + return Info.BS_SLOT_OUTPUT; + } + } + + @Override + public int getSizeInventorySide(ForgeDirection side) + { + // Each side accesses a single slot + return 1; + } + */ + + @Override + public int[] getAccessibleSlotsFromSide(int side) + { + return BatteryStationSideInOut; // Testing I/O constraint methods func_102007_a, func_102008_b + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack stack) + { + if (i == Info.BS_SLOT_INPUT) return Utils.isItemDrainable(stack, powerTier); + return false; + } + + // Returns true if automation can insert the given item in the given slot from the given side. Args: Slot, item, side + @Override + public boolean canInsertItem(int i, ItemStack itemstack, int j) // canInsertItem + { + if (i == Info.BS_SLOT_INPUT) return true; + return false; + } + + // Returns true if automation can extract the given item in the given slot from the given side. Args: Slot, item, side + @Override + public boolean canExtractItem(int i, ItemStack itemstack, int j) // canExtractItem + { + if (i == Info.BS_SLOT_OUTPUT) return true; + return false; + } + + // IInventory + + @Override + public int getSizeInventory() + { + // Only input/output slots are accessible to machines + return 2; + } + + @Override + public String getInventoryName() + { + switch (baseTier) + { + case 1: + return Info.KEY_BLOCK_NAMES[8] + Info.KEY_NAME_SUFFIX; + case 2: + return Info.KEY_BLOCK_NAMES[9] + Info.KEY_NAME_SUFFIX; + case 3: + return Info.KEY_BLOCK_NAMES[10] + Info.KEY_NAME_SUFFIX; + } + return ""; + } + + @Override + public void markDirty(int slot) + { + if (slot == Info.BS_SLOT_INPUT || slot == Info.BS_SLOT_OUTPUT) + { + rejectInvalidInput(); + } + super.markDirty(); + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/tileentities/TEChargingBench.java b/src/main/java/com/kaijin/AdvPowerMan/tileentities/TEChargingBench.java new file mode 100755 index 0000000..78ebf74 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/tileentities/TEChargingBench.java @@ -0,0 +1,838 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.tileentities; + +import ic2.api.Direction; +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import ic2.api.tile.IEnergyStorage; +import ic2.api.energy.event.EnergyTileLoadEvent; +import ic2.api.energy.tile.IEnergySink; +import ic2.core.IC2; +import ic2.core.network.NetworkManager; +import io.netty.buffer.ByteBuf; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +import com.kaijin.AdvPowerMan.AdvancedPowerManagement; +import com.kaijin.AdvPowerMan.Info; +import com.kaijin.AdvPowerMan.MovingAverage; +import com.kaijin.AdvPowerMan.Utils; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.Constants; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.common.MinecraftForge; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class TEChargingBench extends TECommonBench implements IEnergySink, IEnergyStorage, IInventory, ISidedInventory +{ + // Base values + public int baseMaxInput; + public int baseStorage; + + // Adjustable values that need communicating via container + public int adjustedMaxInput; + public int adjustedStorage; + + public int currentEnergy; + //For outside texture display + public int chargeLevel; + + public float drainFactor; + public float chargeFactor; + + protected int energyReceived = 0; + public MovingAverage inputTracker = new MovingAverage(12); + + public int ticksRequired = 0; + public int energyRequired = 0; + + private static final int[] ChargingBenchSideInput = {Info.CB_SLOT_INPUT}; + private static final int[] ChargingBenchSideOutput = {Info.CB_SLOT_OUTPUT}; + private static final int[] ChargingBenchSideInOut = {Info.CB_SLOT_INPUT, Info.CB_SLOT_OUTPUT}; + private static final int[] ChargingBenchSidePower = {Info.CB_SLOT_POWER_SOURCE}; + + public TEChargingBench() // Default constructor used only when loading tile entity from world save + { + super(); + // Do nothing else; Creating the inventory array and loading previous values will be handled in NBT read method momentarily. + } + + public TEChargingBench(int i) // Constructor used when placing a new tile entity, to set up correct parameters + { + super(); + contents = new ItemStack[19]; + + //base tier = what we're passed, so 1, 2 or 3 + baseTier = i; + initializeBaseValues(); + + //setup Adjusted variables to = defaults, we'll be adjusting them in entityUpdate + adjustedMaxInput = baseMaxInput; + adjustedStorage = baseStorage; + + powerTier = baseTier; + + drainFactor = 1.0F; + chargeFactor = 1.0F; + } + + protected void initializeBaseValues() + { + //if (ChargingBench.isDebugging) System.out.println("Initializing - BaseTier: " + baseTier); + + //Max Input math = 32 for tier 1, 128 for tier 2, 512 for tier 3 + baseMaxInput = (int)Math.pow(2.0D, (double)(2 * baseTier + 3)); + //if (ChargingBench.isDebugging) System.out.println("BaseMaxInput: " + baseMaxInput); + + switch(baseTier) + { + case 1: + baseStorage = 40000; + break; + case 2: + baseStorage = 600000; + break; + case 3: + baseStorage = 10000000; + break; + default: + baseStorage = 0; + } + //if (ChargingBench.isDebugging) System.out.println("BaseStorage: " + baseStorage); + } + + /** + * Called to upgrade (or downgrade) a charging bench to a certain tier. + * @param newTier The tier to replace the charging bench with, based on the component item used + * @return the original tier of the charging bench, for creating the correct component item + */ + public int swapBenchComponents(int newTier) + { + int oldTier = baseTier; + baseTier = newTier; + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, Info.CB_META + newTier - 1, 3); + initializeBaseValues(); + doUpgradeEffects(); + chargeLevel = gaugeEnergyScaled(12); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + return oldTier; + } + + // IC2 API stuff + + // IEnergySink + + @Override + public void setStored(int energy) + { + // What uses this? + } + + @Override + public int addEnergy(int amount) + { + // Returning our current energy value always, we do not implement this function + return currentEnergy; + } + + @Override + public int getMaxSafeInput() + { + return adjustedMaxInput; + } + + // IEnergyStorage + + /** + * Get the amount of energy currently stored in the block. + * + * @return Energy stored in the block + */ + @Override + public int getStored() + { + return currentEnergy; + } + + /** + * Get the maximum amount of energy the block can store. + * + * @return Maximum energy stored + */ + @Override + public int getCapacity() + { + return adjustedStorage; + } + + /** + * Get the block's energy output. + * + * @return Energy output in EU/t + */ + @Override + public int getOutput() + { + return 0; + } + + // End IC2 API + + @Override + public int getGuiID() + { + return Info.GUI_ID_CHARGING_BENCH; + } + + /** + * This will cause the block to drop anything inside it, create a new item in the + * world of its type, invalidate the tile entity, remove itself from the IC2 + * EnergyNet and clear the block space (set it to air) + */ + @Override + protected void selfDestroy() + { + dropContents(); + ItemStack stack = new ItemStack(AdvancedPowerManagement.blockAdvPwrMan, 1, Info.CB_META + baseTier - 1); + dropItem(stack); + worldObj.setBlockToAir(xCoord, yCoord, zCoord); + this.invalidate(); + } + + public void doUpgradeEffects() + { + // Count our upgrades + ItemStack stack; + int ocCount = 0; + int tfCount = 0; + int esCount = 0; + for (int i = Info.CB_SLOT_UPGRADE; i < Info.CB_SLOT_UPGRADE + 4; ++i) + { + stack = contents[i]; + if (stack != null) + { + if (stack.isItemEqual(Info.ic2overclockerUpg)) + { + ocCount += stack.stackSize; + } + else if (stack.isItemEqual(Info.ic2storageUpg)) + { + esCount += stack.stackSize; + } + else if (stack.isItemEqual(Info.ic2transformerUpg)) + { + tfCount += stack.stackSize; + } + } + } + + // Cap upgrades at sane quantities that won't result in negative energy storage from integer overflows and such. + if (ocCount > 20) ocCount = 20; + if (esCount > 64) esCount = 64; + if (tfCount > 3) tfCount = 3; + + // Overclockers: + chargeFactor = (float)Math.pow(1.3F, ocCount); // 30% more power transferred to an item per overclocker, exponential. + drainFactor = (float)Math.pow(1.5F, ocCount); // 50% more power drained per overclocker, exponential. Yes, you waste power, that's how OCs work. + + // Transformers: + powerTier = baseTier + tfCount; // Allows better energy storage items to be plugged into the battery slot of lower tier benches. + if (powerTier > 3) powerTier = 3; + + adjustedMaxInput = (int)Math.pow(2.0D, (double)(2 * (baseTier + tfCount) + 3)); + if (adjustedMaxInput > 2048) adjustedMaxInput = 2048; // You can feed EV in with 1-4 TF upgrades, if you so desire. + + // Energy Storage: + switch (baseTier) + { + case 1: + adjustedStorage = baseStorage + esCount * 10000; // LV: 25% additional storage per upgrade (10,000). + break; + case 2: + adjustedStorage = baseStorage + esCount * 60000; // MV: 10% additional storage per upgrade (60,000). + break; + case 3: + adjustedStorage = baseStorage + esCount * 500000; // HV: 5% additional storage per upgrade (500,000). + break; + default: + adjustedStorage = baseStorage; // This shouldn't ever happen, but just in case, it shouldn't crash it - storage upgrades just won't work. + } + if (currentEnergy > adjustedStorage) currentEnergy = adjustedStorage; // If storage has decreased, lose any excess energy. + } + + public boolean isItemValid(int slot, ItemStack stack) + { + // Decide if the item is a valid IC2 electrical item + if (stack != null && stack.getItem() instanceof IElectricItem) + { + IElectricItem item = (IElectricItem)(stack.getItem()); + // Is the item appropriate for this slot? + if (slot == Info.CB_SLOT_POWER_SOURCE && item.canProvideEnergy(stack) && item.getTier(stack) <= powerTier) return true; + if (slot >= Info.CB_SLOT_CHARGING && slot < Info.CB_SLOT_CHARGING + 12 && item.getTier(stack) <= baseTier) return true; + if (slot >= Info.CB_SLOT_UPGRADE && slot < Info.CB_SLOT_UPGRADE + 4 && (stack.isItemEqual(Info.ic2overclockerUpg) || stack.isItemEqual(Info.ic2transformerUpg) || stack.isItemEqual(Info.ic2storageUpg))) return true; + if (slot == Info.CB_SLOT_INPUT && item.getTier(stack) <= baseTier) return true; + if (slot == Info.CB_SLOT_OUTPUT) return true; // GUI won't allow placement of items here, but if the bench or an external machine does, it should at least let it sit there as long as it's an electrical item. + } + return false; + } + + /** + * Reads a tile entity from NBT. + */ + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) + { + super.readFromNBT(nbttagcompound); + + if (Info.isDebugging) System.out.println("CB ID: " + nbttagcompound.getString("id")); + + baseTier = nbttagcompound.getInteger("baseTier"); + currentEnergy = nbttagcompound.getInteger("currentEnergy"); + //if (ChargingBench.isDebugging) System.out.println("ReadNBT.CurrentEergy: " + currentEnergy); + + // Our inventory + contents = new ItemStack[Info.CB_INVENTORY_SIZE]; + NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound1.getByte("Slot") & 255; + + if (j >= 0 && j < contents.length) + { + contents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } + } + + // We can calculate these, no need to save/load them. + initializeBaseValues(); + doUpgradeEffects(); + } + + /** + * Writes a tile entity to NBT. + */ + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) + { + super.writeToNBT(nbttagcompound); + + nbttagcompound.setInteger("baseTier", baseTier); + nbttagcompound.setInteger("currentEnergy", currentEnergy); + //if (ChargingBench.isDebugging) System.out.println("WriteNBT.CurrentEergy: " + currentEnergy); + + // Our inventory + NBTTagList nbttaglist = new NBTTagList(); + for (int i = 0; i < contents.length; ++i) + { + if (contents[i] != null) + { + //if (ChargingBench.isDebugging) System.out.println("WriteNBT contents[" + i + "] stack tag: " + contents[i].stackTagCompound); + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte)i); + contents[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + } + nbttagcompound.setTag("Items", nbttaglist); + } + + @Override + public void updateEntity() //TODO Marked for easy access + { + if (AdvancedPowerManagement.proxy.isClient()) + { + return; + } + + if (!initialized && worldObj != null) + { + EnergyTileLoadEvent loadEvent = new EnergyTileLoadEvent(this); + MinecraftForge.EVENT_BUS.post(loadEvent); + // EnergyNet.getForWorld(worldObj).addTileEntity(this); + initialized = true; + } + + inputTracker.tick(energyReceived); + energyReceived = 0; + ticksRequired = 0; + energyRequired = 0; + + boolean lastWorkState = doingWork; + doingWork = false; + + // Work done every tick + drainPowerSource(); + chargeItems(); + moveOutputItems(); + acceptInputItems(); + + // Determine if and how completion time will be affected by lack of energy and input rate + if (energyRequired > currentEnergy) + { + final int deficit = energyRequired - currentEnergy; + final float avg = inputTracker.getAverage(); + if (avg >= 1.0F) + { + final int time = (int)Math.ceil(((float)deficit) / avg); + if (time > ticksRequired) ticksRequired = time; + } + else ticksRequired = -1; + } + + // Trigger this only when charge level passes where it would need to update the client texture + int oldChargeLevel = chargeLevel; + chargeLevel = gaugeEnergyScaled(12); + if (oldChargeLevel != chargeLevel || lastWorkState != doingWork) + { + //if (ChargingBench.isDebugging) System.out.println("TE oldChargeLevel: " + oldChargeLevel + " chargeLevel: " + chargeLevel); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + } + + /** + * Looks in the power item slot to see if it can pull in EU from a valid item in that slot. + * If so, pull in as much EU as the item allows to be transferred per tick up to the maximum + * energy transfer rate based on our tier, limited also by the maximum energy storage capacity. + * ie. do not pull in more than we have room for + * @return + */ + private void drainPowerSource() + { + int chargeReturned = 0; + + ItemStack stack = getStackInSlot(Info.CB_SLOT_POWER_SOURCE); + if (stack != null && stack.getItem() instanceof IElectricItem && currentEnergy < adjustedStorage) + { + IElectricItem powerSource = (IElectricItem)(stack.getItem()); + + Item emptyItem = powerSource.getEmptyItem(stack); + int chargedItemID = Item.getIdFromItem(powerSource.getChargedItem(stack)); + + if (Item.getIdFromItem(stack.getItem()) == chargedItemID) + { + if (powerSource.getTier(stack) <= powerTier && powerSource.canProvideEnergy(stack)) + { + int itemTransferLimit = powerSource.getTransferLimit(stack); + int energyNeeded = adjustedStorage - currentEnergy; + + // Test if the amount of energy we have room for is greater than what the item can transfer per tick. + if (energyNeeded > itemTransferLimit) + { + // If so, request the max it can transfer per tick. + energyNeeded = itemTransferLimit; + // If we need less than it can transfer per tick, request only what we have room for so we don't waste power. + } + + if (energyNeeded > 0) + { + chargeReturned = ElectricItem.manager.discharge(stack, energyNeeded, powerTier, false, false); + // Add the energy we received to our current energy level, + currentEnergy += chargeReturned; + if (chargeReturned > 0) doingWork = true; + // and make sure that we didn't go over. If we somehow did, drop the excess. + if (currentEnergy > adjustedStorage) currentEnergy = adjustedStorage; + } + } + + // Workaround for buggy IC2 API .discharge that automatically switches stack to emptyItemID but leaves a stackTagCompound on it, so it can't be stacked with never-used empties + if (chargedItemID != Item.getIdFromItem(emptyItem) && ElectricItem.manager.discharge(stack, 1, powerTier, false, true) == 0) + { + //if (ChargingBench.isDebugging) System.out.println("Switching to emptyItemID: " + emptyItemID + " from stack.itemID: " + stack.itemID + " - chargedItemID: " + chargedItemID); + setInventorySlotContents(Info.CB_SLOT_POWER_SOURCE, new ItemStack(emptyItem, 1, 0)); + //ItemStack newStack = new ItemStack(emptyItemID, 1, 0); + //contents[ChargingBench.slotPowerSource] = newStack; + } + } + } + } + + /** + * Look through all of the items in our main inventory and determine the current charge level, + * maximum charge level and maximum base charge rate for each item. Increase maximum charge + * rate for each item based on overclockers as appropriate, then, starting with the first slot + * in the main inventory, transfer one tick worth of energy from our internal storage to the + * item. Continue doing this for all items in the inventory until we reach the end of the main + * inventory or run out of internal EU storage. + */ + private void chargeItems() + { + for (int i = Info.CB_SLOT_CHARGING; i < Info.CB_SLOT_CHARGING + 12; i++) + { + ItemStack stack = contents[i]; + if (stack != null && stack.getItem() instanceof IElectricItem && stack.stackSize == 1) + { + IElectricItem item = (IElectricItem)(stack.getItem()); + if (item.getTier(stack) <= baseTier) + { + int itemTransferLimit = item.getTransferLimit(stack); + if (itemTransferLimit == 0) itemTransferLimit = baseMaxInput; + int adjustedTransferLimit = (int)Math.ceil(chargeFactor * itemTransferLimit); + int amountNeeded; + int missing; + int consumption; + if (Item.getIdFromItem(item.getChargedItem(stack)) != Item.getIdFromItem(item.getEmptyItem(stack)) || stack.isStackable()) + { + // Running stack.copy() on every item every tick would be a horrible thing for performance, but the workaround is needed + // for ElectricItem.charge adding stackTagCompounds for charge level to EmptyItemID batteries even when run in simulate mode. + // Limiting its use by what is hopefully a broad enough test to catch all cases where it's necessary in order to avoid problems. + // Using it for any item types listed as stackable and for any items where the charged and empty item IDs differ. + final ItemStack stackCopy = stack.copy(); + amountNeeded = ElectricItem.manager.charge(stackCopy, adjustedTransferLimit, baseTier, true, true); + if (amountNeeded == adjustedTransferLimit) + { + missing = ElectricItem.manager.charge(stackCopy, item.getMaxCharge(stackCopy), baseTier, true, true); + } + else missing = amountNeeded; + } + else + { + amountNeeded = ElectricItem.manager.charge(stack, adjustedTransferLimit, baseTier, true, true); + if (amountNeeded == adjustedTransferLimit) + { + missing = ElectricItem.manager.charge(stack, item.getMaxCharge(stack), baseTier, true, true); + } + else missing = amountNeeded; + } + + // How long will this item take and how much will it drain? + final int eta = (int)Math.ceil(((float)missing) / ((float)adjustedTransferLimit)); + if (ticksRequired < eta) ticksRequired = eta; + energyRequired += (int)Math.ceil((drainFactor / chargeFactor) * missing); + + int adjustedEnergyUse = (int)Math.ceil((drainFactor / chargeFactor) * amountNeeded); + if (adjustedEnergyUse > 0 && currentEnergy > 0) + { + if (adjustedEnergyUse > currentEnergy) + { + // Allow that last trickle of energy to be transferred out of the bench + adjustedTransferLimit = (adjustedTransferLimit * currentEnergy) / adjustedEnergyUse; + adjustedEnergyUse = currentEnergy; + } + // We don't need to do this with the current API, it's switching the ItemID for us. Just make sure we don't try to charge stacked batteries, as mentioned above! + //int chargedItemID = item.getChargedItemId(); + //if (stack.itemID != chargedItemID) + //{ + // setInventorySlotContents(i, new ItemStack(chargedItemID, 1, 0)); + //} + ElectricItem.manager.charge(contents[i], adjustedTransferLimit, baseTier, true, false); + currentEnergy -= adjustedEnergyUse; + if (currentEnergy < 0) currentEnergy = 0; + doingWork = true; + } + } + } + } + } + + /** + * First, check the output slot to see if it's empty. If so, look to see if there are any fully + * charged items in the main inventory. Move the first fully charged item to the output slot. + */ + private void moveOutputItems() + { + ItemStack stack = contents[Info.CB_SLOT_OUTPUT]; + if (stack == null) + { + // Output slot is empty. Try to find a fully charged item to move there. + for (int slot = Info.CB_SLOT_CHARGING; slot < Info.CB_SLOT_CHARGING + 12; ++slot) + { + ItemStack currentStack = contents[slot]; + if (currentStack != null && currentStack.getItem() instanceof IElectricItem) + { + // Test if the item is fully charged (cannot accept any more power). + if (ElectricItem.manager.charge(currentStack.copy(), 1, baseTier, false, true) == 0) + { + contents[Info.CB_SLOT_OUTPUT] = currentStack; + contents[slot] = null; + this.markDirty(); + break; + } + } + } + } + } + + /** + * Check to see if there are any items in the input slot. If so, check to see if there are any + * free charging slots. If so, move one from the input slot to a free charging slot. Do not + * move more than one, if the stack contains more. + */ + private void acceptInputItems() + { + ItemStack stack = contents[Info.CB_SLOT_INPUT]; + if (stack != null && stack.getItem() instanceof IElectricItem) + { + // Input slot contains something electrical. If possible, move one of it into the charging area. + IElectricItem item = (IElectricItem)(stack.getItem()); + for (int slot = Info.CB_SLOT_CHARGING; slot < Info.CB_SLOT_CHARGING + 12; ++slot) + { + if (contents[slot] == null) + { + // Grab one unit from input and move it to the selected slot. + contents[slot] = decrStackSize(Info.CB_SLOT_INPUT, 1); + break; + } + } + } + } + + public int gaugeEnergyScaled(int gaugeSize) + { + if (currentEnergy <= 0) + { + return 0; + } + + int result = currentEnergy * gaugeSize / adjustedStorage; + if (result > gaugeSize) result = gaugeSize; + + return result; + } + + //Networking stuff + + @SideOnly(Side.CLIENT) + @Override + public void receiveDescriptionData(int packetID, ByteBuf stream) + { + final int a; + final boolean b; + //try + //{ + a = stream.readInt(); + b = stream.readBoolean(); + /*} + catch (IOException e) + { + logDescPacketError(e); + return; + }*/ + chargeLevel = a; + doingWork = b; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + + @Override + public Packet getDescriptionPacket() + { + return createDescPacket(); + } + + @Override + protected void addUniqueDescriptionData(ByteBuf data) throws IOException + { + data.writeInt(chargeLevel); + data.writeBoolean(doingWork); + } + + // ISidedInventory + + /* + @Override + public int getStartInventorySide(ForgeDirection side) + { + switch (side) + { + case UP: + return Info.CB_SLOT_INPUT; + case DOWN: + return Info.CB_SLOT_OUTPUT; + default: + return Info.CB_SLOT_POWER_SOURCE; + } + } + + @Override + public int getSizeInventorySide(ForgeDirection side) + { + // Each side accesses a single slot + return 1; + } */ + + @Override + public int[] getAccessibleSlotsFromSide(int side) + { + switch (side) + { + //Correct values for top and bottom sides: 0 = bottom, 1 = top + case 0: + // return ChargingBenchSideOutput; + case 1: + // return ChargingBenchSideInput; + return ChargingBenchSideInOut; + default: + return ChargingBenchSidePower; + } + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack stack) + { + // Decide if the item is a valid IC2 electrical item + if (i == Info.CB_SLOT_POWER_SOURCE) return Utils.isItemDrainable(stack, powerTier); + if (i == Info.CB_SLOT_INPUT) return Utils.isItemChargeable(stack, powerTier); + // Info.CB_SLOT_OUTPUT ? + return false; + } + + // Returns true if automation can insert the given item in the given slot from the given side. Args: Slot, item, side + @Override + public boolean canInsertItem(int i, ItemStack itemstack, int j) // canInsertItem + { + if (i == Info.CB_SLOT_INPUT || i == Info.CB_SLOT_POWER_SOURCE) return true; + return false; + } + + // Returns true if automation can extract the given item in the given slot from the given side. Args: Slot, item, side + @Override + public boolean canExtractItem(int i, ItemStack itemstack, int j) // canExtractItem + { + if (i == Info.CB_SLOT_OUTPUT || i == Info.CB_SLOT_POWER_SOURCE) return true; + return false; + } + + // IInventory + + @Override + public int getSizeInventory() + { + // Only input/output slots are accessible to machines + return 3; + } + + @Override + public String getInventoryName() + { + switch (baseTier) + { + case 1: + return Info.KEY_BLOCK_NAMES[0] + Info.KEY_NAME_SUFFIX; + case 2: + return Info.KEY_BLOCK_NAMES[1] + Info.KEY_NAME_SUFFIX; + case 3: + return Info.KEY_BLOCK_NAMES[2] + Info.KEY_NAME_SUFFIX; + } + return ""; + } + + @Override + public void markDirty(int slot) + { + if (slot == Info.CB_SLOT_INPUT || slot == Info.CB_SLOT_OUTPUT) + { + // Move item from input to output if not valid. (Wrong tier or not electric item.) + if (contents[Info.CB_SLOT_INPUT] != null && contents[Info.CB_SLOT_OUTPUT] == null) + { + if (!isItemValid(Info.CB_SLOT_INPUT, contents[Info.CB_SLOT_INPUT])) + { + contents[Info.CB_SLOT_OUTPUT] = contents[Info.CB_SLOT_INPUT]; + contents[Info.CB_SLOT_INPUT] = null; + } + } + } + else if (slot >= Info.CB_SLOT_UPGRADE && slot < Info.CB_SLOT_UPGRADE + 4) + { + // One of the upgrade slots was touched, so we need to recalculate. + doUpgradeEffects(); + } + else if (slot >= Info.CB_SLOT_CHARGING && slot < Info.CB_SLOT_CHARGING + 12) + { + // Make sure it's not fully charged already? Not sure, full items will be output in updateEntity + + } + else if (slot == Info.CB_SLOT_POWER_SOURCE) + { + // Perhaps eject the item if it's not valid? No, just leave it alone. + // If machinery added it the player can figure out the problem by trying to remove and replace it and realizing it won't fit. + } + super.markDirty(); + } + + @Override + public void markDirty() + { + // We're not sure what called this or what slot was altered, so make sure the upgrade effects are correct just in case and then pass the call on. + doUpgradeEffects(); + super.markDirty(); + } + + @Override + public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) { + return true; + } + + @Override + public double getOutputEnergyUnitsPerTick() { + return 0; + } + + @Override + public boolean isTeleporterCompatible(ForgeDirection side) { + return false; + } + + @Override + public double demandedEnergyUnits() { + // return (currentEnergy < adjustedStorage && !receivingRedstoneSignal()); + if(!receivingRedstoneSignal()) + { + return adjustedStorage - currentEnergy; + } + return 0; + } + + @Override + public double injectEnergyUnits(ForgeDirection directionFrom, double amount) { + int surplus = 0; + if (AdvancedPowerManagement.proxy.isServer()) + { + // if supply is greater than the max we can take per tick + if (amount > adjustedMaxInput) + { + //If the supplied EU is over the baseMaxInput, we're getting + //supplied higher than acceptable current. Pop ourselves off + //into the world and return all but 1 EU, or if the supply + //somehow was 1EU, return zero to keep IC2 from spitting out + //massive errors in the log + selfDestroy(); + if (amount <= 1) + return 0; + else + return amount - 1; + } + else + { + if (currentEnergy > adjustedStorage) currentEnergy = adjustedStorage; + currentEnergy += amount; + energyReceived += amount; + // check if our current energy level is now over the max energy level + if (currentEnergy > adjustedStorage) + { + //if so, our surplus to return is equal to that amount over + surplus = currentEnergy - adjustedStorage; + //and set our current energy level TO our max energy level + currentEnergy = adjustedStorage; + energyReceived -= surplus; + } + //surplus may be zero or greater here + } + } + return surplus; + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/tileentities/TECommon.java b/src/main/java/com/kaijin/AdvPowerMan/tileentities/TECommon.java new file mode 100755 index 0000000..7c51234 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/tileentities/TECommon.java @@ -0,0 +1,134 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.tileentities; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + +import java.io.ByteArrayOutputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +import com.kaijin.AdvPowerMan.AdvPacket; +import com.kaijin.AdvPowerMan.ChannelHandler; +import com.kaijin.AdvPowerMan.Info; + +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.server.S3FPacketCustomPayload; +import net.minecraft.tileentity.TileEntity; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.FMLLog; + +public abstract class TECommon extends TileEntity +{ + @Override + public boolean canUpdate() + { + return true; + } + + /** + * TileEntities override this to select a GUI to open on block activation + * @return int guiID + */ + public int getGuiID() + { + return -1; + } + + /** + * TileEntites implement this to receive packet data, they are then responsible + * in their own code to handle the packet. + * @param packetID The first value from the packet, in case it's needed again + * @param stream The remaining unread packet data for the tile entity to handle + */ + public void receiveDescriptionData(int packetID, ByteBuf stream) {} // Stub for classes that need no desc data + + public void receiveGuiButton(int buttonID) {} // Stub for classes with no buttons + + public void receiveGuiControl(int controlID, int state) {} // Stub for classes with no other controls + + public void receiveGuiText(int fieldID, String text) {} // Stub for classes with no text fields + + /** + * Packet transmission from client to server of what button was clicked on the GUI. + * @param id = the button ID + */ + public void sendGuiButton(int id) + { + ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + DataOutputStream data = new DataOutputStream(bytes); + try + { + data.writeInt(0); // Packet ID for GUI button clicks + data.writeInt(xCoord); + data.writeInt(yCoord); + data.writeInt(zCoord); + data.writeInt(id); + } + catch (IOException e) + { + FMLLog.getLogger().info("[AdvancedPowerManagement] " + "Client failed to create packet. (Details: " + e.toString() + ")"); + return; + } + + //AdvancedPowerManagement.proxy.sendPacketToServer(new Packet250CustomPayload(Info.PACKET_CHANNEL, bytes.toByteArray())); + ChannelHandler.instance.sendToServer(new AdvPacket(bytes.toByteArray())); + } + + /** + * Does the bulk of the work of creating the description packet. + * Performs a callback to addUniqueDescriptionData. That method must be overridden. + * We're not overriding getDescriptionPacket in this class because not all of our tile entities need such packets. + * @return The completed Packet250. + */ + protected Packet createDescPacket() + { + //if (ChargingBench.isDebugging) System.out.println("TE getAuxillaryInfoPacket()"); + //ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + //DataOutputStream data = new DataOutputStream(bytes); + ByteBuf data = Unpooled.buffer(); + try + { + data.writeInt(0); + data.writeInt(xCoord); + data.writeInt(yCoord); + data.writeInt(zCoord); + addUniqueDescriptionData(data); + } + catch (IOException e) + { + FMLLog.getLogger().info("[AdvancedPowerManagement] " + "Server failed to create description packet. (Details: " + e.toString() + ")"); + } + //ChannelHandler.instance.sendToPlayer(new AdvPacket(bytes.toByteArray()), player); + return new S3FPacketCustomPayload("Test", data); + } + + /** + * Tile Entities that use description packets must override this to write whatever + * information they require into 'data' + * @param data - Base packet data with packet ID and coordinates already written + */ + protected void addUniqueDescriptionData(ByteBuf data) throws IOException + { + // Why can't I throw something that I WANT to be uncaught so it stops the program?? + // Piggy-backing on IOException is stupid, but hopefully this will never end up happening anyway. + throw new IOException("This tile entity must override addUniqueDescriptionData to pass its description correctly! " + this.getClass()); + } + + protected void logDescPacketError(Exception e) + { + FMLLog.getLogger().info("[AdvancedPowerManagement] " + "Client received invalid description packet. (Details: " + e.toString() + ")"); + } + + public void dropContents() {} // Stub for block destroyed event + + public void markDirty(int slot) + { + markDirty(); + } +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/tileentities/TECommonBench.java b/src/main/java/com/kaijin/AdvPowerMan/tileentities/TECommonBench.java new file mode 100755 index 0000000..7fa1ea0 --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/tileentities/TECommonBench.java @@ -0,0 +1,175 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.tileentities; + +import ic2.api.energy.event.EnergyTileUnloadEvent; +import ic2.api.energy.tile.IEnergyTile; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.MinecraftForge; + +public abstract class TECommonBench extends TECommon implements IInventory +{ + protected ItemStack[] contents; + + protected boolean initialized = false; + + public int baseTier; + public int powerTier; // Transformer upgrades allow charging from energy crystals and lapotrons + + //For outside texture display + public boolean doingWork; + + public boolean receivingRedstoneSignal() + { + return worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord); + } + + @Override + public void invalidate() + { + if (worldObj != null && initialized) + { + EnergyTileUnloadEvent unloadEvent = new EnergyTileUnloadEvent((IEnergyTile)this); + MinecraftForge.EVENT_BUS.post(unloadEvent); + } + super.invalidate(); + } + + // Common IC2 API function + public boolean isAddedToEnergyNet() + { + return initialized; + } + + /** + * This will cause the block to drop anything inside it, create a new item in the + * world of its type, invalidate the tile entity, remove itself from the IC2 + * EnergyNet and clear the block space (set it to air) + */ + protected abstract void selfDestroy(); + + public void dropItem(ItemStack item) + { + EntityItem entityitem = new EntityItem(worldObj, (double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D, item); + entityitem.delayBeforeCanPickup = 10; + worldObj.spawnEntityInWorld(entityitem); + } + + @Override + public void dropContents() + { + ItemStack item; + for (int i = 0; i < contents.length; ++i) + { + item = contents[i]; + contents[i] = null; + if (item != null && item.stackSize > 0) dropItem(item); + } + } + + public abstract int getSizeInventory(); + + @Override + public ItemStack getStackInSlot(int i) + { + return contents[i]; + } + + @Override + public ItemStack decrStackSize(int slot, int amount) + { + if (this.contents[slot] != null) + { + ItemStack output; + + if (this.contents[slot].stackSize <= amount) + { + output = this.contents[slot]; + this.contents[slot] = null; + this.markDirty(slot); + return output; + } + else + { + output = this.contents[slot].splitStack(amount); + + if (this.contents[slot].stackSize <= 0) + { + this.contents[slot] = null; + } + this.markDirty(slot); + return output; + } + } + else + { + return null; + } + } + + @Override + public ItemStack getStackInSlotOnClosing(int slot) + { + if (this.contents[slot] == null) + { + return null; + } + + ItemStack stack = this.contents[slot]; + this.contents[slot] = null; + return stack; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack itemstack) + { + this.contents[slot] = itemstack; + + if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) + { + itemstack.stackSize = getInventoryStackLimit(); + } + this.markDirty(slot); + } + + /** + * Returns the name of the inventory. + */ + @Override + public abstract String getInventoryName(); + + @Override + public boolean hasCustomInventoryName() + { + return false; + } + + @Override + public int getInventoryStackLimit() + { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer entityplayer) + { + if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) + { + return false; + } + + return entityplayer.getDistanceSq((double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D) <= 64D; + } + + @Override + public void openInventory() {} + + @Override + public void closeInventory() {} + +} diff --git a/src/main/java/com/kaijin/AdvPowerMan/tileentities/TEStorageMonitor.java b/src/main/java/com/kaijin/AdvPowerMan/tileentities/TEStorageMonitor.java new file mode 100755 index 0000000..24ca01c --- /dev/null +++ b/src/main/java/com/kaijin/AdvPowerMan/tileentities/TEStorageMonitor.java @@ -0,0 +1,595 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 Yancarlo Ramsey and CJ Bowman + * Licensed as open source with restrictions. Please see attached LICENSE.txt. + ******************************************************************************/ +package com.kaijin.AdvPowerMan.tileentities; + +import ic2.api.tile.IEnergyStorage; +import io.netty.buffer.ByteBuf; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +import com.kaijin.AdvPowerMan.AdvancedPowerManagement; +import com.kaijin.AdvPowerMan.Info; +import com.kaijin.AdvPowerMan.items.ItemCardBase; +import com.kaijin.AdvPowerMan.items.ItemStorageLinkCard; + +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.Constants; +import net.minecraftforge.common.util.ForgeDirection; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class TEStorageMonitor extends TECommon implements ISidedInventory +{ + private ItemStack[] contents; + + private int tickTime = 0; + private int tickDelay = 5; + + public int lowerBoundary = 60; + public int upperBoundary = 90; + + private boolean tileLoaded = false; + + public int energyStored = 0; + public int energyCapacity = 0; + public int chargeLevel = 0; + + public boolean isPowering = false; + public boolean blockState = false; + + public int[] targetCoords; + + private static final int[] storageMonitorSideUniversal = {Info.SM_SLOT_UNIVERSAL}; + + public TEStorageMonitor() + { + super(); + contents = new ItemStack[Info.SM_INVENTORY_SIZE]; + } + + /** + * Reads a tile entity from NBT. + */ + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) + { + super.readFromNBT(nbttagcompound); + + // State info to remember + isPowering = nbttagcompound.getBoolean("isPowering"); + upperBoundary = nbttagcompound.getInteger("upperBoundary"); + lowerBoundary = nbttagcompound.getInteger("lowerBoundary"); + + // Our inventory + NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND); + //Redundant: contents = new ItemStack[Info.SM_INVENTORY_SIZE]; + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound1.getByte("Slot") & 255; + + if (j >= 0 && j < contents.length) + { + contents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } + } + } + + /** + * Writes a tile entity to NBT. + */ + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) + { + super.writeToNBT(nbttagcompound); + + // State info to remember + nbttagcompound.setBoolean("isPowering", isPowering); + nbttagcompound.setInteger("upperBoundary", upperBoundary); + nbttagcompound.setInteger("lowerBoundary", lowerBoundary); + + // Our inventory + NBTTagList nbttaglist = new NBTTagList(); + for (int i = 0; i < contents.length; ++i) + { + if (contents[i] != null) + { + //if (ChargingBench.isDebugging) System.out.println("WriteNBT contents[" + i + "] stack tag: " + contents[i].stackTagCompound); + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte)i); + contents[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + } + nbttagcompound.setTag("Items", nbttaglist); + } + + @Override + public int getGuiID() + { + return Info.GUI_ID_STORAGE_MONITOR; + } + + /** + * This will cause the block to drop anything inside it, create a new item in the + * world of its type, invalidate the tile entity, remove itself from the IC2 + * EnergyNet and clear the block space (set it to air) + */ + private void selfDestroy() + { + dropContents(); + ItemStack stack = new ItemStack(AdvancedPowerManagement.blockAdvPwrMan, 1, 11); + dropItem(stack); + worldObj.setBlockToAir(xCoord, yCoord, zCoord); + this.invalidate(); + } + + public void dropItem(ItemStack item) + { + EntityItem entityitem = new EntityItem(worldObj, (double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D, item); + entityitem.delayBeforeCanPickup = 10; + worldObj.spawnEntityInWorld(entityitem); + } + + @Override + public void dropContents() + { + ItemStack item; + int i; + for (i = 0; i < contents.length; ++i) + { + item = contents[i]; + if (item != null && item.stackSize > 0) dropItem(item); + } + } + + public boolean isItemValid(int slot, ItemStack stack) + { + // Decide if the item is valid to place in a slot + return stack != null && stack.getItem() instanceof ItemStorageLinkCard; + } + + /** + * Runs once on tile entity load to make sure all of our internals are setup correctly + */ + private void onLoad() + { + if (!AdvancedPowerManagement.proxy.isClient()) + { + tileLoaded = true; + checkInventory(); + if (targetCoords != null) + { + TileEntity tile = null; + if (targetCoords[3] == worldObj.provider.dimensionId) + { + tile = worldObj.getTileEntity(targetCoords[0], targetCoords[1], targetCoords[2]); + } + + if (tile instanceof IEnergyStorage) + { + energyStored = ((IEnergyStorage)tile).getStored(); + energyCapacity = ((IEnergyStorage)tile).getCapacity(); + blockState = true; + } + else + { + energyStored = 0; + energyCapacity = 0; + blockState = false; + } + } + chargeLevel = gaugeEnergyScaled(12); + + if (energyCapacity > 0) // Avoid divide by zero and also test if the remote energy storage is valid + { + updateRedstone(); + } + else if (isPowering) // If we're emitting redstone at this point, we need to shut it off + { + isPowering = false; + worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + } + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + } + + @Override + public void updateEntity() //TODO Marked for easy access + { + if (AdvancedPowerManagement.proxy.isClient()) return; + + if (!tileLoaded) + { + onLoad(); + } + + // Delayed work + if (tickTime > 0) + { + tickTime--; + } + else + { + tickTime = tickDelay; + if (targetCoords != null) + { + TileEntity tile = null; + if (targetCoords[3] == worldObj.provider.dimensionId) + { + tile = worldObj.getTileEntity(targetCoords[0], targetCoords[1], targetCoords[2]); + } + + if (tile instanceof IEnergyStorage) + { + //if (ChargingBench.isDebugging) System.out.println("updateEntity - check energy level of remote block"); + energyStored = ((IEnergyStorage)tile).getStored(); + energyCapacity = ((IEnergyStorage)tile).getCapacity(); + if (!blockState) + { + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + blockState = true; + } + else + { + energyStored = 0; + energyCapacity = 0; + if (blockState) + { + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + blockState = false; + } + } + + if (energyCapacity > 0) // Avoid divide by zero and also test if the remote energy storage is valid + { + updateRedstone(); + } + else if (isPowering) // If we're emitting redstone at this point, we need to shut it off + { + isPowering = false; + worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + } + + // Trigger this only when charge level passes where it would need to update the client texture + int oldChargeLevel = chargeLevel; + chargeLevel = gaugeEnergyScaled(12); + if (oldChargeLevel != chargeLevel) + { + //if (ChargingBench.isDebugging) System.out.println("TE oldChargeLevel: " + oldChargeLevel + " chargeLevel: " + chargeLevel); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + } + } + + private void updateRedstone() + { + float chargePercent = ((float)energyStored * 100.0F) / (float)energyCapacity; + if ((isPowering == false && chargePercent < lowerBoundary) || (isPowering == true && chargePercent >= upperBoundary)) + { + if (Info.isDebugging) System.out.println("Storage Monitor toggling redstone. chargePercent:" + chargePercent); + isPowering = !isPowering; + worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + } + + private void checkInventory() + { + ItemStack item = getStackInSlot(Info.SM_SLOT_UNIVERSAL); + if (item == null || !(item.getItem() instanceof ItemStorageLinkCard)) + { + targetCoords = null; + energyCapacity = 0; + energyStored = 0; + blockState = false; + } + else + { + targetCoords = ItemCardBase.getCoordinates(item); + ItemCardBase.setCoordinates(item, targetCoords); // Make sure old cards have a dimension number + } + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + + boolean receivingRedstoneSignal() + { + return worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord); + } + + public int gaugeEnergyScaled(int gaugeSize) + { + if (energyStored <= 0 || energyCapacity <= 0) + { + return 0; + } + + int result = energyStored * gaugeSize / energyCapacity; + if (result > gaugeSize) result = gaugeSize; + + return result; + } + + //Networking stuff + + /** + * Packet reception by server of what button was clicked on the client's GUI. + * @param id = the button ID + */ + @Override + public void receiveGuiButton(int id) + { + switch (id) + { + case 0: + upperBoundary -= 10; + if (upperBoundary < 1) upperBoundary = 1; + if (upperBoundary < lowerBoundary) lowerBoundary = upperBoundary; + break; + case 1: + upperBoundary -= 1; + if (upperBoundary < 1) upperBoundary = 1; + if (upperBoundary < lowerBoundary) lowerBoundary = upperBoundary; + break; + case 2: + upperBoundary += 1; + if (upperBoundary > 100) upperBoundary = 100; + break; + case 3: + upperBoundary += 10; + if (upperBoundary == 11) upperBoundary = 10; + if (upperBoundary > 100) upperBoundary = 100; + break; + case 4: + lowerBoundary -= 10; + if (lowerBoundary < 1) lowerBoundary = 1; + break; + case 5: + lowerBoundary -= 1; + if (lowerBoundary < 1) lowerBoundary = 1; + break; + case 6: + lowerBoundary += 1; + if (lowerBoundary > 100) lowerBoundary = 100; + if (lowerBoundary > upperBoundary) upperBoundary = lowerBoundary; + break; + case 7: + lowerBoundary += 10; + if (lowerBoundary == 11) lowerBoundary = 10; + if (lowerBoundary > 100) lowerBoundary = 100; + if (lowerBoundary > upperBoundary) upperBoundary = lowerBoundary; + break; + } + } + + @Override + public Packet getDescriptionPacket() + { + return createDescPacket(); + } + + @Override + protected void addUniqueDescriptionData(ByteBuf data) throws IOException + { + data.writeInt(chargeLevel); + data.writeBoolean(isPowering); + data.writeBoolean(blockState); + } + + @SideOnly(Side.CLIENT) + @Override + public void receiveDescriptionData(int packetID, ByteBuf stream) + { + final int a; + final boolean b; + final boolean c; + //try + //{ + a = stream.readInt(); + b = stream.readBoolean(); + c = stream.readBoolean(); + /*} + catch (IOException e) + { + logDescPacketError(e); + return; + }*/ + + chargeLevel = a; + isPowering = b; + blockState = c; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + + // ISidedInventory + +/* @Override + public int getStartInventorySide(ForgeDirection side) + { + return Info.SM_SLOT_UNIVERSAL; + } + + @Override + public int getSizeInventorySide(int side) + { + // Each side accesses a single slot + return 1; + } +*/ + + @Override + public int[] getAccessibleSlotsFromSide(int side) + { + return storageMonitorSideUniversal; + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack stack) + { + // Decide if the item is a link card + return (i == Info.SM_SLOT_UNIVERSAL && stack != null && stack.getItem() instanceof ItemStorageLinkCard); + } + + // Returns true if automation can insert the given item in the given slot from the given side. Args: Slot, item, side + @Override + public boolean canInsertItem(int i, ItemStack itemstack, int j) // canInsertItem + { + return true; + } + + // Returns true if automation can extract the given item in the given slot from the given side. Args: Slot, item, side + @Override + public boolean canExtractItem(int i, ItemStack itemstack, int j) // canExtractItem + { + return true; + } + + // IInventory + + @Override + public boolean hasCustomInventoryName() + { + return false; + } + + @Override + public int getSizeInventory() + { + // Only input/output slots are accessible to machines + return 1; + } + + @Override + public ItemStack getStackInSlot(int i) + { + return contents[i]; + } + + @Override + public ItemStack decrStackSize(int slot, int amount) + { + if (contents[slot] != null) + { + ItemStack output; + + if (contents[slot].stackSize <= amount) + { + output = contents[slot]; + contents[slot] = null; + this.markDirty(slot); + return output; + } + else + { + output = contents[slot].splitStack(amount); + + if (contents[slot].stackSize == 0) + { + contents[slot] = null; + } + this.markDirty(slot); + return output; + } + } + else + { + return null; + } + } + + @Override + public ItemStack getStackInSlotOnClosing(int slot) + { + if (contents[slot] == null) + { + return null; + } + + ItemStack stack = contents[slot]; + contents[slot] = null; + return stack; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack itemstack) + { + contents[slot] = itemstack; + + if (Info.isDebugging && itemstack != null) + { + if (AdvancedPowerManagement.proxy.isServer()) + { + System.out.println("Server assigned stack tag: " + itemstack.stackTagCompound); +// if (itemstack.stackTagCompound != null) System.out.println(" " + itemstack.stackTagCompound.getTags().toString()); + } + if (AdvancedPowerManagement.proxy.isClient()) + { + System.out.println("Client assigned stack tag: " + itemstack.stackTagCompound); +// if (itemstack.stackTagCompound != null) System.out.println(" " + itemstack.stackTagCompound.getTags().toString()); + } + } + if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) + { + itemstack.stackSize = getInventoryStackLimit(); + } + this.markDirty(slot); + } + + @Override + public void markDirty(int slot) + { + this.markDirty(); + } + + @Override + public void markDirty() + { + if (Info.isDebugging) System.out.println("TEStorageMonitor.onInventoryChanged"); + checkInventory(); + super.markDirty(); + } + + @Override + public String getInventoryName() + { + return Info.KEY_BLOCK_NAMES[11] + Info.KEY_NAME_SUFFIX; + } + + @Override + public int getInventoryStackLimit() + { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer entityplayer) + { + if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) + { + return false; + } + + return entityplayer.getDistanceSq((double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D) <= 64D; + } + + @Override + public void openInventory() {} + + @Override + public void closeInventory() {} +} diff --git a/src/main/resources/assets/advancedpowermanagement/lang/en_US.lang b/src/main/resources/assets/advancedpowermanagement/lang/en_US.lang new file mode 100755 index 0000000..815089e --- /dev/null +++ b/src/main/resources/assets/advancedpowermanagement/lang/en_US.lang @@ -0,0 +1,51 @@ +blockChargingBench1.name=LV Charging Bench +blockChargingBench2.name=MV Charging Bench +blockChargingBench3.name=HV Charging Bench +blockEmitterBlock1.name=LV Emitter +blockEmitterBlock2.name=MV Emitter +blockEmitterBlock3.name=HV Emitter +blockAdjustableTransformer.name=Adjustable Transformer +blockEmitterAdjustable.name=Adjustable Emitter +blockBatteryStation1.name=LV Battery Station +blockBatteryStation2.name=MV Battery Station +blockBatteryStation3.name=HV Battery Station +blockStorageMonitor.name=Storage Monitor + +AdvPwrMan.dir.down=Down +AdvPwrMan.dir.up=Up +AdvPwrMan.dir.north=North +AdvPwrMan.dir.south=South +AdvPwrMan.dir.west=West +AdvPwrMan.dir.east=East + +item.benchTools.toolkit.name=Charging Bench Toolkit +item.benchTools.LV-kit.name=LV Charging Bench Components +item.benchTools.MV-kit.name=MV Charging Bench Components +item.benchTools.HV-kit.name=HV Charging Bench Components + +item.itemStorageLinkCard.name=Energy Link Card +item.itemStorageLinkCardCreator.name=Energy Link Card (Blank) + +AdvPwrMan.title=Advanced Power Management +AdvPwrMan.misc.EU=EU +AdvPwrMan.misc.in=In +AdvPwrMan.misc.out=Out +AdvPwrMan.charger.maxEU=Max +AdvPwrMan.charger.requiredEU=Req +AdvPwrMan.charger.redstonePower=Pwr +AdvPwrMan.charger.estimatedTime=ETC +AdvPwrMan.charger.averageInput=Avg. EU/t In +AdvPwrMan.emitter.packet=Packet size (Voltage) +AdvPwrMan.emitter.output=Output / Tick (Max 64 Packets) +AdvPwrMan.transformer.limit=Transfer Rate (Max 64 Packets) +AdvPwrMan.monitor.invalid=No Valid Link +AdvPwrMan.monitor.upper=Upper Threshold (Off) +AdvPwrMan.monitor.lower=Lower Threshold (On) +AdvPwrMan.station.modeline1=Only when +AdvPwrMan.station.modeline2=required +AdvPwrMan.station.average=Avg. EU/t +AdvPwrMan.station.remaining=Remaining +AdvPwrMan.station.led.days= DAYS +AdvPwrMan.station.led.unknown=UNKNOWN +AdvPwrMan.station.packetIn=Avg. Pkt In +AdvPwrMan.station.EUbuffered=EU Buffered \ No newline at end of file diff --git a/src/main/resources/assets/advancedpowermanagement/textures/GUIAdjustableTransformer.png b/src/main/resources/assets/advancedpowermanagement/textures/GUIAdjustableTransformer.png new file mode 100755 index 0000000000000000000000000000000000000000..d1917335080ebabfb3db4f44a4c8e3408af3a55c GIT binary patch literal 1750 zcmaJ>4>Z$T9KSzf6Em&E$iKJVAswZbBo1%>%qSL>KdE_pHT_5ajJ0fbbV}r3De_P( z{V~i@G5KFaOG?R`KgmiNLn+C^wl{S;@73|%z2~0qz2AH9_kKU$`~7|ry-7qZ4Fe4T zfR=~5>ox!&b^4)0My<20acwnJg!tC zqCC6^h<-ISRV&@tGm1&&#l0S`PCMwmi3AMFp*!p4^<^*TlnMR(K zH?6Ff5uOIB*M4}L5Z)8YFYPbaYlSAH(qW{_J!4~IEOt*_&}F9i#87L4^rK7AOItP5 zudo0f02QzpumMm73#igli?7AaeHz(*&V+%>Za!ku$!Nxu4V>pq6^mJvh5>V$Gnbpx zbtw1?j&!bfDyO%CMSH02z&y5jsPM(^fhz8?v*&pO&v`T^NM8pn^pu{cr=Zc-SD&T1 z3EoJ>C3YQpYw45_{oV+UXrqesB{F#^|M1+j4Ij&Qu>Ci5 zdR>cDk~jsjLBGqP9T5@4&Be_wYX05TE*EG*id^`8Z%{^ZX! zxl0^X06bGdHT}_dQ>`cU@G(Zm$(gbYiR46LZwZloz zn(viWWAh8xW0RBJb75u32}h9M=Lp*gnw4?gYO7$k=SJbiI-|Cq zq5hMqp771JtPC!fVZ_Qw+F=e$DR(e{QE=HvyASb0l_L?tYv<$M>y!z~D~V_{jVwf? zEA!*gbUOX?>C;mTrW7>_`{QQ8xnk?qLF#*^zxRo?8z^+7kvCBH(c&LL3^cvklm^|?QTZ2AhMW# z1)T;Q`XNID(Tn|6?fb5z+Lca0`P$#YT0H_|uWO?{)q(JzBgoeGR{+=Mh&#!gm2L{+ zg5{f1qFzY)NE;>%CgIaL+x=DVt@u{lbA{zgJGhOKLT@qMm%`9syTEdrxO_?OE~5B0 z@p~05Oa_ohN4bHc`ci1;%3NYfG#(8HEbIPe7$417+#Xzo<*ZEV4&{^9ykQ`Y#>9w^ ztTnJxl4nq{GGH_zBAax*yl)(?2)^EV&@!vd`Bsy^G9>Sw$z)8jkk&sHPLdhY$gNxC zF9rr`+^YfxPN~Ff(3p_M$qU?;8#}gcNxOV6PczCG+@a5Y9{2doKl7@W1sY@xJ-27~ zhnj;bx|>S;Jdx#Vi_S6Uq&~$iJZR!o6QUIL4zR~mD7ShJ(4?EqP2aE(-kHHxEC?D64MI?3j{8&KJdH~o=WMXzIXP%m1& zd+JkRxfswnVy%0IAVx?=Z5uU>q0F}6rwR3`lZIX>VjAdZF?z|Ui^i&gO@FrUYY}UL hh`o8r@BY7Lx>Nz#@f|wvYY^1t&v_6?t~_T-{NH1OuKEA~ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/GUIAdvEmitter.png b/src/main/resources/assets/advancedpowermanagement/textures/GUIAdvEmitter.png new file mode 100755 index 0000000000000000000000000000000000000000..403b0c50bd7d593f3952963fcc3ea2536e0dcc04 GIT binary patch literal 1879 zcmb`HdpJ~S9LL`ox0xYLZN(~#u$h`9J&6>S%_0kT5E$NA8k(Fh|XTvoFdBVx~~ZCm?Cf9*NXIq!Mj=ly-p=llD;@0;e~=C}l> zg#!RAadxuz0ssYnq5wu2ZuZBNgu;#T0T)Mmuz=iL0WSw0!A3dx#R8yy4|!0xe-0ai z2UX&nT^&?jtD>=6)t>XniE!X=&h|FnCv=W=Z;t5NyGEr?NQkXEbOhfJYfLdQ%O@Pp zR_~|$VyW?6|9-pdW{-rcXjHe_%R7`e>VD)fYU;jB#*?azZ_{#nrcvnh_8C>~L(Wsq zBOxi#N2Psf$C%GyJ$g;nTu_jmJW2C@nd7{?27f<|ri;S*Nd z$|ZxVuZ_ zt~z8-gt4%D5G)>y^_+{a*&RF|$2=XHj=xZLwlH4cB*o6)(LOb3Ex4V_VCMb4BrNUu=m2 zq>LypLqsnj>7gSWX$Z#=4+Q2S!m$hCC_p&O4XL#ts?zQ5gbzb39ZQ<49?6B6DipTV zb5ne9(n+?XAgm=2Hjag=NZom*MYU$zav}29a{Yk!L9XIo{)XWS&;So002Be??fkT3a4H5iso@hQgn|J6&z18@DKi0zS(m5B}bu&7pBB z0!t+Qmlafj#>h=e+69qF2AF$~$l>B3$?*HqEsG#salv_BJk zQA400R`g~Mq4b(5N1Qa5mw?Kao_u*Oz&8kXKi)|Pm=HgHRT*q~=o9|(sO01b{bP3& zo>Y;_cr8~mREavMm&aMG!oqf~(F|F_8e0rwW2MsZfK+~k9p>WHyY^Ja`rev>h_@^H zTI0y!2E%XP9vzxIwc6?))dVx%BiJG=yd|BJOWk;-{?F%&h9nFb&gC{ zSFOKpG5Flo4-;Ius=+-!fX!w{NL)=AyBjwj9O*Q3U zQ%1qT=FV6WtwQ0eKfwbt6b2A%_9~k4CSrdQo}~=NC1Sw$Xq)#7|Wy4++5@@utS|O{7Balnzfo3WQvJCtC|$ zrA9m!`g6JeSvCI_#{ed5Ae&HzX12^&JUr-4oyzo1`8&wqgj^iIeW@OuB)T6*z7?(a zN*~I}`Nsc@;36F4>(e?iIo$5dS30$u?~+rTREzHUMLiXiOWl$xe}LwyMM|C zgtz8$P7MkPqZcu3-G!Bq7s^>4c<{!gONpsPK7|9! x^=H?n3lFZg1=*K0MSOku;2v>CgRfp`@}=E}%)GxfjV(szIXk%7SJ+Zd{{@pR*6{!U literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/GUIBatteryStation.png b/src/main/resources/assets/advancedpowermanagement/textures/GUIBatteryStation.png new file mode 100755 index 0000000000000000000000000000000000000000..3150f51e6b2f0ad5f9e22a8f21d3ad98696a4d44 GIT binary patch literal 2027 zcma)-c~Dc=9>-5Y2p0qlB~YL!i6RhLwOA?1lgRQSR`!Zepd?BWMV26YTmnKV2n4h$ zmMz0#5GaBQK@ka9ii!-Iov=d;4x5N3AhIRzUTojYoAHl#@7#0le9rIu&i8kIzjJT8 zyDLpiMNb6)pyqtY(Gvg^{E7k)7Vi9`DuUq-d;B|^BakCEx0!bpCd!eAe9r=)-ikb^ z#@x_(7%D|OyErM0Y{6kQlxV#}ESSVQJ0AQ#erSHQ`Se%5I@pP?iA%Sfb$>M-*hR`D z^rwupwl(4=jn2GDoZHnF+uU`%%|}?xh10`oR4FCowafhh?5 zf(JFWf`P%o+v|jk5-6c)eAqHTcw)PHT9)3_0X{=aLXVBBa7{7}kGJsoaSI#JT>OhC zqFN7e*-*cSMh^+3dt&f_n1cIvY3{DbWIU=Wq32d$u(jS`sj}ox0-6e0%`JXUv}y-9 z^vp`slfCj=-Bqaj)|i)=AvcZMa+G_Ahd*?`cn4Ptq)QJAw6TH!&WO}oHCv|a1&**3 z=@Q-(Q{f^*BVjkOSi zwf1%=n*#?Pzu$Y(NuY+Mdf*um5tfyK4{JI`?lZMlK8|;o$Zg1WG2!cauz?b_XsUN# ziH>^OwWfDRY*(yL72w@2;ZcR?Y6_#WN2B6fJW3I~Kw>RB2n)zT#8BH1xT(bII|O18 zSb{)hM4q853boj*l zYpJ;Bcg-B2gJ-cNk^fYEkYsySA9bd&?iY7lkQx{g)D ze5FTY4w3!|;xlnkVZoaLEB`RGmHYeX*(^<=O?7u)jldSI%TpHnFF<9c@BZ~WFd}nR zwnb!m#prKKdiiNjKI;w+7{hjf+e10o)IU$H+f;Kt^|t7+5Jg1Tbo_~eO7S#Qh6T{4 z5dL?o|8`3NXV5r6O^(Lwbrp9o&R>tkBpdZY!5^?#Jk2YevCbK+*#q$a}-y z9o@Xo^)Du#SBQoMeAX))$teW#;Wmd5kd)Q`k?CU)kd&TXBXC6_-&1hKPv*r*Bc_;j z-i@McA8yQfrNTAqeA9mU%LZ((JE->Xy)Kg6WcPKM|2+KRLqob>oEn|7{bWCXf5ceO zPrlxdbvta1h708ud_I5MO6V0AZ$OOS2AEoCOE-mzP(@Jon&E*DwJV;DZ6bC{Z~o-R z>nBxZlXX<>?+80BkG{-K#u%I-qw2I?0z7TC|YOu0VmwN=9 z>3hd%YR+2h6_!TI7_mz|tkI^`fyE8umIDv^2imJ}wrU&MnfDl{=XCz)d*|N!&hPiV@ArMbd(XK! z9JaTv_Ev2GfUd6(D+mAx{e%FCfG(e%`sO&g5RQKA%>rxKD{j17h(@#oK4G5&px25G zsJ0+>8VwSKz5!mu0lW^ujw&VGwnihzd|3xRInz5m;1N&pH6;w&`la~Lw{G=2!LZ1! zJ@9Uee}PnB7Bp{sXtX55?m|Q9NRj1%iv2n62mL%Ly+%!=Pp%&|Rj60??k#y;z)mC{ z87;4pCPq4X=(nwnLvL(Cmla%EXDNR^yD6I-nYyH!FDxxC&XUXJpQ;w-M-^#1Vc z%Wq|GOZ}g$w(^=t>Cv>zO=~NQ-9-1*(-Uh_snjH8^`|&vJ$?P~FnYBc-9sj;tJ5YD zi5{N3S2=5%>E^Yj+R%k1dMW!v+Te)#$mYha3E#1&tdUapwACq>FK-o>l$=kT9n6{# zF3wrMXm7u%US7Db{e88*hvmrPESLLRnJ8GI@HopW{uvs6N%yXCr~x{Capv3JoRf>{ zeW!Y+7c{i!q1e=^S?ko5iS2#aeP-^dFjDT2@K8A|U&w9l-OmGvyK4}f7kTloG83sJ0SDslJt;<_qoXCuWOlfk1Y*Q9?oAT& zX34iF=y|1p8p|Ji%C&%)8fO`W1DKEcwXU87{+1N)RK?WnY<3spNq#Or&GhO&Ljbqw z+&_Lzd^j)=;pE{VvI`td_BOW$NpruAmqqi44fE4p51vYJ&moS}PBB21iVzsFV?cP2 z6$EPo?K?OlV8qs9fMItuE#BzIgqSxlOvWw@a~Q?c2BK-k7ls_bVPF^@h8aOIUUZ% zy#CGkJGMg)t3ptEWp)3M(tiBwGpBt~-lW2}Cf8<0Q#N6RTQPBMn7IDCXyKv*Sm7c} zoDC*UfMUQqEFHzc{M|+|jkb?=yJ4(4$2y;3f#SW7cJIZ=wqRrjF*JT@duIAg{G~YQ?Rdagf=DDv3#*YR!h?f@)Iztmva;8*vV@6Ww0W-E_ATPPy}hmf zRdpw;H_kD9;bPaLG0C@9_YxKv=JiR}W#?94YDQsUVQ<=TC(|S^Bw_+gMp_2mJuD@C z{Fgm@vMkOLm?WC((A?NbSFUwnYLAMN-O?cf?}wf^TBG@Q;A-6svHgy(00%zU3Naf) zW`d=f$gVEP$Oxu_Oz^T9Us)5M=mNs(?O;I41A92*lZKYySffJa{a?a`@T;& zwg03nZHBvt@ZAQVt0oo=o6B+(nB3t4x;Q7mvhG0`e2r8z_@h?` zw^;5KA~}8;}JEZ4DS7TEf#U#?%@UmOsvK)=Kt%<;>mIk@j6;=Y;A=Jp4AIz&AIIzse29Pqj@C9b2+2LEI!fZcd7(M1 z>DpleW^hJu56p8x0F%UdZj7V`^7^1l+8{X@HD82$UAFW?pC!8(ei9caN$#IA$Iy3Tfm@3~?v$|sz`3aY}3YOR>1mx1iT9o+mZlM_^{r%?u zuHpY=!7ViO!ZUizqN;Z^>kWjt7?6VgW|9BiM_d$ND+bjX6dHZj%EoQoY}@m2wS9#5 ze!dR6S*RPVF$i|P{#b$vOkuQR>Hhd?_8Ya*>~MNV-o2LfLy80K5v$#KjpR0-&E`&N zMTO~Sj9;~R0)b#SCSMoNbGfWP+)tx*&qjbhdys9*8|r&mU6+$Ke1qY9z1XaZgS?FY E01t8p>i_@% literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/GUIStorageMonitor.png b/src/main/resources/assets/advancedpowermanagement/textures/GUIStorageMonitor.png new file mode 100755 index 0000000000000000000000000000000000000000..3573ddcc8830c2eefb167fb11ae653b6f4826a11 GIT binary patch literal 1886 zcmbtUc~BE)6n`560fh+BX_10SDNz^^Xv@?TIaUcZq%|NI0ZnRbRj?@Gh+sHmW37lN zp@N{c;HnjLMrrT>5hBr|!BP&TQk1it#)60e%Mn61(3#emcKSzmXXov{@ArQ1{q}v| zOAq9&wU}o!4*)FuIqV<+gm^{3)PyjC*b6%dWAfR@YuPYkxN&7sHsLXg=7hxoP;VO^ z2y8q{j_@dbg4{61N_Fd*p3dGe(JbKLPTmvVwv^rPRY^WG#X94QFz#^3may1 zV^>2~-}zKOdgY|-I5rj!wSBQgvNtoniZqQ#qbVlfhIk+Sgg7FTrceS_zy5E9ho(Yk zYm+}$6;DFVI0KHz3gk7(s!1dK`Ss~XkN9zU`;SqXqE$#>xEX7Syho>N%g*~E2b&g< zTEtnK9FaZXz$2uIzN9Ji5G`Af{~dYPG7$U=tLjMsFNjpS5V)wvTC)hV*IUp`hdsqZ zY0+ZUnAZ?>B$O&0EL>9Ck%JA9(ROB6MZ$2RmsDENnS8dSZpv1_*GKtwT~B=umJ7lM z%_-E~XJa$|);B_g%Gg_SjHbwkXeJ~7oT2YquUZei>=D{>F>wQU7%kp z&Ds9AM%HfovuEtybB97N2Rv5RHc^OkWo1fGG0_0-_(^Z}9M^A(6(E?-V3jzXwQ z-o1D0J9=7N22n(zH`?%SKJW8#fsLA#BtQ3U>6{M3(3-2u5-@{O#vGF+%>Fq%>35^q zjlZ++OKUYt(xj{)wOZA%gw_LUJK5m8wug&VlM4dBvJ)Q(-ebFpq?wDJ75X~itc#2} z5eXe?GSPb)9m`!kXXD8pjsJ&cpu<>B$gC?hQQ&bQv>@W4iC~kU0UqqDSFF_P zBmk*{0DgZz0L5Zekc1|J$aHCfz%VUN@(z_+v$|ng7^X!mTA*00x~hvcwz3(ffCGK_Czm`E}sy7?2qzeUtlrDKe2LZkdzqWoGS zo6tH&*ifgMmw39f#CrOQqw9wsudiWi3zMX@Syti~O%eC?d305A{fDoF(^ZAN=$v>< b-G1j!_)?&UmOag#00000NkvXXu0mjfTQJeN literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/BenchBottom.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/BenchBottom.png new file mode 100755 index 0000000000000000000000000000000000000000..f09c57fddc1aaed516aa70fb78768731ec0727bf GIT binary patch literal 262 zcmV+h0r~!kP)K zfDd@xkKMNevC!npY28j1I_Ssw(;!P`qF>Uz;Cxt(1cDVbPjh2R1KRW}MZPYkg1gP4 zLH&MNI7iwjT+U|=u$8+aGLBlTO-cYP)4WR8bU$|93~9#>F?|F0RcWZi42u>@lPTg;5$ayGaO!Sq%mCltu<3jX{*K zL`4Szxw(*b)*$5S5hg~n3S1ODd7D{`LhW=GB}@#bMRaGL(k45r%lXgw?>Qg$Y6jN{ zCx{k)N{1XzpkA-z(ernhTmPWM@bClB;ScP|C6yaZT*h2>0JT~Tx5r+CeLt*$F^1gY zTVL~;%pL45&SOt5A@Xosp!h;MK>^swfo=003Tosbi(57XXkhmoT#s0RZGiD#|2z;XGLL4XJ1V9c@5I8<2_y zkS>>0vk>hNq8&2}5j72fhQU9F!F6)`2gz|gvP?mRp)eJO!ep6(ws|*g^KPyhJnw3A4ZWeSqT zBFSQrEK|@OcanVmy}+ap89_f*`G&o zl!eUOsO}%2x_}1PY`+d(|-R^@xJXo z9Zme+_i8HJQl`~{~JnjY#+5PN)drg*}m9iNyy^chst|7qB=uPX%lhr!d;&t;ucLK6V^lUPdt literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVBatteryStationOn.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVBatteryStationOn.png new file mode 100755 index 0000000000000000000000000000000000000000..a6513a9c15eea73c19aa51b8632ccbe61b34def0 GIT binary patch literal 254 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`M?GB}Ln>}1PY`+d(|-R^@xJXo z9ZmoAnCo~_xGIYHtKt3l-q86UaB+zP=L=XUlu7Acq-yk8{2u(>y)N03dyF*o(% z|C&2F2|fM1LEVCEOQafv*bKxQZYZ!S^z`>WWQvfO@Q7)OLBmmNO|}I`m^9)%zcP97 ze@$w9WYDm)L4>Egaf^ihxjhWR$ES)rR57Z2{QqLjg!OBH9%Arx^>bP0l+XkKDfU{| literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVBenchTop.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVBenchTop.png new file mode 100755 index 0000000000000000000000000000000000000000..34a32769a30db989c01c8998ac99523358041368 GIT binary patch literal 594 zcmV-Y05&Vcj zqoziDFxJ0zyl2+C-4-5B?#%4mvvX(8_&Sdq0MXjA58CeZw}`Ld&FN}CC^k>RN9X7B zSyZ3Sz%<(N{r<%Ud|4X7*X8rBZv{H=`_)akb4>lnN7i32=Wwd04O_P}c(<6rn_CGv zH|JCMv^*-d7olE1c3xDZ5~+ZH{%|)h1g|TD4FvSP&?LOWpZnTc_v72W3)osnWBP1A zrUrXa7&cH$h2@-x9LJSt4+`;q*r|}jNWkYv1!SSKxsZ}eYme4ZOj}rcydl1QE{xTO z>$o};l#?-5wu^wQh2a3o`3R(t>3e}ZM zcrsyOQZ=lU8~9&#Od7`0)^@5@`3DL*}k1m;{9S)Y^s$6p*}x;JS)|eNCHAH6PwBh%-*L)jj?QwhyVZp literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff0.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff0.png new file mode 100755 index 0000000000000000000000000000000000000000..393525bf815b9093dd6ac5631910882599cff2c0 GIT binary patch literal 342 zcmV-c0jd6pP)#; z;EH!Qw=?^8-rG5MTd$>mKW_os)rZG!Jx{w2i3c&zy1-t?L&?oy??DWi2t;o4IRX;I zKt*iswHqPtobw=#2tKEeIfAd*Ful9E@F30-uoei^o+aRf&i%FTfc*D+Kav0{5g>!& z-^Ek#MmXw$2mr<7=XP`hkq6Rf3Gl^w!1rj-@^27%P}TwZfi#!SL6HZV14#g!%Ep`r z8lvnRG?Vi{pblhabPGjuz}nU2S@1xxKAiNxb|BD!q*NXxwQPxUb6|fKxhw+Z3va<{ oT+UyEK4J=Np7qH~C)AMp2dkzRe!!b74FCWD07*qoM6N<$f`77=AOHXW literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff1.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff1.png new file mode 100755 index 0000000000000000000000000000000000000000..3efbc1aa5aae06afbe1e07605919fba5bf31bec0 GIT binary patch literal 347 zcmV-h0i^zkP)rup4%!-E)TU0|={q2%}P)`J)_5s2L869N*% zKt*i6&zd3cobw=#2xhO{gkU~-$S*I>Jcx?~tOWwKX9+l=eO>b%kY9{DkpyrQ0Wv85 zdhZ8sgnvB{0ibv|$f6sFJdj39fG^eqzMp$H{tY4z_H}@MAkBN{pv(i!fg}J3-r5QVo4ma^PV15%pG-r7?AYiGWNx6HaH zTD-fto!PhZ-p;xD&1JrvzXhy+KRh;zN#1^_dJqGx3+#0~lw9q$9>kD|K;$-`5Rf1S zDq{0vRttIOoCk44@ICG(1V5ks{O==lJ0L%M??e*7Sp>+S z`0r~Fyb%%)iU25|fye`Cv;_EKJ>dJb*Ys}?d2p-)^aE)=ItN7_XbvO+a4H)U z4>UxUfVD=o6bRIT%#3b9b8zTErF;=Q5UdX;J+K`JbRa2b50YB8M9Cc3pG7W5O3 puo|b6m!OZB0-I-j^xO(HylIL*J`pCf)h-VE!{Y2NG94a7isfwO^!ia&oF12JSG5V@}x2q+K( zHF5YRYs7j8!9bi4%wO&-`Cl~h(5}0FEL+ z2F+iyhvy*%KA^!2em~vItZ! ry#=pvIUPoQ#5DLi`KLiQ_E6gbLQp7zvv+-t00000NkvXXu0mjf{4J0q literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff12.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff12.png new file mode 100755 index 0000000000000000000000000000000000000000..304bcd7a3f3316d754bb1166fcb6dd3a19a06802 GIT binary patch literal 337 zcmV-X0j~auP)qcBO#86M2O2Zq7aFMpwS7PLKKRtsI_!{fRakDR^qQ6voV{ucju#+yS4Ln z?#=9@O8Hc9-cJp#hlR%N=m(9uqk%QReFA3{9waZ1y9U+}qX5Mv9}xf%D5b$79B#Tr z!>bpk-n=ESp0y(an`JjB7t$J7hXt@_1lXPwz!$t~PImx)H*Z-MfWHJ_1I4FR&tyY< z&42;`ipPD|x&bQ#dXxglMP`8CqfSk~0V{(~9l$?8&mZR?E(6X1Edcl`4n{KI5QXQU z;v|g#J7AdBEyT?M_Oh9T$$*eK{LDahK%fI!`FoJqvJ{HUf&8;DWeSjwy#?uU>ko}T jtWh9&>`w-ssR8!{t7j?>y9msc00000NkvXXu0mjfFgJ3-r5QVo4#0ZKSBp`}nBPk>x7?L!0V!9M!VPU0p+Sug>q>Pn)YRj0vcFDK!mf71= zQoOslo!PhZ-p;vZt(5KGp92mb3y<&5RW|6>J&1wU1@<}~N`CzuJ%}L_fyiw>As|5v zRK(`n-gU@3=RAlbg3ZfaLh!mAXE%*258^xlYk@%RSprVzx2wJb^4s|^k^ufifDDRv z>-*r1aMlA60E(v%z32ua52Vo&;EVNu@5!j+-yrhfR0rq>(tL6biagL9NCMzgHYOfu zi1KsLs$T{Ibs#gNTPT_X)+*(T;DKO$NIdwP5)XM`I}qqVQW6jH1R5l@Y>ARNus@4j v7J>4Gw_r8Ct)7BDVhU`Y_1R-T)R6lHJ?|Qp$U0Rq00000NkvXXu0mjfmKT-R literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff3.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff3.png new file mode 100755 index 0000000000000000000000000000000000000000..8a3e4aa74827df9191018b6fda24cf7566174a83 GIT binary patch literal 349 zcmV-j0iyniP)3-r5QVoCj6y<;h#(1yjid;HfRfnQN$f1d!on)4ZMDk}uryWr)G5`!cKR*6W%gEs z#k-r^nSDF&?VPLKUS&UDqkzBl)MLAuXPsungBWOCV6Wq$USj%;yeLsfk5q90#0b(-}ny5uO?5C1aJ`nGARE3 z=ml?te?1TZpm_M&if$nCKpHIpzE}_V9=tsGH;6nq*8%#0G@qS=QyypzBmr9mve+7BmOPOZJcl*X2U+K(Ia}9#{g_YzG1zNJ`>Co00000NkvXXu0mjf31^a= literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff4.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff4.png new file mode 100755 index 0000000000000000000000000000000000000000..e543a8239a097a885a7becfabbc6e8ef8aaf04b8 GIT binary patch literal 351 zcmV-l0igbgP)?GBf*b-rI>gKRv8gis{m{kA(002ovPDHLkV1k9Tj(Y$A literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff5.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff5.png new file mode 100755 index 0000000000000000000000000000000000000000..86eb8f00e13787fd957e6962f76f4cb762f01eda GIT binary patch literal 350 zcmV-k0iphhP)_MzOkOaV2 zIhc5$C9(wMTG?qJ&;&9wx&`flB_LO?odgdA>qFv!B_L-f5STzxj(T7hNh4dLWDo40 wMJ|g#^}V-XH7?7?ppTdaTPHsr7NLjQ4hx(gI^>e?6#xJL07*qoM6N<$g7{91aR2}S literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff6.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff6.png new file mode 100755 index 0000000000000000000000000000000000000000..9e17a531fee0ac6c98ecfd89d8179dd07eb12b97 GIT binary patch literal 350 zcmV-k0iphhP)61Lt+8}8#;m=g`u#Z(%M!!J^-au^wgBfS3CJ_@;0+9 zo)+(Jn3;Vy@9p5KSEt2#@f5IKPCdRpXT@DJ^B@Mw3!HU4RNU;oJ%}L_fyiw=A)r7E z)WqR-eiQ1>IS=B9;BC@L2;N`1MeX{`gZPkuTp-YRmVhs`ZZG`=)aTFlkp%EB0%Xv< zdhG>ogi;Sg0B9cd^XLX552Vo&;EVNu-@}K7e}l*aO|W;!LldAMNb|3IAP+2o_COK< zU*%xpftJV;kgI1Wfj|?;%;*-h2bO@`#d#%oAXp#%^uSIaFoC3$dSDkxBU_?m5A2^s wE{j0*qqkr+e#{<&K4Kbdo&0#v3O&?*02xgn#tZtywg3PC07*qoM6N<$f@+MIlmGw# literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff7.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff7.png new file mode 100755 index 0000000000000000000000000000000000000000..e263c70856cf5ff6434f6a5e44cfa2b127ae8047 GIT binary patch literal 349 zcmV-j0iyniP)hR-fwPW>il5tW4`RqfAaYwz2q+K( zHF3C`)kEDm=Rq71ygc0|1dI87*{q#=5bqL@3j`X^67Yrm`qEE8eKqYx62QL*kU{hN zb3b?^9Q8m1fab{{i*6wDKpKAqdJyA_^?={wyBq%okq4T<5|BebkmiGXAP+2o_COK< zU*%xpftJV;kZV;>1A!)xnb9q14|YAcsGI~31na|}9@q&4CXke)9@s_F$d)MC1N&!@ v%OX&H?=4u3%VHGt5z}Dn&KAA00000NkvXXu0mjfGu@DU literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff8.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOff8.png new file mode 100755 index 0000000000000000000000000000000000000000..f8fa4eb3766a2719b50b3fcf4a761a18ed1da518 GIT binary patch literal 349 zcmV-j0iyniP)&ugJ@%@Wpz-cdvEl-yrhfPzUG-(tL0Z2a@uu2X>IuvL#C9!2T?9 vSp>@ecnenJXVDG%h$*mn)(03M%i~jel_hy5@Wpz-_glZ|-yrhfQU~Y<(tL3a@;uNSNCMzg zHYOfuh%5nX_tmRFpblhabPJk;a}RE=3&8`y`tYX*wgZ6lqu3?zWP2#`VX zdU5By5&rZ*1c2i4eHNTR;DIz+0(`L^@cwvn;hrGyps54&18HuYgE|j12a*8zDjOpY zG(^=oI7<&afjW?x!70?u0c%HxE$@L~efZY{+krp_lCt+8sbxzP&4K+{07*qoM6N<$f{#*`G5`Po literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn1.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn1.png new file mode 100755 index 0000000000000000000000000000000000000000..67bbd65af5aea7e2fe119a8389f167c1b83a3e10 GIT binary patch literal 346 zcmV-g0j2(lP)?T+sxh` zYA)|?ZfEx0yti}is#eMO+i}3hZtC&*I?uc9x(6}Py1-t?P09Demj^LqA`rRFCj=yj zfr{AN%PvFS{anNm!E(}12v)N}e%+{g5Eltp3j}J<67Ypi^TKyPe)Do0NdW&MKnBHc zi~Hb>@T&(R02B`&vgiaN52Vo&;EVNu_vgEoe}c$^V;!I$Nb}J-DDyybAPIo4vN7>M zLsXoDoBC-WPzN$II)$=1VD0?uBzPcLAO7^fb|BD!q$D2X&Uq9ENiAEVWDe}lB9}#= seCa7zjqCYS&__&x&9gpw?1UO}->ga<1}wU6LjV8(07*qoM6N<$g2GXl5&!@I literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn10.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn10.png new file mode 100755 index 0000000000000000000000000000000000000000..aa7f89cbaa3650670c7b200b77326f0673b2f6e3 GIT binary patch literal 344 zcmV-e0jK_nP)3-r5QVo4ma^PV15%pG-r7?AYbW25x6HaH z%JJ^zc4ptrdpqZ9H<$Tx{uZ$Q{qWcOl;&F0j{eQ*yQ2dJsb<0+HK%LO_BT zsEEyv*==lJ0L%M??e*7Sp>+S z`0uM9yb%%)iUdQIsp+2}^59qp=m*k#bPkF<&>Tnt;Hzv* zJkStX0@fPUQXo(VGBY{_&B37umGVXKK(IcX^uTr?(1E0!JxFTV5+!qBe-^nc0_6)& q!D^gNUV=Vi3T&SB(V!J-$n60qk}C48pGKwt0000e^V literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn12.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn12.png new file mode 100755 index 0000000000000000000000000000000000000000..72f0b74c166d2b99f56e7b352dc39c94b06ca67e GIT binary patch literal 337 zcmV-X0j~auP)qcBO#86M2O2Zq7aFMpwS7PLKKRtsI_!{fRakDR^qRn%*Jfq-Uo7-yLbEE z&b^s^rz*uva6Qfq?x&T;H!G=6i`x|jS&wxMBzE8 zIcY<{4rr!z3UPCQwR|pRJRqbGKRu8g5a@tX{vIT@EQum>Ab%FROakU(PeE$j`(vXI jF$!cJ>$8z(YLI&al{792HHA`)00000NkvXXu0mjf%J+wK literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn2.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn2.png new file mode 100755 index 0000000000000000000000000000000000000000..5b492d1268459e79b2b5649efcd0bf56e6625461 GIT binary patch literal 349 zcmV-j0iyniP)PMdW30G6goZ=Evw)lPm(-ZFc8 ziX885ZfEx0yti|%-K=CkUoQc_>$%6@W|7_Av^jS9)&harvjlvhf8FpMkpG3-r5QVoCj6y<;h#(1yjid;HfMRUyBz6{JVPTcjw%X+fSehz*>XhnVJNcHpW%gEs z9Pe&!XZGE^w{xy`dzF2Ejst!-GmqVNk#(9C4`QHofxV8Kl0S#N2Qg$K5V_4K1SE)o zirD@FV+Lzhc6HQ2_g^9b%1^#&1dJ}ln0svNdSD6jfn>u zqWl~*D#bvc4rFF@3Yvq=IS+YoT`mL<1nWcMfhAzgb|BD!q$D2X2{cG**%BplV1E|5 vECS_Eo`Ti5S`30dVhU`Y^|#k{s3CU*2f830F@$<^00000NkvXXu0mjf&q0so literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn4.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn4.png new file mode 100755 index 0000000000000000000000000000000000000000..08f2a0d35262aa871cdb82bd2aee3fdeb2c6a8a5 GIT binary patch literal 348 zcmV-i0i*tjP)FZb5rs3CJ}YwcvqZeMmg81mx@l0uxBeQ4j1QX=F>3?16n* w-$0mMLgfwPV;6+eG}0*E0KfyiyWL_mQU zsENaugR@w7+YfOk4p_ZF@brpgoWT zz*9Mxc%UV+1mrHWMj+4xGBdgb?Lpmx=J7%BK(IdS^uSIaFoC3O^}sHYMz%!B9@v*f vE{j0*e{aERd@lztbyp@%d@#>~00000NkvXXu0mjf++~t& literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn8.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/HVChargingBenchOn8.png new file mode 100755 index 0000000000000000000000000000000000000000..559da980dc068b6e9ba96591ca2811880ea2b40d GIT binary patch literal 347 zcmV-h0i^zkP)3-r5QVoC)IdZNLLev+n~)+1fWRV?{Dqw{-)?bd`iGtAW(ajfG;$vCEo%0&&f+90bE3Y42swD z*Witic#t{gVF>`mgHAmb3Hs`)2~JUG_@`hhf`odbDb2{Z?i0Qf2! z6Av^*mVmW~NuKsV$9P?c}%QEwk=P z!tw6rc4ptrdpqZDE5+<As|5v zRK(_Ps~+<1_acr6KBkWe!Sd}XyQ`Hvh|dXF3j}J<67Yp~qwG5%zn=9X2_PZJob#{* z$e{T1eGt465)bkS0L7zWD>{M518KAb_+mZa{k7lpPY`)pWc?Ln>}1KX{z>+n+OSg2=<4 z`%|5+{O{fS@c-7SuK(ZfDHGPe7AW|Ce|8j81pf^NfsMIAXX;HW6`N)yM#MV)_dQBsH96(zjw69Q4VqB`><0~i?3MWpN8=8NMeMjy z!K;v>9mw|Jvw1GhfoUzAm5%O_Jc$e%v8zvU3i;H2Sh7arPknGa%PK|%AD=X)m5nRg dr5!lg7#3e~%bsfbsRihA22WQ%mvv4FO#r-vS*HL1 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVBatteryStationOff.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVBatteryStationOff.png new file mode 100755 index 0000000000000000000000000000000000000000..932ee7508800cf33e9eae7407e0d404971dfda3e GIT binary patch literal 253 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`M?75|Ln>}1PY`+d(|-R^@xJXo z9ZmfF~0}@Bv z$_0U93^V6QCh;6Qm)4aarNUOs=p(1bKKb|urV}A0=}O5HWITA!?ABmAkfSV?+`{M) z5FIJ}1PY`+d(|-R^@xJXo z9ZmIP~}PZ=-0)lv5}!GJZLY& zCFi{n3oLjN^b}YR$13O^>o(RuaHQ}l>x4LlT_mdKI;Vst0J)4< AcmMzZ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVBenchTop.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVBenchTop.png new file mode 100755 index 0000000000000000000000000000000000000000..675d5ade403c3ac2f75cf6bb6a62dadd00950090 GIT binary patch literal 568 zcmV-80>}M{P)#VZ}kFTi~l)9QKXxrzl5nqe@j=%YV*whpcoxeLKN}scM zY&7G1^W_~mSsTaM`g6w*hgxy{?Y-o*sfRp7z4|(j?#@Q+FQ;&@lEROLnCQL5B#zdf ziS3r2hhALnTEava@a110#suKIHE;)jzFRa1bNINYv920_HeO(VX&AGELA-t1j`Wa$ zTs$QDb-y1oeSV~)L1bfw#0bFe2m_+f*;`6VQqhXQj0KhM6F;jGie?xY1x(EtncV{* zYC3AbN*I`V5@o74&X!>EsZQ6xlyNIODFED1s z?ILOh0>EM5pzsU1m|euY6fuH1Re4I$j35*3lo(mv>jK-zU}h*Jt(uDXr26SwVG_@z zwW`p+*Tw|EnM4kS9+1kxsT4h#VWXwo1M}r&?-95HH7ZW&K84;V)N`Rh6UR-?1 zl_!w^6unF=Dwl|&m*{xarp-J0zS9M+<-b<7QuIo@*Zc;zSlK)hc%NVZ0000ZNSEem3kji-^DPRd&;BL=Xe518UhDcqsY%K8+xzKm;Q9dG;g( zB#42E*nHb>T0VpjL7Wi0y$p{CK9&zz`>Gs4d`Q5W5vV;+zzKuvTI_)Q*ZeM#04^dx z2E{+GBlAZ1*8>p%if7}#-GE>O(&!2B#e2Z_<9#>2LE^!w4$u#z+0Q}JL7oSi14#g! zsv$}|&=4KYL8nnP0(BrWlUvA}1J;zK4J=dp7p26z-q|t0ibL6fr|)#vH$=807*qoM6N<$f{y^19RL6T literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff1.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff1.png new file mode 100755 index 0000000000000000000000000000000000000000..c72d6dfbff501127f78ca9dae6fb3ad2cd478fc6 GIT binary patch literal 347 zcmV-h0i^zkP)3-r5QVoC)Ifq7LO>M7Ml6C5FeEnVLhLMpg@u)3X`6KZfRtJV@*7g-zn%FO-ZFc8 z8jE)~w=?^8-rG5MQ>$cO+eyIB=gi}Gx5)aPx(6}Py1-t?L&@*;*n=1{5s2L869N*% zKt*gGbgx6+Ip;wf5v-=egkUotWw(v02XUT&wLqZuECDC_#^bc_59J0AH*Jd_Ui}{ToCc9P0r6K$?%vL6HZV14#g!%ErV4 z4N-m$n)PxZPzN$Ix`m=SVD0jv6g&{D5C3{#I}qqVQW6jT#>^u>NNU*3-r5QVo47zIN#h!7OTCZq^LAfngUiFOvjB864NGHuf32c(RZ;BQEo|90_Pc+0GN zM=ajm+|KOVd2i=j>-sX^e=Y)kzE&Q;-|PIY*YF?)S{K;scqn<;W*)?li9qBwpAe8B z1}b9neg7upopT<<5y56TObFgyp7M6H>Op);z*-ZL>`oNfPNs&rE^f^f#yIG0H?As z@jydl30S*rR04rIkeSgfXbw(2sMjun2ZHtCUk_{t0v$-o*@L8(Em1ND_GgjHB2d2Y q7Ockibr$pyQ(*I~&nJUWL+%ehB?wNf91j%$00003-r5QVoCqJfASLO>!B8%ZI85J_z8B?LHyk*uq z(c;~WGqdmJy&c0%t(ZKGl!J|rL)2{fK3;0v9*s!c%s>%Esq0A~>( zgXW*vFnS~8JSZXnG*6z|$qghPNTVmf7w-YT$Agx=LE^!&3D6Iu`RE=Ld7wRz1i)80 znDanOlcwg6UfZu7K-+O+|^|%dLVcoPI}-c5STzx&R!&q?1^%F;QuUgSp=#V r-h$V-nvSAAVj6s%{L6DE_E6gcL$C?j3<`CI00000NkvXXu0mjfEg6$x literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff12.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff12.png new file mode 100755 index 0000000000000000000000000000000000000000..422a216b504e00a0c0d6b4d42ccfc23c647d3520 GIT binary patch literal 338 zcmV-Y0j>UtP)qcBOyK_5+N=cQHVrBxJD;*3Q;JoB1$ctAE2a?_zg<`?U;?(yuA;un7g&} zcJ9sWqpHP>e?Kn_o|m=8>+1QPR!IYEfcpf_Dm+L&_O1rj5TgLaB_9$1;VY%VA{_2I z6~n6!r@p);uv_*+0*B4eua&bJSO*2LX9U=u6u=kSje_m~{Aty*EC7iFU<1Xs?Z{+9 z{LFv?0E%a0$GQP41A3GK$VFy=-_t=;zX2lUKs0DJjd%49&u9R6k?J0Q>jtt1{Kwk(B0b0GgLOql}YBX2=^JbJG2 khcyZ$kNx?iZEC>10j$RhW`8E6kN^Mx07*qoM6N<$f~kp%N&o-= literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff2.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff2.png new file mode 100755 index 0000000000000000000000000000000000000000..093b8dab4958019e28cc8fe648bdb213806654ef GIT binary patch literal 349 zcmV-j0iyniP)1c2hnOE}Q9}*A#r^G`Z*bW3bkd(xOJb?yDEnA{w4(!h& vmqnm_;VoE=oB1f{Bc{OSS$})&g&J~yKTrGL#_AY-00000NkvXXu0mjfW4D+# literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff3.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff3.png new file mode 100755 index 0000000000000000000000000000000000000000..a095a6dd0be5673e69eebcd8864f5e4bb6671f08 GIT binary patch literal 350 zcmV-k0iphhP)={9thTl!~;vfn(aWK14&6d$P;Lg)UqW?=D_|e wa#;k*U%UmYal4oVeZ&;lJnOUPUZ^4W3m;AWYx223u>b%707*qoM6N<$g6*=MOaK4? literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff4.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff4.png new file mode 100755 index 0000000000000000000000000000000000000000..bcde7f25120d3dcc7e2c067c7f36986842d0ef67 GIT binary patch literal 351 zcmV-l0igbgP)S(0l7e+@hkyf$S=Eo0_tDSH<1MJF9KxH zym`A1-UtUh5CNch`Y?=cAo4&OEdjn*5BU8!9{4wiJZPE#{Xm)<_n^)L?SUi!zRJPG z11-_t9eK#f>=;cNhoQx;|EYeW#VtJ^uL{co4n1e z>s=_`-7quzZrf z7^sQE!@Lvf&N&a_h+s7vCj^_tZFzNZ>OuUMfLtKZc$R=K^t&xT0rmI!D3Sn2msAb_jz;!kq6Rf3Gl^w!0*RN&%Z(BLDdB42hv=*2lC+8Vh>{Nfg}LF z%E80~Es-T4cbzo@fhLfd(Jg2XECIRmvqtbhus$RnSORi(0)Yu6rPc$xNE+D^C3|51 xEOJ={s{eZnR^!{U2>OU=uyyj!5B<3=)@7Tz-J z>Y3u*O=f1_&3ij>r`?14ZF3*+v3>OT+*S4PBJ&^y$_t!zJXCyNl^(>9i9qDGo)AzV z25RE)C_f2x=bQ&|M6jG+CIsunb$!?LeRjWM*^=+5<~K?&z=;JP@o8|9W625STzx8a=R!q>(LAvIq9h wB9}#=`meWOH9l8m&__&zt&^YK6`_aP7aFYs9+Eiwi~s-t07*qoM6N<$g00q-$p8QV literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff7.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOff7.png new file mode 100755 index 0000000000000000000000000000000000000000..a65a7bd1d469ec38029b7c94d5d6093a8898ac94 GIT binary patch literal 350 zcmV-k0iphhP)XYE$Ke!C0Uye~bzKdO3gnRyTcch8$=#x0!u&+{Xm+3-2-`G3A6{2 z0Qf2g6A!dRmVjI@I}8MxKxRg_pgq|4;N#7X;h$*mn)*tSQP(yA9W5NYC+f%fa00000NkvXXu0mjfT4aU5K59SXf+@kTPx3`2#Gq3iul={cjh)g}2OR z@6h7i&F##-o%eRmo%cHR_U$p?`~Ah^=cB5JSD6Pf(7M20$3w}lW$8f-nFvH~^9cb7 zVxS^6kMgsScg}ebM+A$faYC?qy{#`!k35L?30MmRYR?jILecN~4#;nwuOkT{A^4^D zums4U_;Wr9-Ux{YO$31A>0KV(K;(fmS^|8r9`OBeGw^Q^dC=AY`hhgJ&Owt0ngdAy zoXW<;0}YWSVC^zH3>wx^*({&&L>_vbK ziocc*L+ktz6z=O69&<~`!bq<<5&>Tnt;Hzwm zJkSu;=io9u^aScaW(KFwGzYAmo*Z}&1na}U9@q{9I*^pT2T3hkqG%56&mxyapnT&g pSdHtl@cM`;uzA+!)7;mP+X0r-{KG45^p*es002ovPDHLkV1hF3-r5QVo4BoPcTAqYWHY{Vi20tRDaC)!yAixgH7OIz*y0V$J8@Hbfc-%h?IZ<)P4 zV>sU3+|KN~d2i?3!|heJ-HZeFUsI36_bh8SDjvi@>jHZnHzjwAz6UX6A`rRFCj=yj zfr{ANY2Jst`@M)Gg8Ae*Ay|HNv+CWo2XUT&wLqZuECF9=)oy$T{3-r5QVo4Xas{M1R*F9n_v+F0fVuz6YVTQ3JWX6GHufN15zfH;BT<>zny$b-ZFc8 zlH+)Hb33!|=DnSBw~cDH+s*KK< z6#uSXf;U3qK@kCXX0KUq` z!~+eHC1CBYSqTK{KxRg#pgG8UP_JDC4+QJOzaH2Q1UitE(u1UyEm1ND_GgjHB2d2Y q6s*S2aWjNi3G40 z0WxU*Tuh@kLd}CF0zmWZHcxIK@jx0a0lrud_%+eu*a-wCkd(a_Nh4dL+8)@KMJ|g# s^~PJU8aGuL^%2ux>*OEqir7PK2Q7UK)b``p9`@?uv_+H1c%KqtXJ|Hh@%8pGX!i;65tD7v!pvf{?Z|jT zeD#0?0E%a0*E#{q18S56@I`un_vxUepMd2-S_jY%P;=@WBzeF&pacM4#m1Ni9HQtP zG@Ps3-r5QVoCqJfASLO_&=jieAkh!`6?FM zLzJI`X8kGARNus@4j u7J>4Gr(iX%SCgQRm;#$;eg51HHRMhy9RJ%7Un3=)<7T+>^ zn@Bj`-Q3RXyLoTt+|A`_wOvmFzBhA^pU<-D-en%dKU=U|@)ngdAye3gxf z2O6UK9JI4WAW#P~Gdcy$LFJr>Jh(VN2_6X6hr|O*z?$tqpaV%sJg5_BkkqmzO6I`+ xEOJ={%I`e|t8rBhgFa#kY@YR(K@n=m{Q?OZ0e0An!(RXZ002ovPDHLkV1kqyiZ1{F literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn4.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn4.png new file mode 100755 index 0000000000000000000000000000000000000000..e791b05f03cbb22d53781f7bc3aa3f32b4a5db06 GIT binary patch literal 350 zcmV-k0iphhP)*NBA#gap0DE@)>FQlz*_v9#6BA7GhO0e^#K{@aCb@h!92 zyAZ-lCNs0|=DnSB=O>5t>iaq1?`P(*UR3qf z7^sQEH~CqpyZ;YyMDX@9Ob9;aqx$0X$b)#BfLtKZc$R=C6jwbz0rjuxZ6pEgMSu*N zm#^dCjj+=L5dfMe_jz;!kq6Rf3Gl^w!2id)zW)W02W=CeA4qfS9yEENJ&**zQ#qJ; zpe3rE^N`b*Stk%^0+|`zg7&}?kn0{F1P=u3L*juYAZI5Km_Skz54H)kNE+D^C3|3B w7P%|})f;cYYW%FqppTdaTPOeYP=p?88%?AG0<(tV!2kdN07*qoM6N<$f=y+X<^TWy literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn5.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn5.png new file mode 100755 index 0000000000000000000000000000000000000000..39f59018f56cf72daaee446a1e0efb7a7e3da1c9 GIT binary patch literal 350 zcmV-k0iphhP)3-r5QVo4#0ZgGLI?yUhfPQkgn+?ZV;5p)At_Q=DVAxq%MVByE5YAj>3=)AZC_IQE6M@KWJt3e# z4AjKohx{tk-S3AuBAAbR3Bl(_zr49T^B_JZAQuQUo+aQ3-FC}QKz%iNj3j`65g>!+ z_3Sx#Bh-2z0zmWYAdhY!@<19b0lrud_&4qL^2ll!Ij)F;}RR91007*qoM6N<$g7w?^9NXJCHNaG{ckJZ;#+2O z$r-{+CNs0|=DnSBy^}-#`Fb1i{k9JHd9VEWC<`D4$_t!ze5v^LSOyS7CIXS$dX0br zF;EkSFY<1zyT1={Lh!J>su4WhUHks&Q2_BK0l7$^@hkyPD9$=z0_rcT%R~a$ivSrk zf80-^H$tNaA^=h6W&i*H literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn7.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn7.png new file mode 100755 index 0000000000000000000000000000000000000000..9345db5eb9b138391ed7d340239cd88d7cba3ea1 GIT binary patch literal 350 zcmV-k0iphhP)YJylL<0C10WxTQ zpWj7qghmfU0B9bM^5g~*52VpM7eI_J)&u@O++2oVka(a8ECD(618M$s59EO*&>lzv z;Hey}d7ve-1mw=M!$_bBWM*;;+Jk)$j@t*(1Ht<6rw4Wdfe9p~(F40k8rc%n_Q1X@ wa#;kb|9A^l3-r5QVoCqC$ciL=b~wBNh@642g}MXlD^pSXe2Rw%YjvER!nWZ%FBXyYMY}%d8ts zINsgd&g{E+Z|7XKl+Ql*(}1tTo5$&Wk#(A74`QHofxV8KlE?MXgBUUqh}`BA0usbP zMQrZ2?nB=FT*MK;0x`>o$rAB?zI<50RJLD2E`xC zr{Il{c#t{gVF>`m^59Yj=m*k#aSr5xCD0s50^qA` zOgzvKSpwGT<(ojD4rFF@3Yvp+4{nRO;DKO$_|pU1fj|e6a@7MnNNU*q`It002ovPDHLkV1g`*m{R}% literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn9.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVChargingBenchOn9.png new file mode 100755 index 0000000000000000000000000000000000000000..e7d20b4bf018b547f818f62de8b4a5cf17c29ee0 GIT binary patch literal 346 zcmV-g0j2(lP)3-r5QVo4m;JG1ZRy`6K_huiFTJqkE%rXI)bJZm?~9>hTF0(%`dCHISg2Qg$K5V_4K1SE)o zirDXK%n+40bgi6mwX50er~{c9or31z+=Kh#P4GalKK$!}?LeRdNx5nctcjK=nFIT?$Yl{I spL+^c<7z$#`iLp8dDcJstx!Ym4~X*$z9O4fuK)l507*qoM6N<$f>XGZ`v3p{ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVEmitter.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/LVEmitter.png new file mode 100755 index 0000000000000000000000000000000000000000..3eae40b549d27c5b2ff129ff627db7197f4968fb GIT binary patch literal 364 zcmV-y0h9iTP)ZX0M-LG07Pt? z6!TwAUg-bAEW7`UvhDuQO|t~k3o>l}FE4Ngvyrj7g7E*X6QdCZfNWlp>j*YrMzk?r z3^N3z2X4T+Lf8KbGi?cKhT#R7Hem0-4FGXKf*{GM(YkPjW;#+}Oq2m2XCW(cGLic~ zIb0TuL2Ud66uZM+0J9mSaX}megV@L}!RrNL4cJ)Xi7;Sei3f@SBzpmrP|yv)7l@$n zLNNdojp%`h4=>GgL^S}EC}0VMkY-rQ)KL~g7ywGws&ay036SZ?$##B*_5a1$_Fy(B zwSo*#R}}ugsV@T601$>{CQzV)G7$*FGSSK$h_gXzVCvxpP=Wz#h3Qi~efOjQ0000< KMNUMnLSTY0r<%_I literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVBatteryStationOff.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVBatteryStationOff.png new file mode 100755 index 0000000000000000000000000000000000000000..459d70530e4f66365fa381d45595b067a1eb7f25 GIT binary patch literal 253 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`M?75|Ln>}1PY`+d(|-R^@xJXo z9Zm$+)&smk?63BQ6rI|n6ZO5h~dzW8xndAt&Ey_4xG#pdnP9_cnZ@WS8LZE*bJYD@<);T3K0RW$3Th{;p literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVBatteryStationOn.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVBatteryStationOn.png new file mode 100755 index 0000000000000000000000000000000000000000..9f7d3149df5166fd0ed5fa91d40e6eeefdb6053c GIT binary patch literal 254 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`M?GB}Ln>}1PY`+d(|-R^@xJXo z9ZmwXN9*;ssFNp(>=87-}Br%GtUsA=m zq`hjRL!rch7zeJl-40Pb;^}b>osUm(E9_-p{QGU+*M(QpfF5G-boFyt=akR{0P_=E AK>z>% literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVBenchTop.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVBenchTop.png new file mode 100755 index 0000000000000000000000000000000000000000..41668f37b2978405520e28d58d8254e05c3e28d1 GIT binary patch literal 591 zcmV-V0qr}|_;Ua94t!kd$EW2>zMV1K@bmekyg8yi3X%24GZ)E@7Odax!|R1UysYFz zuFdu0{qjZ8gGe0@5;S5HRabSq@zDBC6+bw&cFBN32=#@c+ZJo^31!gNW=4NL5@Ws2{n zbxg^;_!!wP0m#cigbd`yo%9f1&V7&s_Q!L_{NO%+X%6L~{G{Z^sV zFYK-^u#Hm0oT*4m44sIGWXqiGmX7mmyS49@Y$5O`kwc*eq;YT>p(itA9IkhPbDd~E zCdW1UmxG7Pa+8jy-X}Bmx$0y^kLBpn|JhmzYAQ;|E+2x d^hyWU{2w)x={F`8#?=4-002ovPDHLkV1lA04(R{@ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff0.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff0.png new file mode 100755 index 0000000000000000000000000000000000000000..c4ceaf6e2be99fec475bf1eb2d310be7f74d2d42 GIT binary patch literal 345 zcmV-f0jB0&*z0&G`TO(iK@6D)L~ip1 z0usbPMQk3VS0V45^B|50R&VzOg7y3{yS_a0AkGu876{ayCE$c!=fZbDe*1nGNdUD7 zkU{a+au~c3{`5cufa2Ft8r?wTfizkIe6b$z{qoTDZxDG<)dBi}G*`|+nFpE!NdTP6 z#)1bLqWm1(B&UHu9mve+7Ru&;we#jl@IbIW{Of`3K%fIjsXa()*%B4z!2T?9Sp>?L r-h$P*Sv&=O#1z;(>yvRW)Q~#@=y4EINaMHC00000NkvXXu0mjfcrBJ4 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff1.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff1.png new file mode 100755 index 0000000000000000000000000000000000000000..ed331629b71893781b8320558bff3c2119a18f5c GIT binary patch literal 350 zcmV-k0iphhP)SokoTd;@2= zv$L8MXZP;hJ7?}WbJyKnpXKYtN5Ez|@YsHj^2TGugBWOCV6Wq$Ws5)XdI%%eC+YS|Jcb6|fK wxhw+ZOK-tyoQ>XsK4J=Np7s7~J=Bo<0slx5-UwDb`~Uy|07*qoM6N<$f?yetwg3PC literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff10.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff10.png new file mode 100755 index 0000000000000000000000000000000000000000..60e0aaf7e1eb0dc9bab1fb2ba1df7c901bda557b GIT binary patch literal 346 zcmV-g0j2(lP)3-r5QVoCOavt+NFYRV*hq>X1QZhjb`m>_kRpXuQrl{mACOWj|AeLg!@?hP`YpU= z);)>EyPMmYeLL^%oNHWN!A}`_ch-E`T56FBmta7 zfDDS4-@V|Cka$o;04N^zv*-pQ52Vo&;EVNu@4<7^zd_`|sSeN&r1|6=6nUUIkOaV~ zY)m}R5Lp7&?&{@0pblhabPJk;V-Kp8Qt&{qKK$!}?LeRdNjZCv)UqW?=D_|ea#;k* s7v6%^IGel%eZ&;lJnQc-tx!X54|_-)|3IBSW8Qe}wjr)1+H)=TztO4#5IIHj=`FxBtu!a}~C@y(N0EDlU28(dG z=@ksG-kkdImcVx2b_8~-u3yS0HL(5`z@8Ccdr|;js8=$&1Mr7M%d!AO5`Ya9Up76H z4e>Jr3IHgc^gZhatPJQ;3LqDm0e+7=Rs9C648l5qe}JAt=O8Ep&H*g|_$m%M8E}Zc z=b)U68v%B}Fs)k%ngi^mQ!$ePA#?bff$V@l2ecA-kl3;ma^^t(S(q{f$Oqnn^tfLS ljX$hWAbIRh2X#{e?gi*FBI0RWxNraf002ovPDHLkV1m+#hnoNZ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff2.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff2.png new file mode 100755 index 0000000000000000000000000000000000000000..e455eed45f42b71064ddd9a2c5fac98b8fab046d GIT binary patch literal 351 zcmV-l0igbgP)3-r5QVoCi~&UrL6AtqCRj*7NKg^%Leg1C3Ja@P+s4ixV3}0;6PEcODe_}3`4-+X zdwYt-yPMmYeLL^%oV%`HWM8|NfW!XPfvBdVZe}Y?cpMt6A|N&J(Z}2-Kb>;Dp{y&38b4yBI_gz*z*y zp!oCcF?b`K^gslF;-^tJx`D_8X|x3RVm;t{HthH}h&(vf0s4V7ADx3D4>Sjo063M6 zi3b{@{2a6!aMtj71%BTL4@j9*`4cJqA1U% z%-&wa;@!>d%)XuXcFtX%9haNMbHH}_=JCBM%A4!VgBWOCV6Wq$;0)g7I1e}m}TD}AFU$1wO1n@5c zWKg{R7zJ;HKRplupm=)Ui*6wDKpHIpzE}_Vo(#JF4I&Q?b%1^#%?Ib8&I8SXBmhoj zW8#5^s5%E%*-;=+2Qo9d1Cl|X}}mMu{- z2li)?%OX&|_7<$h&te?(5mR9EtUo>Ep@!TKTDTPUUqK&j00000NkvXXu0mjfAWxMQ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff4.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff4.png new file mode 100755 index 0000000000000000000000000000000000000000..00e0377f10ac778fc01643e0c887f2f49b0dd792 GIT binary patch literal 353 zcmV-n0iOPeP)TrcKfp4n@+U0wKP>z)r{BU` zW^XTI@$M!wv+w4;ow)AVQMG-43i$kZ_SmhfvBVm3+$mM=F|uYK%6TqhtG2sEB0;0s0n)K5VDZ9a@7fPWDn zgXYcaZSY3;(*qFznx}VpbOVtG(r5|r#d^T+$@PVQgUEw@6QCbR^WHsZ@<4ka34pJ1 zF!4Z3^m|7ha{4?w35{FtX_;V!d2 zH7V|UG3}KSxo|d*Y6&?%{+Oj6+DQ6@&aca4;2slp$9Q!A`rQ)rwAwz z12u8DSucgUbIyY}BKVrNQv}~1-K1R1dJvxzkP8GF&l2#3#&h0JKz%uDMH0Zj2#`VZ z_VYD(Bi!^r1c2souO8h%(_0uxBeO%LoMX=F>3+5`J% wk;@`b{o*ZHjf?pp=p&}V*2%y18=;5V5mp!(nmex6{Qv*}07*qoM6N<$f~!7~AOHXW literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff7.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOff7.png new file mode 100755 index 0000000000000000000000000000000000000000..6aa2478f26be8b2bbe7c7dc0ee12300f760f2a63 GIT binary patch literal 350 zcmV-k0iphhP)jEGLAw;e!oo^x+t~R5mPwVLu*`p0_%Tn&4U;+5s2K@Qv?)< zftonnYTSpqbIyY}B3OL9qzIPNZc?q}J%~>U$OQt8X9@U1^Qq`3puYNSM-sqI1jwNI zXWk3m2p2sN0igN4--vD?@<1Ao0zHWF#d^T+VW;NbAo4&HSORkB2h#lS9>@brpgoWT zz*jk#@<2;u3CKN`vw=Vp$js;#v{JcuuZTC0YOm_(uJh65Q`LBnL2Ik@&GBd%1c=0JuG~f)osTCGk4uZ{iNKirU9Sp7mw|GQT8u04`QHofxV80lHXsC9>kD|K;$-` z5Rf1SDq{0huNm^rIS=B9VE!~r2o|%Oveh{CAg&Uy76{ayCE$d-Q}Z2=e|sK862QL* zkU{as>uvBxNIdxM&%+V`ipO`o=msJWq|p-Ki}ir-(RJ6qLFB={4$u#zdG8#^152Pe zkOaV~Y)m}R5Lp7&+Szd+PzN$Ix&_Ta)r0f1qu_yHefZM@+krp_l5)@kJ4kBT5+!qB ye-^nc0_At!g4MVz9)dn%3T&SB$$cJb$o&AHEgZ56LcYrY00000&*z0&G`TH~SAcjl?BDeX3 zfCMp65t|3uWym|{JcuKLxA|>C@cw$AU$v?p#D@f|1p>8a2{@tOZTJqzuNT8e0!Rq{ z={+m~GAQ1!9)dSQ;z1Dspm_3_MK=(6AdQv)U#tgwkMDZ^4I&SYb%1^#%}3{;$OFxR zBmhojW8#5^$P%#DX_fAVoYa$u)su# z1#Ia6Bqqqm0S^NhMh*vpVSwxc7zVij<`tq763ofS24SQF)zEd62k|tr}bnNDctfJ`_$Q+*OGH0000$KYW0G3JROIYSTQur_{-;guh z*;#*B&hFj0ch25(=B~TFI?vY2_khi6j9>hTF0(%`dCAWVA4`RqfAaa{e z2uKhE6|uS9ya{>te-TFnvyaDw;A`B?YS$MY#CZbN0)g7I1bm^@xbz*6Uwn2V3E(6G zWKjGweGc9T2R#r0p!n^j8J$4nfizkIe6b$z{`z$1pCIyJUkB(1(!6&LiagL9NCM!i zY)m}R5as8fUM&Rzbs#gNQz)7P)+*(*;DKO$IO>7zK%fIjNj%7$^T-d9TDC;V9N3>l vE{j03-r5QVoCOavt+NFYRV*hq>X1QZhjb`m>_kRpXuQrl{mACOWj|AeLg!@?hP@-4n) z);)r#6ar;dmT3=ciT4)V#q`wa+^;G zNDu=RvH3B(33+$8h$DiZaVH^|es%NP>q`&fV*=I!f!fQR^UxPs_ch-E`T56FBmta7 zfDDS4-@V|Cka$o;04N^zv*-jO52Vo&;EVNu_rY`1KSAWdsSeN&r1|6=6nUUIkOaV2 z*_e2sA+iLl-POy1Kpn`;=oB;u#~xHGrQm^JefZY{+krp_l5+MSsbx!)%z^z`3-r5QVoCjDivqLbE!P*LD_g+$}x6_p7wqu6Ymx2hx0T5Ard%+eu*a-wCkd&(zNh4dL%pTa6MJ|g# s_1s&q8rQ3rppTdaTPHsqbwUrdUufthQW6bN=Kufz07*qoM6N<$f<(rX>Hq)$ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn12.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn12.png new file mode 100755 index 0000000000000000000000000000000000000000..5a8ab9a7158b6a7c3cc66a996536dcec5f4c5d25 GIT binary patch literal 339 zcmV-Z0j&OsP)$r-4v;^tI+g_BF9OIw@pU^e z-Vk3sAOV2l+0eC4!190^B>{Yq9^if2Yv?Cnd63ir^aIqKI0tbaa1JN|z*n&`;sJ*! zJO?!=Z3x%_&9qJ-ZVs@P&!vn9g!JL32eJbK9Z<^OgT$64QDhF}&q9|;zUfy`rlKJrWra&OW9Cf+>R?41Ar002ovPDHLkV1h+^jcfn_ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn2.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn2.png new file mode 100755 index 0000000000000000000000000000000000000000..e7ff1e3cd25642b266a4c554d9d8d489c3dce887 GIT binary patch literal 351 zcmV-l0igbgP)3-r5QVo4Xab5Rgg{UtHewM1LP87yJJHTUQdn4NZL6I>z%r@wCoJ6_!i$X zdwYr;?{02q_T9XXX0KUq` z!~+dceh%*Ir9hw#WM*^IRGz)7rw=} z%-&u^j(0b=Gy87d+c|e}c3gg~X93&Iv&ZhED6g+F4`QHofxV8Kl0V;19>kD|K;$-` z5Rf1SDq{0Zza8@K_acr6mh-!WVD)lecFvm~#8m>;0)g7I1biXywtNTV-xs%$1n@5c zWKjJ1`VhPk{`5cufa1xpADuwtfizkIe6b$zJ|6V^6GR>y>Hz&fnh(xFod=o&NdSD6 zjfn>uqUs!6W=DZQ9mve+6f_5=a~|^G^rR6y5UdZ02bO>}+krp_l9G5(CD0(LWlNOI zf&E$JvIvx~Jq4@rtr!J;#1z;(>(j?P)R5Z)M1>gg(I=C>00000NkvXXu0mjfo!^!O literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn4.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn4.png new file mode 100755 index 0000000000000000000000000000000000000000..e3de593cb9019ce54eb0da2a3dabfe33cd5e66df GIT binary patch literal 350 zcmV-k0iphhP)@Wpz-|KUr+|ANSaa}%H+Nb}h}IOT!%KoS5?)^WM*^=+5<~Ku2{GU9thTl!~;t}&Q2gOfutlJ9201fG_oa1_Q1X@ wa#;kbpS%UD@oUi!`iN<;b@HQLJM>Wd2Z;|Femt2EIRF3v07*qoM6N<$f&>SaBLDyZ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn5.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn5.png new file mode 100755 index 0000000000000000000000000000000000000000..55345c9ea20154c756f7935303e5120da55eb161 GIT binary patch literal 353 zcmV-n0iOPeP)`x-xJFV0ArOfnkS@e7g``MvRZ`m~T|Pj{SotL^{T>$iFekso zx6Edvh&&xe9Y#E^+VPg2;n?6QCbR^WHs>2bFUk#M%Q% z06dk0i3eIDOF*ud)dGPgkeSgfXb&s_xmNQecpz9G5)Ui^IXi*C1d?*l1G`8X*%Bpt zU|$xwECSX4y#=fBqr40Hh-t8O@=uc@^ibOZGBg|t@@fR^00000NkvXXu0mjfGR=_` literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn6.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn6.png new file mode 100755 index 0000000000000000000000000000000000000000..39f4b2c376cc94282c79efd7430cd5c5ba522be6 GIT binary patch literal 352 zcmV-m0iXVfP)^9NXJ#h;+$e^B^imV6uD zW|o7~kO#xe?7Mky=Unsr#4kR_5zDVh!0Nm3*H>8pF;HIMtm8|?-}NYf7%~xv+}2A3 z6o`SEIDFH+h;_I95GMrlm%9?d+w{S=8npo8T>^5EK;u~go{(Rjg$byCyxt}fz`qEP zLG#b77rhZGJrDt)`KjMcZXoeM8Z807SP%IBc;5-XAn`yGc;^B%0s4V7AKU|ZU>H_2Ews>;wW6NJ^y#c9Ar)B`WQK yeOctP2vpyD3s&QMF^u|%X|Q$j&x1VnP}=}M15QVo4Xas{AL=ZzRHew-xKtdG3PPDU-6c$!m+iI5wNU2p`B4yqqMIPpcZ}BX% zUjLAz2bI#6n)lxqF`WOd%f4+PCZ0Bj~vFt$%lovSb_)_ujx9>p=nFvH~>lp$H z#6V3PZYTGl?)D$zh+sK+$`Gt(FKMlE>p^@-KrRqyJWIe6nvFX@0rkza6G;G95g>!+ z-QqQPBb@a>1c2t@TN2$s!_dp(40_}k$ z0G`Uhj0ajGOF*t(&IJNZATy&|&>kFmP%PX84+QJOMGx!*0uxBeSr63*#rBs w$Yl|ze)JZs#`U}x^bylw>*Pn>X6T{z53(X3B4S?4hyVZp07*qoM6N<$f*1Uep8x;= literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn8.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn8.png new file mode 100755 index 0000000000000000000000000000000000000000..713d0e1253482f4f10fe6cf2ff7277576bf76364 GIT binary patch literal 351 zcmV-l0igbgP){JcuuZTC0YOm_(uJh65Q`LBnL2Ik@&GBd%1c=0JuG~fm2dD2 zcXpB}%h|m<_s-dS&fIku^^8a3HU3}gU^Om_hoFy`0-I-ja-WA9azBXrAg(Mb{6YW#002ovPDHLkV1gFbl?4C* literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn9.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVChargingBenchOn9.png new file mode 100755 index 0000000000000000000000000000000000000000..ecc50620f2e7a3bf96a6d2e8f299e2b1db0abf58 GIT binary patch literal 349 zcmV-j0iyniP)3-r5QVoCqJk0)5(tWiO|XzaAd-ZDooHtv7AdSuoi=v<086d%CsO8rr0~aF_?En7 z);%#C?{02q_T9XI_}ClGlcjg|mktOvZ0?mPYoA`eb=fPNs&C+DEZ1I>XX z0KUq`!~+eHC1CBQaS;gAfy|6fL342IL9JQ}9thTlvmV$E1UitEf6ak4(Gn$dV1E|5 vECS^VPr+*ZSUv}R#1z;(>yxKms3G?Y#9ksgU_YGW00000NkvXXu0mjfFr<(u literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVEmitter.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/MVEmitter.png new file mode 100755 index 0000000000000000000000000000000000000000..1da26f39494f0c9b4ad1471b4ce7422d4f4c8476 GIT binary patch literal 223 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`%RF5iLn>}1KX{z>+n+OSg2=<4 z`%|5+{O{fS@c-7SuK(ZfDHGPe7AW|Ce|8j81pf^NfsMIAXX;HW6`N)yM#MV)_4wI&jkE-Tx;Akp^rVJ&hPrv^^d-S#Ypz+_nau{&x;;@PL~43oFy2%uCFR;I-;KH`tbkkUrGVI42elGOhL@S{N@cpJPgX2 WQ!eYgN}D#aM>^WNp7dPazC#HHF#XMf-54S5w##$ z!Ex1lgL8+?@MVCNFd3`Bg(hAEGzXK{-AILa{swjU)}X`4GaGljd@-PLb@)~cCWBlu zk<^Y*uLgKQCU>>4Y>Y8G^j-xRU@n&F5;l{1F+d}*0-RI3zzV3BCSohX+-^T&P^agB zTZ3G`9B1~#J4mroKS7-sRI{RXI`tE|K(7`2^E*EQtgr^XgG||w00000NkvXXu0mjf DM2CI0 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorInvalid.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorInvalid.png new file mode 100755 index 0000000000000000000000000000000000000000..53ec62f41cb513a9031ff9d9d92d53daf276b0a8 GIT binary patch literal 321 zcmV-H0lxl;P)Q9(Ma?Xxn3j^f<{G16bez0TyjE9$8~;ylFFY@`fn?9@z%VTMKSmBc5d#? zyj@o*m%PO+srga8s(@OI>u`BqQ~$Uu0}jXBud|H;YRthmN`L`!=A3r~)GRLu?B*>6 z{1E~yf*N!7tIkK@exCY#(JbzObig90fdhyQC2-qzm4G9G>@5He^Hc`oUPEOdt+N0) z%nJg;cD?W_&=BLDq$@Idx!YBYKhMv2 zGj>g_TCu(sNyAQ>btTM-Sc8YpBen1Q+Ub1B>~^ZLD%;%iJaoJJA zFZu?UN#?Za{S02Wxy@GX{240S01U(!%HVnEM-9M8PIWLHw4xn=k(@Iacbj=8D%Jsc zXMi{SYeE|^J9xDL2Fw-efS;3h1}MfqNTChLs}24+2keNP+5juXI$#9wssoun)Bz(D vo&*0b6kVp$yTEMMbma2M*E0KTn5YiEb_(7I&VEQC00000NkvXXu0mjfsP%tr literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff1.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff1.png new file mode 100755 index 0000000000000000000000000000000000000000..1354b544db6b23ef877c07fbd904186d32a7a932 GIT binary patch literal 300 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`pFLe1Ln>}1KX{z>yT6b5%8`H7 zT3m}0CP2I)ZFx@<0BKmrmqZ<|r|p+ab$A;u)_9b6Q%2pb5hgwn$ko ziHe&m1bCPyNTmR^&p9h{u&yc5DUl(V-<;t{qbskS_<=usLH&=ICNP|d|8a;xjUOZ< zV(@~Kb3S*%tH2lsAFGB|K_A&JZU;Xl5jF$;hAWF(7&rZYnApHJac_gE?1Ja4IWsxa t;~IXhRXfS|&OXI#)BW0&Ow?pNS>o!NZZD$YRBfwxct2cQil@YwfC1;CL!mBFOn)ENW>z>z#BFzO_Q zC!)x}TQURkod9n5YhoSHJNT*t6zD6K0iToa1Q3kBkzyT?uR8eI2Z0Qj5qYWuv{aS> zEr72wkp5#C&_Zw@__GiiroXd5Zet5&R!dD^h!q^^Kkh-+|o-!uEVtsGA0+-|lz1=J)5?O$69e4{hZ~)p+0*`&KQ~(^wQyEP9O`SnN036A40;5h+ zcp}O&Am0h#hQB7(0lkB-IzWNGVj1u``Az`A_!}wK0r{$ffA#@0B2RUImdY}q1@Kh{ z(tj)iS_tj~e-=W+^m7*I?UD_hKY1;^PY0>W-~$I13F}S0`9lBz002ovPDHLkV1ib! Bd@TR~ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff12.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff12.png new file mode 100755 index 0000000000000000000000000000000000000000..e611223beee1eec448486c7b222724ad6f594198 GIT binary patch literal 296 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`?>$`{Ln>}1KX{z>yT6b5%8`H7 zT3m}0CPVY!|nKpOOfhfqui4#Vw4R{(o#`Ji{GvnXxMFz_ghK&sb;N p&zkh+!9V9T<==OYhw-ZNFl>KuN3HY22WQ%mvv4FO#sv!YLfr} literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff2.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff2.png new file mode 100755 index 0000000000000000000000000000000000000000..322eae23ef702edce0ffa3ae1f925a7d73142735 GIT binary patch literal 302 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Up-wMLn>}1KX{z>yT6b5%8`H7 zT3m}0CP2I)ZFx@<0BKmrmqZ<|r|p+ab$A;u)_9b6Q%2pb5hgwn$ko ziHe&m1bCPyNTmR^&p9h{u&yc5DUl(V-<;t{qbskS_<=usLH&=ICNP|d|8a;xjUOZ< zV(@~Kb3S*%tH2lsAFGB|K_A&JZU;XnPG*yiH>?w?rWiPUv$x^dAi?mN=~_v{Jn;>w wYI7GJ#!p*Gs}Nd2A+= zoyo0h)N9^i8Mpj2YAT=>;yN5YkHo+48^-yP`Q84YfSTms9VH+EvU5%WHOpgx_#fGJ#!p*Goc}Jl4r% zX1sHadd*ub45mk!QVPC2WHd}@stBtQXK>wPz3N* z2Qoi*P!b`y4(whCZKlG#K-sRznDfbdnSDNrRR>?LvhDbaDsWW*0000GJ#!p*Gs}NdF)Ll zJ9BrgQLlN6W!&=9sHuQji0g3qJQDxDZy4uG=6Cyp0&0?jZY83ud#R0dz&NcHgNE4s@70000V%B| literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff7.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOff7.png new file mode 100755 index 0000000000000000000000000000000000000000..62a5cbdec721a4c9850858c4d56758c2d344e682 GIT binary patch literal 307 zcmV-30nGl1P)GJ#!p*Gs}NdF)Ll zJ9BrgQLlN6W!&=9sHuQji0g3qJQDxDZy4uG=6Cyp0&0?jZY8GJ#!p*Gs}Nd2A+= zoyo0h)N9^i8Mpj2YAT=>;yN5YkHo+48^-yP`Q84YfSTms9VH+EvU5%WHOpgxgj|C>ZDECCj zGcZeLKztU!4gH$34#+$Bssj|r7iSO9DsfGh;}ft`iWFcr=MdAlZK_9w5U_xUJR8GHd48U5%lrk?}=0000JT{Zb z&g9nAsuk;Fo;K__sVkrs;u;*@_sqU-D~HoLx0~%w0X50NJ4!$TWMhm1YCg{i92RW_ ze9;#`O>&Ow?pNS>o!NZZD$YPz2jBp-p#&cLo)+*HYT!to%3#uO>I?z`;7Fbm7dx!YBYKhMv2 zGj>g_TCu(sNyAQ>btTM-Sc8YpBen1Q+Ub1B>~^ZLD%;%iJaoJJA zFZu?UN#?Za{S02Wxy@GX{240S01U(!%HVnEM-9M8PIWLHw4xn=k(@Iacbj=8D%Jsc zXMi{SYeE|^J9xDL2Fw-efS;3h1}MfqNTChLs}24+2keNP+5juXI$#9wssoun)Bz(D vo&*0b6kVp$yTEMMbma2M*E0KTn5YiEb_(7I&VEQC00000NkvXXu0mjfsP%tr literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn1.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn1.png new file mode 100755 index 0000000000000000000000000000000000000000..5eb3634c3174956d27b1a5807a85c3ce7144a16f GIT binary patch literal 301 zcmV+|0n+}7P)~WQ5Ppg!NEZs6bg#Yx@k8bz)>e(!qIm-O(Ey^9c|Ac{rQ@v zNqT2$)r$2oj~jLz)fF(y;~E^^_r$(#D~HoLwVUlu0W-Q!XyvQ9(Ma@{$n_$T5Hu=6qELu}Q9(Ma?Xxn3j^f<{G16bez0TtcYnxXuqyQuz}~|81E|-g>iHdy2V_ceAr^ z=JuINxnzCJlA0aWs|3_ST!YK&mfGia>2N${cD>mWP}3Z&Aps4LjWGn&e4Z27&szlS z_*q3jO>+*b&R5`Znc8g8%e4BPeG zlb|RA;X47m$ghcYAl|{J4p0zZu?*z9@SOmH@efk01L0E#|C|HKNO;r%S}MvwEPziL zX#cSc#6s{K__Giirk}GQ-p=X3`P0wZ`=p;x25&Oz3F{g5LD2vJ002ovPDHLkV1jGP Bf|vjR literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn12.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn12.png new file mode 100755 index 0000000000000000000000000000000000000000..9c49124513d9ba4643429dbee48841366f18aa3a GIT binary patch literal 297 zcmV+^0oMMBP)dx!YBYKhMv2 zGj>g_TCu(sNyAQ>btTM-Sc8YpBen1Q+Ub1B>~^iRE%;%iJaoJJA zFZu?UN#?Za{S02Wxy@GX{240S01U(!%HVnEM-9M8PIWLHw4xn=k(@Iacbj=8D%Jsc zXMi{SYeE|^J9xDL2Fw-efS;3h1}MfqNTChLs}24+2keNP+5juXI$#9wssoun)Bz(D vo&*0b6kVp$yTEMMbma2M*E0KTn5YiE;qeXUqvZ7n00000NkvXXu0mjf&aHu* literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn2.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn2.png new file mode 100755 index 0000000000000000000000000000000000000000..b525829dd8a2d1e9b84a7a7a585a93b903d2f67c GIT binary patch literal 303 zcmV+~0nq-5P)~WQ5Ppg!NEZs6bg#Yx@k8bz)>e(!qIm-O(Ey^9oN<&{rQ@v zNqT2$)r$2oj~jLz)fF%caSaaddtzU=mBZqoO00ZVK>VVJ5cLFHJUr0p`$X5>jSqJQhJmmnEWC!236l4VORR=OZ zI|vCdLU0}Udm*%$a`ytWU6P^8C$DAp=^$1ed;pX{<^b5m&oBT0002ovPDHLkV1nK{ Bcsl?9 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn3.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn3.png new file mode 100755 index 0000000000000000000000000000000000000000..ed1172d8274d192c5991b3e3b04216cc9a331112 GIT binary patch literal 305 zcmV-10nYx3P)~WQ5Ppg!NEZs6bee6b<=J>fTK>ngro0vnnKR+JFe}J{(Mc- zB)v0@dd>P+#w|OInhKbOxCV#MBeC!M#^HR)>~4Qhz)W)RjuMan*%+gMna^_q$5mGW zU-ShqlbqAG{}*`O7B*XV@-tB6033iZl)y6`R0@D2d8&iiuwB^!IFjcCCcP-nL{xP^ zz7xO=e@&SKW(Qw6z<{~RI^c8iodAmQ7gCu6@|6RB9sJ%>z>FP{ryRhN?7$b05x`d+ z$o%XeB)|y4b>Q!X&}J&!3(R&+#x9?{mf7c{Sat9PC-dq2d}3Dc00000NkvXXu0mjf D`&x!v literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn4.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn4.png new file mode 100755 index 0000000000000000000000000000000000000000..d39cdf69481f2bd54d05c19d2bbcff07e526c971 GIT binary patch literal 305 zcmV-10nYx3P)~WQ5Ppg!NEZs6bee6b<=J>fTK>ngro0vnnKR+JFe}J{(Mc- zB)v0@dd>P+#w|OInhKbOxCV#MBeC!M#^HR)>~4Qhz)W)RjuMan*%+gMna^_q$5mGW zU-ShqlbqAG{}*`O7B*XV@-tB6033iZl)y6`R0@D2d8&iiuwB^!IFjcCCcP-nL{xP^ zz7xO=e@&SKW(Qw6z<{~RI^c8iodAmQ7t-%71?hl%<-lJDz5r(Ih&<&0mShJZ2aEu| z>Okga2W1h0>%iX&q0Lmd7ntpuj9or?Ewj%@vFhLpzM}2;d(~S@00000NkvXXu0mjf DqIiT& literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn5.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn5.png new file mode 100755 index 0000000000000000000000000000000000000000..e25d813c450014bedd95898c3b8095f8c6ce3b28 GIT binary patch literal 306 zcmV-20nPr2P)I)OQNk4sWa9(!|> zoyo0f)N9tqGH%&v)Kow%#5K5l9*KS5HxB1ZW_SC80&0?jJxV|VWMhm1YCg{i99LZh ze9;#`O>$1#{$JpATi9&f$?rf>2jBp-p#+}kpi%%F$x|83hV9A>z>z#BFzH3PC!#6? z@|^%)_-o2Kpm*?92Pn`NGx+UNK#l9zPHk7AX<7g%fY^yN#swg3PC07*qoM6N<$ Ef(g2RKmY&$ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn6.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorOn6.png new file mode 100755 index 0000000000000000000000000000000000000000..68181753752fc5e3c3334d0e2221cb81b96acb2d GIT binary patch literal 305 zcmV-10nYx3P)Q9(Ma?Xxn3j^f<{G16bez0TtcYnxXuqyQuz}~|81E|X1%xByDjEE-p$Uv zncZh<)r$48NE&w1tSg`v;u>5&kJP^JYlrhCv)kQX0X50N8YLhBvN1*hHJ|4Mj?0b$ z{^$#!COM}~?=SGW&26@7=Xao}18@M^Py)|GKPmu@I)OQNk4sWa9-Fzz z&fKkO)N9tqGH%&v)Kow%#5K5l9*KS5HxB1ZW_SC80&0?jHA+ANWMhm1YCg{i99LZh z{LvRcO>$1#{$JpATi9&f$?rf>2jBp-p#+}kpi%%F$x|83hV9A>z>z#BFzH3PCjx$d zs}y7g~WQ5Ppg!NEZs6bee6b<=J>fTK>ngro0vnnKR+JFe}J{(Mc- zB)v0@dd>P+#w|OInhKbOxCV#MBeC!M#^HR)>~4Qhz)W)RjuMan*%+gMna^_q$5mGW zU-ShqlbqAG{}*`O7B*XV@-tB6033iZl)y6`R0@D2d8&iiu&p}yy`_K|IFjcCCcP-n zL?Ev(AUh!63E+mmrpy7egRdN5z+CJgB*5q7I{_5qFQhUDZj>uCEV5zDD zMgU)RAoG`XzzD&0;O~XdW-8nZ%yv!2E}y)X+2^BJb?^l@`Tgk6_3N~WQ5Ppg!NEZs6bg#Yx@k8bz)>e(!qIm-P2oGg9M^M5f4-(^ zlHQqGwPJnD(}o=ptm}w5)Aps4LjWGnwe4Z0HEZPKo z(HFo>bB^ooPvCi-*?ie5&On(1Z~%!x0*`%<1io((Fat;PsDnwrNgad)z|lM>FzO^l zCIRyL0=fg?I|1CtuZcO3?BJ6F3?x^q19>idCxBx7g%oojd~)EggHQ+3k?_a?EdA?1 zB7jdF==`w`Btmc<_WTmrq~o?9)L?9ee=Y-vRT;ITgbI0000}1KX{z>yT6b5%8`H7 zT3m}0CPfDd_WO^D_ZU0(Jba{J<|DI&O|379!GlTiu*l-gi4sQ{ zCh!_`-r{h!IHn#Zliq2-aI?+Uc#=WRVYTh4P9jGb0v;$x8yFwv>igK)_@&{CQG=7j z%@hIYHclY7iMPNk_(*|XmBfP6&4(EB7&@F+i3h|q7l$ ziiQOWO^cZBa_?9q7|A!K?7>S0+o}nZb@dDbBp&#ldJ))WtjYbca8Zid6M^>5#mAZ4 e(iW*$Gc%OwXI);)bcY$}TLw>8KbLh*2~7ay>}dP| literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorX.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/StorageMonitorX.png new file mode 100755 index 0000000000000000000000000000000000000000..c6ecebf903fec9426ce7f0d46f4fcd85a2f61547 GIT binary patch literal 129 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`9-c0aAr-fh6Be*ld{X#p&oOze zoSH+AqQzCAWDZBuA0h&8y>hrbKPt7cO)`CK)beJ<(yq5DzvpWiI!rZjm>SX%u6uN5 crw{|ftcVYlVwtnTfMzmyy85}Sb4q9e06}&s?*IS* literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerInput.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerInput.png new file mode 100755 index 0000000000000000000000000000000000000000..3c1eaa61faca1d8eb4ea1ae1c352b2320d3c79e6 GIT binary patch literal 551 zcmV+?0@(eDP))cj+drd6e|9FO#sEkk6_u^q?0N2+KtS=!R{U* z`?IDl*<^oLCjhs9Z^*1Kuz6VIKeBhBP%))^WlAJ$NNT26QZv002^-4RywBuvlF8+i ztxz#VD^yIeyWq|_{p(}H-fy)mVzvHM19uy3vUhw0fcw)66{H!}I(X(rhjD+Tx4`~L z1Oq-f+5IAep)M(3nQBGChLqd;q}<-8a<ec`N literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput1EV.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput1EV.png new file mode 100755 index 0000000000000000000000000000000000000000..528513c102b520fc65157b62bc8bf08b91446aaa GIT binary patch literal 336 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmP)E2l7?wKG_tmzGfH6Q zEIU?U#?8!p_>I*5{q_IDd~d6tY6-P%7O+pR-}rrf{QjV5GebiI0|P_DP~Y3zD_#q- z$s~Ndrrf$WS`r8(BqUT_D_VY7eq7Pk9Fae}TzQ0*I2P zCLLN;b*y%q za}4hFXP%d!YWZje&=RZS*u!^qI9BDIFLP@Ns-Kv?W;?Ik)ww&@`S|!;*y0lOiH*U{ XJDllkn&3sCM;Sa_{an^LB{Ts5-;#V+ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput1HV.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput1HV.png new file mode 100755 index 0000000000000000000000000000000000000000..9db0a9100ddc3155ac6a346e0841cab07bca4a57 GIT binary patch literal 379 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmP)E2l84yk&Ev5d#Awho_5Uh{fsTDIyPlo^N0gld(G8 zz^`&ca`A^q2_Q(j{=@Lk-`~?0X5F%53sl?lOS0vMrR1;fy^?i*e;u80Yg1=qXCn}F zc6Nf4v>lD^HxOXz-Y%D@@#gNS11C-=X|j-4#{)?@m6(j;ikgc%?| zSQW=g9=faJap}&yw>?rFe_iMCY`kaYlKJjTX=*}JlG77buT91bLQfNvgxTIM2L=;^ Mr>mdKI;Vst0M1{a&;S4c literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput1LV.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput1LV.png new file mode 100755 index 0000000000000000000000000000000000000000..61c1b0aa7f3a049a186e14d8f6af3492a7cf2747 GIT binary patch literal 374 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmP)E2l7{!8g0gd=cU(|0iOt|_DbO&_ekU_TVB%NZBbLwQfBlW#bxX6_ Q92i0jp00i_>zopr0Cwh*;{X5v literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput1MV.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput1MV.png new file mode 100755 index 0000000000000000000000000000000000000000..b8182571efee1a37df5777e882ab466e1e380efa GIT binary patch literal 379 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmP)E2l6c%k{3_TMP`09G)(YAr_~Tr-(fKdA@-~OvdVT z1HZ}*$;BTcC4eC9`VYfDe}7M3n03pJEl_RGFUgi4mXg1^_e$3N{dIK0txcVcosB@y z+1UwF(sneu-#~z=d%Iks#+$pR4xBh~;s6L}Xde0;-!Xr(#@Q1J*KW5xynFmTPmlHb zyMO#o+}v^Cbv+MH#n!YI3!{`4i$|s{tn;6}>ntkx)?@m6--u6g!{B@njv+f8{rhea zrdFqw&c|!mG%Z*bwr~j*Xj!nvv^10iY=5NT!TvIgNzduJj}sfa^n|=eS{7fKMY#N0 z#cx?mS>oxjN?`uWcRQZ{v$@lmwpeP?fy=kqcNf%^O!)MjK`!4va&6cbcj0eO{p`NZ zI`-k1ljhN*ca4P{ygcho65sg$n2me&tH9uSNmR{v*R`End=Igo&Td1 z{nsd2JLNT|EZnosQzUDGNQiOtj?G>+j$%(;&&XYh5AWdfWa6okJ=ez{%(+hd!HZQB zYU(rd=5r=g)HdZxuJruWvRSv;asA}Dg=eh)GYGgYoT*TKq!k#744$rjF6*2UngC%F Bp|k)1 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput3HV.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput3HV.png new file mode 100755 index 0000000000000000000000000000000000000000..93f13e9d1c2fb8fd02e58ac4b8211e6f9ede5235 GIT binary patch literal 451 zcmV;!0X+VRP)Uq zK~y-)rIWEs0#O{tKXB7YbeK-36t3Io0J^SIs&{F2`us+-)93uQgQjT!XtrgDxEb+- zi@7WSjaE+y4C;9&!^h+k?dfeGWZA`BmO`ZlfLC_?&8zg`oSy`8lNpNwFd2>U$}YfC zz0vA1oP*AW_z4=V9$wjHG8!wVtkNZl2SKw|ttG?x_Z%#;%(!AM8|q5v3c;31Dt5PH;`M!?eCbqDq*KX|zPFPQ?Yk3UTZZsW ttX>?EcQQ&P%Z$rA8E)J|^$MFj=P%si!wv+4C?@~_002ovPDHLkV1i&;!kYj9 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput3LV.png b/src/main/resources/assets/advancedpowermanagement/textures/blocks/TransformerOutput3LV.png new file mode 100755 index 0000000000000000000000000000000000000000..20daf472b1853d6f54b18231248bd6102c288065 GIT binary patch literal 413 zcmV;O0b>4%P)HX(5e6xHK1gRqQw2J>Glw?&D6>Yo(YBk1wyR!E5)?9-D&{f z`k_{sk2|)-$LAN~`RzScW4BukoZYSDq;Zrco8prN%LXc`Tu7QtXGt=!GVb~zlLbgN zByHgOA>KG*I@3=v#TA-^ye!jNp*hH75|_p3AS<+7NF=HWj1KMg^@s0!+3&l{zdxRraYdWaP%b|1=CPXx;~wo}{!mcd^!_)`vf{F*VYXYd zW`5k-^}KSF z2A;dUlRiIMZ91DNanhnG3=w+!4NJrojPs)SR-1ZoeX3VZ znK`wb@1%}^{*M<;KwTo-&|FzlSY2Q(LBHBKH+fP_nH4f=t6!jM%UNCU}W%g^>bP0l+XkK Dx5A|Q literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/items/HV-kit.png b/src/main/resources/assets/advancedpowermanagement/textures/items/HV-kit.png new file mode 100755 index 0000000000000000000000000000000000000000..94ef1264be4b926268a79d31cc9be302d0e35609 GIT binary patch literal 406 zcmV;H0crk;P)GeVAI{2^G7g#rQ>LS$0R{#J207*qoM6N<$f{?Vf AJpcdz literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/items/LV-kit.png b/src/main/resources/assets/advancedpowermanagement/textures/items/LV-kit.png new file mode 100755 index 0000000000000000000000000000000000000000..a3f756147fafdb7023180c84c9e960de063f9dbc GIT binary patch literal 387 zcmV-}0et?6P)Nkl$ zgGERWy2)gA|K0hRnOz!fvsce7^2DH*E`w!$g7UsY!5iV@<3G32X!Lz`%IFjpWz_GvfSO&Ch!+1!;>`0<<>Q zVVPS5P-`WV_V5batm^=7pn>MVg;>@J$P47d#r@$nR4=44F_rHK}}1CrFeu%>4PH-f2c- zqPa*iLkEl5(Hl22W;qJ||G(zP|G&vs{?C^WJ^15x`-lJA*Z(}2IYFYMO`>U;N0lJYr4r-B-zuS#Nbny^*D9|W8Kf~57`dQ;rT4o)BBKhf?5fWQ2R~3 zLkhPObJoN$WHRk!cp@~zJYicCk5d_An7%?gW6_!g$64GY61Wp{Ha5)^b7SOSV3;yR W*W9;b{ym_B89ZJ6T-G@yGywo<`d3~6 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/items/LinkCardCreator.png b/src/main/resources/assets/advancedpowermanagement/textures/items/LinkCardCreator.png new file mode 100755 index 0000000000000000000000000000000000000000..6dc9ee048691dd9d796e596163bb5f815d4b653b GIT binary patch literal 226 zcmV<803H8{P)>vQZUzQ0#?TCtz@``*8$&Zl;{Tr&|G$5X`v3EzDj0wJ5dQ!6H9t5F z5(Cj7wHTUVHV}(3oDRa59UM@c333t4c96?pd=vvg cFbco`0M5%TyjR|V!~g&Q07*qoM6N<$f=nh>{{R30 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/items/MV-kit.png b/src/main/resources/assets/advancedpowermanagement/textures/items/MV-kit.png new file mode 100755 index 0000000000000000000000000000000000000000..43c3e5090a0cbd0c8114a75ddc5461f178944b6f GIT binary patch literal 409 zcmV;K0cQS*P);l5Wfx5gK29*Kor4PI6x(W3i0eK_y8Wg`4S#|4n1%XW8dTN z&Xj7kw(+2wOlJ2#JHPJCZZnyLaZ*&!F3D(_Dm+JrTT*efCc!NVD=FwY8e9?M&Esbq zWKjSmjh}1`syfGL-L*B=PVGhEE!H?WJ2%4?g|x&M2UP>dn=&r;^Kf?*G&jV&mJ?or zXDzW714#3;SkV@6RxZGwjBt5Sz}w3Zjcpm8ZNPsGG=DOLx0j0pu6rgP?*<$U0hHu9 z2HPiKlnl7PsiPqp*01P63AH>ov$-zeoJtTHl}B0(aOG~{;kF}=8#J$9(b#t^m5t`T z^72PxV}Qe5gG*?cnt*7iuV&fPmATU^ZBuM|wLhMK08|E*6P}3Hq|^G#gGmE~2~hw+ zQvr01;XE3PS}Gvagk$^uLSy4!07?HxD&*Ij|9ZRwkBV{bb0ysa00000NkvXXu0mjf DVL7gG literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/items/SlotChargeable.png b/src/main/resources/assets/advancedpowermanagement/textures/items/SlotChargeable.png new file mode 100755 index 0000000000000000000000000000000000000000..5f78975999d4ff9190143cc8c7a56d9df3f614d0 GIT binary patch literal 100 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`+MX_sAr-fh6D0O2sH#4-H~S`F x$gqS_TJ3b%rWivWo&#bNQqm5~bS3S9~|GYrgq|XB84H66tQL{pS TYIbP0l+XkKq)j95 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/items/SlotInput.png b/src/main/resources/assets/advancedpowermanagement/textures/items/SlotInput.png new file mode 100755 index 0000000000000000000000000000000000000000..6d83c49e7cfb44af2a07d6a211a559924efa9f2b GIT binary patch literal 95 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`YMw5RAr-fh6C{KbR9zq2yUsdk s)}VB@`FL51kNnxi8y%KD@eXHTc$;gcs&s@+7^s86)78&qol`;+07J1FzW@LL literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/items/SlotInput2.png b/src/main/resources/assets/advancedpowermanagement/textures/items/SlotInput2.png new file mode 100755 index 0000000000000000000000000000000000000000..73a66085bbb3f1c8dd8e2826e1ccaa1a6580cbe5 GIT binary patch literal 133 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`KAtX)Ar-fh6C9W|HKqPbo?ult zn0PKsWq9? f;ycV3VtE)2xGu`g7vIAUG?&5C)z4*}Q$iB}Hkv2~ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/items/SlotLinkCard.png b/src/main/resources/assets/advancedpowermanagement/textures/items/SlotLinkCard.png new file mode 100755 index 0000000000000000000000000000000000000000..1c113b50ccdb411da463765fc47ba20d887bde26 GIT binary patch literal 126 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`uAVNAAr-fh6C_F$6cirVZBnC~hxlP zV_dBuclt$g!}9d&^#W?QjbhjY)(XmAKF_dek3*pXUtftsV33>v14GQq1V^2va}NTI OVeoYIb6Mw<&;$Ud9U-Ft literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/items/SlotOutput.png b/src/main/resources/assets/advancedpowermanagement/textures/items/SlotOutput.png new file mode 100755 index 0000000000000000000000000000000000000000..25bc7bc0f48ecf6d243634cb577beaf30e22597a GIT binary patch literal 121 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`4xTQKAr-fh6C_L&jvsz(&oOx| zpIYO2fu^hvnhM95=5Tdh>+xkiIjd08sccQa(Xvf{{ijMS@RCyS;yvnFd4Pc-@PFOG U+?5+bfMzjxy85}Sb4q9e0231@n*aa+ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/items/SlotPlayerArmor0.png b/src/main/resources/assets/advancedpowermanagement/textures/items/SlotPlayerArmor0.png new file mode 100755 index 0000000000000000000000000000000000000000..1f8cedaa3707c70371c8bb0e34c64603fd06a732 GIT binary patch literal 107 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`MxHK?Ar-fh6C~y-C@4IzH}lz& zR`jGJ*ujH0l=r~X`b9hkmT}C#qhQ2v^Zk*oekL|HhO63+`#0+uRReW1c)I$ztaD0e F0szV`ARqt$ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/items/SlotPlayerArmor1.png b/src/main/resources/assets/advancedpowermanagement/textures/items/SlotPlayerArmor1.png new file mode 100755 index 0000000000000000000000000000000000000000..e9f169551263796093d90385885f37ad0a96256a GIT binary patch literal 127 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Zk{fVAr-fh6C_F$6cirVa|mnq z1vA>2wK?v{Q3;#JIQ{Ym%h?*t9Ic{``2uTaYOx7qa~xbD^N39#$f3mHu#kY&GS6qs Z48LN1BQ1VzVF#MX;OXk;vd$@?2>{YJBkuqJ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/items/SlotPlayerArmor2.png b/src/main/resources/assets/advancedpowermanagement/textures/items/SlotPlayerArmor2.png new file mode 100755 index 0000000000000000000000000000000000000000..87bdf3db7eebaf0c1e421aae868c84a0ec3ed7bb GIT binary patch literal 102 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`x}GkMAr-fh6C_F$6cirV+xY|- z8;bELGH>`fJA=6+v0us{gZIF+cb=#CmoPCr<;uvGDcgG+sFA_b)z4*}Q$iB}zBU{| literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/items/SlotPlayerArmor3.png b/src/main/resources/assets/advancedpowermanagement/textures/items/SlotPlayerArmor3.png new file mode 100755 index 0000000000000000000000000000000000000000..22d4d428d93e8e89d61aa2db9cf6ae6a0be39469 GIT binary patch literal 111 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`W}YsNAr-fh6C~;s6cirV^E?(l zymF?9m5;@F*Id66;xm{p$%9>H*Ao~CS literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/items/SlotPowerSource0.png b/src/main/resources/assets/advancedpowermanagement/textures/items/SlotPowerSource0.png new file mode 100755 index 0000000000000000000000000000000000000000..1174af7fbf546f99bdd5d1a712c4d6f14abbdfd6 GIT binary patch literal 112 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`=AJH&Ar-fh6Bej)aB%$KKO~Z^ za#CT2Qwj5hqaI~u7uPv#8?QthTY|SsO1f4O1B1O*pm{-L-yEP344$rj JF6*2UngAf$A58!N literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/items/SlotPowerSource1.png b/src/main/resources/assets/advancedpowermanagement/textures/items/SlotPowerSource1.png new file mode 100755 index 0000000000000000000000000000000000000000..65bf22a919d6882de9fde5ab584ab1d87c70eeda GIT binary patch literal 117 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Hl8kyAr-fh6C}1M96$Wn-bgLd z*f7Z@TkV#B6PJb=!+NQtzaASIEw1wIVH9Ck3guZ~q4@9=d&*PxBu0j%lk5{`)J=E* PG>5^{)z4*}Q$iB}yrv

mdKI;Vst08mLK{Qv*} literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedpowermanagement/textures/items/toolkit.png b/src/main/resources/assets/advancedpowermanagement/textures/items/toolkit.png new file mode 100755 index 0000000000000000000000000000000000000000..e0c3c2bac667796ac920f9cf6fe176d1e68ac206 GIT binary patch literal 192 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`?Vc` zdn|P8|9xdyGuRqT4yz>0^4umHD|5Fj#k=5E-