Remove almost all explicit uses of CapabilityEnergy (#1643)

* Battery packs (ItemLithiumBackpack/ItemLapotronPack) still use CapEnergy explicitly, but don't charge IC2 items.
 * Note: Before we can remove FE, we have to modify StackInfoHUD and ItemUtils in RebornCore.
This commit is contained in:
coderbot16 2018-12-27 05:58:55 -08:00 committed by Modmuss50
parent fbc8ceb1ed
commit a766cdfa53
27 changed files with 64 additions and 76 deletions

View file

@ -41,10 +41,10 @@ import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage;
import prospector.shootingstar.ShootingStar;
import prospector.shootingstar.model.ModelCompound;
import reborncore.common.powerSystem.forge.ForgePowerItemManager;
import reborncore.common.util.WorldUtils;
import techreborn.events.TRRecipeHandler;
import techreborn.init.ModSounds;
@ -172,7 +172,7 @@ public class BlockRubberLog extends Block {
}
IEnergyStorage capEnergy = null;
if (stack.getItem() instanceof ItemElectricTreetap) {
capEnergy = stack.getCapability(CapabilityEnergy.ENERGY, null);
capEnergy = new ForgePowerItemManager(stack);
}
if ((capEnergy != null && capEnergy.getEnergyStored() > 20) || stack.getItem() instanceof ItemTreeTap) {
if (state.getValue(HAS_SAP) && state.getValue(SAP_SIDE) == side) {