|
20 | 20 | import com.laytonsmith.abstraction.enums.MCOcelotType; |
21 | 21 | import com.laytonsmith.abstraction.enums.MCPigType; |
22 | 22 | import com.laytonsmith.abstraction.enums.MCProfession; |
23 | | -import com.laytonsmith.abstraction.enums.MCSkeletonType; |
24 | 23 | import com.laytonsmith.abstraction.enums.MCWolfType; |
25 | 24 | import com.laytonsmith.abstraction.enums.MCZombieType; |
26 | 25 | import com.laytonsmith.annotations.api; |
@@ -84,25 +83,28 @@ public Integer[] numArgs() { |
84 | 83 |
|
85 | 84 | @Override |
86 | 85 | public String docs() { |
87 | | - return "array {mobType, [qty], [location]} Spawns qty mob of one of the following types at location. qty defaults to 1, and location defaults" |
88 | | - + " to the location of the player. An array of the entity IDs spawned is returned." |
| 86 | + return "array {mobType, [qty], [location]} Spawns qty mob of one of the following types at location." |
| 87 | + + " qty defaults to 1, and location defaults to the location of the player." |
| 88 | + + " An array of the entity UUIDs spawned is returned." |
89 | 89 | + " ---- mobType can be one of: " + StringUtils.Join(MCMobs.values(), ", ", ", or ", " or ") + "." |
90 | | - + " Spelling matters, but capitalization doesn't. At this time, the function is limited to spawning a maximum of 50 at a time." |
91 | | - + " Further, subtypes can be applied by specifying MOBTYPE:SUBTYPE, for example the sheep subtype can be any of the dye colors: " |
92 | | - + StringUtils.Join(MCDyeColor.values(), ", ", ", or ", " or ") + ". COLOR defaults to white if not specified. For mobs with multiple" |
93 | | - + " subtypes, separate each type with a \"-\", currently only zombies which, using ZOMBIE:TYPE1-TYPE2 can be any non-conflicting two of: " |
94 | | - + StringUtils.Join(MCZombieType.values(), ", ", ", or ", " or ") + ", but default to normal zombies. Ocelots may be one of: " |
95 | | - + StringUtils.Join(MCOcelotType.values(), ", ", ", or ", " or ") + ", defaulting to the wild variety. Villagers can have a profession as a subtype: " |
96 | | - + StringUtils.Join(MCProfession.values(), ", ", ", or ", " or ") + ", defaulting to farmer if not specified. Skeletons can be " |
97 | | - + StringUtils.Join(MCSkeletonType.values(), ", ", ", or ", " or ") + ". PigZombies' subtype represents their anger," |
98 | | - + " and accepts an integer, where 0 is neutral and 400 is the normal response to being attacked. Defaults to 0. Similarly, Slime" |
99 | | - + " and MagmaCube size can be set by integer, otherwise will be a random natural size. If a material is specified as the subtype" |
100 | | - + " for Endermen, they will hold that material, otherwise they will hold nothing. Creepers can be set to " |
101 | | - + StringUtils.Join(MCCreeperType.values(), ", ", ", or ", " or ") + ", wolves can be " + StringUtils.Join(MCWolfType.values(), ", ", ", or ", " or ") |
102 | | - + ", and pigs can be " + StringUtils.Join(MCPigType.values(), ", ", ", or ", " or ") + "." |
103 | | - + " Horses can have three different subTypes, the variant: " + StringUtils.Join(MCHorse.MCHorseVariant.values(), ", ", ", or ", " or ") + "," |
104 | | - + " the color: " + StringUtils.Join(MCHorse.MCHorseColor.values(), ", ", ", or ", " or ") + "," |
105 | | - + " and the pattern: " + StringUtils.Join(MCHorse.MCHorsePattern.values(), ", ", ", or ", " or ") + "." |
| 90 | + + " Further, subtypes can be applied by specifying MOBTYPE:SUBTYPE," |
| 91 | + + " for example the sheep subtype can be any of the dye colors: " |
| 92 | + + StringUtils.Join(MCDyeColor.values(), ", ", ", or ", " or ") + "." |
| 93 | + + " COLOR defaults to white if not specified." |
| 94 | + + " For mobs with multiple subtypes, separate each type with a \"-\"." |
| 95 | + + " Zombies can be any non-conflicting two of: " + StringUtils.Join(MCZombieType.values(), ", ", ", or ", " or ") + "." |
| 96 | + + " Ocelots may be one of: " + StringUtils.Join(MCOcelotType.values(), ", ", ", or ", " or ") + "." |
| 97 | + + " Villagers can have a profession as a subtype: " + StringUtils.Join(MCProfession.values(), ", ", ", or ", " or ") |
| 98 | + + ", defaulting to farmer if not specified. PigZombies' subtype represents their anger," |
| 99 | + + " and accepts an integer, where 0 is neutral and 400 is the normal response to being attacked." |
| 100 | + + " Defaults to 0. Similarly, Slime and MagmaCube size can be set by integer," |
| 101 | + + " otherwise will be a random natural size. If a material is specified as the subtype for Endermen," |
| 102 | + + " they will hold that material, otherwise they will hold nothing." |
| 103 | + + " Creepers can be set to " + StringUtils.Join(MCCreeperType.values(), ", ", ", or ", " or ") + "." |
| 104 | + + " Wolves can be " + StringUtils.Join(MCWolfType.values(), ", ", ", or ", " or ") + "." |
| 105 | + + " Pigs can be " + StringUtils.Join(MCPigType.values(), ", ", ", or ", " or ") + "." |
| 106 | + + " Horses can have a color: " + StringUtils.Join(MCHorse.MCHorseColor.values(), ", ", ", or ", " or ") + "," |
| 107 | + + " and a pattern: " + StringUtils.Join(MCHorse.MCHorsePattern.values(), ", ", ", or ", " or ") + "." |
106 | 108 | + " If qty is larger than " + spawn_mob.SPAWN_LIMIT + ", a RangeException will be thrown."; |
107 | 109 | } |
108 | 110 |
|
@@ -159,7 +161,7 @@ public Construct exec(Target t, Environment env, Construct... args) throws Cance |
159 | 161 | } |
160 | 162 |
|
161 | 163 | try { |
162 | | - return l.getWorld().spawnMob(MCMobs.valueOf(mob.toUpperCase().replaceAll(" ", "")), secondary, qty, l, t); |
| 164 | + return l.getWorld().spawnMob(MCMobs.valueOf(mob.toUpperCase().replaceAll("[ _]", "")), secondary, qty, l, t); |
163 | 165 | } catch (IllegalArgumentException e) { |
164 | 166 | throw new CREFormatException("Invalid mob name: " + mob, t); |
165 | 167 | } |
|
0 commit comments