@@ -72,11 +72,6 @@ private static void setIcon(ArrayList<InputStream> inputStreams) throws IOExcept
72
72
//$$ RenderSystem.assertThread(RenderSystem::isInInitPhase);
73
73
//#endif
74
74
75
- if (Minecraft .ON_OSX ) {
76
- // TODO: MAC_OS support, Low Priority because I'm lazy,meow~
77
- return ;
78
- }
79
-
80
75
ArrayList <ByteBuffer > byteBuffers = new ArrayList <>(inputStreams .size ());
81
76
82
77
try (MemoryStack memoryStack = MemoryStack .stackPush ()) {
@@ -128,26 +123,18 @@ public static void updateIcon() {
128
123
129
124
try {
130
125
if (Configs .featureCustomWindowIcon ) {
131
- //#if MC > 11802
132
- inputStreams .add (mc .getResourceManager ().getResource (SharedConstants .getCurrentVersion ().isStable () ? IconUtil .TMC_STABLE_16X : IconUtil .TMC_SNAPSHOT_16X ).orElseThrow (RuntimeException ::new ).open ());
133
- inputStreams .add (mc .getResourceManager ().getResource (SharedConstants .getCurrentVersion ().isStable () ? IconUtil .TMC_STABLE_32X : IconUtil .TMC_SNAPSHOT_32X ).orElseThrow (RuntimeException ::new ).open ());
134
- inputStreams .add (mc .getResourceManager ().getResource (SharedConstants .getCurrentVersion ().isStable () ? IconUtil .TMC_STABLE_48X : IconUtil .TMC_SNAPSHOT_48X ).orElseThrow (RuntimeException ::new ).open ());
135
- inputStreams .add (mc .getResourceManager ().getResource (SharedConstants .getCurrentVersion ().isStable () ? IconUtil .TMC_STABLE_128X : IconUtil .TMC_SNAPSHOT_128X ).orElseThrow (RuntimeException ::new ).open ());
136
- inputStreams .add (mc .getResourceManager ().getResource (SharedConstants .getCurrentVersion ().isStable () ? IconUtil .TMC_STABLE_256X : IconUtil .TMC_SNAPSHOT_256X ).orElseThrow (RuntimeException ::new ).open ());
137
- //#else
138
- //$$ inputStreams.add(mc.getResourceManager().getResource(SharedConstants.getCurrentVersion().isStable() ? IconUtil.TMC_STABLE_16X : IconUtil.TMC_SNAPSHOT_16X).getInputStream());
139
- //$$ inputStreams.add(mc.getResourceManager().getResource(SharedConstants.getCurrentVersion().isStable() ? IconUtil.TMC_STABLE_32X : IconUtil.TMC_SNAPSHOT_32X).getInputStream());
140
- //$$ inputStreams.add(mc.getResourceManager().getResource(SharedConstants.getCurrentVersion().isStable() ? IconUtil.TMC_STABLE_48X : IconUtil.TMC_SNAPSHOT_48X).getInputStream());
141
- //$$ inputStreams.add(mc.getResourceManager().getResource(SharedConstants.getCurrentVersion().isStable() ? IconUtil.TMC_STABLE_128X : IconUtil.TMC_SNAPSHOT_128X).getInputStream());
142
- //$$ inputStreams.add(mc.getResourceManager().getResource(SharedConstants.getCurrentVersion().isStable() ? IconUtil.TMC_STABLE_256X : IconUtil.TMC_SNAPSHOT_256X).getInputStream());
143
- //#endif
126
+ IconUtil .pushResource (inputStreams , TMC_STABLE_16X , TMC_SNAPSHOT_16X );
127
+ IconUtil .pushResource (inputStreams , TMC_STABLE_32X , TMC_SNAPSHOT_32X );
128
+ IconUtil .pushResource (inputStreams , TMC_STABLE_48X , TMC_SNAPSHOT_48X );
129
+ IconUtil .pushResource (inputStreams , TMC_STABLE_128X , TMC_SNAPSHOT_128X );
130
+ IconUtil .pushResource (inputStreams , TMC_STABLE_256X , TMC_SNAPSHOT_256X );
144
131
} else {
145
132
//#if MC > 11904
146
- inputStreams . add ( Objects . requireNonNull ( mc . getVanillaPackResources (). getRootResource ( SharedConstants . getCurrentVersion (). isStable () ? IconUtil .VANILLA_STABLE_16X : IconUtil .VANILLA_SNAPSHOT_16X )). get () );
147
- inputStreams . add ( Objects . requireNonNull ( mc . getVanillaPackResources (). getRootResource ( SharedConstants . getCurrentVersion (). isStable () ? IconUtil .VANILLA_STABLE_32X : IconUtil .VANILLA_SNAPSHOT_32X )). get () );
148
- inputStreams . add ( Objects . requireNonNull ( mc . getVanillaPackResources (). getRootResource ( SharedConstants . getCurrentVersion (). isStable () ? IconUtil .VANILLA_STABLE_48X : IconUtil .VANILLA_SNAPSHOT_48X )). get () );
149
- inputStreams . add ( Objects . requireNonNull ( mc . getVanillaPackResources (). getRootResource ( SharedConstants . getCurrentVersion (). isStable () ? IconUtil .VANILLA_STABLE_128X : IconUtil .VANILLA_SNAPSHOT_128X )). get () );
150
- inputStreams . add ( Objects . requireNonNull ( mc . getVanillaPackResources (). getRootResource ( SharedConstants . getCurrentVersion (). isStable () ? IconUtil .VANILLA_STABLE_256X : IconUtil .VANILLA_SNAPSHOT_256X )). get () );
133
+ IconUtil . pushVanillaResource ( inputStreams , IconUtil .VANILLA_STABLE_16X , IconUtil .VANILLA_SNAPSHOT_16X );
134
+ IconUtil . pushVanillaResource ( inputStreams , IconUtil .VANILLA_STABLE_32X , IconUtil .VANILLA_SNAPSHOT_32X );
135
+ IconUtil . pushVanillaResource ( inputStreams , IconUtil .VANILLA_STABLE_48X , IconUtil .VANILLA_SNAPSHOT_48X );
136
+ IconUtil . pushVanillaResource ( inputStreams , IconUtil .VANILLA_STABLE_128X , IconUtil .VANILLA_SNAPSHOT_128X );
137
+ IconUtil . pushVanillaResource ( inputStreams , IconUtil .VANILLA_STABLE_256X , IconUtil .VANILLA_SNAPSHOT_256X );
151
138
//#elseif MC > 11902
152
139
//$$ inputStreams.add(Objects.requireNonNull(mc.getVanillaPackResources().getRootResource(IconUtil.VANILLA_STABLE_16X)).get());
153
140
//$$ inputStreams.add(Objects.requireNonNull(mc.getVanillaPackResources().getRootResource(IconUtil.VANILLA_STABLE_32X)).get());
@@ -162,4 +149,26 @@ public static void updateIcon() {
162
149
TweakMyClientReference .getLogger ().error ("Couldn't set icon" );
163
150
}
164
151
}
152
+
153
+ private static void pushResource (@ NotNull ArrayList <InputStream > list , ResourceLocation stable ,
154
+ ResourceLocation snapshot ) throws IOException {
155
+ Minecraft mc = TweakMyClient .getMinecraftClient ();
156
+ list .add (
157
+ mc .getResourceManager ().getResource (SharedConstants .getCurrentVersion ().isStable () ? stable : snapshot )
158
+ //#if MC > 11802
159
+ .orElseThrow (RuntimeException ::new ).open ()
160
+ //#else
161
+ //$$ .getInputStream()
162
+ //#endif
163
+ );
164
+ }
165
+
166
+ //#if MC > 11904
167
+ private static void pushVanillaResource (@ NotNull ArrayList <InputStream > list , String [] stable ,
168
+ String [] snapshot ) throws IOException {
169
+ Minecraft mc = TweakMyClient .getMinecraftClient ();
170
+ list .add (Objects .requireNonNull (mc .getVanillaPackResources ()
171
+ .getRootResource (SharedConstants .getCurrentVersion ().isStable () ? stable : snapshot )).get ());
172
+ }
173
+ //#endif
165
174
}
0 commit comments