From 3ed5e9cc8a5e98de6bd65f0e4afada9c7ea12a43 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 23 Nov 2016 18:10:55 +0100 Subject: [PATCH] Added internal energy methods to avoid things only using energy up to their cap --- .../mod/blocks/BlockShockSuppressor.java | 4 +- .../mod/inventory/gui/EnergyDisplay.java | 9 ++-- .../mod/items/ItemDrill.java | 4 +- .../mod/items/ItemFillingWand.java | 2 +- .../mod/items/ItemGrowthRing.java | 2 +- .../mod/items/ItemMagnetRing.java | 2 +- .../mod/items/ItemTeleStaff.java | 2 +- .../mod/items/ItemWaterRemovalRing.java | 4 +- .../mod/items/base/ItemEnergy.java | 20 ++++++++ .../mod/tile/CustomEnergyStorage.java | 48 +++++++++++++++++++ .../mod/tile/IEnergyDisplay.java | 2 +- .../tile/TileEntityAtomicReconstructor.java | 8 ++-- .../mod/tile/TileEntityBioReactor.java | 4 +- .../mod/tile/TileEntityCanolaPress.java | 4 +- .../mod/tile/TileEntityCoalGenerator.java | 4 +- .../mod/tile/TileEntityCoffeeMachine.java | 4 +- .../tile/TileEntityDirectionalBreaker.java | 4 +- .../mod/tile/TileEntityDisplayStand.java | 6 +-- .../mod/tile/TileEntityEmpowerer.java | 2 +- .../mod/tile/TileEntityEnergizer.java | 4 +- .../mod/tile/TileEntityEnervator.java | 4 +- .../mod/tile/TileEntityFarmer.java | 4 +- .../mod/tile/TileEntityFireworkBox.java | 6 +-- .../mod/tile/TileEntityFurnaceDouble.java | 6 +-- .../mod/tile/TileEntityFurnaceSolar.java | 6 +-- .../mod/tile/TileEntityGrinder.java | 6 +-- .../mod/tile/TileEntityHeatCollector.java | 6 +-- .../mod/tile/TileEntityItemRepairer.java | 4 +- .../tile/TileEntityLavaFactoryController.java | 6 +-- .../mod/tile/TileEntityLeafGenerator.java | 6 +-- .../mod/tile/TileEntityMiner.java | 6 +-- .../mod/tile/TileEntityOilGenerator.java | 4 +- .../mod/tile/TileEntityPlayerInterface.java | 6 +-- .../mod/tile/TileEntityShockSuppressor.java | 4 +- .../actuallyadditions/mod/util/WorldUtil.java | 1 + 35 files changed, 142 insertions(+), 72 deletions(-) create mode 100644 src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java index 518cc57e6..33f51104b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockShockSuppressor.java @@ -73,7 +73,7 @@ public class BlockShockSuppressor extends BlockContainerBase{ for(BlockPos pos : posesToRemove){ if(suppressor.storage.getEnergyStored() >= use){ - suppressor.storage.extractEnergy(use, false); + suppressor.storage.extractEnergyInternal(use, false); affectedBlocks.remove(pos); } else{ @@ -82,7 +82,7 @@ public class BlockShockSuppressor extends BlockContainerBase{ } for(Entity entity : entitiesToRemove){ if(suppressor.storage.getEnergyStored() >= use){ - suppressor.storage.extractEnergy(use, false); + suppressor.storage.extractEnergyInternal(use, false); affectedEntities.remove(entity); } else{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java index e76665859..d75efe2f7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/EnergyDisplay.java @@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.inventory.gui; import cofh.api.energy.EnergyStorage; import de.ellpeck.actuallyadditions.mod.data.PlayerData; import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; +import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; @@ -28,22 +29,22 @@ import java.util.List; public class EnergyDisplay extends Gui{ - private EnergyStorage rfReference; + private CustomEnergyStorage rfReference; private int x; private int y; private boolean outline; private boolean drawTextNextTo; private boolean displayTesla; - public EnergyDisplay(int x, int y, EnergyStorage rfReference, boolean outline, boolean drawTextNextTo){ + public EnergyDisplay(int x, int y, CustomEnergyStorage rfReference, boolean outline, boolean drawTextNextTo){ this.setData(x, y, rfReference, outline, drawTextNextTo); } - public EnergyDisplay(int x, int y, EnergyStorage rfReference){ + public EnergyDisplay(int x, int y, CustomEnergyStorage rfReference){ this(x, y, rfReference, false, false); } - public void setData(int x, int y, EnergyStorage rfReference, boolean outline, boolean drawTextNextTo){ + public void setData(int x, int y, CustomEnergyStorage rfReference, boolean outline, boolean drawTextNextTo){ this.x = x; this.y = y; this.rfReference = rfReference; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java index 70f52a887..40ebe80b5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java @@ -183,7 +183,7 @@ public class ItemDrill extends ItemEnergy{ public boolean hitEntity(ItemStack stack, EntityLivingBase entity1, EntityLivingBase entity2){ int use = this.getEnergyUsePerBlock(stack); if(this.getEnergyStored(stack) >= use){ - this.extractEnergy(stack, use, false); + this.extractEnergyInternal(stack, use, false); } return true; } @@ -492,7 +492,7 @@ public class ItemDrill extends ItemEnergy{ float hardness = block.getBlockHardness(state, world, pos); boolean canHarvest = (ForgeHooks.canHarvestBlock(block, player, world, pos) || this.canHarvestBlock(state, stack)) && (!isExtra || this.getStrVsBlock(stack, world.getBlockState(pos)) > 1.0F); if(hardness >= 0.0F && (!isExtra || (canHarvest && !block.hasTileEntity(world.getBlockState(pos))))){ - this.extractEnergy(stack, use, false); + this.extractEnergyInternal(stack, use, false); //Break the Block return WorldUtil.playerHarvestBlock(stack, world, player, pos); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java index c508b5d26..851de1afa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java @@ -182,7 +182,7 @@ public class ItemFillingWand extends ItemEnergy{ world.playSound(null, pos, sound.getPlaceSound(), SoundCategory.BLOCKS, (sound.getVolume()+1.0F)/2.0F, sound.getPitch()*0.8F); if(!creative){ - this.extractEnergy(stack, energyUse, false); + this.extractEnergyInternal(stack, energyUse, false); } } else{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java index af89c268f..835ce1b22 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java @@ -83,7 +83,7 @@ public class ItemGrowthRing extends ItemEnergy{ } if(!player.capabilities.isCreativeMode){ - this.extractEnergy(stack, energyUse, false); + this.extractEnergyInternal(stack, energyUse, false); } } else{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java index f0c41e42c..11ad369fc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java @@ -46,7 +46,7 @@ public class ItemMagnetRing extends ItemEnergy{ item.onCollideWithPlayer(player); if(!player.capabilities.isCreativeMode){ - this.extractEnergy(stack, energyForItem, false); + this.extractEnergyInternal(stack, energyForItem, false); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java index 83cd4e88a..4a1b39cdd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java @@ -49,7 +49,7 @@ public class ItemTeleStaff extends ItemEnergy{ player.dismountRidingEntity(); world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.PLAYERS, 1.0F, 1.0F); if(!player.capabilities.isCreativeMode){ - this.extractEnergy(stack, use, false); + this.extractEnergyInternal(stack, use, false); player.getCooldownTracker().setCooldown(this, 50); } return ActionResult.newResult(EnumActionResult.SUCCESS, stack); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java index 7fbe062bf..45f766c3c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java @@ -57,7 +57,7 @@ public class ItemWaterRemovalRing extends ItemEnergy{ world.setBlockToAir(pos); if(!player.capabilities.isCreativeMode){ - this.extractEnergy(stack, energyUse, false); + this.extractEnergyInternal(stack, energyUse, false); } } //Remove Lava @@ -65,7 +65,7 @@ public class ItemWaterRemovalRing extends ItemEnergy{ world.setBlockToAir(pos); if(!player.capabilities.isCreativeMode){ - this.extractEnergy(stack, energyUse*2, false); + this.extractEnergyInternal(stack, energyUse*2, false); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java index 552d96124..ba6792465 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemEnergy.java @@ -122,4 +122,24 @@ public abstract class ItemEnergy extends ItemEnergyContainer{ public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt){ return ActuallyAdditions.teslaLoaded ? new ItemTeslaWrapper(stack, this) : null; } + + public int extractEnergyInternal(ItemStack stack, int maxExtract, boolean simulate){ + int before = this.maxExtract; + this.setMaxExtract(Integer.MAX_VALUE); + + int toReturn = this.extractEnergy(stack, maxExtract, simulate); + + this.setMaxExtract(before); + return toReturn; + } + + public int receiveEnergyInternal(ItemStack stack, int maxReceive, boolean simulate){ + int before = this.maxReceive; + this.setMaxReceive(Integer.MAX_VALUE); + + int toReturn = this.receiveEnergy(stack, maxReceive, simulate); + + this.setMaxReceive(before); + return toReturn; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java new file mode 100644 index 000000000..f21054007 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/CustomEnergyStorage.java @@ -0,0 +1,48 @@ +/* + * This file ("CustomEnergyStorage.java") is part of the Actually Additions mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2015-2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.tile; + +import cofh.api.energy.EnergyStorage; + +public class CustomEnergyStorage extends EnergyStorage{ + + public CustomEnergyStorage(int capacity){ + super(capacity); + } + + public CustomEnergyStorage(int capacity, int maxTransfer){ + super(capacity, maxTransfer); + } + + public CustomEnergyStorage(int capacity, int maxReceive, int maxExtract){ + super(capacity, maxReceive, maxExtract); + } + + public int extractEnergyInternal(int maxExtract, boolean simulate){ + int before = this.maxExtract; + this.setMaxExtract(Integer.MAX_VALUE); + + int toReturn = this.extractEnergy(maxExtract, simulate); + + this.setMaxExtract(before); + return toReturn; + } + + public int receiveEnergyInternal(int maxReceive, boolean simulate){ + int before = this.maxReceive; + this.setMaxReceive(Integer.MAX_VALUE); + + int toReturn = this.receiveEnergy(maxReceive, simulate); + + this.setMaxReceive(before); + return toReturn; + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/IEnergyDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/IEnergyDisplay.java index 377845621..4b676c32d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/IEnergyDisplay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/IEnergyDisplay.java @@ -17,7 +17,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public interface IEnergyDisplay{ @SideOnly(Side.CLIENT) - EnergyStorage getEnergyStorage(); + CustomEnergyStorage getEnergyStorage(); @SideOnly(Side.CLIENT) boolean needsHoldShift(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java index 285a87005..7c89bc25b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java @@ -30,7 +30,7 @@ import net.minecraft.world.World; public class TileEntityAtomicReconstructor extends TileEntityInventoryBase implements ICustomEnergyReceiver, IEnergyDisplay, IAtomicReconstructor{ public static final int ENERGY_USE = 1000; - public final EnergyStorage storage = new EnergyStorage(300000, 5000); + public final CustomEnergyStorage storage = new CustomEnergyStorage(300000, 5000); public int counter; private int currentTime; private int oldEnergy; @@ -100,7 +100,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple Lens currentLens = this.getLens(); if(currentLens.canInvoke(this, sideToManipulate, ENERGY_USE)){ //Extract energy for shooting the laser itself too! - this.storage.extractEnergy(ENERGY_USE, false); + this.storage.extractEnergyInternal(ENERGY_USE, false); int distance = currentLens.getDistance(); for(int i = 0; i < distance; i++){ @@ -147,7 +147,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple @Override public void extractEnergy(int amount){ - this.storage.extractEnergy(amount, false); + this.storage.extractEnergyInternal(amount, false); } @Override @@ -197,7 +197,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple } @Override - public EnergyStorage getEnergyStorage(){ + public CustomEnergyStorage getEnergyStorage(){ return this.storage; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java index 2a2c89a49..4260e2a2b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBioReactor.java @@ -27,7 +27,7 @@ import java.util.List; public class TileEntityBioReactor extends TileEntityInventoryBase implements ISharingEnergyProvider{ - public final EnergyStorage storage = new EnergyStorage(200000, 800); + public final CustomEnergyStorage storage = new CustomEnergyStorage(200000, 800); public int burnTime; public int maxBurnTime; @@ -98,7 +98,7 @@ public class TileEntityBioReactor extends TileEntityInventoryBase implements ISh } else{ this.burnTime--; - this.storage.receiveEnergy(this.producePerTick, false); + this.storage.receiveEnergyInternal(this.producePerTick, false); } if((this.lastBurnTime != this.burnTime || this.lastProducePerTick != this.producePerTick) && this.sendUpdateWithInterval()){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java index 9a840a108..a63190eb2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java @@ -30,7 +30,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IC public static final int PRODUCE = 80; public static final int ENERGY_USE = 35; private static final int TIME = 30; - public final EnergyStorage storage = new EnergyStorage(40000, 100); + public final CustomEnergyStorage storage = new CustomEnergyStorage(40000, 100); public final FluidTank tank = new FluidTank(2*Util.BUCKET){ @Override public boolean canFill(){ @@ -88,7 +88,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IC if(this.isCanola(0) && PRODUCE <= this.tank.getCapacity()-this.tank.getFluidAmount()){ if(this.storage.getEnergyStored() >= ENERGY_USE){ this.currentProcessTime++; - this.storage.extractEnergy(ENERGY_USE, false); + this.storage.extractEnergyInternal(ENERGY_USE, false); if(this.currentProcessTime >= TIME){ this.currentProcessTime = 0; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java index c76e815e1..2fc3b9ab8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java @@ -22,7 +22,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class TileEntityCoalGenerator extends TileEntityInventoryBase implements ISharingEnergyProvider{ public static final int PRODUCE = 30; - public final EnergyStorage storage = new EnergyStorage(60000, 80); + public final CustomEnergyStorage storage = new CustomEnergyStorage(60000, 80); public int maxBurnTime; public int currentBurnTime; private int lastEnergy; @@ -71,7 +71,7 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements if(this.currentBurnTime > 0){ this.currentBurnTime--; - this.storage.receiveEnergy(PRODUCE, false); + this.storage.receiveEnergyInternal(PRODUCE, false); } if(this.currentBurnTime <= 0 && StackUtil.isValid(this.slots.get(0)) && TileEntityFurnace.getItemBurnTime(this.slots.get(0)) > 0 && this.storage.getEnergyStored() < this.storage.getMaxEnergyStored()){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java index f4ca82862..6865ce07c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java @@ -40,7 +40,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements public static final int WATER_USE = 500; public static final int COFFEE_CACHE_MAX_AMOUNT = 300; private static final int TIME_USED = 500; - public final EnergyStorage storage = new EnergyStorage(300000, 250); + public final CustomEnergyStorage storage = new CustomEnergyStorage(300000, 250); public final FluidTank tank = new FluidTank(4*Util.BUCKET){ @Override public boolean canDrain(){ @@ -148,7 +148,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements } this.brewTime++; - this.storage.extractEnergy(ENERGY_USED, false); + this.storage.extractEnergyInternal(ENERGY_USED, false); if(this.brewTime >= TIME_USED){ this.brewTime = 0; ItemStack output = new ItemStack(InitItems.itemCoffee); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java index 5ce5ea785..f6768903c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java @@ -28,7 +28,7 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem public static final int RANGE = 8; public static final int ENERGY_USE = 5; - public final EnergyStorage storage = new EnergyStorage(10000, 20); + public final CustomEnergyStorage storage = new CustomEnergyStorage(10000, 20); private int lastEnergy; private int currentTime; @@ -93,7 +93,7 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem this.worldObj.playEvent(2001, coordsBlock, Block.getStateId(this.worldObj.getBlockState(coordsBlock))); this.worldObj.setBlockToAir(coordsBlock); WorldUtil.addToInventory(this, drops, true, true); - this.storage.extractEnergy(ENERGY_USE, false); + this.storage.extractEnergyInternal(ENERGY_USE, false); this.markDirty(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java index 35d5e68ab..6c87ef594 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDisplayStand.java @@ -22,7 +22,7 @@ import net.minecraft.util.EnumFacing; public class TileEntityDisplayStand extends TileEntityInventoryBase implements IEnergyDisplay, ICustomEnergyReceiver{ - public final EnergyStorage storage = new EnergyStorage(80000, 1000); + public final CustomEnergyStorage storage = new CustomEnergyStorage(80000, 1000); private int oldEnergy; public TileEntityDisplayStand(){ @@ -40,7 +40,7 @@ public class TileEntityDisplayStand extends TileEntityInventoryBase implements I int energy = item.getUsePerTick(this.slots.get(0), this, this.ticksElapsed); if(this.storage.getEnergyStored() >= energy){ if(item.update(this.slots.get(0), this, this.ticksElapsed)){ - this.storage.extractEnergy(energy, false); + this.storage.extractEnergyInternal(energy, false); } } } @@ -104,7 +104,7 @@ public class TileEntityDisplayStand extends TileEntityInventoryBase implements I } @Override - public EnergyStorage getEnergyStorage(){ + public CustomEnergyStorage getEnergyStorage(){ return this.storage; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java index 71307a0ce..25825a74d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEmpowerer.java @@ -62,7 +62,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase{ boolean done = this.processTime >= recipe.time; for(TileEntityDisplayStand stand : modifierStands){ - stand.storage.extractEnergy(recipe.energyPerStand/recipe.time, false); + stand.storage.extractEnergyInternal(recipe.energyPerStand/recipe.time, false); if(done){ stand.decrStackSize(0, 1); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java index bd72e2101..aa5b261ee 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnergizer.java @@ -25,7 +25,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class TileEntityEnergizer extends TileEntityInventoryBase implements ICustomEnergyReceiver{ - public final EnergyStorage storage = new EnergyStorage(50000, 1000); + public final CustomEnergyStorage storage = new CustomEnergyStorage(50000, 1000); private int lastEnergy; public TileEntityEnergizer(){ @@ -73,7 +73,7 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements ICus } } if(received > 0){ - this.storage.extractEnergy(received, false); + this.storage.extractEnergyInternal(received, false); } if(canTakeUp){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java index 4f63bdf1c..b00094c23 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityEnervator.java @@ -25,7 +25,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class TileEntityEnervator extends TileEntityInventoryBase implements ISharingEnergyProvider{ - public final EnergyStorage storage = new EnergyStorage(50000, 1000); + public final CustomEnergyStorage storage = new CustomEnergyStorage(50000, 1000); private int lastEnergy; public TileEntityEnervator(){ @@ -74,7 +74,7 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements ISha } } if(extracted > 0){ - this.storage.receiveEnergy(extracted, false); + this.storage.receiveEnergyInternal(extracted, false); } if(canTakeUp){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java index d90142956..63c7c25d5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFarmer.java @@ -35,7 +35,7 @@ import java.util.List; public class TileEntityFarmer extends TileEntityInventoryBase implements ICustomEnergyReceiver{ public static final int USE_PER_OPERATION = 1500; - public final EnergyStorage storage = new EnergyStorage(100000, 1000); + public final CustomEnergyStorage storage = new CustomEnergyStorage(100000, 1000); private int waitTime; private int checkX; @@ -145,7 +145,7 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements ICustom } if(didSomething){ - this.storage.extractEnergy(USE_PER_OPERATION, false); + this.storage.extractEnergyInternal(USE_PER_OPERATION, false); } this.checkX++; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java index 3d6f748d3..5cdbee53a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java @@ -24,7 +24,7 @@ import net.minecraft.world.World; public class TileEntityFireworkBox extends TileEntityBase implements ICustomEnergyReceiver, IEnergyDisplay{ public static final int USE_PER_SHOT = 300; - public final EnergyStorage storage = new EnergyStorage(20000, 200); + public final CustomEnergyStorage storage = new CustomEnergyStorage(20000, 200); private int timeUntilNextFirework; private int oldEnergy; @@ -127,7 +127,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements ICustomEner if(this.storage.getEnergyStored() >= USE_PER_SHOT){ this.spawnFireworks(this.worldObj, this.pos.getX(), this.pos.getY(), this.pos.getZ()); - this.storage.extractEnergy(USE_PER_SHOT, false); + this.storage.extractEnergyInternal(USE_PER_SHOT, false); } } @@ -162,7 +162,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements ICustomEner } @Override - public EnergyStorage getEnergyStorage(){ + public CustomEnergyStorage getEnergyStorage(){ return this.storage; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java index 9ddb77fe4..2c7ece2d0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceDouble.java @@ -33,7 +33,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements public static final int SLOT_OUTPUT_2 = 3; public static final int ENERGY_USE = 25; private static final int SMELT_TIME = 80; - public final EnergyStorage storage = new EnergyStorage(30000, 80); + public final CustomEnergyStorage storage = new CustomEnergyStorage(30000, 80); public int firstSmeltTime; public int secondSmeltTime; public boolean isAutoSplit; @@ -118,7 +118,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements this.finishBurning(SLOT_INPUT_1, SLOT_OUTPUT_1); this.firstSmeltTime = 0; } - this.storage.extractEnergy(ENERGY_USE, false); + this.storage.extractEnergyInternal(ENERGY_USE, false); } } else{ @@ -132,7 +132,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements this.finishBurning(SLOT_INPUT_2, SLOT_OUTPUT_2); this.secondSmeltTime = 0; } - this.storage.extractEnergy(ENERGY_USE, false); + this.storage.extractEnergyInternal(ENERGY_USE, false); } } else{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java index 8a0ba58f5..d94754f1e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java @@ -19,7 +19,7 @@ import net.minecraft.util.math.BlockPos; public class TileEntityFurnaceSolar extends TileEntityBase implements ISharingEnergyProvider, IEnergyDisplay{ public static final int PRODUCE = 8; - public final EnergyStorage storage = new EnergyStorage(30000, 100); + public final CustomEnergyStorage storage = new CustomEnergyStorage(30000, 100); private int oldEnergy; public TileEntityFurnaceSolar(){ @@ -65,7 +65,7 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements ISharingEn int power = this.getPowerToGenerate(PRODUCE); if(this.worldObj.isDaytime() && power > 0){ if(power <= this.storage.getMaxEnergyStored()-this.storage.getEnergyStored()){ - this.storage.receiveEnergy(power, false); + this.storage.receiveEnergyInternal(power, false); this.markDirty(); } } @@ -98,7 +98,7 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements ISharingEn } @Override - public EnergyStorage getEnergyStorage(){ + public CustomEnergyStorage getEnergyStorage(){ return this.storage; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java index d05bef023..7517c2235 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java @@ -36,7 +36,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements ICusto public static final int SLOT_OUTPUT_2_1 = 4; public static final int SLOT_OUTPUT_2_2 = 5; public static final int ENERGY_USE = 40; - public final EnergyStorage storage = new EnergyStorage(60000, 100); + public final CustomEnergyStorage storage = new CustomEnergyStorage(60000, 100); public int firstCrushTime; public int secondCrushTime; public boolean isDouble; @@ -125,7 +125,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements ICusto this.finishCrushing(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2); this.firstCrushTime = 0; } - this.storage.extractEnergy(ENERGY_USE, false); + this.storage.extractEnergyInternal(ENERGY_USE, false); } } else{ @@ -143,7 +143,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements ICusto this.finishCrushing(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2); this.secondCrushTime = 0; } - this.storage.extractEnergy(ENERGY_USE, false); + this.storage.extractEnergyInternal(ENERGY_USE, false); } } else{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java index ccb738c9a..69be6260d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java @@ -25,7 +25,7 @@ public class TileEntityHeatCollector extends TileEntityBase implements ISharingE public static final int ENERGY_PRODUCE = 40; public static final int BLOCKS_NEEDED = 4; - public final EnergyStorage storage = new EnergyStorage(30000, 80); + public final CustomEnergyStorage storage = new CustomEnergyStorage(30000, 80); private int oldEnergy; public TileEntityHeatCollector(){ @@ -60,7 +60,7 @@ public class TileEntityHeatCollector extends TileEntityBase implements ISharingE } if(blocksAround.size() >= BLOCKS_NEEDED){ - this.storage.receiveEnergy(ENERGY_PRODUCE, false); + this.storage.receiveEnergyInternal(ENERGY_PRODUCE, false); this.markDirty(); if(this.worldObj.rand.nextInt(10000) == 0){ @@ -97,7 +97,7 @@ public class TileEntityHeatCollector extends TileEntityBase implements ISharingE } @Override - public EnergyStorage getEnergyStorage(){ + public CustomEnergyStorage getEnergyStorage(){ return this.storage; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java index 7f1dcb69c..300968478 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemRepairer.java @@ -25,7 +25,7 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I public static final int SLOT_INPUT = 0; public static final int SLOT_OUTPUT = 1; public static final int ENERGY_USE = 2500; - public final EnergyStorage storage = new EnergyStorage(300000, 6000); + public final CustomEnergyStorage storage = new CustomEnergyStorage(300000, 6000); public int nextRepairTick; private int lastEnergy; @@ -87,7 +87,7 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I else{ if(this.storage.getEnergyStored() >= ENERGY_USE){ this.nextRepairTick++; - this.storage.extractEnergy(ENERGY_USE, false); + this.storage.extractEnergyInternal(ENERGY_USE, false); if(this.nextRepairTick >= 4){ this.nextRepairTick = 0; input.setItemDamage(input.getItemDamage()-1); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java index f49ce27ad..0c9925c8e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java @@ -27,7 +27,7 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I public static final int HAS_LAVA = 1; public static final int HAS_AIR = 2; public static final int ENERGY_USE = 150000; - public final EnergyStorage storage = new EnergyStorage(300000, 2000); + public final CustomEnergyStorage storage = new CustomEnergyStorage(300000, 2000); private int currentWorkTime; private int oldEnergy; @@ -62,7 +62,7 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I if(this.currentWorkTime >= 200){ this.currentWorkTime = 0; this.worldObj.setBlockState(this.pos.up(), Blocks.LAVA.getDefaultState(), 2); - this.storage.extractEnergy(ENERGY_USE, false); + this.storage.extractEnergyInternal(ENERGY_USE, false); } } else{ @@ -119,7 +119,7 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I } @Override - public EnergyStorage getEnergyStorage(){ + public CustomEnergyStorage getEnergyStorage(){ return this.storage; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java index f2b215787..1e8ed2b71 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java @@ -25,7 +25,7 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE public static final int RANGE = 7; public static final int ENERGY_PRODUCED = 300; - public final EnergyStorage storage = new EnergyStorage(35000, 450); + public final CustomEnergyStorage storage = new CustomEnergyStorage(35000, 450); private int nextUseCounter; private int oldEnergy; @@ -77,7 +77,7 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE this.worldObj.setBlockToAir(theCoord); - this.storage.receiveEnergy(ENERGY_PRODUCED, false); + this.storage.receiveEnergyInternal(ENERGY_PRODUCED, false); AssetUtil.shootParticles(this.worldObj, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F, 1F); } @@ -115,7 +115,7 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE } @Override - public EnergyStorage getEnergyStorage(){ + public CustomEnergyStorage getEnergyStorage(){ return this.storage; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java index 3da74a0e2..57e096108 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java @@ -34,7 +34,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements ICustomE public static final int ENERGY_USE_PER_BLOCK = 650; public static final int DEFAULT_RANGE = 2; - public final EnergyStorage storage = new EnergyStorage(200000, 2000); + public final CustomEnergyStorage storage = new CustomEnergyStorage(200000, 2000); public int layerAt = -1; public boolean onlyMineOres; private int oldLayerAt; @@ -113,7 +113,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements ICustomE WorldUtil.addToInventory(this, drops, true, true); this.markDirty(); - this.storage.extractEnergy(actualUse, false); + this.storage.extractEnergyInternal(actualUse, false); this.shootParticles(pos.getX(), pos.getY(), pos.getZ()); } } @@ -225,7 +225,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements ICustomE } @Override - public EnergyStorage getEnergyStorage(){ + public CustomEnergyStorage getEnergyStorage(){ return this.storage; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java index 3b5d558e6..b257d06b0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityOilGenerator.java @@ -25,7 +25,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class TileEntityOilGenerator extends TileEntityBase implements ISharingEnergyProvider, ISharingFluidHandler{ - public final EnergyStorage storage = new EnergyStorage(50000, 150); + public final CustomEnergyStorage storage = new CustomEnergyStorage(50000, 150); public final FluidTank tank = new FluidTank(2*Util.BUCKET){ @Override public boolean canDrain(){ @@ -110,7 +110,7 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn if(this.currentBurnTime > 0 && this.currentEnergyProduce > 0){ this.currentBurnTime--; - this.storage.receiveEnergy(this.currentEnergyProduce, false); + this.storage.receiveEnergyInternal(this.currentEnergyProduce, false); } else if(!this.isRedstonePowered){ int fuelUsed = 50; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlayerInterface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlayerInterface.java index 30fb4b1b4..473e84b50 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlayerInterface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPlayerInterface.java @@ -27,7 +27,7 @@ import java.util.UUID; public class TileEntityPlayerInterface extends TileEntityInventoryBase implements ICustomEnergyReceiver, IEnergyDisplay{ public static final int DEFAULT_RANGE = 32; - private final EnergyStorage storage = new EnergyStorage(30000, 50); + private final CustomEnergyStorage storage = new CustomEnergyStorage(30000, 50); public UUID connectedPlayer; public String playerName; private int oldEnergy; @@ -77,7 +77,7 @@ public class TileEntityPlayerInterface extends TileEntityInventoryBase implement } if(received > 0){ - this.storage.extractEnergy(received, false); + this.storage.extractEnergyInternal(received, false); } } } @@ -231,7 +231,7 @@ public class TileEntityPlayerInterface extends TileEntityInventoryBase implement } @Override - public EnergyStorage getEnergyStorage(){ + public CustomEnergyStorage getEnergyStorage(){ return this.storage; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java index 9f987e4bf..5d5e5af05 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityShockSuppressor.java @@ -24,7 +24,7 @@ public class TileEntityShockSuppressor extends TileEntityBase implements ICustom public static final int USE_PER = 300; public static final int RANGE = 5; - public EnergyStorage storage = new EnergyStorage(300000, 400); + public CustomEnergyStorage storage = new CustomEnergyStorage(300000, 400); private int oldEnergy; public TileEntityShockSuppressor(){ @@ -97,7 +97,7 @@ public class TileEntityShockSuppressor extends TileEntityBase implements ICustom } @Override - public EnergyStorage getEnergyStorage(){ + public CustomEnergyStorage getEnergyStorage(){ return this.storage; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java index cba13d49e..78bad2603 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java @@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.util; import cofh.api.energy.IEnergyProvider; import cofh.api.energy.IEnergyReceiver; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; +import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy; import de.ellpeck.actuallyadditions.mod.util.compat.TeslaUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material;