Some machines can use batteries now
This commit is contained in:
parent
4ccd3ff290
commit
01c04c27bb
23 changed files with 143 additions and 138 deletions
|
@ -65,11 +65,12 @@ public class GuiBlastFurnace extends GuiBase {
|
|||
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
final GuiBase.Layer layer = Layer.BACKGROUND;
|
||||
|
||||
drawSlot(50, 27, layer);
|
||||
drawSlot(50, 47, layer);
|
||||
drawSlot(92, 36, layer);
|
||||
drawSlot(110, 36, layer);
|
||||
|
||||
this.drawSlot(8, 72, layer);
|
||||
|
||||
this.drawSlot(50, 27, layer);
|
||||
this.drawSlot(50, 47, layer);
|
||||
this.drawOutputSlotBar(92, 36, 2, layer);
|
||||
|
||||
this.builder.drawJEIButton(this, 150, 4, layer);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class GuiCompressor extends GuiBase {
|
|||
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
|
||||
|
||||
//this.drawSlot(8, 72, layer);
|
||||
this.drawSlot(8, 72, layer);
|
||||
|
||||
this.drawSlot(55, 45, layer);
|
||||
this.drawOutputSlot(101, 45, layer);
|
||||
|
|
|
@ -41,7 +41,7 @@ public class GuiElectricFurnace extends GuiBase {
|
|||
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
final Layer layer = Layer.BACKGROUND;
|
||||
|
||||
//this.drawSlot(8, 72, layer);
|
||||
this.drawSlot(8, 72, layer);
|
||||
|
||||
this.drawSlot(55, 45, layer);
|
||||
this.drawOutputSlot(101, 45, layer);
|
||||
|
|
|
@ -41,7 +41,7 @@ public class GuiExtractor extends GuiBase {
|
|||
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
|
||||
|
||||
//this.drawSlot(8, 72, layer);
|
||||
this.drawSlot(8, 72, layer);
|
||||
|
||||
this.drawSlot(55, 45, layer);
|
||||
this.drawOutputSlot(101, 45, layer);
|
||||
|
|
|
@ -41,7 +41,7 @@ public class GuiGrinder extends GuiBase {
|
|||
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
|
||||
|
||||
//this.drawSlot(8, 72, layer);
|
||||
this.drawSlot(8, 72, layer);
|
||||
|
||||
this.drawSlot(55, 45, layer);
|
||||
this.drawOutputSlot(101, 45, layer);
|
||||
|
|
|
@ -62,6 +62,8 @@ public class GuiImplosionCompressor extends GuiBase {
|
|||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
final GuiBase.Layer layer = Layer.BACKGROUND;
|
||||
|
||||
this.drawSlot(8, 72, layer);
|
||||
|
||||
drawSlot(50, 27, layer);
|
||||
drawSlot(50, 47, layer);
|
||||
drawSlot(92, 36, layer);
|
||||
|
|
|
@ -60,14 +60,16 @@ public class GuiIndustrialGrinder extends GuiBase {
|
|||
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
|
||||
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
final Layer layer = Layer.BACKGROUND;
|
||||
|
||||
drawSlot(34, 35, layer);
|
||||
drawSlot(34, 55, layer);
|
||||
drawSlot(84, 43, layer);
|
||||
drawSlot(126, 18, layer);
|
||||
drawSlot(126, 36, layer);
|
||||
drawSlot(126, 54, layer);
|
||||
drawSlot(126, 72, layer);
|
||||
|
||||
this.drawSlot(8, 72, layer);
|
||||
|
||||
this.drawSlot(34, 35, layer);
|
||||
this.drawSlot(34, 55, layer);
|
||||
this.drawSlot(84, 43, layer);
|
||||
this.drawSlot(126, 18, layer);
|
||||
this.drawSlot(126, 36, layer);
|
||||
this.drawSlot(126, 54, layer);
|
||||
this.drawSlot(126, 72, layer);
|
||||
|
||||
this.builder.drawJEIButton(this, 150, 4, layer);
|
||||
}
|
||||
|
|
|
@ -41,13 +41,15 @@ public class GuiMatterFabricator extends GuiBase {
|
|||
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
final Layer layer = Layer.BACKGROUND;
|
||||
|
||||
drawScrapSlot(30, 20, layer);
|
||||
drawScrapSlot(50, 20, layer);
|
||||
drawScrapSlot(70, 20, layer);
|
||||
drawScrapSlot(90, 20, layer);
|
||||
drawScrapSlot(110, 20, layer);
|
||||
drawScrapSlot(130, 20, layer);
|
||||
drawOutputSlotBar(39, 65, 5, layer);
|
||||
this.drawSlot(8, 72, layer);
|
||||
|
||||
this.drawScrapSlot(30, 20, layer);
|
||||
this.drawScrapSlot(50, 20, layer);
|
||||
this.drawScrapSlot(70, 20, layer);
|
||||
this.drawScrapSlot(90, 20, layer);
|
||||
this.drawScrapSlot(110, 20, layer);
|
||||
this.drawScrapSlot(130, 20, layer);
|
||||
this.drawOutputSlotBar(39, 65, 5, layer);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public class GuiRecycler extends GuiBase {
|
|||
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
|
||||
|
||||
//this.drawSlot(8, 72, layer);
|
||||
this.drawSlot(8, 72, layer);
|
||||
|
||||
this.drawSlot(55, 45, layer);
|
||||
this.drawOutputSlot(101, 45, layer);
|
||||
|
|
|
@ -41,7 +41,7 @@ public class GuiVacuumFreezer extends GuiBase {
|
|||
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
|
||||
|
||||
//this.drawSlot(8, 72, layer);
|
||||
this.drawSlot(8, 72, layer);
|
||||
|
||||
this.drawSlot(55, 45, layer);
|
||||
this.drawOutputSlot(101, 45, layer);
|
||||
|
|
|
@ -68,10 +68,11 @@ public class TileChemicalReactor extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
this.crafter.updateEntity();
|
||||
this.charge(3);
|
||||
public void update() {
|
||||
if (!this.world.isRemote) {
|
||||
super.update();
|
||||
this.charge(3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,11 +29,9 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.common.powerSystem.PoweredItem;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.registration.RebornRegistry;
|
||||
|
@ -79,19 +77,9 @@ public class TileIndustrialCentrifuge extends TilePowerAcceptor
|
|||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
this.charge(6);
|
||||
if (this.inventory.getStackInSlot(6) != ItemStack.EMPTY) {
|
||||
final ItemStack stack = this.inventory.getStackInSlot(6);
|
||||
if (stack.getItem() instanceof IEnergyItemInfo) {
|
||||
final IEnergyItemInfo item = (IEnergyItemInfo) stack.getItem();
|
||||
if (item.canProvideEnergy(stack)) {
|
||||
if (this.getEnergy() != this.getMaxPower()) {
|
||||
this.addEnergy(item.getMaxTransfer(stack));
|
||||
PoweredItem.setEnergy(PoweredItem.getEnergy(stack) - item.getMaxTransfer(stack), stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this.world.isRemote) {
|
||||
super.update();
|
||||
this.charge(6);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,6 +78,7 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor
|
|||
|
||||
@Override
|
||||
public void update() {
|
||||
if (this.world.isRemote) { return; }
|
||||
super.update();
|
||||
this.charge(6);
|
||||
}
|
||||
|
@ -183,6 +184,6 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor
|
|||
.filterSlot(1, 47, 72, stack -> ItemUtils.isItemEqual(stack, DynamicCell.getEmptyCell(1), true, true))
|
||||
.filterSlot(0, 81, 72, stack -> !ItemUtils.isItemEqual(stack, DynamicCell.getEmptyCell(1), true, true))
|
||||
.outputSlot(2, 51, 24).outputSlot(3, 71, 24).outputSlot(4, 91, 24).outputSlot(5, 111, 24)
|
||||
.energySlot(6, 18, 51).syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
.energySlot(6, 8, 72).syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public class TileMatterFabricator extends TilePowerAcceptor
|
|||
// @ConfigRegistry(config = "machines", category = "matter_fabricator", key = "MatterFabricatorWrenchDropRate", comment = "Matter Fabricator Wrench Drop Rate")
|
||||
public static float wrenchDropRate = 1.0F;
|
||||
|
||||
public Inventory inventory = new Inventory(11, "TileMatterFabricator", 64, this);
|
||||
public Inventory inventory = new Inventory(12, "TileMatterFabricator", 64, this);
|
||||
private int amplifier = 0;
|
||||
|
||||
public TileMatterFabricator() {
|
||||
|
@ -93,31 +93,31 @@ public class TileMatterFabricator extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
public void update() {
|
||||
if (world.isRemote){ return; }
|
||||
|
||||
super.update();
|
||||
this.charge(11);
|
||||
|
||||
if (!super.world.isRemote) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
final ItemStack stack = this.inventory.getStackInSlot(i);
|
||||
if (!stack.isEmpty() && spaceForOutput()) {
|
||||
final int amp = this.getValue(stack);
|
||||
final int euNeeded = amp * energyPerAmp;
|
||||
if (amp != 0 && this.canUseEnergy(euNeeded)) {
|
||||
this.useEnergy(euNeeded);
|
||||
this.amplifier += amp;
|
||||
this.inventory.decrStackSize(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (amplifier >= fabricationRate) {
|
||||
if (spaceForOutput()) {
|
||||
this.addOutputProducts();
|
||||
amplifier -= fabricationRate;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
final ItemStack stack = this.inventory.getStackInSlot(i);
|
||||
if (!stack.isEmpty() && spaceForOutput()) {
|
||||
final int amp = this.getValue(stack);
|
||||
final int euNeeded = amp * energyPerAmp;
|
||||
if (amp != 0 && this.canUseEnergy(euNeeded)) {
|
||||
this.useEnergy(euNeeded);
|
||||
this.amplifier += amp;
|
||||
this.inventory.decrStackSize(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (amplifier >= fabricationRate) {
|
||||
if (spaceForOutput()) {
|
||||
this.addOutputProducts();
|
||||
amplifier -= fabricationRate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean spaceForOutput() {
|
||||
|
@ -229,11 +229,11 @@ public class TileMatterFabricator extends TilePowerAcceptor
|
|||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("matterfabricator").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this).slot(0, 30, 20).slot(1, 50, 20).slot(2, 70, 20).slot(3, 90, 20)
|
||||
.slot(4, 110, 20).slot(5, 130, 20).outputSlot(6, 40, 66).outputSlot(7, 60, 66).outputSlot(8, 80, 66)
|
||||
.outputSlot(9, 100, 66).outputSlot(10, 120, 66).syncEnergyValue()
|
||||
.syncIntegerValue(this::getProgress, this::setProgress).addInventory().create(this);
|
||||
return new ContainerBuilder("matterfabricator").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 30, 20).slot(1, 50, 20).slot(2, 70, 20).slot(3, 90, 20).slot(4, 110, 20)
|
||||
.slot(5, 130, 20).outputSlot(6, 40, 66).outputSlot(7, 60, 66).outputSlot(8, 80, 66)
|
||||
.outputSlot(9, 100, 66).outputSlot(10, 120, 66).energySlot(11, 8, 72).syncEnergyValue()
|
||||
.syncIntegerValue(this::getProgress, this::setProgress).addInventory().create(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -44,7 +44,7 @@ import techreborn.init.ModBlocks;
|
|||
public class TileImplosionCompressor extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(4, "TileImplosionCompressor", 64, this);
|
||||
public Inventory inventory = new Inventory(5, "TileImplosionCompressor", 64, this);
|
||||
public MultiblockChecker multiblockChecker;
|
||||
public RecipeCrafter crafter;
|
||||
|
||||
|
@ -75,8 +75,10 @@ public class TileImplosionCompressor extends TilePowerAcceptor
|
|||
|
||||
@Override
|
||||
public void update() {
|
||||
if (this.world.isRemote) { return; }
|
||||
if (this.getMutliBlock()) {
|
||||
super.update();
|
||||
this.charge(4);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,9 +154,9 @@ public class TileImplosionCompressor extends TilePowerAcceptor
|
|||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("implosioncompressor").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 92, 36).outputSlot(3, 110, 36)
|
||||
.syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
return new ContainerBuilder("implosioncompressor").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 92, 36).outputSlot(3, 110, 36)
|
||||
.energySlot(4, 8, 72).syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements ITo
|
|||
public TileIndustrialBlastFurnace() {
|
||||
super();
|
||||
// TODO configs
|
||||
this.inventory = new Inventory(4, "TileIndustrialBlastFurnace", 64, this);
|
||||
this.inventory = new Inventory(5, "TileIndustrialBlastFurnace", 64, this);
|
||||
final int[] inputs = new int[2];
|
||||
inputs[0] = 0;
|
||||
inputs[1] = 1;
|
||||
|
@ -97,6 +97,7 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements ITo
|
|||
|
||||
if (this.getMutliBlock()) {
|
||||
super.update();
|
||||
this.charge(4);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,9 +251,9 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements ITo
|
|||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("blastfurnace").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 92, 36).outputSlot(3, 110, 36)
|
||||
.syncEnergyValue().syncCrafterValue().syncIntegerValue(this::getHeat, this::setHeat).addInventory()
|
||||
.create(this);
|
||||
return new ContainerBuilder("blastfurnace").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 92, 36).outputSlot(3, 110, 36)
|
||||
.energySlot(4, 8, 72).syncEnergyValue().syncCrafterValue()
|
||||
.syncIntegerValue(this::getHeat, this::setHeat).addInventory().create(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
|
|||
// TODO configs
|
||||
|
||||
tank = new Tank("TileIndustrialGrinder", TileIndustrialGrinder.TANK_CAPACITY, this);
|
||||
inventory = new Inventory(7, "TileIndustrialGrinder", 64, this);
|
||||
inventory = new Inventory(8, "TileIndustrialGrinder", 64, this);
|
||||
ticksSinceLastChange = 0;
|
||||
final int[] inputs = new int[2];
|
||||
inputs[0] = 0;
|
||||
|
@ -102,26 +102,25 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
|
|||
|
||||
@Override
|
||||
public void update() {
|
||||
ticksSinceLastChange++;
|
||||
|
||||
super.update();
|
||||
if (this.multiblockChecker == null) {
|
||||
final BlockPos pos = this.getPos().offset(this.getFacing().getOpposite(), 2).down();
|
||||
this.multiblockChecker = new MultiblockChecker(this.world, pos);
|
||||
}
|
||||
|
||||
if (this.getMutliBlock()) {
|
||||
super.update();
|
||||
}
|
||||
|
||||
//Check cells input slot 2 time per second
|
||||
if (ticksSinceLastChange >= 10){
|
||||
if (!this.inventory.getStackInSlot(1).isEmpty()){
|
||||
this.ticksSinceLastChange++;
|
||||
// Check cells input slot 2 time per second
|
||||
if (this.ticksSinceLastChange >= 10) {
|
||||
if (!this.inventory.getStackInSlot(1).isEmpty()) {
|
||||
FluidUtils.drainContainers(this.tank, this.inventory, 1, 6);
|
||||
FluidUtils.fillContainers(this.tank, this.inventory, 1, 6, this.tank.getFluidType());
|
||||
}
|
||||
ticksSinceLastChange = 0;
|
||||
this.ticksSinceLastChange = 0;
|
||||
}
|
||||
|
||||
if (!world.isRemote && this.getMutliBlock()) {
|
||||
this.charge(7);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -273,10 +272,10 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
|
|||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("industrialgrinder").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this).slot(1, 34, 35).slot(0, 84, 43).outputSlot(2, 126, 18).outputSlot(3, 126, 36)
|
||||
.outputSlot(4, 126, 54).outputSlot(5, 126, 72).outputSlot(6, 34, 55).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create(this);
|
||||
return new ContainerBuilder("industrialgrinder").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(1, 34, 35).slot(0, 84, 43).outputSlot(2, 126, 18).outputSlot(3, 126, 36)
|
||||
.outputSlot(4, 126, 54).outputSlot(5, 126, 72).outputSlot(6, 34, 55).energySlot(7, 8, 72)
|
||||
.syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -62,8 +62,10 @@ public class TileVacuumFreezer extends TilePowerAcceptor
|
|||
|
||||
@Override
|
||||
public void update() {
|
||||
if (world.isRemote){ return; }
|
||||
if (this.getMultiBlock()) {
|
||||
super.update();
|
||||
this.charge(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,8 +151,8 @@ public class TileVacuumFreezer extends TilePowerAcceptor
|
|||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("vacuumfreezer").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create(this);
|
||||
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
|
||||
.syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ import techreborn.init.ModBlocks;
|
|||
|
||||
public class TileCompressor extends TilePowerAcceptor implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(6, "TileCompressor", 64, this);
|
||||
public Inventory inventory = new Inventory(3, "TileCompressor", 64, this);
|
||||
|
||||
public RecipeCrafter crafter;
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class TileCompressor extends TilePowerAcceptor implements IToolDrop, IInv
|
|||
public void update() {
|
||||
if (!this.world.isRemote) {
|
||||
super.update();
|
||||
this.charge(3);
|
||||
this.charge(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ public class TileCompressor extends TilePowerAcceptor implements IToolDrop, IInv
|
|||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("compressor").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create(this);
|
||||
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
|
||||
.syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ import techreborn.init.ModBlocks;
|
|||
public class TileElectricFurnace extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider, IMachineSlotProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(6, "TileElectricFurnace", 64, this);
|
||||
public Inventory inventory = new Inventory(3, "TileElectricFurnace", 64, this);
|
||||
public int capacity = 1000;
|
||||
public int progress;
|
||||
public int fuelScale = 100;
|
||||
|
@ -62,33 +62,36 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
|||
|
||||
@Override
|
||||
public void update() {
|
||||
if (world.isRemote){ return; }
|
||||
|
||||
super.update();
|
||||
if (!this.world.isRemote) {
|
||||
final boolean burning = this.isBurning();
|
||||
boolean updateInventory = false;
|
||||
if (this.isBurning() && this.canSmelt()) {
|
||||
this.updateState();
|
||||
this.charge(2);
|
||||
|
||||
this.progress++;
|
||||
if (this.progress % 10 == 0) {
|
||||
this.useEnergy(this.cost);
|
||||
}
|
||||
if (this.progress >= this.fuelScale) {
|
||||
this.progress = 0;
|
||||
this.cookItems();
|
||||
updateInventory = true;
|
||||
}
|
||||
} else {
|
||||
this.progress = 0;
|
||||
this.updateState();
|
||||
final boolean burning = this.isBurning();
|
||||
boolean updateInventory = false;
|
||||
if (this.isBurning() && this.canSmelt()) {
|
||||
this.updateState();
|
||||
|
||||
this.progress++;
|
||||
if (this.progress % 10 == 0) {
|
||||
this.useEnergy(this.cost);
|
||||
}
|
||||
if (burning != this.isBurning()) {
|
||||
if (this.progress >= this.fuelScale) {
|
||||
this.progress = 0;
|
||||
this.cookItems();
|
||||
updateInventory = true;
|
||||
}
|
||||
if (updateInventory) {
|
||||
this.markDirty();
|
||||
}
|
||||
} else {
|
||||
this.progress = 0;
|
||||
this.updateState();
|
||||
}
|
||||
if (burning != this.isBurning()) {
|
||||
updateInventory = true;
|
||||
}
|
||||
if (updateInventory) {
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void cookItems() {
|
||||
|
@ -221,8 +224,8 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
|||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("electricfurnace").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).syncEnergyValue()
|
||||
.syncIntegerValue(this::getBurnTime, this::setBurnTime).addInventory().create(this);
|
||||
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
|
||||
.syncIntegerValue(this::getBurnTime, this::setBurnTime).addInventory().create(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,7 +43,7 @@ import techreborn.init.ModBlocks;
|
|||
public class TileExtractor extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(6, "TileExtractor", 64, this);
|
||||
public Inventory inventory = new Inventory(3, "TileExtractor", 64, this);
|
||||
|
||||
public RecipeCrafter crafter;
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class TileExtractor extends TilePowerAcceptor
|
|||
public void update() {
|
||||
if (!this.world.isRemote) {
|
||||
super.update();
|
||||
this.charge(3);
|
||||
this.charge(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,9 +151,9 @@ public class TileExtractor extends TilePowerAcceptor
|
|||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("extractor").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create(this);
|
||||
return new ContainerBuilder("extractor").player(player.inventory).inventory().hotbar().addInventory().tile(this)
|
||||
.slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue().syncCrafterValue()
|
||||
.addInventory().create(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ import techreborn.init.ModBlocks;
|
|||
public class TileGrinder extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(6, "TileGrinder", 64, this);
|
||||
public Inventory inventory = new Inventory(3, "TileGrinder", 64, this);
|
||||
|
||||
public RecipeCrafter crafter;
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class TileGrinder extends TilePowerAcceptor
|
|||
public void update() {
|
||||
if (!this.world.isRemote) {
|
||||
super.update();
|
||||
this.charge(3);
|
||||
this.charge(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,9 +152,9 @@ public class TileGrinder extends TilePowerAcceptor
|
|||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("grinder").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create(this);
|
||||
return new ContainerBuilder("grinder").player(player.inventory).inventory().hotbar().addInventory().tile(this)
|
||||
.slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue().syncCrafterValue()
|
||||
.addInventory().create(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,7 +41,7 @@ import techreborn.items.ItemParts;
|
|||
|
||||
public class TileRecycler extends TilePowerAcceptor implements IToolDrop, IInventoryProvider, IContainerProvider {
|
||||
|
||||
private final Inventory inventory = new Inventory(6, "TileRecycler", 64, this);
|
||||
private final Inventory inventory = new Inventory(3, "TileRecycler", 64, this);
|
||||
private final int capacity = 1000;
|
||||
private final int cost = 2;
|
||||
private final int time = 15;
|
||||
|
@ -78,6 +78,7 @@ public class TileRecycler extends TilePowerAcceptor implements IToolDrop, IInven
|
|||
}
|
||||
|
||||
this.updateState();
|
||||
this.charge(2);
|
||||
|
||||
if (updateInventory) {
|
||||
this.markDirty();
|
||||
|
@ -199,7 +200,7 @@ public class TileRecycler extends TilePowerAcceptor implements IToolDrop, IInven
|
|||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("recycler").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).syncEnergyValue()
|
||||
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
|
||||
.syncIntegerValue(this::getProgress, this::setProgress).addInventory().create(this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue