Skip to content

Commit

Permalink
Fixes crash with growing SugarCane and Cactus.
Browse files Browse the repository at this point in the history
This crash was reported in Discord. There was infinite loop in finding the root sugarcane/cactus block.
  • Loading branch information
BONNe committed Feb 22, 2023
1 parent 3243788 commit 7ba7dbd
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ else if (Material.CACTUS.equals(block.getType()) || Material.SUGAR_CANE.equals(b

while (rootBlock.getRelative(BlockFace.DOWN).getType().equals(block.getType()))
{
rootBlock = block.getRelative(BlockFace.DOWN);
rootBlock = rootBlock.getRelative(BlockFace.DOWN);
}

int height = 1;
Expand All @@ -240,8 +240,7 @@ else if (Material.CACTUS.equals(block.getType()) || Material.SUGAR_CANE.equals(b
height++;
}

if (height < 4 &&
Material.AIR.equals(rootBlock.getType()))
if (height < 4 && Material.AIR.equals(rootBlock.getType()))
{
rootBlock.setBlockData(block.getType().createBlockData(), true);
this.spawnParticle(rootBlock.getLocation());
Expand Down

0 comments on commit 7ba7dbd

Please sign in to comment.