more charge slots
This commit is contained in:
parent
a74910e763
commit
0ebf0c95dd
5 changed files with 55 additions and 2 deletions
|
@ -32,6 +32,9 @@ public class ContainerIndustrialElectrolyzer extends ContainerCrafting {
|
||||||
this.addSlotToContainer(new SlotOutput(electrolyzer.inventory, 4, 90, 19));
|
this.addSlotToContainer(new SlotOutput(electrolyzer.inventory, 4, 90, 19));
|
||||||
this.addSlotToContainer(new SlotOutput(electrolyzer.inventory, 5, 110, 19));
|
this.addSlotToContainer(new SlotOutput(electrolyzer.inventory, 5, 110, 19));
|
||||||
|
|
||||||
|
// battery
|
||||||
|
this.addSlotToContainer(new Slot(electrolyzer.inventory, 6, 18, 51));
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 3; ++i) {
|
for (i = 0; i < 3; ++i) {
|
||||||
for (int j = 0; j < 9; ++j) {
|
for (int j = 0; j < 9; ++j) {
|
||||||
|
|
|
@ -30,6 +30,8 @@ public class ContainerRollingMachine extends RebornContainer {
|
||||||
|
|
||||||
// output
|
// output
|
||||||
this.addSlotToContainer(new SlotOutput(tileRollingmachine.inventory, 0, 124, 35));
|
this.addSlotToContainer(new SlotOutput(tileRollingmachine.inventory, 0, 124, 35));
|
||||||
|
// battery
|
||||||
|
this.addSlotToContainer(new Slot(tileRollingmachine.inventory, 2, 8, 51));
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -17,7 +19,7 @@ import techreborn.powerSystem.TilePowerAcceptor;
|
||||||
public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWrenchable, IEnergyTile, IInventory, ISidedInventory {
|
public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWrenchable, IEnergyTile, IInventory, ISidedInventory {
|
||||||
|
|
||||||
public int tickTime;
|
public int tickTime;
|
||||||
public Inventory inventory = new Inventory(7, "TileIndustrialElectrolyzer", 64);
|
public Inventory inventory = new Inventory(8, "TileIndustrialElectrolyzer", 64);
|
||||||
public RecipeCrafter crafter;
|
public RecipeCrafter crafter;
|
||||||
|
|
||||||
public TileIndustrialElectrolyzer() {
|
public TileIndustrialElectrolyzer() {
|
||||||
|
@ -38,6 +40,28 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWr
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
crafter.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
|
@Override
|
||||||
|
|
|
@ -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.Container;
|
import net.minecraft.inventory.Container;
|
||||||
|
@ -18,7 +20,7 @@ import techreborn.powerSystem.TilePowerAcceptor;
|
||||||
//TODO add tick and power bars.
|
//TODO add tick and power bars.
|
||||||
public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable, IEnergyTile, IInventory {
|
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(
|
public final InventoryCrafting craftMatrix = new InventoryCrafting(
|
||||||
new RollingTileContainer(), 3, 3);
|
new RollingTileContainer(), 3, 3);
|
||||||
|
|
||||||
|
@ -34,6 +36,27 @@ public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable
|
||||||
return 100000;
|
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
|
@Override
|
||||||
public boolean canAcceptEnergy(ForgeDirection direction) {
|
public boolean canAcceptEnergy(ForgeDirection direction) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -70,6 +93,7 @@ public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
charge(2);
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote) {
|
||||||
currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(
|
currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(
|
||||||
craftMatrix, worldObj);
|
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