minor fixes, begin work on TileChargingTable

This commit is contained in:
Adrian Siekierka 2014-11-08 08:24:20 +01:00
parent 2c04e14389
commit 19b3f81c91
2 changed files with 50 additions and 1 deletions

2
common/buildcraft/core/robots/EntityRobot.java Executable file → Normal file
View file

@ -657,7 +657,7 @@ public class EntityRobot extends EntityRobotBase implements
public boolean isItemValidForSlot(int var1, ItemStack var2) {
return inv[var1] == null
|| (inv[var1].isItemEqual(var2) && inv[var1].isStackable() && inv[var1].stackSize
+ var2.stackSize <= inv[var1].getItem().getItemStackLimit());
+ var2.stackSize <= inv[var1].getItem().getItemStackLimit(inv[var1]));
}
@Override

View file

@ -0,0 +1,49 @@
package buildcraft.silicon;
import buildcraft.api.tiles.IHasWork;
import buildcraft.core.utils.StringUtils;
import cofh.api.energy.IEnergyContainerItem;
import net.minecraft.item.ItemStack;
public class TileChargingTable extends TileLaserTableBase implements IHasWork {
@Override
public int getRequiredEnergy() {
ItemStack stack = this.getStackInSlot(0);
if (stack != null && stack.getItem() != null && stack.getItem() instanceof IEnergyContainerItem) {
IEnergyContainerItem containerItem = (IEnergyContainerItem) stack.getItem();
return containerItem.getMaxEnergyStored(stack) - containerItem.getEnergyStored(stack);
}
return 0;
}
@Override
public boolean hasWork() {
return getRequiredEnergy() > 0;
}
@Override
public boolean canCraft() {
return hasWork();
}
@Override
public int getSizeInventory() {
return 1;
}
@Override
public String getInventoryName() {
return StringUtils.localize("tile.chargingTableBlock.name");
}
@Override
public boolean hasCustomInventoryName() {
return false;
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack) {
return slot == 0 && stack != null && stack.getItem() != null && stack.getItem() instanceof IEnergyContainerItem;
}
}