20
20
* SOFTWARE.
21
21
*/
22
22
23
- package dev .galacticraft .machinelib .client .api .model . sprite ;
23
+ package dev .galacticraft .machinelib .client .api .model ;
24
24
25
25
import com .mojang .serialization .Codec ;
26
26
import com .mojang .serialization .codecs .RecordCodecBuilder ;
34
34
import java .util .Collections ;
35
35
import java .util .function .Function ;
36
36
37
- public record MachineTextureBase (Material machineEnergyIn , Material machineEnergyOut , Material machineEnergyBoth ,
37
+ public record MachineTextureBase (Material base ,
38
+ Material machineEnergyIn , Material machineEnergyOut , Material machineEnergyBoth ,
38
39
Material machineItemIn , Material machineItemOut , Material machineItemBoth ,
39
40
Material machineFluidIn , Material machineFluidOut , Material machineFluidBoth ,
40
41
Material machineAnyIn , Material machineAnyOut , Material machineAnyBoth
41
42
) implements UnbakedModel {
42
43
public static final Codec <MachineTextureBase > CODEC = RecordCodecBuilder .create (instance -> instance .group (
44
+ TextureProvider .MATERIAL_CODEC .fieldOf ("base" ).forGetter (MachineTextureBase ::base ),
43
45
TypedResourceSprites .CODEC .fieldOf ("energy" ).forGetter (b -> new TypedResourceSprites (b .machineEnergyIn , b .machineEnergyOut , b .machineEnergyBoth )),
44
46
TypedResourceSprites .CODEC .fieldOf ("item" ).forGetter (b -> new TypedResourceSprites (b .machineItemIn , b .machineItemOut , b .machineItemBoth )),
45
47
TypedResourceSprites .CODEC .fieldOf ("fluid" ).forGetter (b -> new TypedResourceSprites (b .machineFluidIn , b .machineFluidOut , b .machineFluidBoth )),
46
48
TypedResourceSprites .CODEC .fieldOf ("any" ).forGetter (b -> new TypedResourceSprites (b .machineAnyIn , b .machineAnyOut , b .machineAnyBoth ))
47
- ).apply (instance , (e , i , f ,a ) -> new MachineTextureBase (e .input , e .output , e .both , i .input , i .output , i .both , f .input , f .output , f .both , a .input , a .output , a .both )));
49
+ ).apply (instance , (b , e , i , f ,a ) -> new MachineTextureBase (b , e .input , e .output , e .both , i .input , i .output , i .both , f .input , f .output , f .both , a .input , a .output , a .both )));
48
50
49
51
public static MachineTextureBase prefixed (String id , String prefix ) {
50
52
return new MachineTextureBase (
53
+ mat (id , prefix ),
51
54
mat (id , prefix + "_energy_input" ), mat (id , prefix + "_energy_output" ), mat (id , prefix + "_energy_both" ),
52
55
mat (id , prefix + "_item_input" ), mat (id , prefix + "_item_output" ), mat (id , prefix + "_item_both" ),
53
56
mat (id , prefix + "_fluid_input" ), mat (id , prefix + "_fluid_output" ), mat (id , prefix + "_fluid_both" ),
@@ -57,6 +60,7 @@ public static MachineTextureBase prefixed(String id, String prefix) {
57
60
58
61
public Bound bind (Function <Material , TextureAtlasSprite > atlas ) {
59
62
return new Bound (
63
+ atlas .apply (this .base ),
60
64
atlas .apply (this .machineEnergyIn ), atlas .apply (this .machineEnergyOut ), atlas .apply (this .machineEnergyBoth ),
61
65
atlas .apply (this .machineItemIn ), atlas .apply (this .machineItemOut ), atlas .apply (this .machineItemBoth ),
62
66
atlas .apply (this .machineFluidIn ), atlas .apply (this .machineFluidOut ), atlas .apply (this .machineFluidBoth ),
@@ -78,7 +82,8 @@ public void resolveParents(Function<ResourceLocation, UnbakedModel> modelLoader)
78
82
return null ;
79
83
}
80
84
81
- public record Bound (TextureAtlasSprite machineEnergyIn , TextureAtlasSprite machineEnergyOut , TextureAtlasSprite machineEnergyBoth ,
85
+ public record Bound (TextureAtlasSprite base ,
86
+ TextureAtlasSprite machineEnergyIn , TextureAtlasSprite machineEnergyOut , TextureAtlasSprite machineEnergyBoth ,
82
87
TextureAtlasSprite machineItemIn , TextureAtlasSprite machineItemOut , TextureAtlasSprite machineItemBoth ,
83
88
TextureAtlasSprite machineFluidIn , TextureAtlasSprite machineFluidOut , TextureAtlasSprite machineFluidBoth ,
84
89
TextureAtlasSprite machineAnyIn , TextureAtlasSprite machineAnyOut , TextureAtlasSprite machineAnyBoth ) {
0 commit comments