Add energy storage upgrades.

This commit is contained in:
modmuss50 2017-04-11 19:26:46 +01:00
parent 1ccd192790
commit 6355d11b0f
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82
2 changed files with 11 additions and 8 deletions

View file

@ -155,7 +155,9 @@ public class ContainerTileInventoryBuilder {
public ContainerTileInventoryBuilder syncEnergyValue() { public ContainerTileInventoryBuilder syncEnergyValue() {
if (this.tile instanceof TilePowerAcceptor) if (this.tile instanceof TilePowerAcceptor)
return this.syncIntegerValue(() -> (int) ((TilePowerAcceptor) this.tile).getEnergy(), 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."); Core.logHelper.error(this.tile + " is not an instance of TilePowerAcceptor! Energy cannot be synced.");
return this; return this;
} }

View file

@ -32,6 +32,7 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n; import net.minecraft.util.text.translation.I18n;
import reborncore.api.tile.IUpgrade; import reborncore.api.tile.IUpgrade;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.tile.TileLegacyMachineBase; import reborncore.common.tile.TileLegacyMachineBase;
import techreborn.client.TechRebornCreativeTabMisc; import techreborn.client.TechRebornCreativeTabMisc;
@ -84,13 +85,6 @@ public class ItemUpgrades extends ItemTRNoDestroy implements IUpgrade {
} }
} }
@Override
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> 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 @Override
public void process( public void process(
@Nonnull @Nonnull
@ -105,5 +99,12 @@ public class ItemUpgrades extends ItemTRNoDestroy implements IUpgrade {
crafter.addPowerMulti(0.5); crafter.addPowerMulti(0.5);
} }
} }
if(machineBase instanceof TilePowerAcceptor){
if (stack.getItemDamage() == 2) {
TilePowerAcceptor acceptor = (TilePowerAcceptor) machineBase;
acceptor.extraPowerStoage += acceptor.getBaseMaxPower();
}
}
} }
} }