2020 * SOFTWARE.
2121 */
2222
23- package dev .galacticraft .machinelib .client .api .model . sprite ;
23+ package dev .galacticraft .machinelib .client .api .model ;
2424
2525import com .mojang .serialization .Codec ;
2626import com .mojang .serialization .codecs .RecordCodecBuilder ;
3434import java .util .Collections ;
3535import java .util .function .Function ;
3636
37- public record MachineTextureBase (Material machineEnergyIn , Material machineEnergyOut , Material machineEnergyBoth ,
37+ public record MachineTextureBase (Material base ,
38+ Material machineEnergyIn , Material machineEnergyOut , Material machineEnergyBoth ,
3839 Material machineItemIn , Material machineItemOut , Material machineItemBoth ,
3940 Material machineFluidIn , Material machineFluidOut , Material machineFluidBoth ,
4041 Material machineAnyIn , Material machineAnyOut , Material machineAnyBoth
4142) implements UnbakedModel {
4243 public static final Codec <MachineTextureBase > CODEC = RecordCodecBuilder .create (instance -> instance .group (
44+ TextureProvider .MATERIAL_CODEC .fieldOf ("base" ).forGetter (MachineTextureBase ::base ),
4345 TypedResourceSprites .CODEC .fieldOf ("energy" ).forGetter (b -> new TypedResourceSprites (b .machineEnergyIn , b .machineEnergyOut , b .machineEnergyBoth )),
4446 TypedResourceSprites .CODEC .fieldOf ("item" ).forGetter (b -> new TypedResourceSprites (b .machineItemIn , b .machineItemOut , b .machineItemBoth )),
4547 TypedResourceSprites .CODEC .fieldOf ("fluid" ).forGetter (b -> new TypedResourceSprites (b .machineFluidIn , b .machineFluidOut , b .machineFluidBoth )),
4648 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 )));
4850
4951 public static MachineTextureBase prefixed (String id , String prefix ) {
5052 return new MachineTextureBase (
53+ mat (id , prefix ),
5154 mat (id , prefix + "_energy_input" ), mat (id , prefix + "_energy_output" ), mat (id , prefix + "_energy_both" ),
5255 mat (id , prefix + "_item_input" ), mat (id , prefix + "_item_output" ), mat (id , prefix + "_item_both" ),
5356 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) {
5760
5861 public Bound bind (Function <Material , TextureAtlasSprite > atlas ) {
5962 return new Bound (
63+ atlas .apply (this .base ),
6064 atlas .apply (this .machineEnergyIn ), atlas .apply (this .machineEnergyOut ), atlas .apply (this .machineEnergyBoth ),
6165 atlas .apply (this .machineItemIn ), atlas .apply (this .machineItemOut ), atlas .apply (this .machineItemBoth ),
6266 atlas .apply (this .machineFluidIn ), atlas .apply (this .machineFluidOut ), atlas .apply (this .machineFluidBoth ),
@@ -78,7 +82,8 @@ public void resolveParents(Function<ResourceLocation, UnbakedModel> modelLoader)
7882 return null ;
7983 }
8084
81- public record Bound (TextureAtlasSprite machineEnergyIn , TextureAtlasSprite machineEnergyOut , TextureAtlasSprite machineEnergyBoth ,
85+ public record Bound (TextureAtlasSprite base ,
86+ TextureAtlasSprite machineEnergyIn , TextureAtlasSprite machineEnergyOut , TextureAtlasSprite machineEnergyBoth ,
8287 TextureAtlasSprite machineItemIn , TextureAtlasSprite machineItemOut , TextureAtlasSprite machineItemBoth ,
8388 TextureAtlasSprite machineFluidIn , TextureAtlasSprite machineFluidOut , TextureAtlasSprite machineFluidBoth ,
8489 TextureAtlasSprite machineAnyIn , TextureAtlasSprite machineAnyOut , TextureAtlasSprite machineAnyBoth ) {
0 commit comments