Skip to content

Commit

Permalink
Fix: #5
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias de Bruijn committed May 10, 2021
1 parent 7eb86a8 commit 833e61d
Showing 1 changed file with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,29 @@ public void onCreatureSpawnEvent(CreatureSpawnEvent event) {
//Check if we should only be blocking hostile mobs
if(HaroTorch.getConfigHandler().onlyBlockHostileMobs) {

//Check if the spawned Entity is a Monster, Phantom or Slime and not a Wither
if(e instanceof Monster || et.equals(EntityType.PHANTOM) || et.equals(EntityType.SLIME) && !et.equals(EntityType.WITHER) && !et.equals(EntityType.ENDER_DRAGON)) {
if(torchInRange(event.getLocation())) event.setCancelled(true);
//Check if the spawned Entity is a Monster, Phantom, Slime, Ghast or Magma cube and not a Wither
// https://github.com/TheDutchMC/HaroTorch/issues/5
if(e instanceof Monster
|| et.equals(EntityType.PHANTOM)
|| et.equals(EntityType.SLIME)
|| et.equals(EntityType.GHAST)
|| et.equals(EntityType.MAGMA_CUBE)
&& !et.equals(EntityType.WITHER)
&& !et.equals(EntityType.ENDER_DRAGON)) {

if(torchInRange(event.getLocation())) {
event.setCancelled(true);
}
}
} else {
//Check if the spawned entity is an ender dragon or wither, we dont want to block those
if(et.equals(EntityType.ENDER_DRAGON) || et.equals(EntityType.WITHER)) return;
if(et.equals(EntityType.ENDER_DRAGON) || et.equals(EntityType.WITHER)) {
return;
}

if(torchInRange(event.getLocation())) event.setCancelled(true);
if(torchInRange(event.getLocation())) {
event.setCancelled(true);
}
}
}

Expand Down

0 comments on commit 833e61d

Please sign in to comment.