Set state to error even if throttle is minimal
This commit is contained in:
parent
bb8e594b4c
commit
51faf655b9
@ -170,16 +170,18 @@ abstract public class BlockEntityMatteryPoweredWorker extends BlockEntityMattery
|
||||
|
||||
private int idle_ticks_anim = 0;
|
||||
private int working_ticks_anim = 0;
|
||||
private int error_ticks_anim = 0;
|
||||
|
||||
protected void workerLoop() {
|
||||
if (throttle_ticks > 0) {
|
||||
if (level != null && throttle_ticks > 40 && getBlockState().hasProperty(WORKER_STATE) && getBlockState().getValue(WORKER_STATE) != WorkerState.ERROR) {
|
||||
level.setBlock(getBlockPos(), getBlockState().setValue(WORKER_STATE, WorkerState.ERROR), Block.UPDATE_CLIENTS);
|
||||
}
|
||||
if (level != null && error_ticks_anim > 20 && getBlockState().hasProperty(WORKER_STATE) && getBlockState().getValue(WORKER_STATE) != WorkerState.ERROR) {
|
||||
level.setBlock(getBlockPos(), getBlockState().setValue(WORKER_STATE, WorkerState.ERROR), Block.UPDATE_CLIENTS);
|
||||
}
|
||||
|
||||
if (throttle_ticks > 0) {
|
||||
working_ticks_anim = 0;
|
||||
idle_ticks_anim = 0;
|
||||
throttle_ticks--;
|
||||
error_ticks_anim++;
|
||||
|
||||
if (throttle_ticks > 0)
|
||||
return;
|
||||
@ -187,6 +189,7 @@ abstract public class BlockEntityMatteryPoweredWorker extends BlockEntityMattery
|
||||
|
||||
if (is_idling) {
|
||||
working_ticks_anim = 0;
|
||||
error_ticks_anim = 0;
|
||||
idle_ticks_anim++;
|
||||
|
||||
if (level != null && idle_ticks_anim > 20 && getBlockState().hasProperty(WORKER_STATE) && getBlockState().getValue(WORKER_STATE) != WorkerState.IDLE) {
|
||||
@ -235,6 +238,7 @@ abstract public class BlockEntityMatteryPoweredWorker extends BlockEntityMattery
|
||||
}
|
||||
|
||||
working_ticks_anim++;
|
||||
error_ticks_anim = 0;
|
||||
|
||||
double new_work_ticks = work_speed.doubleValue() + work_ticks;
|
||||
|
||||
@ -265,6 +269,7 @@ abstract public class BlockEntityMatteryPoweredWorker extends BlockEntityMattery
|
||||
}
|
||||
|
||||
working_ticks_anim++;
|
||||
error_ticks_anim = 0;
|
||||
work_ticks += 1d;
|
||||
|
||||
if (work_ticks >= current_job.ticks_processing_time) {
|
||||
@ -284,12 +289,14 @@ abstract public class BlockEntityMatteryPoweredWorker extends BlockEntityMattery
|
||||
if (finish.valid) {
|
||||
current_job = null;
|
||||
work_ticks = 0d;
|
||||
error_ticks_anim = 0;
|
||||
} else {
|
||||
throttle_ticks += finish.throttle;
|
||||
error_ticks_anim++;
|
||||
}
|
||||
}
|
||||
|
||||
if (level != null && working_ticks_anim > 20 && getBlockState().hasProperty(WORKER_STATE) && getBlockState().getValue(WORKER_STATE) != WorkerState.WORKING) {
|
||||
if (level != null && (working_ticks_anim > 20 && error_ticks_anim == 0) && getBlockState().hasProperty(WORKER_STATE) && getBlockState().getValue(WORKER_STATE) != WorkerState.WORKING) {
|
||||
level.setBlock(getBlockPos(), getBlockState().setValue(WORKER_STATE, WorkerState.WORKING), Block.UPDATE_CLIENTS);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user