aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/interfaces/ITexture.java
blob: e97fa4539afee5a02b267ef860cbb6f20e8a9805 (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
package gregtech.api.interfaces;

import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;

public interface ITexture {

    void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ);

    void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ);

    void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ);

    void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ);

    void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ);

    void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ);

    boolean isValidTexture();

    /**
     * @return {@code true} if this texture is from the old package
     */
    default boolean isOldTexture() {
        return true;
    }

    /**
     * Will initialize the {@link Tessellator} if rendering off-world (Inventory)
     * 
     * @param aRenderer The {@link RenderBlocks} Renderer
     * @param aNormalX  The X Normal for current Quad Face
     * @param aNormalY  The Y Normal for current Quad Face
     * @param aNormalZ  The Z Normal for current Quad Face
     */
    default void startDrawingQuads(RenderBlocks aRenderer, float aNormalX, float aNormalY, float aNormalZ) {
        if (aRenderer.useInventoryTint && !isOldTexture()) {
            Tessellator.instance.startDrawingQuads();
            Tessellator.instance.setNormal(aNormalX, aNormalY, aNormalZ);
        }
    }

    /**
     * Will run the {@link Tessellator} to draw Quads if rendering off-world (Inventory)
     * 
     * @param aRenderer The {@link RenderBlocks} Renderer
     */
    default void draw(RenderBlocks aRenderer) {
        if (aRenderer.useInventoryTint && !isOldTexture()) {
            Tessellator.instance.draw();
        }
    }
}