Skip to content

Commit

Permalink
Separate out ALL case
Browse files Browse the repository at this point in the history
  • Loading branch information
zax71 committed Apr 21, 2024
1 parent 24a5933 commit a713a9d
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.regex.Pattern;

public class PortalDetector {
Expand Down Expand Up @@ -257,17 +256,19 @@ public Entity[] getRedstoneTeleportEntities(Sign sign) {
List<LivingEntity> entitiesInRange = new ArrayList<LivingEntity>(worldEntities.size());

for (LivingEntity entity : worldEntities) {
if ((type == RedstoneTeleportType.ALL || type == RedstoneTeleportType.ANIMALS) && (entity instanceof Animals || entity instanceof Squid || entity instanceof Villager)) {
if (entity.getLocation().toVector().isInAABB(min, max)) {
Logging.finest("Found " + entity + " within range!");
entitiesInRange.add(entity);
}
} else if ((type == RedstoneTeleportType.ALL || type == RedstoneTeleportType.MONSTERS) && (entity instanceof Monster)) {
if (entity.getLocation().toVector().isInAABB(min, max)) {
Logging.finest("Found " + entity + " within range!");
entitiesInRange.add(entity);
}
} else if ((type == RedstoneTeleportType.ALL || type == RedstoneTeleportType.PLAYERS) && (entity instanceof HumanEntity)) {
boolean tryToAddEntity = false;

if (type == RedstoneTeleportType.ALL) {
tryToAddEntity = true;
} else if (type == RedstoneTeleportType.ANIMALS && (entity instanceof Animals || entity instanceof Squid || entity instanceof Villager)) {
tryToAddEntity = true;
} else if (type == RedstoneTeleportType.MONSTERS && (entity instanceof Monster)) {
tryToAddEntity = true;
} else if (type == RedstoneTeleportType.PLAYERS && (entity instanceof HumanEntity)) {
tryToAddEntity = true;
}

if (tryToAddEntity && entity.getLocation().toVector().isInAABB(min, max)) {
if (entity.getLocation().toVector().isInAABB(min, max)) {
Logging.finest("Found " + entity + " within range!");
entitiesInRange.add(entity);
Expand Down

0 comments on commit a713a9d

Please sign in to comment.