Some machines can use batteries now

This commit is contained in:
drcrazy 2017-09-16 00:50:43 +03:00
parent 4ccd3ff290
commit 01c04c27bb
23 changed files with 143 additions and 138 deletions

View file

@ -66,10 +66,11 @@ public class GuiBlastFurnace extends GuiBase {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
final GuiBase.Layer layer = Layer.BACKGROUND; final GuiBase.Layer layer = Layer.BACKGROUND;
drawSlot(50, 27, layer); this.drawSlot(8, 72, layer);
drawSlot(50, 47, layer);
drawSlot(92, 36, layer); this.drawSlot(50, 27, layer);
drawSlot(110, 36, layer); this.drawSlot(50, 47, layer);
this.drawOutputSlotBar(92, 36, 2, layer);
this.builder.drawJEIButton(this, 150, 4, layer); this.builder.drawJEIButton(this, 150, 4, layer);
} }

View file

@ -41,7 +41,7 @@ public class GuiCompressor extends GuiBase {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
//this.drawSlot(8, 72, layer); this.drawSlot(8, 72, layer);
this.drawSlot(55, 45, layer); this.drawSlot(55, 45, layer);
this.drawOutputSlot(101, 45, layer); this.drawOutputSlot(101, 45, layer);

View file

@ -41,7 +41,7 @@ public class GuiElectricFurnace extends GuiBase {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND; final Layer layer = Layer.BACKGROUND;
//this.drawSlot(8, 72, layer); this.drawSlot(8, 72, layer);
this.drawSlot(55, 45, layer); this.drawSlot(55, 45, layer);
this.drawOutputSlot(101, 45, layer); this.drawOutputSlot(101, 45, layer);

View file

@ -41,7 +41,7 @@ public class GuiExtractor extends GuiBase {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
//this.drawSlot(8, 72, layer); this.drawSlot(8, 72, layer);
this.drawSlot(55, 45, layer); this.drawSlot(55, 45, layer);
this.drawOutputSlot(101, 45, layer); this.drawOutputSlot(101, 45, layer);

View file

@ -41,7 +41,7 @@ public class GuiGrinder extends GuiBase {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
//this.drawSlot(8, 72, layer); this.drawSlot(8, 72, layer);
this.drawSlot(55, 45, layer); this.drawSlot(55, 45, layer);
this.drawOutputSlot(101, 45, layer); this.drawOutputSlot(101, 45, layer);

View file

@ -62,6 +62,8 @@ public class GuiImplosionCompressor extends GuiBase {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
final GuiBase.Layer layer = Layer.BACKGROUND; final GuiBase.Layer layer = Layer.BACKGROUND;
this.drawSlot(8, 72, layer);
drawSlot(50, 27, layer); drawSlot(50, 27, layer);
drawSlot(50, 47, layer); drawSlot(50, 47, layer);
drawSlot(92, 36, layer); drawSlot(92, 36, layer);

View file

@ -61,13 +61,15 @@ public class GuiIndustrialGrinder extends GuiBase {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND; final Layer layer = Layer.BACKGROUND;
drawSlot(34, 35, layer); this.drawSlot(8, 72, layer);
drawSlot(34, 55, layer);
drawSlot(84, 43, layer); this.drawSlot(34, 35, layer);
drawSlot(126, 18, layer); this.drawSlot(34, 55, layer);
drawSlot(126, 36, layer); this.drawSlot(84, 43, layer);
drawSlot(126, 54, layer); this.drawSlot(126, 18, layer);
drawSlot(126, 72, layer); this.drawSlot(126, 36, layer);
this.drawSlot(126, 54, layer);
this.drawSlot(126, 72, layer);
this.builder.drawJEIButton(this, 150, 4, layer); this.builder.drawJEIButton(this, 150, 4, layer);
} }

View file

@ -41,13 +41,15 @@ public class GuiMatterFabricator extends GuiBase {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND; final Layer layer = Layer.BACKGROUND;
drawScrapSlot(30, 20, layer); this.drawSlot(8, 72, layer);
drawScrapSlot(50, 20, layer);
drawScrapSlot(70, 20, layer); this.drawScrapSlot(30, 20, layer);
drawScrapSlot(90, 20, layer); this.drawScrapSlot(50, 20, layer);
drawScrapSlot(110, 20, layer); this.drawScrapSlot(70, 20, layer);
drawScrapSlot(130, 20, layer); this.drawScrapSlot(90, 20, layer);
drawOutputSlotBar(39, 65, 5, layer); this.drawScrapSlot(110, 20, layer);
this.drawScrapSlot(130, 20, layer);
this.drawOutputSlotBar(39, 65, 5, layer);
} }

View file

@ -41,7 +41,7 @@ public class GuiRecycler extends GuiBase {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
//this.drawSlot(8, 72, layer); this.drawSlot(8, 72, layer);
this.drawSlot(55, 45, layer); this.drawSlot(55, 45, layer);
this.drawOutputSlot(101, 45, layer); this.drawOutputSlot(101, 45, layer);

View file

@ -41,7 +41,7 @@ public class GuiVacuumFreezer extends GuiBase {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
//this.drawSlot(8, 72, layer); this.drawSlot(8, 72, layer);
this.drawSlot(55, 45, layer); this.drawSlot(55, 45, layer);
this.drawOutputSlot(101, 45, layer); this.drawOutputSlot(101, 45, layer);

View file

@ -68,10 +68,11 @@ public class TileChemicalReactor extends TilePowerAcceptor
} }
@Override @Override
public void updateEntity() { public void update() {
super.updateEntity(); if (!this.world.isRemote) {
this.crafter.updateEntity(); super.update();
this.charge(3); this.charge(3);
}
} }
@Override @Override

View file

@ -29,11 +29,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import reborncore.api.IListInfoProvider; import reborncore.api.IListInfoProvider;
import reborncore.api.power.IEnergyItemInfo;
import reborncore.api.recipe.IRecipeCrafterProvider; import reborncore.api.recipe.IRecipeCrafterProvider;
import reborncore.api.tile.IInventoryProvider; import reborncore.api.tile.IInventoryProvider;
import reborncore.api.IToolDrop; import reborncore.api.IToolDrop;
import reborncore.common.powerSystem.PoweredItem;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegistry; import reborncore.common.registration.RebornRegistry;
@ -79,19 +77,9 @@ public class TileIndustrialCentrifuge extends TilePowerAcceptor
@Override @Override
public void update() { public void update() {
super.update(); if (!this.world.isRemote) {
this.charge(6); super.update();
if (this.inventory.getStackInSlot(6) != ItemStack.EMPTY) { this.charge(6);
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);
}
}
}
} }
} }

