diff --git a/src/main/java/io/ix0rai/rainglow/Rainglow.java b/src/main/java/io/ix0rai/rainglow/Rainglow.java index d701768..98094ce 100644 --- a/src/main/java/io/ix0rai/rainglow/Rainglow.java +++ b/src/main/java/io/ix0rai/rainglow/Rainglow.java @@ -29,9 +29,6 @@ public class Rainglow implements ModInitializer { public static final Gson GSON = new Gson(); private static final List COLOURS = new ArrayList<>(); - private static final Map GLOW_SQUID_TEXTURES = new HashMap<>(); - private static final Map ALLAY_TEXTURES = new HashMap<>(); - private static final Map SLIME_TEXTURES = new HashMap<>(); public static final String CUSTOM_NBT_KEY = "Colour"; @@ -61,9 +58,6 @@ public static void setMode(RainglowMode mode) { LOGGER.warn("attempted to load missing mode, resetting to rainbow"); } - GLOW_SQUID_TEXTURES.clear(); - ALLAY_TEXTURES.clear(); - SLIME_TEXTURES.clear(); COLOURS.clear(); List colours = mode.getColours(); @@ -79,23 +73,11 @@ public static void setMode(RainglowMode mode) { private static void addColour(RainglowColour colour) { COLOURS.add(colour); - GLOW_SQUID_TEXTURES.put(colour.getId(), colour.getTexture(RainglowEntity.GLOW_SQUID)); - ALLAY_TEXTURES.put(colour.getId(), colour.getTexture(RainglowEntity.ALLAY)); - SLIME_TEXTURES.put(colour.getId(), colour.getTexture(RainglowEntity.SLIME)); - if (COLOURS.size() >= 100) { throw new RuntimeException("Too many colours registered! Only up to 99 are allowed"); } } - public static Identifier getTexture(RainglowEntity entityType, String colour) { - return switch (entityType) { - case ALLAY -> ALLAY_TEXTURES.get(colour); - case SLIME -> SLIME_TEXTURES.get(colour); - case GLOW_SQUID -> GLOW_SQUID_TEXTURES.get(colour); - }; - } - public static String generateRandomColourId(RandomGenerator random) { return COLOURS.get(random.nextInt(COLOURS.size())).getId(); } diff --git a/src/main/java/io/ix0rai/rainglow/data/RainglowEntity.java b/src/main/java/io/ix0rai/rainglow/data/RainglowEntity.java index 0e5118a..f0d041b 100644 --- a/src/main/java/io/ix0rai/rainglow/data/RainglowEntity.java +++ b/src/main/java/io/ix0rai/rainglow/data/RainglowEntity.java @@ -92,7 +92,7 @@ public void overrideTexture(Entity entity, CallbackInfoReturnable ci // if the colour is default we don't need to override the method // this optimises a tiny bit if (Rainglow.CONFIG.isEntityEnabled(this) && colour != this.getDefaultColour()) { - Identifier texture = Rainglow.getTexture(this, colour.getId()); + Identifier texture = colour.getTexture(this); cir.setReturnValue(texture != null ? texture : this.getDefaultTexture()); } }