Class TransparencyRenderHelper
java.lang.Object
johnsmith.enchantmentcore.client.render.TransparencyRenderHelper
Provides mechanisms to calculate and apply dynamic alpha transparency across asynchronous rendering pipelines.
Utilizes thread-local storage to maintain state during render pipeline construction.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic floatcalculateAlpha(net.minecraft.world.item.ItemStack stack) Calculates the minimum alpha multiplier applicable to the specified item stack.static voidResets the active alpha multiplier to 1.0F for the current thread.static floatgetAlpha()Retrieves the active alpha multiplier for the current thread.static booleanEvaluates if the active alpha multiplier dictates transparency.static voidsetAlphaActive(float alpha) Sets the active alpha multiplier for the current thread.static net.minecraft.client.renderer.SubmitNodeCollectorwrapCollector(net.minecraft.client.renderer.SubmitNodeCollector original, float alpha) Wraps a node collector to intercept rendering submissions.
-
Constructor Details
-
TransparencyRenderHelper
public TransparencyRenderHelper()
-
-
Method Details
-
setAlphaActive
public static void setAlphaActive(float alpha) Sets the active alpha multiplier for the current thread.- Parameters:
alpha- The alpha multiplier to apply to subsequent render operations.
-
clearAlphaActive
public static void clearAlphaActive()Resets the active alpha multiplier to 1.0F for the current thread. -
isAlphaActive
public static boolean isAlphaActive()Evaluates if the active alpha multiplier dictates transparency.- Returns:
- True if the active alpha is less than 1.0F. False otherwise.
-
getAlpha
public static float getAlpha()Retrieves the active alpha multiplier for the current thread.- Returns:
- The active alpha multiplier.
-
calculateAlpha
public static float calculateAlpha(net.minecraft.world.item.ItemStack stack) Calculates the minimum alpha multiplier applicable to the specified item stack. Iterates through applied enchantments and extracts values from transparency effects.- Parameters:
stack- The item stack to evaluate.- Returns:
- The calculated alpha multiplier, clamped between 0.0F and 1.0F.
-
wrapCollector
public static net.minecraft.client.renderer.SubmitNodeCollector wrapCollector(net.minecraft.client.renderer.SubmitNodeCollector original, float alpha) Wraps a node collector to intercept rendering submissions. Applies the specified alpha multiplier to packed ARGB color integers and custom vertex geometries.- Parameters:
original- The vanilla node collector.alpha- The alpha multiplier to apply.- Returns:
- A proxy node collector that applies the alpha modifier.
-