diff options
| author | Lance5057 <Lance5057@gmail.com> | 2017-11-26 02:38:49 -0600 |
|---|---|---|
| committer | Lance5057 <Lance5057@gmail.com> | 2017-11-26 02:38:49 -0600 |
| commit | f2f2eedda86142a5c9b090f164c9a64d92e1ea66 (patch) | |
| tree | 46943eb4678691f9f71bf55263f47b6d1b9be88d /src/main/java/lance5057/tDefense/renderers/info | |
| parent | 6af565ab07a802518345df7f06772df56f6e205f (diff) | |
Added more materials, broke something in the tool table.
Diffstat (limited to 'src/main/java/lance5057/tDefense/renderers/info')
| -rw-r--r-- | src/main/java/lance5057/tDefense/renderers/info/TDMaterialRenderInfo.java | 85 |
1 files changed, 85 insertions, 0 deletions
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; + } + } +} |