View file

@ -78,6 +78,7 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor
@Override @Override
public void update() { public void update() {
if (this.world.isRemote) { return; }
super.update(); super.update();
this.charge(6); 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(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)) .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) .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);
} }
} }

View file

@ -58,7 +58,7 @@ public class TileMatterFabricator extends TilePowerAcceptor
// @ConfigRegistry(config = "machines", category = "matter_fabricator", key = "MatterFabricatorWrenchDropRate", comment = "Matter Fabricator Wrench Drop Rate") // @ConfigRegistry(config = "machines", category = "matter_fabricator", key = "MatterFabricatorWrenchDropRate", comment = "Matter Fabricator Wrench Drop Rate")
public static float wrenchDropRate = 1.0F; 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; private int amplifier = 0;
public TileMatterFabricator() { public TileMatterFabricator() {
@ -93,31 +93,31 @@ public class TileMatterFabricator extends TilePowerAcceptor
} }
@Override @Override
public void updateEntity() { public void update() {
super.updateEntity(); if (world.isRemote){ return; }
if (!super.world.isRemote) { super.update();
for (int i = 0; i < 6; i++) { this.charge(11);
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) { for (int i = 0; i < 6; i++) {
if (spaceForOutput()) { final ItemStack stack = this.inventory.getStackInSlot(i);
this.addOutputProducts(); if (!stack.isEmpty() && spaceForOutput()) {
amplifier -= fabricationRate; 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() { private boolean spaceForOutput() {
@ -229,11 +229,11 @@ public class TileMatterFabricator extends TilePowerAcceptor
@Override @Override
public BuiltContainer createContainer(final EntityPlayer player) { public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("matterfabricator").player(player.inventory).inventory().hotbar() return new ContainerBuilder("matterfabricator").player(player.inventory).inventory().hotbar().addInventory()
.addInventory().tile(this).slot(0, 30, 20).slot(1, 50, 20).slot(2, 70, 20).slot(3, 90, 20) .tile(this).slot(0, 30, 20).slot(1, 50, 20).slot(2, 70, 20).slot(3, 90, 20).slot(4, 110, 20)
.slot(4, 110, 20).slot(5, 130, 20).outputSlot(6, 40, 66).outputSlot(7, 60, 66).outputSlot(8, 80, 66) .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() .outputSlot(9, 100, 66).outputSlot(10, 120, 66).energySlot(11, 8, 72).syncEnergyValue()
.syncIntegerValue(this::getProgress, this::setProgress).addInventory().create(this); .syncIntegerValue(this::getProgress, this::setProgress).addInventory().create(this);
} }
@Override @Override

View file

@ -44,7 +44,7 @@ import techreborn.init.ModBlocks;
public class TileImplosionCompressor extends TilePowerAcceptor public class TileImplosionCompressor extends TilePowerAcceptor
implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider { 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 MultiblockChecker multiblockChecker;
public RecipeCrafter crafter; public RecipeCrafter crafter;
@ -75,8 +75,10 @@ public class TileImplosionCompressor extends TilePowerAcceptor
@Override @Override
public void update() { public void update() {
if (this.world.isRemote) { return; }
if (this.getMutliBlock()) { if (this.getMutliBlock()) {
super.update(); super.update();
this.charge(4);
} }
} }
@ -152,9 +154,9 @@ public class TileImplosionCompressor extends TilePowerAcceptor
@Override @Override
public BuiltContainer createContainer(final EntityPlayer player) { public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("implosioncompressor").player(player.inventory).inventory().hotbar() return new ContainerBuilder("implosioncompressor").player(player.inventory).inventory().hotbar().addInventory()
.addInventory().tile(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 92, 36).outputSlot(3, 110, 36) .tile(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 92, 36).outputSlot(3, 110, 36)
.syncEnergyValue().syncCrafterValue().addInventory().create(this); .energySlot(4, 8, 72).syncEnergyValue().syncCrafterValue().addInventory().create(this);
} }
} }

View file

@ -64,7 +64,7 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements ITo
public TileIndustrialBlastFurnace() { public TileIndustrialBlastFurnace() {
super(); super();
// TODO configs // TODO configs
this.inventory = new Inventory(4, "TileIndustrialBlastFurnace", 64, this); this.inventory = new Inventory(5, "TileIndustrialBlastFurnace", 64, this);
final int[] inputs = new int[2]; final int[] inputs = new int[2];
inputs[0] = 0; inputs[0] = 0;
inputs[1] = 1; inputs[1] = 1;
@ -97,6 +97,7 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements ITo
if (this.getMutliBlock()) { if (this.getMutliBlock()) {
super.update(); super.update();
this.charge(4);
} }
} }
@ -250,9 +251,9 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements ITo
@Override @Override
public BuiltContainer createContainer(final EntityPlayer player) { public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("blastfurnace").player(player.inventory).inventory().hotbar() return new ContainerBuilder("blastfurnace").player(player.inventory).inventory().hotbar().addInventory()
.addInventory().tile(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 92, 36).outputSlot(3, 110, 36) .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() .energySlot(4, 8, 72).syncEnergyValue().syncCrafterValue()
.create(this); .syncIntegerValue(this::getHeat, this::setHeat).addInventory().create(this);
} }
} }

View file

@ -66,7 +66,7 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
// TODO configs // TODO configs
tank = new Tank("TileIndustrialGrinder", TileIndustrialGrinder.TANK_CAPACITY, this); tank = new Tank("TileIndustrialGrinder", TileIndustrialGrinder.TANK_CAPACITY, this);
inventory = new Inventory(7, "TileIndustrialGrinder", 64, this); inventory = new Inventory(8, "TileIndustrialGrinder", 64, this);
ticksSinceLastChange = 0; ticksSinceLastChange = 0;
final int[] inputs = new int[2]; final int[] inputs = new int[2];
inputs[0] = 0; inputs[0] = 0;
@ -102,26 +102,25 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
@Override @Override
public void update() { public void update() {
ticksSinceLastChange++; super.update();
if (this.multiblockChecker == null) { if (this.multiblockChecker == null) {
final BlockPos pos = this.getPos().offset(this.getFacing().getOpposite(), 2).down(); final BlockPos pos = this.getPos().offset(this.getFacing().getOpposite(), 2).down();
this.multiblockChecker = new MultiblockChecker(this.world, pos); this.multiblockChecker = new MultiblockChecker(this.world, pos);
} }
if (this.getMutliBlock()) { this.ticksSinceLastChange++;
super.update(); // Check cells input slot 2 time per second
} if (this.ticksSinceLastChange >= 10) {
if (!this.inventory.getStackInSlot(1).isEmpty()) {
//Check cells input slot 2 time per second
if (ticksSinceLastChange >= 10){
if (!this.inventory.getStackInSlot(1).isEmpty()){
FluidUtils.drainContainers(this.tank, this.inventory, 1, 6); FluidUtils.drainContainers(this.tank, this.inventory, 1, 6);
FluidUtils.fillContainers(this.tank, this.inventory, 1, 6, this.tank.getFluidType()); 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 @Override
@ -273,10 +272,10 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
@Override @Override
public BuiltContainer createContainer(final EntityPlayer player) { public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("industrialgrinder").player(player.inventory).inventory().hotbar() return new ContainerBuilder("industrialgrinder").player(player.inventory).inventory().hotbar().addInventory()
.addInventory().tile(this).slot(1, 34, 35).slot(0, 84, 43).outputSlot(2, 126, 18).outputSlot(3, 126, 36) .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() .outputSlot(4, 126, 54).outputSlot(5, 126, 72).outputSlot(6, 34, 55).energySlot(7, 8, 72)
.create(this); .syncEnergyValue().syncCrafterValue().addInventory().create(this);
} }
} }

View file

@ -62,8 +62,10 @@ public class TileVacuumFreezer extends TilePowerAcceptor
@Override @Override
public void update() { public void update() {
if (world.isRemote){ return; }
if (this.getMultiBlock()) { if (this.getMultiBlock()) {
super.update(); super.update();
this.charge(2);
} }
} }
@ -149,8 +151,8 @@ public class TileVacuumFreezer extends TilePowerAcceptor
@Override @Override
public BuiltContainer createContainer(final EntityPlayer player) { public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("vacuumfreezer").player(player.inventory).inventory().hotbar().addInventory() return new ContainerBuilder("vacuumfreezer").player(player.inventory).inventory().hotbar().addInventory()
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).syncEnergyValue().syncCrafterValue().addInventory() .tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
.create(this); .syncCrafterValue().addInventory().create(this);
} }
} }

View file

@ -41,7 +41,7 @@ import techreborn.init.ModBlocks;
public class TileCompressor extends TilePowerAcceptor implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider { 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; public RecipeCrafter crafter;
@ -59,7 +59,7 @@ public class TileCompressor extends TilePowerAcceptor implements IToolDrop, IInv
public void update() { public void update() {
if (!this.world.isRemote) { if (!this.world.isRemote) {
super.update(); super.update();
this.charge(3); this.charge(2);
} }
} }
@ -137,7 +137,7 @@ public class TileCompressor extends TilePowerAcceptor implements IToolDrop, IInv
@Override @Override
public BuiltContainer createContainer(final EntityPlayer player) { public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("compressor").player(player.inventory).inventory().hotbar().addInventory() return new ContainerBuilder("compressor").player(player.inventory).inventory().hotbar().addInventory()
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).syncEnergyValue().syncCrafterValue().addInventory() .tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
.create(this); .syncCrafterValue().addInventory().create(this);
} }
} }

