Skip to content

Commit

Permalink
Apply translucent overlays to basic machines
Browse files Browse the repository at this point in the history
Should look the same in dev
  • Loading branch information
basdxz committed Jan 6, 2025
1 parent 43eb346 commit e3912f0
Showing 1 changed file with 30 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import gregtech.api.util.GT_Utility;
import gregtech.api.util.WorldSpawnedEventBuilder;
import ic2.core.Ic2Items;
import lombok.val;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -52,16 +53,7 @@ public GT_MetaTileEntity_BasicMachine_GT_Recipe(
int aInputSlots, int aOutputSlots, int aTankCapacity, int aGUIParameterA, int aGUIParameterB, String aGUIName, String aSound, boolean aSharedTank,
boolean aRequiresFluidForFiltering, int aSpecialEffect, String aOverlays, Object[] aRecipe
) {
super(aID, aName, aNameRegional, aTier, aRecipes.mAmperage, aDescription, aInputSlots, aOutputSlots, aGUIName, aRecipes.mNEIName,
TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_ACTIVE")),
TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE")),
TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT_ACTIVE")),
TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT")),
TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP_ACTIVE")),
TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP")),
TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM_ACTIVE")),
TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM"))
);
super(aID, aName, aNameRegional, aTier, aRecipes.mAmperage, aDescription, aInputSlots, aOutputSlots, aGUIName, aRecipes.mNEIName, createTextures(aOverlays));
this.mSharedTank = aSharedTank;
this.mTankCapacity = aTankCapacity;
this.mSpecialEffect = aSpecialEffect;
Expand Down Expand Up @@ -933,4 +925,32 @@ protected boolean displaysOutputFluid() {
}

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}

@Override
public boolean hasTranslucency() {
return true;
}

private static ITexture[] createTextures(String aOverlays) {
val prefix = "basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_";
return new ITexture[]{
texzWithDaGlass(prefix, "SIDE_ACTIVE", "SIDE_TRANSLUCENT"),
texzWithDaGlass(prefix, "SIDE", "SIDE_TRANSLUCENT"),
texzWithDaGlass(prefix, "FRONT_ACTIVE", "FRONT_TRANSLUCENT"),
texzWithDaGlass(prefix, "FRONT", "FRONT_TRANSLUCENT"),
texzWithDaGlass(prefix, "TOP_ACTIVE", "TOP_TRANSLUCENT"),
texzWithDaGlass(prefix, "TOP", "TOP_TRANSLUCENT"),
texzWithDaGlass(prefix, "BOTTOM_ACTIVE", "BOTTOM_TRANSLUCENT"),
texzWithDaGlass(prefix, "BOTTOM", "BOTTOM_TRANSLUCENT"),
};
}

private static ITexture texzWithDaGlass(String prefix, String opaqueName, String translucentName) {
val opaque = TextureFactory.of(new CustomIcon(prefix + opaqueName));
val translucent = TextureFactory.builder()
.addIcon(new CustomIcon(prefix + translucentName))
.setTranslucent(true)
.build();
return TextureFactory.of(opaque, translucent);
}
}

0 comments on commit e3912f0

Please sign in to comment.