From 6355d11b0f956b405382b037130971d132bc1855 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Tue, 11 Apr 2017 19:26:46 +0100 Subject: [PATCH] Add energy storage upgrades. --- .../builder/ContainerTileInventoryBuilder.java | 4 +++- src/main/java/techreborn/items/ItemUpgrades.java | 15 ++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/techreborn/client/container/builder/ContainerTileInventoryBuilder.java b/src/main/java/techreborn/client/container/builder/ContainerTileInventoryBuilder.java index 507a32ed7..2c9f74993 100644 --- a/src/main/java/techreborn/client/container/builder/ContainerTileInventoryBuilder.java +++ b/src/main/java/techreborn/client/container/builder/ContainerTileInventoryBuilder.java @@ -155,7 +155,9 @@ public class ContainerTileInventoryBuilder { public ContainerTileInventoryBuilder syncEnergyValue() { if (this.tile instanceof TilePowerAcceptor) return this.syncIntegerValue(() -> (int) ((TilePowerAcceptor) this.tile).getEnergy(), - ((TilePowerAcceptor) this.tile)::setEnergy); + ((TilePowerAcceptor) this.tile)::setEnergy) + .syncIntegerValue(() -> (int) ((TilePowerAcceptor) this.tile).extraPowerStoage, + ((TilePowerAcceptor) this.tile)::setExtraPowerStoage); Core.logHelper.error(this.tile + " is not an instance of TilePowerAcceptor! Energy cannot be synced."); return this; } diff --git a/src/main/java/techreborn/items/ItemUpgrades.java b/src/main/java/techreborn/items/ItemUpgrades.java index 7c4dcc084..1dcb929ce 100644 --- a/src/main/java/techreborn/items/ItemUpgrades.java +++ b/src/main/java/techreborn/items/ItemUpgrades.java @@ -32,6 +32,7 @@ import net.minecraft.util.NonNullList; import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.translation.I18n; import reborncore.api.tile.IUpgrade; +import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.recipes.RecipeCrafter; import reborncore.common.tile.TileLegacyMachineBase; import techreborn.client.TechRebornCreativeTabMisc; @@ -84,13 +85,6 @@ public class ItemUpgrades extends ItemTRNoDestroy implements IUpgrade { } } - @Override - public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) { - tooltip.add(TextFormatting.RED + I18n.translateToLocal("tooltip.wip")); - tooltip.add(TextFormatting.RED + I18n.translateToLocal("tooltip.upBroken")); - tooltip.add(TextFormatting.RED + I18n.translateToLocal("tooltip.ingredient")); - } - @Override public void process( @Nonnull @@ -105,5 +99,12 @@ public class ItemUpgrades extends ItemTRNoDestroy implements IUpgrade { crafter.addPowerMulti(0.5); } } + if(machineBase instanceof TilePowerAcceptor){ + if (stack.getItemDamage() == 2) { + TilePowerAcceptor acceptor = (TilePowerAcceptor) machineBase; + acceptor.extraPowerStoage += acceptor.getBaseMaxPower(); + } + } + } } \ No newline at end of file