Skip to content

Commit 4defbed

Browse files
committed
refactor: change block.getWorld().getBlockAt() to block.getRelative()
1 parent 3a7a7d9 commit 4defbed

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/main/java/br/minilambda/event/DirtToMudUsingWater.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,7 @@ public void onWaterFlow(BlockFromToEvent event) {
6868
}
6969

7070
// Getting bottom block.
71-
Block bottomBlock = toBlock.getWorld().getBlockAt(
72-
toBlock.getX(),
73-
toBlock.getY() - 1,
74-
toBlock.getZ()
75-
);
71+
Block bottomBlock = toBlock.getRelative(0, -1, 0);
7672

7773
// Exit if bottom block is different of dirt.
7874
if(bottomBlock.getType() != Material.DIRT){
@@ -97,11 +93,7 @@ public void onBlockPlaceUnderWater(BlockPlaceEvent event){
9793
}
9894

9995
// Getting top block.
100-
Block topBlock = block.getWorld().getBlockAt(
101-
block.getX(),
102-
block.getY() + 1,
103-
block.getZ()
104-
);
96+
Block topBlock = block.getRelative(0, 1, 0);
10597

10698
// Exit if top block is water.
10799
if(topBlock.getType() != Material.WATER){

0 commit comments

Comments
 (0)