summaryrefslogtreecommitdiff
path: root/src/main/java/lance5057/tDefense/renderers/info/TDMaterialRenderInfo.java
blob: 19738397f4e7430ffa0bc85efc1c06bc5488d3ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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;

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;
		    }
		  }
}