From b08d478d73ed17a8e1dd9d438019b45efde7de71 Mon Sep 17 00:00:00 2001 From: qloak Date: Wed, 15 Jul 2026 20:33:38 +0100 Subject: [PATCH] fix(TU20): Piston and StemTile fixes (#6) - fixed "Two pistons stacked facing up and the top piston is powered with a repeater will cause the top piston to lock in place." - fixed "Fix for issue where destroying planted pumpkin and melon seeds drops an incorrect number of seeds." --------- Co-authored-by: pieeebot <10+pieeebot@noreply.neolegacy.dev> Reviewed-on: https://git.neolegacy.dev/pieeebot/mc_pieLCE/pulls/6 Co-authored-by: qloak Co-committed-by: qloak --- Minecraft.World/PistonBaseTile.cpp | 9 +++++++++ Minecraft.World/StemTile.cpp | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Minecraft.World/PistonBaseTile.cpp b/Minecraft.World/PistonBaseTile.cpp index e8cb35b1..8c002a85 100644 --- a/Minecraft.World/PistonBaseTile.cpp +++ b/Minecraft.World/PistonBaseTile.cpp @@ -218,10 +218,12 @@ bool PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1, if (extend && param1 == TRIGGER_CONTRACT) { level->setData(x, y, z, facing | EXTENDED_BIT, UPDATE_CLIENTS); + ignoreUpdate(false); return false; } else if (!extend && param1 == TRIGGER_EXTEND) { + ignoreUpdate(false); return false; } } @@ -247,6 +249,7 @@ bool PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1, } else { + ignoreUpdate(false); return false; } PIXEndNamedEvent(); @@ -340,6 +343,12 @@ bool PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1, ignoreUpdate(false); + level->updateNeighborsAt(x, y, z, id); + int stepX = x + Facing::STEP_X[facing]; + int stepY = y + Facing::STEP_Y[facing]; + int stepZ = z + Facing::STEP_Z[facing]; + level->updateNeighborsAt(stepX, stepY, stepZ, id); + return true; } diff --git a/Minecraft.World/StemTile.cpp b/Minecraft.World/StemTile.cpp index e8367522..32592c51 100644 --- a/Minecraft.World/StemTile.cpp +++ b/Minecraft.World/StemTile.cpp @@ -189,7 +189,10 @@ void StemTile::spawnResources(Level *level, int x, int y, int z, int data, float if (fruit == Tile::melon) seed = Item::seeds_melon; for (int i = 0; i < 3; i++) { - popResource(level, x, y, z, shared_ptr(new ItemInstance(seed))); + if (level->random->nextInt(15) <= data) + { + popResource(level, x, y, z, shared_ptr(new ItemInstance(seed))); + } } }