Skip to content

Commit e3912f0

Browse files
committed
Apply translucent overlays to basic machines
Should look the same in dev
1 parent 43eb346 commit e3912f0

File tree

1 file changed

+30
-10
lines changed

1 file changed

+30
-10
lines changed

src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java

+30-10
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import gregtech.api.util.GT_Utility;
2121
import gregtech.api.util.WorldSpawnedEventBuilder;
2222
import ic2.core.Ic2Items;
23+
import lombok.val;
2324
import net.minecraft.entity.player.InventoryPlayer;
2425
import net.minecraft.init.Blocks;
2526
import net.minecraft.item.ItemStack;
@@ -52,16 +53,7 @@ public GT_MetaTileEntity_BasicMachine_GT_Recipe(
5253
int aInputSlots, int aOutputSlots, int aTankCapacity, int aGUIParameterA, int aGUIParameterB, String aGUIName, String aSound, boolean aSharedTank,
5354
boolean aRequiresFluidForFiltering, int aSpecialEffect, String aOverlays, Object[] aRecipe
5455
) {
55-
super(aID, aName, aNameRegional, aTier, aRecipes.mAmperage, aDescription, aInputSlots, aOutputSlots, aGUIName, aRecipes.mNEIName,
56-
TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_ACTIVE")),
57-
TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE")),
58-
TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT_ACTIVE")),
59-
TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT")),
60-
TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP_ACTIVE")),
61-
TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP")),
62-
TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM_ACTIVE")),
63-
TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM"))
64-
);
56+
super(aID, aName, aNameRegional, aTier, aRecipes.mAmperage, aDescription, aInputSlots, aOutputSlots, aGUIName, aRecipes.mNEIName, createTextures(aOverlays));
6557
this.mSharedTank = aSharedTank;
6658
this.mTankCapacity = aTankCapacity;
6759
this.mSpecialEffect = aSpecialEffect;
@@ -933,4 +925,32 @@ protected boolean displaysOutputFluid() {
933925
}
934926

935927
public enum X {PUMP, WIRE, WIRE4, HULL, PIPE, GLASS, PLATE, MOTOR, ROTOR, SENSOR, PISTON, EMITTER, CONVEYOR, ROBOT_ARM, COIL_HEATING, COIL_ELECTRIC, STICK_MAGNETIC, STICK_DISTILLATION, FIELD_GENERATOR, COIL_HEATING_DOUBLE, STICK_ELECTROMAGNETIC, CIRCUIT_POWER, CIRCUIT_LOGIC}
928+
929+
@Override
930+
public boolean hasTranslucency() {
931+
return true;
932+
}
933+
934+
private static ITexture[] createTextures(String aOverlays) {
935+
val prefix = "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_";
936+
return new ITexture[]{
937+
texzWithDaGlass(prefix, "SIDE_ACTIVE", "SIDE_TRANSLUCENT"),
938+
texzWithDaGlass(prefix, "SIDE", "SIDE_TRANSLUCENT"),
939+
texzWithDaGlass(prefix, "FRONT_ACTIVE", "FRONT_TRANSLUCENT"),
940+
texzWithDaGlass(prefix, "FRONT", "FRONT_TRANSLUCENT"),
941+
texzWithDaGlass(prefix, "TOP_ACTIVE", "TOP_TRANSLUCENT"),
942+
texzWithDaGlass(prefix, "TOP", "TOP_TRANSLUCENT"),
943+
texzWithDaGlass(prefix, "BOTTOM_ACTIVE", "BOTTOM_TRANSLUCENT"),
944+
texzWithDaGlass(prefix, "BOTTOM", "BOTTOM_TRANSLUCENT"),
945+
};
946+
}
947+
948+
private static ITexture texzWithDaGlass(String prefix, String opaqueName, String translucentName) {
949+
val opaque = TextureFactory.of(new CustomIcon(prefix + opaqueName));
950+
val translucent = TextureFactory.builder()
951+
.addIcon(new CustomIcon(prefix + translucentName))
952+
.setTranslucent(true)
953+
.build();
954+
return TextureFactory.of(opaque, translucent);
955+
}
936956
}

0 commit comments

Comments
 (0)