Skip to content

Commit

Permalink
remove running = false
Browse files Browse the repository at this point in the history
  • Loading branch information
Shroopy committed Nov 27, 2024
1 parent 319b3ed commit 5572bd4
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void read(CompoundTag compound, boolean clientPacket) {

if (clientPacket) {
NBTHelper.iterateCompoundList(compound.getList("ParticleItems", Tag.TAG_COMPOUND),
c -> particleItems.add(ItemStack.of(c)));
c -> particleItems.add(ItemStack.of(c)));
spawnParticles();
}
}
Expand Down Expand Up @@ -146,13 +146,13 @@ public void tick() {
entityScanCooldown = ENTITY_SCAN;

if (BlockEntityBehaviour.get(level, worldPosition.below(2),
TransportedItemStackHandlerBehaviour.TYPE) != null)
TransportedItemStackHandlerBehaviour.TYPE) != null)
return;
if (BasinBlock.isBasin(level, worldPosition.below(2)))
return;

for (ItemEntity itemEntity : level.getEntitiesOfClass(ItemEntity.class,
new AABB(worldPosition.below()).deflate(.125f))) {
new AABB(worldPosition.below()).deflate(.125f))) {
if (!itemEntity.isAlive() || !itemEntity.onGround())
continue;
if (!specifics.tryProcessInWorld(itemEntity, true))
Expand All @@ -178,19 +178,18 @@ public void tick() {
applyOnBasin();

if (level.getBlockState(worldPosition.below(2))
.getSoundType() == SoundType.WOOL)
.getSoundType() == SoundType.WOOL)
AllSoundEvents.MECHANICAL_PRESS_ACTIVATION_ON_BELT.playOnServer(level, worldPosition);
else
AllSoundEvents.MECHANICAL_PRESS_ACTIVATION.playOnServer(level, worldPosition, .5f,
.75f + (Math.abs(specifics.getKineticSpeed()) / 1024f));
.75f + (Math.abs(specifics.getKineticSpeed()) / 1024f));

if (!level.isClientSide)
blockEntity.sendData();
}

if (!level.isClientSide && runningTicks > CYCLE) {
finished = true;
running = false;
particleItems.clear();
specifics.onPressingCompleted();
blockEntity.sendData();
Expand Down Expand Up @@ -258,13 +257,14 @@ protected void spawnParticles() {

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));
.add(0, 8 / 16f, 0), stack));
if (mode == Mode.WORLD)
particleItems.forEach(stack -> makePressingParticleEffect(VecHelper.getCenterOf(worldPosition.below(1))
.add(0, -1 / 4f, 0), stack));
.add(0, -1 / 4f, 0), stack));

particleItems.clear();
}
Expand All @@ -279,10 +279,10 @@ public void makePressingParticleEffect(Vec3 pos, ItemStack stack, int amount) {
return;
for (int i = 0; i < amount; i++) {
Vec3 motion = VecHelper.offsetRandomly(Vec3.ZERO, level.random, .125f)
.multiply(1, 0, 1);
.multiply(1, 0, 1);
motion = motion.add(0, amount != 1 ? 0.125f : 1 / 16f, 0);
level.addParticle(new ItemParticleOption(ParticleTypes.ITEM, stack), pos.x, pos.y - .25f, pos.z, motion.x,
motion.y, motion.z);
motion.y, motion.z);
}
}

Expand All @@ -292,9 +292,9 @@ public void makeCompactingParticleEffect(Vec3 pos, ItemStack stack) {
return;
for (int i = 0; i < 20; i++) {
Vec3 motion = VecHelper.offsetRandomly(Vec3.ZERO, level.random, .175f)
.multiply(1, 0, 1);
.multiply(1, 0, 1);
level.addParticle(new ItemParticleOption(ParticleTypes.ITEM, stack), pos.x, pos.y, pos.z, motion.x,
motion.y + .25f, motion.z);
motion.y + .25f, motion.z);
}
}

Expand Down

0 comments on commit 5572bd4

Please sign in to comment.