blob: 8258e74ffa194b155bbb4e6dfc717954e42e8868 (
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
83
84
85
86
87
88
89
90
91
|
package gregtech.common.render;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GT_IconFlipped implements IIcon {
private final IIcon baseIcon;
private final boolean flipU;
private final boolean flipV;
public GT_IconFlipped(IIcon baseIcon, boolean flipU, boolean flipV) {
this.baseIcon = baseIcon;
this.flipU = flipU;
this.flipV = flipV;
}
/**
* Returns the width of the icon, in pixels.
*/
@Override
public int getIconWidth() {
return this.baseIcon.getIconWidth();
}
/**
* Returns the height of the icon, in pixels.
*/
@Override
public int getIconHeight() {
return this.baseIcon.getIconHeight();
}
/**
* Returns the minimum U coordinate to use when rendering with this icon.
*/
@Override
public float getMinU() {
return this.flipU ? this.baseIcon.getMaxU() : this.baseIcon.getMinU();
}
/**
* Returns the maximum U coordinate to use when rendering with this icon.
*/
@Override
public float getMaxU() {
return this.flipU ? this.baseIcon.getMinU() : this.baseIcon.getMaxU();
}
/**
* Gets a U coordinate on the icon. 0 returns uMin and 16 returns uMax. Other arguments return in-between values.
*/
@Override
public float getInterpolatedU(double p_94214_1_) {
final float f = this.getMaxU() - this.getMinU();
return this.getMinU() + f * ((float) p_94214_1_ / 16.0F);
}
/**
* Returns the minimum V coordinate to use when rendering with this icon.
*/
@Override
public float getMinV() {
return this.flipV ? this.baseIcon.getMaxV() : this.baseIcon.getMinV();
}
/**
* Returns the maximum V coordinate to use when rendering with this icon.
*/
@Override
public float getMaxV() {
return this.flipV ? this.baseIcon.getMinV() : this.baseIcon.getMaxV();
}
/**
* Gets a V coordinate on the icon. 0 returns vMin and 16 returns vMax. Other arguments return in-between values.
*/
@Override
public float getInterpolatedV(double p_94207_1_) {
final float f = this.getMaxV() - this.getMinV();
return this.getMinV() + f * ((float) p_94207_1_ / 16.0F);
}
@Override
public String getIconName() {
return this.baseIcon.getIconName();
}
}
|