Prevent upward jumps from blocks lower than a full block like end portal frames

This commit is contained in:
MineTec committed 2026-10-08 00:10:19 +02:00
1 parent 8ba25758be
commit 9e1edbfc7c
1 file changed
+6
@@ -23,6 +23,8 @@ public class JumpGenerator {
private Pos starting;
private int combo = 0;
// Block, von dem der nächste Sprung startet (bestimmt, ob ein Sprung nach oben möglich ist)
private Block lastBlock = Block.DIAMOND_BLOCK;
private final int preview = 3;
@@ -55,6 +57,7 @@ public class JumpGenerator {
Pos previous = blocks.get(blocks.size()-1);
Pos target = previous.add(this.nextOffset(index, r));
Block block = isHundredth ? Block.DIAMOND_BLOCK : isTenth ? Block.GOLD_BLOCK : BlockPalette.getRandom(index, r);
this.lastBlock = block;
BlockTransition.animate(this.world, previous, target, block, animationDelayTicks, () -> {
this.world.setBlock(target, block);
this.world.setBlock(target.add(0, 1, 0), Block.LIGHT);
@@ -102,6 +105,9 @@ public class JumpGenerator {
if(roll < 0.05 + 0.28 * difficulty && y <= 120) dy = 1;
else if(roll > 1 - (0.2 + 0.13 * difficulty) && y >= 80) dy = -1;
// von niedrigen Blöcken (z. B. Endportalrahmen, 13/16 hoch) ist ein Block höher nicht erreichbar
if(dy == 1 && this.lastBlock.collisionShape().relativeEnd().y() < 1) dy = 0;
// weite Sprünge nach oben erst ab mittlerer, diagonal erst ab hoher Schwierigkeit
if(dy == 1 && dz == 4 && difficulty < 0.4) dz = 3;
if(dy == 1 && dz == 4 && dx != 0 && difficulty < 0.7) dx = 0;