From 4025089a5b1e366d961b163218e0ec3d35cbb0e5 Mon Sep 17 00:00:00 2001 From: Abdiel Kavash <19243993+AbdielKavash@users.noreply.github.com> Date: Tue, 16 Jan 2024 12:51:38 -0600 Subject: [PATCH] Fix hardcoded world height. (#37) --- src/main/java/twilightforest/world/TFGenCanopyMushroom.java | 2 +- src/main/java/twilightforest/world/TFGenCanopyOak.java | 2 +- src/main/java/twilightforest/world/TFGenCanopyTree.java | 2 +- src/main/java/twilightforest/world/TFGenLargeWinter.java | 2 +- src/main/java/twilightforest/world/TFGenMangroveTree.java | 2 +- src/main/java/twilightforest/world/TFGenMinersTree.java | 2 +- src/main/java/twilightforest/world/TFGenSmallTwilightOak.java | 4 ++-- src/main/java/twilightforest/world/TFGenSortingTree.java | 2 +- src/main/java/twilightforest/world/TFGenTreeOfTime.java | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/twilightforest/world/TFGenCanopyMushroom.java b/src/main/java/twilightforest/world/TFGenCanopyMushroom.java index 24d7fb809b..4127a97dab 100644 --- a/src/main/java/twilightforest/world/TFGenCanopyMushroom.java +++ b/src/main/java/twilightforest/world/TFGenCanopyMushroom.java @@ -45,7 +45,7 @@ public boolean generate(World world, Random random, int x, int y, int z) { // check if we're on dirt or grass Block blockUnder = world.getBlock(x, y - 1, z); if (blockUnder != Blocks.grass && blockUnder != Blocks.dirt && blockUnder != Blocks.mycelium - || y >= 256 - treeHeight - 1) { + || y >= world.getHeight() - treeHeight - 1) { return false; } diff --git a/src/main/java/twilightforest/world/TFGenCanopyOak.java b/src/main/java/twilightforest/world/TFGenCanopyOak.java index 3ac833fb07..a71443d4d4 100644 --- a/src/main/java/twilightforest/world/TFGenCanopyOak.java +++ b/src/main/java/twilightforest/world/TFGenCanopyOak.java @@ -33,7 +33,7 @@ public boolean generate(World world, Random random, int x, int y, int z) { // check if we're on dirt or grass Material materialUnder = world.getBlock(x, y - 1, z).getMaterial(); - if ((materialUnder != Material.grass && materialUnder != Material.ground) || y >= TFWorld.MAXHEIGHT - 12) { + if ((materialUnder != Material.grass && materialUnder != Material.ground) || y >= world.getHeight() - 12) { return false; } diff --git a/src/main/java/twilightforest/world/TFGenCanopyTree.java b/src/main/java/twilightforest/world/TFGenCanopyTree.java index 53182ba609..563970d503 100644 --- a/src/main/java/twilightforest/world/TFGenCanopyTree.java +++ b/src/main/java/twilightforest/world/TFGenCanopyTree.java @@ -43,7 +43,7 @@ public boolean generate(World world, Random random, int x, int y, int z) { // check if we're on dirt or grass Material materialUnder = world.getBlock(x, y - 1, z).getMaterial(); - if ((materialUnder != Material.grass && materialUnder != Material.ground) || y >= TFWorld.MAXHEIGHT - 12) { + if ((materialUnder != Material.grass && materialUnder != Material.ground) || y >= world.getHeight() - 12) { return false; } diff --git a/src/main/java/twilightforest/world/TFGenLargeWinter.java b/src/main/java/twilightforest/world/TFGenLargeWinter.java index 90109690a8..94825052bf 100644 --- a/src/main/java/twilightforest/world/TFGenLargeWinter.java +++ b/src/main/java/twilightforest/world/TFGenLargeWinter.java @@ -40,7 +40,7 @@ public boolean generate(World world, Random random, int x, int y, int z) { // check if we're on dirt or grass Block blockUnder = world.getBlock(x, y - 1, z); - if (blockUnder != Blocks.grass && blockUnder != Blocks.dirt || y >= TFWorld.MAXHEIGHT - treeHeight) { + if (blockUnder != Blocks.grass && blockUnder != Blocks.dirt || y >= world.getHeight() - treeHeight) { return false; } diff --git a/src/main/java/twilightforest/world/TFGenMangroveTree.java b/src/main/java/twilightforest/world/TFGenMangroveTree.java index 8b487ca107..344fe58345 100644 --- a/src/main/java/twilightforest/world/TFGenMangroveTree.java +++ b/src/main/java/twilightforest/world/TFGenMangroveTree.java @@ -34,7 +34,7 @@ public TFGenMangroveTree(boolean par1) { @Override public boolean generate(World world, Random random, int x, int y, int z) { // we only start over water - if ((this.checkForWater && world.getBlock(x, y - 1, z) != Blocks.water) || y >= 128 - 18 - 1) { + if ((this.checkForWater && world.getBlock(x, y - 1, z) != Blocks.water) || y >= world.getHeight() - 18 - 1) { return false; } diff --git a/src/main/java/twilightforest/world/TFGenMinersTree.java b/src/main/java/twilightforest/world/TFGenMinersTree.java index e22f2cde26..32615655e1 100644 --- a/src/main/java/twilightforest/world/TFGenMinersTree.java +++ b/src/main/java/twilightforest/world/TFGenMinersTree.java @@ -31,7 +31,7 @@ public boolean generate(World world, Random rand, int x, int y, int z) { // check soil Material materialUnder = world.getBlock(x, y - 1, z).getMaterial(); - if ((materialUnder != Material.grass && materialUnder != Material.ground) || y >= TFWorld.MAXHEIGHT - 12) { + if ((materialUnder != Material.grass && materialUnder != Material.ground) || y >= world.getHeight() - 12) { return false; } diff --git a/src/main/java/twilightforest/world/TFGenSmallTwilightOak.java b/src/main/java/twilightforest/world/TFGenSmallTwilightOak.java index 8d7707bc2a..3773fea8db 100644 --- a/src/main/java/twilightforest/world/TFGenSmallTwilightOak.java +++ b/src/main/java/twilightforest/world/TFGenSmallTwilightOak.java @@ -35,7 +35,7 @@ public boolean generate(World world, Random rand, int x, int y, int z) { int height = rand.nextInt(3) + this.minTreeHeight; boolean allClear = true; - if (y >= 1 && y + height + 1 <= 256) { + if (y >= 1 && y + height + 1 <= world.getHeight()) { int cy; byte width; int cz; @@ -77,7 +77,7 @@ public boolean generate(World world, Random rand, int x, int y, int z) { } else { Block blockUsing = world.getBlock(x, y - 1, z); - if ((blockUsing == Blocks.grass || blockUsing == Blocks.dirt) && y < 256 - height - 1) { + if ((blockUsing == Blocks.grass || blockUsing == Blocks.dirt) && y < world.getHeight() - height - 1) { this.setBlock(world, x, y - 1, z, Blocks.dirt); width = 3; byte var18 = 0; diff --git a/src/main/java/twilightforest/world/TFGenSortingTree.java b/src/main/java/twilightforest/world/TFGenSortingTree.java index c1ae56cb85..c654a1209b 100644 --- a/src/main/java/twilightforest/world/TFGenSortingTree.java +++ b/src/main/java/twilightforest/world/TFGenSortingTree.java @@ -33,7 +33,7 @@ public TFGenSortingTree(boolean notify) { public boolean generate(World world, Random rand, int x, int y, int z) { // check soil Material materialUnder = world.getBlock(x, y - 1, z).getMaterial(); - if ((materialUnder != Material.grass && materialUnder != Material.ground) || y >= TFWorld.MAXHEIGHT - 12) { + if ((materialUnder != Material.grass && materialUnder != Material.ground) || y >= world.getHeight() - 12) { return false; } diff --git a/src/main/java/twilightforest/world/TFGenTreeOfTime.java b/src/main/java/twilightforest/world/TFGenTreeOfTime.java index 68d5470792..da39993c68 100644 --- a/src/main/java/twilightforest/world/TFGenTreeOfTime.java +++ b/src/main/java/twilightforest/world/TFGenTreeOfTime.java @@ -26,7 +26,7 @@ public boolean generate(World world, Random random, int x, int y, int z) { int diameter = 1; // do we have enough height? - if (y < 1 || y + height + diameter > TFWorld.MAXHEIGHT) { + if (y < 1 || y + height + diameter > world.getHeight()) { // System.out.println("Failed with hollow tree of height " + // height); return false;