mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-02-06 10:25:00 +01:00
This is breaking but I want to save this work
This commit is contained in:
parent
008111a846
commit
e1816ec8fe
1 changed files with 40 additions and 36 deletions
|
@ -38,7 +38,7 @@ public class PressingBehaviour extends BeltProcessingBehaviour {
|
|||
public int prevRunningTicks;
|
||||
public int runningTicks;
|
||||
public boolean running;
|
||||
public boolean finished;
|
||||
public boolean wentDown;
|
||||
public Mode mode;
|
||||
|
||||
int entityScanCooldown;
|
||||
|
@ -72,7 +72,7 @@ public class PressingBehaviour extends BeltProcessingBehaviour {
|
|||
public void read(CompoundTag compound, boolean clientPacket) {
|
||||
running = compound.getBoolean("Running");
|
||||
mode = Mode.values()[compound.getInt("Mode")];
|
||||
finished = compound.getBoolean("Finished");
|
||||
wentDown = compound.getBoolean("WentDown");
|
||||
prevRunningTicks = runningTicks = compound.getInt("Ticks");
|
||||
super.read(compound, clientPacket);
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class PressingBehaviour extends BeltProcessingBehaviour {
|
|||
public void write(CompoundTag compound, boolean clientPacket) {
|
||||
compound.putBoolean("Running", running);
|
||||
compound.putInt("Mode", mode.ordinal());
|
||||
compound.putBoolean("Finished", finished);
|
||||
compound.putBoolean("WentDown", wentDown);
|
||||
compound.putInt("Ticks", runningTicks);
|
||||
super.write(compound, clientPacket);
|
||||
|
||||
|
@ -110,6 +110,7 @@ public class PressingBehaviour extends BeltProcessingBehaviour {
|
|||
public void start(Mode mode) {
|
||||
this.mode = mode;
|
||||
running = true;
|
||||
wentDown = false;
|
||||
prevRunningTicks = 0;
|
||||
runningTicks = 0;
|
||||
particleItems.clear();
|
||||
|
@ -128,17 +129,21 @@ public class PressingBehaviour extends BeltProcessingBehaviour {
|
|||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
finished = false;
|
||||
if (specifics.getKineticSpeed() == 0) {
|
||||
running = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Level level = getWorld();
|
||||
|
||||
if (level == null)
|
||||
return;
|
||||
|
||||
BlockPos worldPosition = getPos();
|
||||
|
||||
if (!running || level == null) {
|
||||
if (level != null && !level.isClientSide) {
|
||||
if (!running) {
|
||||
if (level.isClientSide)
|
||||
return;
|
||||
|
||||
if (entityScanCooldown > 0)
|
||||
entityScanCooldown--;
|
||||
|
@ -151,8 +156,7 @@ public class PressingBehaviour extends BeltProcessingBehaviour {
|
|||
if (BasinBlock.isBasin(level, worldPosition.below(2)))
|
||||
return;
|
||||
|
||||
for (ItemEntity itemEntity : level.getEntitiesOfClass(ItemEntity.class,
|
||||
new AABB(worldPosition.below()).deflate(.125f))) {
|
||||
for (ItemEntity itemEntity : level.getEntitiesOfClass(ItemEntity.class, new AABB(worldPosition.below()).deflate(.125f))) {
|
||||
if (!itemEntity.isAlive() || !itemEntity.onGround())
|
||||
continue;
|
||||
if (!specifics.tryProcessInWorld(itemEntity, true))
|
||||
|
@ -160,7 +164,6 @@ public class PressingBehaviour extends BeltProcessingBehaviour {
|
|||
start(Mode.WORLD);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return;
|
||||
|
@ -171,7 +174,7 @@ public class PressingBehaviour extends BeltProcessingBehaviour {
|
|||
return;
|
||||
}
|
||||
|
||||
if (runningTicks == CYCLE / 2 && specifics.getKineticSpeed() != 0) {
|
||||
if (runningTicks >= CYCLE / 2 && !wentDown) {
|
||||
if (inWorld())
|
||||
applyInWorld();
|
||||
if (onBasin())
|
||||
|
@ -186,22 +189,22 @@ public class PressingBehaviour extends BeltProcessingBehaviour {
|
|||
|
||||
if (!level.isClientSide)
|
||||
blockEntity.sendData();
|
||||
|
||||
wentDown = true;
|
||||
}
|
||||
|
||||
if (!level.isClientSide && runningTicks > CYCLE) {
|
||||
finished = true;
|
||||
wentDown = false;
|
||||
particleItems.clear();
|
||||
specifics.onPressingCompleted();
|
||||
blockEntity.sendData();
|
||||
prevRunningTicks = runningTicks - 240;
|
||||
runningTicks += getRunningTickSpeed() - 240;
|
||||
runningTicks -= 240;
|
||||
return;
|
||||
}
|
||||
|
||||
prevRunningTicks = runningTicks;
|
||||
runningTicks += getRunningTickSpeed();
|
||||
if (prevRunningTicks < CYCLE / 2 && runningTicks >= CYCLE / 2) {
|
||||
runningTicks = CYCLE / 2;
|
||||
// Pause the ticks until a packet is received
|
||||
if (level.isClientSide && !blockEntity.isVirtual())
|
||||
runningTicks = -(CYCLE / 2);
|
||||
|
@ -257,7 +260,8 @@ public class PressingBehaviour extends BeltProcessingBehaviour {
|
|||
|
||||
if (mode == Mode.BASIN)
|
||||
particleItems
|
||||
.forEach(stack -> makeCompactingParticleEffect(VecHelper.getCenterOf(worldPosition.below(2)), stack));
|
||||
.forEach(stack -> makeCompactingParticleEffect(VecHelper.getCenterOf(worldPosition.below(2)),
|
||||
stack));
|
||||
if (mode == Mode.BELT)
|
||||
particleItems.forEach(stack -> makePressingParticleEffect(VecHelper.getCenterOf(worldPosition.below(2))
|
||||
.add(0, 8 / 16f, 0), stack));
|
||||
|
|
Loading…
Reference in a new issue