From f2f2eedda86142a5c9b090f164c9a64d92e1ea66 Mon Sep 17 00:00:00 2001 From: Lance5057 Date: Sun, 26 Nov 2017 02:38:49 -0600 Subject: Added more materials, broke something in the tool table. --- .../renderers/info/TDMaterialRenderInfo.java | 85 ++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 src/main/java/lance5057/tDefense/renderers/info/TDMaterialRenderInfo.java (limited to 'src/main/java/lance5057/tDefense/renderers/info') diff --git a/src/main/java/lance5057/tDefense/renderers/info/TDMaterialRenderInfo.java b/src/main/java/lance5057/tDefense/renderers/info/TDMaterialRenderInfo.java new file mode 100644 index 0000000..a22d514 --- /dev/null +++ b/src/main/java/lance5057/tDefense/renderers/info/TDMaterialRenderInfo.java @@ -0,0 +1,85 @@ +package lance5057.tDefense.renderers.info; + +import lance5057.tDefense.renderers.AlphaColorTexture; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.ResourceLocation; +import slimeknights.tconstruct.library.client.MaterialRenderInfo; +import slimeknights.tconstruct.library.client.MaterialRenderInfo.AbstractMaterialRenderInfo; +import slimeknights.tconstruct.library.client.texture.SimpleColoredTexture; +import slimeknights.tconstruct.library.client.texture.TinkerTexture; + +public interface TDMaterialRenderInfo { + + TextureAtlasSprite getTexture(ResourceLocation baseTexture, String location); + + boolean isStitched(); + + boolean useVertexColoring(); + + int getVertexColor(); + + // this actually would require its own thing, but we put it here for simplicity + String getTextureSuffix(); + + MaterialRenderInfo setTextureSuffix(String suffix); + + abstract class AbstractMaterialRenderInfo implements MaterialRenderInfo { + + private String suffix; + + @Override + public boolean isStitched() { + return true; + } + + @Override + public boolean useVertexColoring() { + return false; + } + + @Override + public int getVertexColor() { + return 0xffffffff; // white and opaque + } + + @Override + public String getTextureSuffix() { + return suffix; + } + + @Override + public MaterialRenderInfo setTextureSuffix(String suffix) { + this.suffix = suffix; + return this; + } + } + + class AlphaColor extends AbstractMaterialRenderInfo { + + public final int color; + + public AlphaColor(int color) { + this.color = color; + } + + @Override + public TextureAtlasSprite getTexture(ResourceLocation baseTexture, String location) { + return new AlphaColorTexture(color, color, color, baseTexture, location); + } + + @Override + public boolean isStitched() { + return false; + } + + @Override + public boolean useVertexColoring() { + return true; + } + + @Override + public int getVertexColor() { + return color; + } + } +} -- cgit v1.2.3