Class TransparencyRenderHelper

java.lang.Object
johnsmith.enchantmentcore.client.render.TransparencyRenderHelper

public class TransparencyRenderHelper extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static float
    calculateAlpha(net.minecraft.world.item.ItemStack stack)
    Calculates the minimum alpha multiplier applicable to the specified item stack.
    static void
    Resets the active alpha multiplier to 1.0F for the current thread.
    static float
    Retrieves the active alpha multiplier for the current thread.
    static boolean
    Evaluates if the active alpha multiplier dictates transparency.
    static void
    setAlphaActive(float alpha)
    Sets the active alpha multiplier for the current thread.
    static net.minecraft.client.renderer.SubmitNodeCollector
    wrapCollector(net.minecraft.client.renderer.SubmitNodeCollector original, float alpha)
    Wraps a node collector to intercept rendering submissions.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.