View file

@ -44,7 +44,7 @@ import techreborn.init.ModBlocks;
public class TileElectricFurnace extends TilePowerAcceptor public class TileElectricFurnace extends TilePowerAcceptor
implements IToolDrop, IInventoryProvider, IContainerProvider, IMachineSlotProvider { 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 capacity = 1000;
public int progress; public int progress;
public int fuelScale = 100; public int fuelScale = 100;
@ -62,33 +62,36 @@ public class TileElectricFurnace extends TilePowerAcceptor
@Override @Override
public void update() { public void update() {
super.update(); if (world.isRemote){ return; }
if (!this.world.isRemote) {
final boolean burning = this.isBurning();
boolean updateInventory = false;
if (this.isBurning() && this.canSmelt()) {
this.updateState();
this.progress++; super.update();
if (this.progress % 10 == 0) { this.charge(2);
this.useEnergy(this.cost);
} final boolean burning = this.isBurning();
if (this.progress >= this.fuelScale) { boolean updateInventory = false;
this.progress = 0; if (this.isBurning() && this.canSmelt()) {
this.cookItems(); this.updateState();
updateInventory = true;
} this.progress++;
} else { if (this.progress % 10 == 0) {
this.progress = 0; this.useEnergy(this.cost);
this.updateState();
} }
if (burning != this.isBurning()) { if (this.progress >= this.fuelScale) {
this.progress = 0;
this.cookItems();
updateInventory = true; updateInventory = true;
} }
if (updateInventory) { } else {
this.markDirty(); this.progress = 0;
} this.updateState();
} }
if (burning != this.isBurning()) {
updateInventory = true;
}
if (updateInventory) {
this.markDirty();
}
} }
public void cookItems() { public void cookItems() {
@ -221,8 +224,8 @@ public class TileElectricFurnace extends TilePowerAcceptor
@Override @Override
public BuiltContainer createContainer(final EntityPlayer player) { public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("electricfurnace").player(player.inventory).inventory().hotbar().addInventory() return new ContainerBuilder("electricfurnace").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::getBurnTime, this::setBurnTime).addInventory().create(this); .syncIntegerValue(this::getBurnTime, this::setBurnTime).addInventory().create(this);
} }
@Override @Override

View file

@ -43,7 +43,7 @@ import techreborn.init.ModBlocks;
public class TileExtractor extends TilePowerAcceptor public class TileExtractor extends TilePowerAcceptor
implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider { 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; public RecipeCrafter crafter;
@ -62,7 +62,7 @@ public class TileExtractor extends TilePowerAcceptor
public void update() { public void update() {
if (!this.world.isRemote) { if (!this.world.isRemote) {
super.update(); super.update();
this.charge(3); this.charge(2);
} }
} }
@ -151,9 +151,9 @@ public class TileExtractor extends TilePowerAcceptor
@Override @Override
public BuiltContainer createContainer(final EntityPlayer player) { public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("extractor").player(player.inventory).inventory().hotbar().addInventory() return new ContainerBuilder("extractor").player(player.inventory).inventory().hotbar().addInventory().tile(this)
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).syncEnergyValue().syncCrafterValue().addInventory() .slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue().syncCrafterValue()
.create(this); .addInventory().create(this);
} }
} }

