Add energy storage upgrades.
This commit is contained in:
parent
1ccd192790
commit
6355d11b0f
2 changed files with 11 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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<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
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue