Fix some tiles update on clientside
This commit is contained in:
parent
0c4895efa4
commit
25e683b2e9
4 changed files with 55 additions and 46 deletions
|
@ -20,7 +20,7 @@ import techreborn.init.ModBlocks;
|
||||||
import techreborn.utils.upgrade.UpgradeHandler;
|
import techreborn.utils.upgrade.UpgradeHandler;
|
||||||
|
|
||||||
public class TileCompressor extends TilePowerAcceptor
|
public class TileCompressor extends TilePowerAcceptor
|
||||||
implements IWrenchable, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
implements IWrenchable, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||||
|
|
||||||
public Inventory inventory = new Inventory(6, "TileCompressor", 64, this);
|
public Inventory inventory = new Inventory(6, "TileCompressor", 64, this);
|
||||||
|
|
||||||
|
@ -39,10 +39,12 @@ public class TileCompressor extends TilePowerAcceptor
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
super.update();
|
if (!this.world.isRemote) {
|
||||||
this.crafter.updateEntity();
|
super.update();
|
||||||
this.upgradeHandler.tick();
|
this.crafter.updateEntity();
|
||||||
this.charge(3);
|
this.upgradeHandler.tick();
|
||||||
|
this.charge(3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,7 +17,7 @@ import techreborn.client.container.builder.ContainerBuilder;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
|
|
||||||
public class TileElectricFurnace extends TilePowerAcceptor
|
public class TileElectricFurnace extends TilePowerAcceptor
|
||||||
implements IWrenchable, IInventoryProvider, IContainerProvider {
|
implements IWrenchable, IInventoryProvider, IContainerProvider {
|
||||||
|
|
||||||
private static final int[] SLOTS_TOP = new int[] { 0 };
|
private static final int[] SLOTS_TOP = new int[] { 0 };
|
||||||
private static final int[] SLOTS_BOTTOM = new int[] { 1 };
|
private static final int[] SLOTS_BOTTOM = new int[] { 1 };
|
||||||
|
@ -40,30 +40,33 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
super.update();
|
if (!this.world.isRemote) {
|
||||||
final boolean burning = this.isBurning();
|
super.update();
|
||||||
boolean updateInventory = false;
|
|
||||||
if (this.isBurning() && this.canSmelt()) {
|
|
||||||
this.updateState();
|
|
||||||
|
|
||||||
this.progress++;
|
final boolean burning = this.isBurning();
|
||||||
if (this.progress % 10 == 0) {
|
boolean updateInventory = false;
|
||||||
this.useEnergy(this.cost);
|
if (this.isBurning() && this.canSmelt()) {
|
||||||
}
|
this.updateState();
|
||||||
if (this.progress >= this.fuelScale) {
|
|
||||||
|
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.progress = 0;
|
||||||
this.cookItems();
|
this.updateState();
|
||||||
|
}
|
||||||
|
if (burning != this.isBurning()) {
|
||||||
updateInventory = true;
|
updateInventory = true;
|
||||||
}
|
}
|
||||||
} else {
|
if (updateInventory) {
|
||||||
this.progress = 0;
|
this.markDirty();
|
||||||
this.updateState();
|
}
|
||||||
}
|
|
||||||
if (burning != this.isBurning()) {
|
|
||||||
updateInventory = true;
|
|
||||||
}
|
|
||||||
if (updateInventory) {
|
|
||||||
this.markDirty();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,17 +90,16 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
||||||
public boolean canSmelt() {
|
public boolean canSmelt() {
|
||||||
if (this.getStackInSlot(this.input1) == ItemStack.EMPTY) {
|
if (this.getStackInSlot(this.input1) == ItemStack.EMPTY) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
final ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.getStackInSlot(this.input1));
|
|
||||||
if (itemstack == ItemStack.EMPTY)
|
|
||||||
return false;
|
|
||||||
if (this.getStackInSlot(this.output) == ItemStack.EMPTY)
|
|
||||||
return true;
|
|
||||||
if (!this.getStackInSlot(this.output).isItemEqual(itemstack))
|
|
||||||
return false;
|
|
||||||
final int result = this.getStackInSlot(this.output).getCount() + itemstack.getCount();
|
|
||||||
return result <= this.getInventoryStackLimit() && result <= itemstack.getMaxStackSize();
|
|
||||||
}
|
}
|
||||||
|
final ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.getStackInSlot(this.input1));
|
||||||
|
if (itemstack == ItemStack.EMPTY)
|
||||||
|
return false;
|
||||||
|
if (this.getStackInSlot(this.output) == ItemStack.EMPTY)
|
||||||
|
return true;
|
||||||
|
if (!this.getStackInSlot(this.output).isItemEqual(itemstack))
|
||||||
|
return false;
|
||||||
|
final int result = this.getStackInSlot(this.output).getCount() + itemstack.getCount();
|
||||||
|
return result <= this.getInventoryStackLimit() && result <= itemstack.getMaxStackSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBurning() {
|
public boolean isBurning() {
|
||||||
|
@ -153,7 +155,8 @@ public class TileElectricFurnace extends TilePowerAcceptor
|
||||||
// ISidedInventory
|
// ISidedInventory
|
||||||
@Override
|
@Override
|
||||||
public int[] getSlotsForFace(final EnumFacing side) {
|
public int[] getSlotsForFace(final EnumFacing side) {
|
||||||
return side == EnumFacing.DOWN ? TileElectricFurnace.SLOTS_BOTTOM : side == EnumFacing.UP ? TileElectricFurnace.SLOTS_TOP : TileElectricFurnace.SLOTS_SIDES;
|
return side == EnumFacing.DOWN ? TileElectricFurnace.SLOTS_BOTTOM
|
||||||
|
: side == EnumFacing.UP ? TileElectricFurnace.SLOTS_TOP : TileElectricFurnace.SLOTS_SIDES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -42,10 +42,12 @@ implements IWrenchable, IInventoryProvider, IRecipeCrafterProvider, IContainerPr
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
super.update();
|
if (!this.world.isRemote) {
|
||||||
this.crafter.updateEntity();
|
super.update();
|
||||||
this.upgradeHandler.tick();
|
this.crafter.updateEntity();
|
||||||
this.charge(3);
|
this.upgradeHandler.tick();
|
||||||
|
this.charge(3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -43,11 +43,13 @@ implements IWrenchable, IInventoryProvider, IRecipeCrafterProvider, IContainerPr
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void update() {
|
||||||
super.updateEntity();
|
if (!this.world.isRemote) {
|
||||||
this.upgradeHandler.tick();
|
super.update();
|
||||||
//charge(3); TODO
|
this.upgradeHandler.tick();
|
||||||
this.charge(3);
|
//charge(3); TODO
|
||||||
|
this.charge(3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue