Skip to content

Commit

Permalink
feat(world): Implement Logical Height (#924)
Browse files Browse the repository at this point in the history
  • Loading branch information
thelooter committed Dec 7, 2023
1 parent 1c28b83 commit 88d24d2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/be/seeseemelk/mockbukkit/WorldMock.java
Original file line number Diff line number Diff line change
Expand Up @@ -2931,8 +2931,12 @@ public double getHumidity(int x, int y, int z)
@Override
public int getLogicalHeight()
{
// TODO Auto-generated method stub
throw new UnimplementedOperationException();
return switch (environment)
{
case NETHER, THE_END -> 256;
case NORMAL -> 384;
case CUSTOM -> throw new UnimplementedOperationException("We don't have support for Datapacks");
};
}

@Override
Expand Down
13 changes: 13 additions & 0 deletions src/test/java/be/seeseemelk/mockbukkit/WorldMockTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2142,4 +2142,17 @@ void testGetEntityWrongWorld()
assertNull(world2.getEntity(entity.getUniqueId()));
}

@Test
void testGetLogicalHeight()
{
WorldMock world = new WorldMock(Material.DIRT, 3);
assertEquals(384, world.getLogicalHeight());

world.setEnvironment(World.Environment.NETHER);
assertEquals(256, world.getLogicalHeight());

world.setEnvironment(World.Environment.THE_END);
assertEquals(256, world.getLogicalHeight());
}

}

0 comments on commit 88d24d2

Please sign in to comment.