Skip to content

Commit

Permalink
Fix #192: Whitelist wheat, grass, ... when jumping up sidewards.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelzangl committed May 9, 2020
1 parent 7034733 commit b55add2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ private boolean isAllowedPosition(int cx, int cy, int cz) {
}

protected boolean checkGroundBlock(int currentNode, int cx, int cy, int cz) {
if (getY(currentNode) < cy) {
// Moving up
if (getY(currentNode) < cy && cx == getX(currentNode) && cz == getZ(currentNode)) {
// Moving straight up - this needs to place a block
return allowedGroundForUpwardsBlocks.isAt(world, cx, cy - 1, cz);
} else {
return allowedGroundBlocks.isAt(world, cx, cy - 1, cz);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ public class BlockSets {
* Flowers and stuff like that
*/
private static final BlockSet explicitFootWalkableBlocks = BlockSet.builder().add(
Blocks.TALL_GRASS,
Blocks.GRASS,
Blocks.CORNFLOWER,
Blocks.CHORUS_FLOWER,
Blocks.SUNFLOWER,
Expand Down Expand Up @@ -434,14 +434,14 @@ public class BlockSets {
public static final BlockSet HEAD_CAN_WALK_THROUGH = BlockSet.builder().add(
Blocks.KELP_PLANT,
Blocks.CHORUS_PLANT,
Blocks.TALL_GRASS,
Blocks.SUGAR_CANE).add(AIR).add(TORCH).build();

public static final BlockSet FEET_CAN_WALK_THROUGH = BlockSet.builder().add(explicitFootWalkableBlocks).add(HEAD_CAN_WALK_THROUGH).build();

private static final BlockSet explicitSafeSideBlocks = BlockSet.builder().add(
Blocks.ANVIL,
Blocks.CACTUS,
Blocks.SUGAR_CANE,
Blocks.CACTUS,
Blocks.COBWEB,
Blocks.GLASS_PANE,
Blocks.ENCHANTING_TABLE,
Expand All @@ -456,7 +456,7 @@ public class BlockSets {
Blocks.STONE_BUTTON,
Blocks.DRAGON_EGG,
Blocks.TURTLE_EGG,
Blocks.FLOWER_POT).add(WALL).add(FENCE).add(FENCE_GATE).add(BED).add(WOODEN_PRESSURE_PLATE).add(WOODEN_BUTTON).build();
Blocks.FLOWER_POT).add(FEET_CAN_WALK_THROUGH).add(WALL).add(FENCE).add(FENCE_GATE).add(BED).add(WOODEN_PRESSURE_PLATE).add(WOODEN_BUTTON).build();

/**
* Blocks we can just walk over/next to without problems.
Expand Down Expand Up @@ -488,7 +488,9 @@ public class BlockSets {
Blocks.EMERALD_ORE,
Blocks.OBSERVER,
// FIXME: Not a cube.
Blocks.FARMLAND, Blocks.FURNACE, Blocks.GLASS, Blocks.GLOWSTONE,
Blocks.FARMLAND,

Blocks.FURNACE, Blocks.GLASS, Blocks.GLOWSTONE,
Blocks.GRASS_BLOCK, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE,
Blocks.CLAY, Blocks.IRON_BLOCK, Blocks.IRON_ORE,
Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE,
Expand Down

0 comments on commit b55add2

Please sign in to comment.