more charge slots
This commit is contained in:
parent
a74910e763
commit
0ebf0c95dd
5 changed files with 55 additions and 2 deletions
|
@ -31,6 +31,9 @@ public class ContainerIndustrialElectrolyzer extends ContainerCrafting {
|
|||
this.addSlotToContainer(new SlotOutput(electrolyzer.inventory, 3, 70, 19));
|
||||
this.addSlotToContainer(new SlotOutput(electrolyzer.inventory, 4, 90, 19));
|
||||
this.addSlotToContainer(new SlotOutput(electrolyzer.inventory, 5, 110, 19));
|
||||
|
||||
// battery
|
||||
this.addSlotToContainer(new Slot(electrolyzer.inventory, 6, 18, 51));
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 3; ++i) {
|
||||
|
|
|
@ -30,6 +30,8 @@ public class ContainerRollingMachine extends RebornContainer {
|
|||
|
||||
// output
|
||||
this.addSlotToContainer(new SlotOutput(tileRollingmachine.inventory, 0, 124, 35));
|
||||
// battery
|
||||
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 2, 8, 51));
|
||||
|
||||
int i;
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package techreborn.tiles;
|
||||
|
||||
import ic2.api.energy.tile.IEnergyTile;
|
||||
import ic2.api.item.ElectricItem;
|
||||
import ic2.api.item.IElectricItem;
|
||||
import ic2.api.tile.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
@ -17,7 +19,7 @@ import techreborn.powerSystem.TilePowerAcceptor;
|
|||
public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWrenchable, IEnergyTile, IInventory, ISidedInventory {
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(7, "TileIndustrialElectrolyzer", 64);
|
||||
public Inventory inventory = new Inventory(8, "TileIndustrialElectrolyzer", 64);
|
||||
public RecipeCrafter crafter;
|
||||
|
||||
public TileIndustrialElectrolyzer() {
|
||||
|
@ -38,6 +40,28 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWr
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
crafter.updateEntity();
|
||||
charge(6);
|
||||
}
|
||||
|
||||
public void charge(int slot)
|
||||
{
|
||||
if(getStackInSlot(slot) != null)
|
||||
{
|
||||
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
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package techreborn.tiles;
|
||||
|
||||
import ic2.api.energy.tile.IEnergyTile;
|
||||
import ic2.api.item.ElectricItem;
|
||||
import ic2.api.item.IElectricItem;
|
||||
import ic2.api.tile.IWrenchable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
@ -18,7 +20,7 @@ import techreborn.powerSystem.TilePowerAcceptor;
|
|||
//TODO add tick and power bars.
|
||||
public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable, IEnergyTile, IInventory {
|
||||
|
||||
public Inventory inventory = new Inventory(2, "TileRollingMachine", 64);
|
||||
public Inventory inventory = new Inventory(3, "TileRollingMachine", 64);
|
||||
public final InventoryCrafting craftMatrix = new InventoryCrafting(
|
||||
new RollingTileContainer(), 3, 3);
|
||||
|
||||
|
@ -33,6 +35,27 @@ public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable
|
|||
public double getMaxPower() {
|
||||
return 100000;
|
||||
}
|
||||
|
||||
public void charge(int slot)
|
||||
{
|
||||
if(getStackInSlot(slot) != null)
|
||||
{
|
||||
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
|
||||
public boolean canAcceptEnergy(ForgeDirection direction) {
|
||||
|
@ -70,6 +93,7 @@ public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable
|
|||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
charge(2);
|
||||
if (!worldObj.isRemote) {
|
||||
currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(
|
||||
craftMatrix, worldObj);
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 793 B After Width: | Height: | Size: 2.2 KiB |
Loading…
Add table
Reference in a new issue