From 623a28f6734d641eeb7dbdbf55491ba4aa00eb4c Mon Sep 17 00:00:00 2001 From: KnightMiner Date: Wed, 5 Aug 2020 21:34:16 -0500 Subject: [PATCH] Disallow Blocks.AIR as a texture for models Set to null so I do not need to check for two values every time --- .../slimeknights/mantle/client/model/RetexturedModel.java | 4 ++-- src/main/java/slimeknights/mantle/util/RetexturedHelper.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/slimeknights/mantle/client/model/RetexturedModel.java b/src/main/java/slimeknights/mantle/client/model/RetexturedModel.java index e66b772..52008a9 100644 --- a/src/main/java/slimeknights/mantle/client/model/RetexturedModel.java +++ b/src/main/java/slimeknights/mantle/client/model/RetexturedModel.java @@ -189,7 +189,7 @@ public class RetexturedModel implements IModelGeometry { // if particle is retextured, fetch particle from the cached model if (retextured.contains("particle")) { Block block = data.getData(RetexturedHelper.BLOCK_PROPERTY); - if (block != null && block != Blocks.AIR) { + if (block != null) { return getCachedModel(block).getParticleTexture(data); } } @@ -199,7 +199,7 @@ public class RetexturedModel implements IModelGeometry { @Override public List getQuads(@Nullable BlockState state, @Nullable Direction direction, Random random, IModelData data) { Block block = data.getData(RetexturedHelper.BLOCK_PROPERTY); - if (block == null || block == Blocks.AIR) { + if (block == null) { return originalModel.getQuads(state, direction, random, data); } return getCachedModel(block).getQuads(state, direction, random, data); diff --git a/src/main/java/slimeknights/mantle/util/RetexturedHelper.java b/src/main/java/slimeknights/mantle/util/RetexturedHelper.java index 2181024..7063761 100644 --- a/src/main/java/slimeknights/mantle/util/RetexturedHelper.java +++ b/src/main/java/slimeknights/mantle/util/RetexturedHelper.java @@ -19,7 +19,7 @@ public final class RetexturedHelper { /** Tag name for texture blocks. Should not be used directly, use the utils to interact */ private static final String TAG_TEXTURE = "texture"; /** Property for tile entities containing a texture block */ - public static final ModelProperty BLOCK_PROPERTY = new ModelProperty<>(); + public static final ModelProperty BLOCK_PROPERTY = new ModelProperty<>(block -> block != Blocks.AIR); /* Getting */