Skip to content

Commit cd65f7c

Browse files
committed
Mob homes without locations
1 parent b8c9548 commit cd65f7c

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/main/java/de/erethon/aether/creature/AetherBaseMob.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,9 +752,14 @@ protected void onLoad() {
752752
}
753753
}
754754
registerAetherGoals();
755+
// Set home location/range if configured
755756
if (data.getHomeLocation() != null) {
756757
setHomeTo(data.getHomeLocation(), data.getHomeRange());
757758
}
759+
// Homes can also be just a range around the spawn point
760+
if (data.getHomeLocation() == null && data.getHomeRange() != -1) {
761+
setHomeTo(new BlockPos(getBlockX(), getBlockY(), getBlockZ()), data.getHomeRange());
762+
}
758763
drops.clear();
759764
setDropChance(EquipmentSlot.HEAD, 0);
760765
setDropChance(EquipmentSlot.CHEST, 0);

src/main/java/de/erethon/aether/creature/NPCData.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ public class NPCData {
102102
String faction = null;
103103
EntityType projectile;
104104
BoundingBox hitbox;
105-
private BlockPos homeLocation;
106-
private int homeRange;
105+
private BlockPos homeLocation = null;
106+
private int homeRange = -1;
107107

108108
private final Set<SpellCastEntry> onDamagedSpells = new HashSet<>();
109109
private final Set<SpellCastEntry> onTimerSpells = new HashSet<>();
@@ -508,7 +508,9 @@ public void load() {
508508
if (section == null) {
509509
Aether.addException(ID, "No configuration found for homeLocation", "Ensure the configuration is correct and not empty", null);
510510
} else {
511-
homeLocation = new BlockPos(section.getInt("x"), section.getInt("y"), section.getInt("z"));
511+
if (section.contains("x") && section.contains("y") && section.contains("z")) {
512+
homeLocation = new BlockPos(section.getInt("x"), section.getInt("y"), section.getInt("z"));
513+
}
512514
homeRange = section.getInt("range", 32);
513515
}
514516
}

0 commit comments

Comments
 (0)