3434import de .bluecolored .bluemap .core .util .Key ;
3535import de .bluecolored .bluemap .core .world .Entity ;
3636import de .bluecolored .bluemap .core .world .block .BlockNeighborhood ;
37+ import de .bluecolored .bluemap .entities .data .EquipmentData ;
38+ import de .bluecolored .bluemap .entities .data .ItemStack ;
3739import de .bluecolored .bluemap .entities .entity .Llama ;
3840
41+ import java .util .Optional ;
42+
3943public class LlamaRenderer extends CustomResourceModelRenderer {
4044
4145 private final ResourcePath <Model >
@@ -84,7 +88,13 @@ public void render(Entity entity, BlockNeighborhood block, Part part, TileModelV
8488 }
8589
8690 // decoration model
87- ResourcePath <Model > decorationModel = switch (llama .getEquipment ().getBody ().id ().getFormatted ()) {
91+ ResourcePath <Model > decorationModel = switch (
92+ Optional .ofNullable (llama .getEquipment ())
93+ .map (EquipmentData ::getBody )
94+ .map (ItemStack ::id )
95+ .map (Key ::getFormatted )
96+ .orElse ("" )
97+ ) {
8898 case "minecraft:black_carpet" -> LLAMA_CARPET_BLACK ;
8999 case "minecraft:blue_carpet" -> LLAMA_CARPET_BLUE ;
90100 case "minecraft:brown_carpet" -> LLAMA_CARPET_BROWN ;
@@ -101,7 +111,6 @@ public void render(Entity entity, BlockNeighborhood block, Part part, TileModelV
101111 case "minecraft:red_carpet" -> LLAMA_CARPET_RED ;
102112 case "minecraft:white_carpet" -> LLAMA_CARPET_WHITE ;
103113 case "minecraft:yellow_carpet" -> LLAMA_CARPET_YELLOW ;
104-
105114 default -> null ;
106115 };
107116 if (decorationModel != null ) {
0 commit comments