Fix 2509; reviewed all ticking entities to ensure consistency in checks (#2510)
This commit is contained in:
parent
42f0d5ce42
commit
7d85960a4a
14 changed files with 37 additions and 50 deletions
|
@ -79,17 +79,12 @@ public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEn
|
|||
@Override
|
||||
public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) {
|
||||
super.tick(world, pos, state, blockEntity);
|
||||
|
||||
if (world == null) {
|
||||
if (world == null || world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
ticksSinceLastChange++;
|
||||
|
||||
if (world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check cells input slot 2 time per second
|
||||
if (ticksSinceLastChange >= 10) {
|
||||
ItemStack inputStack = inventory.getStack(0);
|
||||
|
|
|
@ -56,8 +56,7 @@ public class LightningRodBlockEntity extends PowerAcceptorBlockEntity implements
|
|||
@Override
|
||||
public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) {
|
||||
super.tick(world, pos, state, blockEntity);
|
||||
|
||||
if (world == null){
|
||||
if (world == null || world.isClient){
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -148,12 +148,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
|
|||
@Override
|
||||
public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) {
|
||||
super.tick(world, pos, state, blockEntity);
|
||||
|
||||
if (world == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (world.isClient) {
|
||||
if (world == null || world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,23 +65,20 @@ public class DragonEggSyphonBlockEntity extends PowerAcceptorBlockEntity
|
|||
@Override
|
||||
public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) {
|
||||
super.tick(world, pos, state, blockEntity);
|
||||
|
||||
if (world == null) {
|
||||
if (world == null || world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!world.isClient) {
|
||||
if (world.getBlockState(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()))
|
||||
.getBlock() == Blocks.DRAGON_EGG) {
|
||||
if (tryAddingEnergy(TechRebornConfig.dragonEggSyphonEnergyPerTick))
|
||||
lastOutput = world.getTime();
|
||||
}
|
||||
if (world.getBlockState(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()))
|
||||
.getBlock() == Blocks.DRAGON_EGG) {
|
||||
if (tryAddingEnergy(TechRebornConfig.dragonEggSyphonEnergyPerTick))
|
||||
lastOutput = world.getTime();
|
||||
}
|
||||
|
||||
if (world.getTime() - lastOutput < 30 && !isActive()) {
|
||||
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, true));
|
||||
} else if (world.getTime() - lastOutput > 30 && isActive()) {
|
||||
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, false));
|
||||
}
|
||||
if (world.getTime() - lastOutput < 30 && !isActive()) {
|
||||
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, true));
|
||||
} else if (world.getTime() - lastOutput > 30 && isActive()) {
|
||||
world.setBlockState(pos, world.getBlockState(pos).with(BlockMachineBase.ACTIVE, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public class DrainBlockEntity extends MachineBaseBlockEntity {
|
|||
@Override
|
||||
public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) {
|
||||
super.tick(world, pos, state, blockEntity);
|
||||
if (world.isClient) {
|
||||
if (world == null || world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,12 +75,14 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem
|
|||
// TileGenericMachine
|
||||
@Override
|
||||
public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) {
|
||||
if (world == null){
|
||||
super.tick(world, pos, state, blockEntity);
|
||||
if (world == null || world.isClient){
|
||||
return;
|
||||
}
|
||||
|
||||
ticksSinceLastChange++;
|
||||
// Check cells input slot 2 time per second
|
||||
if (!world.isClient && ticksSinceLastChange >= 10) {
|
||||
if (ticksSinceLastChange >= 10) {
|
||||
if (!inventory.getStack(1).isEmpty()) {
|
||||
FluidUtils.fillContainers(tank, inventory, 1, 2);
|
||||
if (tank.isEmpty()){
|
||||
|
@ -90,8 +92,6 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem
|
|||
}
|
||||
ticksSinceLastChange = 0;
|
||||
}
|
||||
|
||||
super.tick(world, pos, state, blockEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -78,20 +78,20 @@ public class IndustrialGrinderBlockEntity extends GenericMachineBlockEntity impl
|
|||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) {
|
||||
if (world == null){
|
||||
super.tick(world, pos, state, blockEntity);
|
||||
if (world == null || world.isClient){
|
||||
return;
|
||||
}
|
||||
|
||||
ticksSinceLastChange++;
|
||||
// Check cells input slot 2 time per second
|
||||
if (!world.isClient && ticksSinceLastChange >= 10) {
|
||||
if (ticksSinceLastChange >= 10) {
|
||||
if (!inventory.getStack(1).isEmpty()) {
|
||||
FluidUtils.drainContainers(tank, inventory, 1, 6);
|
||||
FluidUtils.fillContainers(tank, inventory, 1, 6);
|
||||
}
|
||||
ticksSinceLastChange = 0;
|
||||
}
|
||||
|
||||
super.tick(world, pos, state, blockEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -78,21 +78,20 @@ public class IndustrialSawmillBlockEntity extends GenericMachineBlockEntity impl
|
|||
// TileGenericMachine
|
||||
@Override
|
||||
public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) {
|
||||
if (world == null) {
|
||||
super.tick(world, pos, state, blockEntity);
|
||||
if (world == null || world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
ticksSinceLastChange++;
|
||||
// Check cells input slot 2 time per second
|
||||
if (!world.isClient && ticksSinceLastChange >= 10) {
|
||||
if (ticksSinceLastChange >= 10) {
|
||||
if (!inventory.getStack(1).isEmpty()) {
|
||||
FluidUtils.drainContainers(tank, inventory, 1, 5);
|
||||
FluidUtils.fillContainers(tank, inventory, 1, 5);
|
||||
}
|
||||
ticksSinceLastChange = 0;
|
||||
}
|
||||
|
||||
super.tick(world, pos, state, blockEntity);
|
||||
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
|
|
|
@ -105,7 +105,7 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
|
|||
@Override
|
||||
public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) {
|
||||
super.tick(world, pos, state, blockEntity);
|
||||
if (world.isClient) {
|
||||
if (world == null || world.isClient) {
|
||||
return;
|
||||
}
|
||||
charge(10);
|
||||
|
|
|
@ -114,10 +114,10 @@ public class MatterFabricatorBlockEntity extends PowerAcceptorBlockEntity
|
|||
@Override
|
||||
public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) {
|
||||
super.tick(world, pos, state, blockEntity);
|
||||
|
||||
if (world.isClient) {
|
||||
if (world == null || world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.charge(11);
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
|
|
|
@ -92,7 +92,7 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements
|
|||
@Override
|
||||
public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) {
|
||||
super.tick(world, pos, state, blockEntity);
|
||||
if (world == null) {
|
||||
if (world == null || world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,12 +69,10 @@ public class EnergyStorageBlockEntity extends PowerAcceptorBlockEntity implement
|
|||
@Override
|
||||
public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) {
|
||||
super.tick(world, pos, state, blockEntity);
|
||||
if (world == null) {
|
||||
return;
|
||||
}
|
||||
if (world.isClient) {
|
||||
if (world == null || world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!inventory.getStack(0).isEmpty()) {
|
||||
discharge(0);
|
||||
}
|
||||
|
|
|
@ -88,6 +88,10 @@ public class LSUStorageBlockEntity extends MachineBaseBlockEntity
|
|||
@Override
|
||||
public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) {
|
||||
super.tick(world, pos, state, blockEntity);
|
||||
if (world == null || world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (network == null) {
|
||||
findAndJoinNetwork(world, pos);
|
||||
} else {
|
||||
|
|
|
@ -101,7 +101,7 @@ public class LapotronicSUBlockEntity extends EnergyStorageBlockEntity implements
|
|||
@Override
|
||||
public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) {
|
||||
super.tick(world, pos, state, blockEntity);
|
||||
if (world.isClient) {
|
||||
if (world == null || world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue