Skip to content

Commit 979cf1b

Browse files
wesleyegbertsenjpenillaCopilot
authored
Added support for all mobs through Minecraft 1.21.11 (#139)
* Delete addons/mobs/src/main/resources/icons/trader_llama.png:Zone.Identifier error: invalid path 'addons/mobs/src/main/resources/icons/trader_llama.png:Zone.Identifier' * Added support for more mobs * Added missing passive/neutral mobs to `allowed-mobs` * Added missing passive mob `bat` to `allowed-mobs` * Added `README.md` for mobs addon * Fixed exception warning logging using wrong addon name * Fixed using wrong quotes for describing wildcard usage in README for `allowed-mobs` * Changed name of `aboveSurface` to `belowSurface` The actual code checks if the Y location of the mob is lower than the hightest block Y location of the XZ location of the mob. So the function name was not correct. * Small README change so it actually reflects generated default config * Added missing mob `creaking` * Added capital letters to mobs addon `README` headers * Added missing mobs `camel_husk` & `parched` * Updated `README` with information about why `zombie_horse` & `zombie_nautilus` are not in the default passive/neutral mobs list * Removed `camel_husk` from default passive/neutral mobs list, as it becomes passive once their hostile mob rider gets separated from them * Remove submodule version override Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 768acb4 commit 979cf1b

22 files changed

Lines changed: 97 additions & 7 deletions

addons/mobs/README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Mobs
2+
3+
Display live mobs on your map.
4+
5+
## Configuration
6+
7+
### Global options
8+
9+
* `update-interval` - How often (in seconds) to update mobs on the map (default: `5`)
10+
11+
### Per-world options
12+
13+
* `enabled` - Enable or disable mobs for this world (default: `true`)
14+
* `layer.label` - Name of the layer shown in the UI (default: `"Mobs"`)
15+
* `layer.controls.enabled` - Show layer toggle controls (default: `true`)
16+
* `layer.controls.hide-by-default` - Hide the layer by default (default: `false`)
17+
* `layer.priority` - Layer stacking order (default: `999`)
18+
* `layer.z-index` - CSS z-index for the layer (default: `999`)
19+
* `icon.size` - Size in pixels of mob icons (default: `16`)
20+
* `icon.tooltip` - Tooltip text when hovering over a mob. Use `{name}` for the mob name (default: `'{name}'`)
21+
* `allowed-mobs` - List of mob types to display. Use Minecraft entity type names (lowercase with underscores). Use `'*'` to show all supported mobs. By default, only passive and neutral mobs are displayed.
22+
23+
### Allowed-mobs examples
24+
25+
Show all mobs:
26+
27+
```yaml
28+
worlds:
29+
world:
30+
allowed-mobs:
31+
- '*'
32+
```
33+
34+
Show specific mobs (mix of passive and hostile):
35+
36+
```yaml
37+
worlds:
38+
world:
39+
allowed-mobs:
40+
- cow
41+
- pig
42+
- sheep
43+
- blaze
44+
- creeper
45+
- skeleton
46+
- zombie
47+
```
48+
49+
## Supported mobs
50+
51+
### Passive/neutral
52+
53+
allay, armadillo, axolotl, bat, bee, camel, cat, chicken, cod, cow, dolphin, donkey, fox, frog, glow_squid, goat, happy_ghast, horse, iron_golem, llama, mooshroom, mule, nautilus, ocelot, panda, parrot, pig, polar_bear, pufferfish, rabbit, salmon, sheep, sniffer, snow_golem, squid, strider, tadpole, trader_llama, tropical_fish, turtle, villager, wandering_trader, wolf
54+
55+
#### Exceptions
56+
57+
camel_husk, zombie_horse & zombie_nautilus are not added to the default passive/neutral mobs list, since they become passive/neutral once their hostile mob rider gets separated from them.
58+
59+
---
60+
61+
### Hostile
62+
63+
blaze, breeze, camel_husk, cave_spider, creaking, creeper, drowned, elder_guardian, ender_dragon, enderman, endermite, evoker, ghast, giant, guardian, hoglin, husk, illusioner, magma_cube, parched, phantom, piglin, piglin_brute, pillager, ravager, shulker, silverfish, skeleton, skeleton_horse, slime, spider, stray, vex, vindicator, warden, witch, wither, wither_skeleton, zoglin, zombie, zombie_horse, zombie_nautilus, zombie_villager, zombified_piglin

addons/mobs/src/main/java/xyz/jpenilla/squaremap/addon/mobs/config/MobsWorldConfig.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,29 @@ private void allowedTypes() {
5353
String.class,
5454
"allowed-mobs",
5555
List.of(
56+
"allay",
57+
"armadillo",
58+
"axolotl",
59+
"bat",
60+
"bee",
61+
"camel",
5662
"cat",
5763
"chicken",
5864
"cod",
5965
"cow",
6066
"dolphin",
67+
"donkey",
6168
"fox",
69+
"frog",
70+
"glow_squid",
71+
"goat",
72+
"happy_ghast",
6273
"horse",
6374
"iron_golem",
6475
"llama",
6576
"mooshroom",
6677
"mule",
78+
"nautilus",
6779
"ocelot",
6880
"panda",
6981
"parrot",
@@ -73,9 +85,11 @@ private void allowedTypes() {
7385
"rabbit",
7486
"salmon",
7587
"sheep",
88+
"sniffer",
7689
"snow_golem",
7790
"squid",
7891
"strider",
92+
"tadpole",
7993
"trader_llama",
8094
"tropical_fish",
8195
"turtle",

addons/mobs/src/main/java/xyz/jpenilla/squaremap/addon/mobs/data/Icons.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,21 @@
1515
public final class Icons {
1616
public static final Map<EntityType, Key> BY_TYPE = new HashMap<>();
1717

18+
public static final Key ALLAY = register("allay");
19+
public static final Key ARMADILLO = register("armadillo");
20+
public static final Key AXOLOTL = register("axolotl");
1821
public static final Key BAT = register("bat");
1922
public static final Key BEE = register("bee");
2023
public static final Key BLAZE = register("blaze");
24+
public static final Key BREEZE = register("breeze");
25+
public static final Key CAMEL = register("camel");
26+
public static final Key CAMEL_HUSK = register("camel_husk");
2127
public static final Key CAT = register("cat");
2228
public static final Key CAVE_SPIDER = register("cave_spider");
2329
public static final Key CHICKEN = register("chicken");
2430
public static final Key COD = register("cod");
2531
public static final Key COW = register("cow");
32+
public static final Key CREAKING = register("creaking");
2633
public static final Key CREEPER = register("creeper");
2734
public static final Key DOLPHIN = register("dolphin");
2835
public static final Key DONKEY = register("donkey");
@@ -33,9 +40,13 @@ public final class Icons {
3340
public static final Key ENDERMITE = register("endermite");
3441
public static final Key EVOKER = register("evoker");
3542
public static final Key FOX = register("fox");
43+
public static final Key FROG = register("frog");
3644
public static final Key GHAST = register("ghast");
3745
public static final Key GIANT = register("giant");
46+
public static final Key GLOW_SQUID = register("glow_squid");
47+
public static final Key GOAT = register("goat");
3848
public static final Key GUARDIAN = register("guardian");
49+
public static final Key HAPPY_GHAST = register("happy_ghast");
3950
public static final Key HOGLIN = register("hoglin");
4051
public static final Key HORSE = register("horse");
4152
public static final Key HUSK = register("husk");
@@ -46,8 +57,10 @@ public final class Icons {
4657
public static final Key MAGMA_CUBE = register("magma_cube");
4758
public static final Key MOOSHROOM = register("mooshroom");
4859
public static final Key MULE = register("mule");
60+
public static final Key NAUTILUS = register("nautilus");
4961
public static final Key OCELOT = register("ocelot");
5062
public static final Key PANDA = register("panda");
63+
public static final Key PARCHED = register("parched");
5164
public static final Key PARROT = register("parrot");
5265
public static final Key PHANTOM = register("phantom");
5366
public static final Key PIG = register("pig");
@@ -65,25 +78,29 @@ public final class Icons {
6578
public static final Key SKELETON = register("skeleton");
6679
public static final Key SKELETON_HORSE = register("skeleton_horse");
6780
public static final Key SLIME = register("slime");
81+
public static final Key SNIFFER = register("sniffer");
6882
public static final Key SNOW_GOLEM = register("snow_golem");
6983
public static final Key SPIDER = register("spider");
7084
public static final Key SQUID = register("squid");
7185
public static final Key STRAY = register("stray");
7286
public static final Key STRIDER = register("strider");
87+
public static final Key TADPOLE = register("tadpole");
7388
public static final Key TRADER_LLAMA = register("trader_llama");
7489
public static final Key TROPICAL_FISH = register("tropical_fish");
7590
public static final Key TURTLE = register("turtle");
7691
public static final Key VEX = register("vex");
7792
public static final Key VILLAGER = register("villager");
7893
public static final Key VINDICATOR = register("vindicator");
7994
public static final Key WANDERING_TRADER = register("wandering_trader");
95+
public static final Key WARDEN = register("warden");
8096
public static final Key WITCH = register("witch");
8197
public static final Key WITHER = register("wither");
8298
public static final Key WITHER_SKELETON = register("wither_skeleton");
8399
public static final Key WOLF = register("wolf");
84100
public static final Key ZOGLIN = register("zoglin");
85101
public static final Key ZOMBIE = register("zombie");
86102
public static final Key ZOMBIE_HORSE = register("zombie_horse");
103+
public static final Key ZOMBIE_NAUTILUS = register("zombie_nautilus");
87104
public static final Key ZOMBIE_VILLAGER = register("zombie_villager");
88105
public static final Key ZOMBIFIED_PIGLIN = register("zombified_piglin");
89106

@@ -107,7 +124,7 @@ private static Key register(String name) {
107124

108125
BY_TYPE.put(type, key);
109126
} catch (final Exception e) {
110-
SquaremapMobs.getInstance().getLogger().log(Level.WARNING, "Failed to register signs icon", e);
127+
SquaremapMobs.getInstance().getLogger().log(Level.WARNING, "Failed to register mobs icon", e);
111128
}
112129
return key;
113130
}

addons/mobs/src/main/java/xyz/jpenilla/squaremap/addon/mobs/task/SquaremapTask.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ public void run() {
4747
if (loc.getY() < this.worldConfig.minimumY) {
4848
continue;
4949
}
50-
if (this.worldConfig.surfaceOnly && aboveSurface(loc)) {
50+
if (this.worldConfig.surfaceOnly && belowSurface(loc)) {
5151
continue;
5252
}
5353
this.handleMob(type, mob.getEntityId(), loc);
5454
}
5555
}
5656

57-
private static boolean aboveSurface(final Location loc) {
57+
private static boolean belowSurface(final Location loc) {
5858
return loc.getY() < loc.getWorld().getHighestBlockYAt(loc.getBlockX(), loc.getBlockZ(), HeightMap.WORLD_SURFACE);
5959
}
6060

212 Bytes
Loading
623 Bytes
Loading
2.16 KB
Loading
506 Bytes
Loading
378 Bytes
Loading
536 Bytes
Loading

0 commit comments

Comments
 (0)