View file

@ -43,7 +43,7 @@ import techreborn.init.ModBlocks;
public class TileGrinder extends TilePowerAcceptor public class TileGrinder extends TilePowerAcceptor
implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider { 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; public RecipeCrafter crafter;
@ -62,7 +62,7 @@ public class TileGrinder extends TilePowerAcceptor
public void update() { public void update() {
if (!this.world.isRemote) { if (!this.world.isRemote) {
super.update(); super.update();
this.charge(3); this.charge(2);
} }
} }
@ -152,9 +152,9 @@ public class TileGrinder extends TilePowerAcceptor
@Override @Override
public BuiltContainer createContainer(final EntityPlayer player) { public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("grinder").player(player.inventory).inventory().hotbar().addInventory() return new ContainerBuilder("grinder").player(player.inventory).inventory().hotbar().addInventory().tile(this)
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).syncEnergyValue().syncCrafterValue().addInventory() .slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue().syncCrafterValue()
.create(this); .addInventory().create(this);
} }
@Override @Override

View file

@ -41,7 +41,7 @@ import techreborn.items.ItemParts;
public class TileRecycler extends TilePowerAcceptor implements IToolDrop, IInventoryProvider, IContainerProvider { 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 capacity = 1000;
private final int cost = 2; private final int cost = 2;
private final int time = 15; private final int time = 15;
@ -78,6 +78,7 @@ public class TileRecycler extends TilePowerAcceptor implements IToolDrop, IInven
} }
this.updateState(); this.updateState();
this.charge(2);
if (updateInventory) { if (updateInventory) {
this.markDirty(); this.markDirty();
@ -199,7 +200,7 @@ public class TileRecycler extends TilePowerAcceptor implements IToolDrop, IInven
@Override @Override
public BuiltContainer createContainer(final EntityPlayer player) { public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("recycler").player(player.inventory).inventory().hotbar().addInventory() 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); .syncIntegerValue(this::getProgress, this::setProgress).addInventory().create(this);
} }