Skip to content

Commit

Permalink
Use vanilla's own render type for making the upgrades appear faded ra…
Browse files Browse the repository at this point in the history
…ther than a custom one
  • Loading branch information
pupnewfster committed Mar 14, 2024
1 parent 8a37da3 commit e94416f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import mekanism.client.gui.IGuiWrapper;
import mekanism.client.gui.element.GuiElement;
import mekanism.client.gui.element.GuiElementHolder;
import mekanism.client.render.MekanismRenderType;
import mekanism.common.MekanismLang;
import mekanism.common.lib.Color;
import mekanism.common.util.EnumUtils;
import mekanism.common.util.UpgradeUtils;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -51,7 +51,7 @@ public void drawBackground(@NotNull GuiGraphics guiGraphics, int mouseX, int mou
gui().renderItem(guiGraphics, UpgradeUtils.getStack(upgrade), xPos, yPos, 0.75F);
if (!supportedUpgrades.contains(upgrade)) {
//Make the upgrade appear faded if it is not supported
guiGraphics.fill(MekanismRenderType.MEK_GUI_FADE, xPos, yPos, xPos + ELEMENT_SIZE, yPos + ELEMENT_SIZE, backgroundColor);
guiGraphics.fill(RenderType.guiGhostRecipeOverlay(), xPos, yPos, xPos + ELEMENT_SIZE, yPos + ELEMENT_SIZE, backgroundColor);
}
}
}
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/mekanism/client/render/MekanismRenderType.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,6 @@ private MekanismRenderType(String name, VertexFormat format, Mode mode, int buff
.createCompositeState(false)
);

//Copy of GUI except with a greater depth test instead of lequal
public static final RenderType MEK_GUI_FADE = create("mek_gui_fade", DefaultVertexFormat.POSITION_COLOR, Mode.QUADS, 256,
false, false, RenderType.CompositeState.builder()
.setShaderState(RENDERTYPE_GUI_SHADER)
.setTransparencyState(TRANSLUCENT_TRANSPARENCY)
.setDepthTestState(GREATER_DEPTH_TEST)
.createCompositeState(false)
);

public static final Function<ResourceLocation, RenderType> STANDARD = Util.memoize(resourceLocation ->
createStandard("mek_standard", resourceLocation, UnaryOperator.identity(), false));
public static final Function<ResourceLocation, RenderType> STANDARD_TRANSLUCENT_TARGET = Util.memoize(resourceLocation ->
Expand Down

0 comments on commit e94416f

Please sign in to comment.