@@ -6,103 +6,107 @@ data class SolidMaterialTexture(
66 val key : Key
77) {
88 companion object {
9+
910 fun exists (key : Key ): Boolean {
10- if (key.namespace() != Key .MINECRAFT_NAMESPACE ) return false
11+ return get(key) != null
12+ }
13+ fun get (key : Key ): SolidMaterialTexture ? {
14+ if (key.namespace() != Key .MINECRAFT_NAMESPACE ) return null
1115 val split = key.value().split(" /" )
1216 val type = split.first().uppercase()
1317 val value = split.last().uppercase()
1418 return when (type) {
1519 " BLOCK" -> try {
16- SolidBlockMaterialTexture .valueOf(value); true
20+ SolidBlockMaterialTexture .valueOf(value).toGeneric()
1721 } catch (ignored: Exception ) {
18- false
22+ null
1923 }
2024
2125 " ITEM" -> try {
22- SolidItemMaterialTexture .valueOf(value); true
26+ SolidItemMaterialTexture .valueOf(value).toGeneric()
2327 } catch (ignored: Exception ) {
24- false
28+ null
2529 }
2630
2731 " MODELS" -> try {
28- SolidModelsMaterialTexture .valueOf(value); true
32+ SolidModelsMaterialTexture .valueOf(value).toGeneric()
2933 } catch (ignored: Exception ) {
30- false
34+ null
3135 }
3236
3337 " GUI" -> try {
34- SolidGuiMaterialTexture .valueOf(value); true
38+ SolidGuiMaterialTexture .valueOf(value).toGeneric()
3539 } catch (ignored: Exception ) {
36- false
40+ null
3741 }
3842
3943 " ENTITY" -> try {
40- SolidEntityMaterialTexture .valueOf(value); true
44+ SolidEntityMaterialTexture .valueOf(value).toGeneric()
4145 } catch (ignored: Exception ) {
42- false
46+ null
4347 }
4448
4549 " PARTICLE" -> try {
46- SolidParticleMaterialTexture .valueOf(value); true
50+ SolidParticleMaterialTexture .valueOf(value).toGeneric()
4751 } catch (ignored: Exception ) {
48- false
52+ null
4953 }
5054
5155 " ENVIRONMENT" -> try {
52- SolidEnvironmentMaterialTexture .valueOf(value); true
56+ SolidEnvironmentMaterialTexture .valueOf(value).toGeneric()
5357 } catch (ignored: Exception ) {
54- false
58+ null
5559 }
5660
5761 " MISC" -> try {
58- SolidMiscMaterialTexture .valueOf(value); true
62+ SolidMiscMaterialTexture .valueOf(value).toGeneric()
5963 } catch (ignored: Exception ) {
60- false
64+ null
6165 }
6266
6367 " PAINTING" -> try {
64- SolidPaintingMaterialTexture .valueOf(value); true
68+ SolidPaintingMaterialTexture .valueOf(value).toGeneric()
6569 } catch (ignored: Exception ) {
66- false
70+ null
6771 }
6872
6973 " FONT" -> try {
70- SolidFontMaterialTexture .valueOf(value); true
74+ SolidFontMaterialTexture .valueOf(value).toGeneric()
7175 } catch (ignored: Exception ) {
72- false
76+ null
7377 }
7478
7579 " MAP" -> try {
76- SolidMapMaterialTexture .valueOf(value); true
80+ SolidMapMaterialTexture .valueOf(value).toGeneric()
7781 } catch (ignored: Exception ) {
78- false
82+ null
7983 }
8084
8185 " COLORMAP" -> try {
82- SolidColormapMaterialTexture .valueOf(value); true
86+ SolidColormapMaterialTexture .valueOf(value).toGeneric()
8387 } catch (ignored: Exception ) {
84- false
88+ null
8589 }
8690
8791 " EFFECT" -> try {
88- SolidEffectMaterialTexture .valueOf(value); true
92+ SolidEffectMaterialTexture .valueOf(value).toGeneric()
8993 } catch (ignored: Exception ) {
90- false
94+ null
9195 }
9296
9397 " TRIMS" -> try {
94- SolidTrimsMaterialTexture .valueOf(value); true
98+ SolidTrimsMaterialTexture .valueOf(value).toGeneric()
9599 } catch (ignored: Exception ) {
96- false
100+ null
97101 }
98102
99103 " MOB_EFFECT" -> try {
100- SolidMobEffectMaterialTexture .valueOf(value); true
104+ SolidMobEffectMaterialTexture .valueOf(value).toGeneric()
101105 } catch (ignored: Exception ) {
102- false
106+ null
103107 }
104108
105- else -> false
109+ else -> null
106110 }
107111 }
108112 }
0 commit comments