Class DisplayRenderer<T extends Display>

java.lang.Object
net.darkhax.botanypots.common.api.data.display.render.DisplayRenderer<T>
Type Parameters:
T - The type of display rendered.
Direct Known Subclasses:
AbstractDisplayRenderer, EntityDisplayStateRenderer, PhasedDisplayStateRenderer

public abstract class DisplayRenderer<T extends Display> extends Object
Renders a display in a botany pot.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends Display>
    void
    bind(DisplayType<T> type, DisplayRenderer<T> renderer)
    Binds a renderer to a display type.
    static DisplayRenderer<?>
    Gets the renderer to use for a given display.
    abstract float
    render(net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context context, T displayState, com.mojang.blaze3d.vertex.PoseStack stack, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, float tickDelta, net.minecraft.client.renderer.MultiBufferSource bufferSource, int light, int overlay, BotanyPotBlockEntity pot, float progress, float growthScale, float heightOffset)
    Renders the display in the world.
    static float
    renderState(net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context context, Display displayState, com.mojang.blaze3d.vertex.PoseStack stack, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, float tickDelta, net.minecraft.client.renderer.MultiBufferSource bufferSource, int light, int overlay, BotanyPotBlockEntity pot, float progress, float growthScale, float heightOffset)
    Renders a display in world.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DisplayRenderer

      public DisplayRenderer()
  • Method Details

    • getRenderer

      public static DisplayRenderer<?> getRenderer(Display state)
      Gets the renderer to use for a given display.
      Parameters:
      state - The display to render.
      Returns:
      A renderer for the display.
    • renderState

      public static float renderState(net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context context, Display displayState, com.mojang.blaze3d.vertex.PoseStack stack, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, float tickDelta, net.minecraft.client.renderer.MultiBufferSource bufferSource, int light, int overlay, BotanyPotBlockEntity pot, float progress, float growthScale, float heightOffset)
      Renders a display in world.
      Parameters:
      context - Context provided when rendering a block entity.
      displayState - The display to render.
      stack - The pose stack for the renderer.
      level - The current level, will always be a client level.
      pos - The position of te block being rendered.
      tickDelta - The delta between frames.
      bufferSource - Buffer source for rendering.
      light - Packed light of the block.
      overlay - Packed overlay of the block.
      pot - The pot block entity.
      progress - The growth progress of the crop.
      growthScale - The scale based on current growth progress.
      heightOffset - A height offset used to make displays stack perfectly on top of each other.
      Returns:
      The new height offset for the next display.
    • render

      public abstract float render(net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context context, T displayState, com.mojang.blaze3d.vertex.PoseStack stack, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, float tickDelta, net.minecraft.client.renderer.MultiBufferSource bufferSource, int light, int overlay, BotanyPotBlockEntity pot, float progress, float growthScale, float heightOffset)
      Renders the display in the world.
      Parameters:
      context - Context provided when rendering a block entity.
      displayState - The display to render.
      stack - The pose stack for the renderer.
      level - The current level, will always be a client level.
      pos - The position of te block being rendered.
      tickDelta - The delta between frames.
      bufferSource - Buffer source for rendering.
      light - Packed light of the block.
      overlay - Packed overlay of the block.
      pot - The pot block entity.
      progress - The growth progress of the crop.
      growthScale - The scale based on current growth progress.
      heightOffset - A height offset used to make displays stack perfectly on top of each other.
      Returns:
      The new height offset for the next display.
    • bind

      public static <T extends Display> void bind(DisplayType<T> type, DisplayRenderer<T> renderer)
      Binds a renderer to a display type. Built-in types are bound during the same phase as vanilla tile entity renderers. Binding a type that has already been bound will log a warning but still override the previous renderer.
      Type Parameters:
      T - The display type.
      Parameters:
      type - The type to bind.
      renderer - The renderer to use.