Skip to content

Commit

Permalink
simplify snow physics bypass logic
Browse files Browse the repository at this point in the history
  • Loading branch information
TehBrian committed Oct 31, 2023
1 parent f6732f7 commit b6b3a6c
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,15 @@ public void onSpectate(final PlayerStartSpectatingEntityEvent event) {
public void onBlockPhysics(final BlockPhysicsEvent event) {
final Block block = event.getBlock();

if (event.getSourceBlock().getType() == Material.AIR
&& event.getChangedType() == Material.AIR
&& block.getLocation().getBlockY() > 0
&& block.getLocation().add(0, -1, 0).getBlock().getType().name().toLowerCase().contains("grass_block")) {
return;
}
if (block.getLocation().add(0, -1, 0).getBlock().getType().name().toLowerCase().contains("grass_block")
&& block.getLocation().getBlockY() > 0) {
if (event.getSourceBlock().getType() == Material.AIR && event.getChangedType() == Material.AIR) {
return;
}

if (event.getSourceBlock().getType().name().toLowerCase().contains("snow")
&& block.getLocation().getBlockY() > 0
&& block.getLocation().add(0, -1, 0).getBlock().getType().name().toLowerCase().contains("grass_block")) {
return;
if (event.getSourceBlock().getType().name().toLowerCase().contains("snow")) {
return;
}
}

final String changed = event.getChangedType().name().toLowerCase();
Expand Down

0 comments on commit b6b3a6c

Please sign in to comment.