Skip to content

Commit 49ec327

Browse files
committed
Extracted full texture icon
1 parent d3b1461 commit 49ec327

File tree

2 files changed

+46
-46
lines changed

2 files changed

+46
-46
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.falsepattern.lib.internal.render;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Getter;
5+
import net.minecraft.util.IIcon;
6+
7+
@Getter
8+
@AllArgsConstructor
9+
public final class FullTextureIcon implements IIcon {
10+
private final String iconName;
11+
12+
private final int iconWidth;
13+
private final int iconHeight;
14+
15+
@Override
16+
public float getMinU() {
17+
return 0F;
18+
}
19+
20+
@Override
21+
public float getMinV() {
22+
return 0F;
23+
}
24+
25+
@Override
26+
public float getMaxU() {
27+
return 1F;
28+
}
29+
30+
@Override
31+
public float getMaxV() {
32+
return 1F;
33+
}
34+
35+
@Override
36+
public float getInterpolatedU(double textureU) {
37+
return (float) textureU / 16F;
38+
}
39+
40+
@Override
41+
public float getInterpolatedV(double textureV) {
42+
return (float) textureV / 16F;
43+
}
44+
}

src/main/java/com/falsepattern/lib/util/RenderUtil.java

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
package com.falsepattern.lib.util;
2222

2323
import com.falsepattern.lib.StableAPI;
24+
import com.falsepattern.lib.internal.render.FullTextureIcon;
2425
import lombok.SneakyThrows;
2526
import lombok.experimental.UtilityClass;
2627
import lombok.val;
@@ -72,52 +73,7 @@ public static void setGLTranslationRelativeToPlayer() {
7273
*/
7374
@StableAPI.Expose(since = "0.10.0")
7475
public static IIcon getFullTextureIcon(String iconName, int width, int height) {
75-
return new IIcon() {
76-
@Override
77-
public int getIconWidth() {
78-
return width;
79-
}
80-
81-
@Override
82-
public int getIconHeight() {
83-
return height;
84-
}
85-
86-
@Override
87-
public float getMinU() {
88-
return 0;
89-
}
90-
91-
@Override
92-
public float getMaxU() {
93-
return 1;
94-
}
95-
96-
@Override
97-
public float getInterpolatedU(double u) {
98-
return (float) (u / 16D);
99-
}
100-
101-
@Override
102-
public float getMinV() {
103-
return 0;
104-
}
105-
106-
@Override
107-
public float getMaxV() {
108-
return 1;
109-
}
110-
111-
@Override
112-
public float getInterpolatedV(double v) {
113-
return (float) (v / 16D);
114-
}
115-
116-
@Override
117-
public String getIconName() {
118-
return iconName;
119-
}
120-
};
76+
return new FullTextureIcon(iconName, width, height);
12177
}
12278

12379
/**

0 commit comments

Comments
 (0)