BreakingFour .java

net.minecraft.client.renderer.block.model.BreakingFour (class, 70 lines): extends BakedQuad. members: texture. imports: TextureAtlasSprite.

net.minecraft.client.renderer.block.modelclass70 linesclientextends BakedQuad1.9 KB

API Surface (0)

No public/protected methods detected (fields or constants only).

Fields & Constants (1)

texture

Code Graph: Dependencies (3)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

BreakingFour.java70 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.renderer.block.model;
2
3
import java.util.Arrays;
4
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
5
6
public class BreakingFour extends BakedQuad
7
{
8
    private final TextureAtlasSprite texture;
9
10
    public BreakingFour(BakedQuad quad, TextureAtlasSprite textureIn)
11
    {
12
        super(Arrays.copyOf(quad.getVertexData(), quad.getVertexData().length), quad.tintIndex, FaceBakery.getFacingFromVertexData(quad.getVertexData()));
13
        this.texture = textureIn;
14
        this.remapQuad();
15
    }
16
17
    private void remapQuad()
18
    {
19
        for (int i = 0; i < 4; ++i)
20
        {
21
            this.remapVert(i);
22
        }
23
    }
24
25
    private void remapVert(int vertex)
26
    {
27
        int i = 7 * vertex;
28
        float f = Float.intBitsToFloat(this.vertexData[i]);
29
        float f1 = Float.intBitsToFloat(this.vertexData[i + 1]);
30
        float f2 = Float.intBitsToFloat(this.vertexData[i + 2]);
31
        float f3 = 0.0F;
32
        float f4 = 0.0F;
33
34
        switch (this.face)
35
        {
36
            case DOWN:
37
                f3 = f * 16.0F;
38
                f4 = (1.0F - f2) * 16.0F;
39
                break;
40
41
            case UP:
42
                f3 = f * 16.0F;
43
                f4 = f2 * 16.0F;
44
                break;
45
46
            case NORTH:
47
                f3 = (1.0F - f) * 16.0F;
48
                f4 = (1.0F - f1) * 16.0F;
49
                break;
50
51
            case SOUTH:
52
                f3 = f * 16.0F;
53
                f4 = (1.0F - f1) * 16.0F;
54
                break;
55
56
            case WEST:
57
                f3 = f2 * 16.0F;
58
                f4 = (1.0F - f1) * 16.0F;
59
                break;
60
61
            case EAST:
62
                f3 = (1.0F - f2) * 16.0F;
63
                f4 = (1.0F - f1) * 16.0F;
64
        }
65
66
        this.vertexData[i + 4] = Float.floatToRawIntBits(this.texture.getInterpolatedU((double)f3));
67
        this.vertexData[i + 4 + 1] = Float.floatToRawIntBits(this.texture.getInterpolatedV((double)f4));
68
    }
69
}
70

Deobfuscated MCP 1.8.9 source of BreakingFour from Marcelektro/MavenMCP-1.8.9 (net/minecraft/client/renderer/block/model/BreakingFour.java), stored verbatim.