Skip to content

Commit aebcf13

Browse files
committed
Fix shulker color in entity_spec
1 parent b945de5 commit aebcf13

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/main/java/com/laytonsmith/core/functions/EntityManagement.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,7 +2232,12 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi
22322232
break;
22332233
case SHULKER:
22342234
MCShulker shulker = (MCShulker) entity;
2235-
specArray.set(entity_spec.KEY_SHULKER_COLOR, new CString(shulker.getColor().name(), t), t);
2235+
MCDyeColor shulkerColor = shulker.getColor();
2236+
if(shulkerColor == null) {
2237+
specArray.set(entity_spec.KEY_SHULKER_COLOR, CNull.NULL, t);
2238+
} else {
2239+
specArray.set(entity_spec.KEY_SHULKER_COLOR, new CString(shulker.getColor().name(), t), t);
2240+
}
22362241
break;
22372242
case SHULKER_BULLET:
22382243
MCShulkerBullet bullet = (MCShulkerBullet) entity;
@@ -3668,8 +3673,13 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi
36683673
for(String index : specArray.stringKeySet()) {
36693674
switch(index.toLowerCase()) {
36703675
case entity_spec.KEY_SHULKER_COLOR:
3676+
Mixed value = specArray.get(index, t);
3677+
if(value instanceof CNull) {
3678+
shulker.setColor(null);
3679+
break;
3680+
}
36713681
try {
3672-
shulker.setColor(MCDyeColor.valueOf(specArray.get(index, t).val().toUpperCase()));
3682+
shulker.setColor(MCDyeColor.valueOf(value.val().toUpperCase()));
36733683
} catch(IllegalArgumentException exception) {
36743684
throw new CREFormatException("Invalid shulker color: " + specArray.get(index, t).val(), t);
36753685
}

src/main/resources/functionDocs/entity_spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ without knowing the rotations on the other axis or of other body parts beforehan
271271
|-
272272
| SHULKER
273273
|
274-
* %KEY_SHULKER_COLOR%: The color of the shulker (can be %DYE_COLOR%).
274+
* %KEY_SHULKER_COLOR%: The color of the shulker or null (can be %DYE_COLOR%).
275275
|-
276276
| SHULKER_BULLET
277277
|

0 commit comments

Comments
 (0)