Some work on charging ic2 items, moving back to a proper pc.

This commit is contained in:
modmuss50 2017-10-22 18:23:58 +01:00
parent 1c6336eb68
commit 3901d60545
3 changed files with 25 additions and 1 deletions

View file

@ -35,7 +35,7 @@ import stanhebben.zenscript.annotations.ZenMethod;
import techreborn.api.Reference;
import techreborn.api.recipe.machines.IndustrialGrinderRecipe;
@ZenClass("mods.techreborn.grinder")
@ZenClass("mods.techreborn.industralGrinder")
public class CTIndustrialGrinder extends CTGeneric {
@ZenMethod

View file

@ -37,6 +37,8 @@ import reborncore.common.powerSystem.PoweredItem;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.util.Inventory;
import techreborn.blocks.storage.BlockEnergyStorage;
import techreborn.compat.CompatManager;
import techreborn.utils.IC2ItemCharger;
/**
* Created by Rushmead
@ -77,6 +79,9 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IToolDrop, I
PoweredItem.setEnergy(PoweredItem.getEnergy(stack) + item.getMaxTransfer(stack), stack);
}
}
if(CompatManager.isIC2Loaded){
IC2ItemCharger.chargeIc2Item(this, stack);
}
}
if (!inventory.getStackInSlot(1).isEmpty()) {
ItemStack stack = inventory.getStackInSlot(1);

View file

@ -0,0 +1,19 @@
package techreborn.utils;
import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem;
import net.minecraft.item.ItemStack;
import reborncore.common.powerSystem.TilePowerAcceptor;
public class IC2ItemCharger {
public static void chargeIc2Item(TilePowerAcceptor tilePowerAcceptor, ItemStack stack){
if(stack.isEmpty()){
return;
}
if(stack.getItem() instanceof IElectricItem){
tilePowerAcceptor.useEnergy(ElectricItem.manager.charge(stack, tilePowerAcceptor.getEnergy(), 4, false, false));
}
}
}