Skip to content

Commit

Permalink
Change the minimum Y value for the 1.18 update. (#1284)
Browse files Browse the repository at this point in the history
  • Loading branch information
JDS-2070 committed Dec 7, 2021
1 parent a4101ed commit 2da1e53
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/com/sk89q/craftbook/mechanics/Elevator.java
Expand Up @@ -284,7 +284,7 @@ public void onCommonClick(PlayerInteractEvent event) {
public Block findDestination(Direction dir, BlockFace shift, Block clickedBlock) {

// find destination sign
int f = dir == Direction.UP ? clickedBlock.getWorld().getMaxHeight() : 0;
int f = dir == Direction.UP ? clickedBlock.getWorld().getMaxHeight() : clickedBlock.getWorld().getMinHeight();
Block destination = clickedBlock;
// heading up from top or down from bottom
if (destination.getY() == f) {
Expand All @@ -303,10 +303,10 @@ public Block findDestination(Direction dir, BlockFace shift, Block clickedBlock)
if (elevatorLoop && !loopd) {
if (destination.getY() == clickedBlock.getWorld().getMaxHeight()) { // hit the top of the world
org.bukkit.Location low = destination.getLocation();
low.setY(0);
low.setY(clickedBlock.getWorld().getMinHeight());
destination = destination.getWorld().getBlockAt(low);
loopd = true;
} else if (destination.getY() == 0) { // hit the bottom of the world
} else if (destination.getY() == clickedBlock.getWorld().getMinHeight()) { // hit the bottom of the world
org.bukkit.Location low = destination.getLocation();
low.setY(clickedBlock.getWorld().getMaxHeight());
destination = destination.getWorld().getBlockAt(low);
Expand All @@ -316,7 +316,7 @@ public Block findDestination(Direction dir, BlockFace shift, Block clickedBlock)
if (destination.getY() == clickedBlock.getWorld().getMaxHeight()) {
return null;
}
else if (destination.getY() == 0) {
else if (destination.getY() == clickedBlock.getWorld().getMinHeight()) {
return null;
}
}
Expand Down Expand Up @@ -346,7 +346,7 @@ private void makeItSo(CraftBookPlayer player, Block destination, BlockFace shift
foundGround = true;
break;
}
if (floor.getY() == 0x0) {
if (floor.getY() == clickedBlock.getWorld().getMinHeight()) {
break;
}
floor = floor.getRelative(BlockFace.DOWN);
Expand Down Expand Up @@ -611,4 +611,4 @@ public void loadConfiguration (YAMLProcessor config, String path) {
config.setComment(path + "smooth-movement-speed", "The speed at which players move from floor to floor when smooth movement is enabled.");
elevatorMoveSpeed = config.getDouble(path + "smooth-movement-speed", 0.5);
}
}
}

0 comments on commit 2da1e53

Please sign in to comment.