All machines can now be powered with batteries
This commit is contained in:
parent
0ebf0c95dd
commit
cc2b6a8df3
1 changed files with 25 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
||||||
package techreborn.tiles;
|
package techreborn.tiles;
|
||||||
|
|
||||||
import ic2.api.energy.tile.IEnergyTile;
|
import ic2.api.energy.tile.IEnergyTile;
|
||||||
|
import ic2.api.item.ElectricItem;
|
||||||
|
import ic2.api.item.IElectricItem;
|
||||||
import ic2.api.tile.IWrenchable;
|
import ic2.api.tile.IWrenchable;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
|
@ -35,6 +37,29 @@ public class TileChemicalReactor extends TilePowerAcceptor implements IWrenchabl
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
crafter.updateEntity();
|
crafter.updateEntity();
|
||||||
|
charge(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void charge(int slot)
|
||||||
|
{
|
||||||
|
if(getStackInSlot(slot) != null)
|
||||||
|
{
|
||||||
|
System.out.println("hi");
|
||||||
|
if(getStackInSlot(slot).getItem() instanceof IElectricItem)
|
||||||
|
{
|
||||||
|
if(getEnergy() != getMaxPower())
|
||||||
|
{
|
||||||
|
ItemStack stack = inventory.getStackInSlot(slot);
|
||||||
|
double MaxCharge = ((IElectricItem) stack.getItem()).getMaxCharge(stack);
|
||||||
|
double CurrentCharge = ElectricItem.manager.getCharge(stack);
|
||||||
|
if (CurrentCharge != 0)
|
||||||
|
{
|
||||||
|
ElectricItem.manager.discharge(stack, 5, 4, false, false, false);
|
||||||
|
addEnergy(5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue