Class InstancedRenderRegistry

java.lang.Object
com.jozufozu.flywheel.backend.instancing.InstancedRenderRegistry

public class InstancedRenderRegistry extends Object
A utility class for registering and retrieving InstancingControllers.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    InstancedRenderRegistry.BlockEntityConfig<T extends net.minecraft.world.level.block.entity.BlockEntity>
    An object to configure the instancing controller for a block entity.
    static class 
    InstancedRenderRegistry.EntityConfig<T extends net.minecraft.world.entity.Entity>
    An object to configure the instancing controller for an entity.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends net.minecraft.world.entity.Entity>
    boolean
    canInstance(net.minecraft.world.entity.EntityType<? extends T> type)
    Checks if the given entity type can be instanced.
    static <T extends net.minecraft.world.level.block.entity.BlockEntity>
    boolean
    canInstance(net.minecraft.world.level.block.entity.BlockEntityType<? extends T> type)
    Checks if the given block entity type can be instanced.
    static <T extends net.minecraft.world.entity.Entity>
    InstancedRenderRegistry.EntityConfig<T>
    configure(net.minecraft.world.entity.EntityType<T> type)
    Get an object to configure the instancing controller for the given entity type.
    static <T extends net.minecraft.world.level.block.entity.BlockEntity>
    InstancedRenderRegistry.BlockEntityConfig<T>
    configure(net.minecraft.world.level.block.entity.BlockEntityType<T> type)
    Get an object to configure the instancing controller for the given block entity type.
    static <T extends net.minecraft.world.level.block.entity.BlockEntity>
    BlockEntityInstance<? super T>
    createInstance(MaterialManager materialManager, T blockEntity)
    Creates an instance for the given block entity, if possible.
    static <T extends net.minecraft.world.entity.Entity>
    EntityInstancingController<? super T>
    getController(net.minecraft.world.entity.EntityType<T> type)
    Gets the instancing controller for the given entity type, if one exists.
    static <T extends net.minecraft.world.level.block.entity.BlockEntity>
    BlockEntityInstancingController<? super T>
    getController(net.minecraft.world.level.block.entity.BlockEntityType<T> type)
    Gets the instancing controller for the given block entity type, if one exists.
    static <T extends net.minecraft.world.level.block.entity.BlockEntity>
    net.minecraft.world.level.block.entity.BlockEntityType<? super T>
    getType(T blockEntity)
    Gets the type of the given block entity.
    static <T extends net.minecraft.world.entity.Entity>
    void
    setController(net.minecraft.world.entity.EntityType<T> type, EntityInstancingController<? super T> instancingController)
    Sets the instancing controller for the given entity type.
    static <T extends net.minecraft.world.level.block.entity.BlockEntity>
    void
    setController(net.minecraft.world.level.block.entity.BlockEntityType<T> type, BlockEntityInstancingController<? super T> instancingController)
    Sets the instancing controller for the given block entity type.
    static <T extends net.minecraft.world.level.block.entity.BlockEntity>
    boolean
    shouldSkipRender(T blockEntity)
    Checks if the given block entity is instanced and should not be rendered normally.

    Methods inherited from class java.lang.Object

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

    • InstancedRenderRegistry

      public InstancedRenderRegistry()
  • Method Details

    • canInstance

      public static <T extends net.minecraft.world.level.block.entity.BlockEntity> boolean canInstance(net.minecraft.world.level.block.entity.BlockEntityType<? extends T> type)
      Checks if the given block entity type can be instanced.
      Type Parameters:
      T - The type of the block entity.
      Parameters:
      type - The block entity type to check.
      Returns:
      true if the block entity type can be instanced.
    • canInstance

      public static <T extends net.minecraft.world.entity.Entity> boolean canInstance(net.minecraft.world.entity.EntityType<? extends T> type)
      Checks if the given entity type can be instanced.
      Type Parameters:
      T - The type of the entity.
      Parameters:
      type - The entity type to check.
      Returns:
      true if the entity type can be instanced.
    • createInstance

      @Nullable public static <T extends net.minecraft.world.level.block.entity.BlockEntity> BlockEntityInstance<? super T> createInstance(MaterialManager materialManager, T blockEntity)
      Creates an instance for the given block entity, if possible.
      Type Parameters:
      T - The type of the block entity.
      Parameters:
      materialManager - The material manager to use.
      blockEntity - The block entity to create an instance of.
      Returns:
      An instance of the block entity, or null if the block entity cannot be instanced.
    • createInstance

      @Nullable public static <T extends net.minecraft.world.entity.Entity> EntityInstance<? super T> createInstance(MaterialManager materialManager, T entity)
      Creates an instance for the given entity, if possible.
      Type Parameters:
      T - The type of the entity.
      Parameters:
      materialManager - The material manager to use.
      entity - The entity to create an instance of.
      Returns:
      An instance of the entity, or null if the entity cannot be instanced.
    • shouldSkipRender

      public static <T extends net.minecraft.world.level.block.entity.BlockEntity> boolean shouldSkipRender(T blockEntity)
      Checks if the given block entity is instanced and should not be rendered normally.
      Type Parameters:
      T - The type of the block entity.
      Parameters:
      blockEntity - The block entity to check.
      Returns:
      true if the block entity is instanced and should not be rendered normally.
    • shouldSkipRender

      public static <T extends net.minecraft.world.entity.Entity> boolean shouldSkipRender(T entity)
      Checks if the given entity is instanced and should not be rendered normally.
      Type Parameters:
      T - The type of the entity.
      Parameters:
      entity - The entity to check.
      Returns:
      true if the entity is instanced and should not be rendered normally.
    • configure

      public static <T extends net.minecraft.world.level.block.entity.BlockEntity> InstancedRenderRegistry.BlockEntityConfig<T> configure(net.minecraft.world.level.block.entity.BlockEntityType<T> type)
      Get an object to configure the instancing controller for the given block entity type.
      Type Parameters:
      T - The type of the block entity.
      Parameters:
      type - The block entity type to configure.
      Returns:
      The configuration object.
    • configure

      public static <T extends net.minecraft.world.entity.Entity> InstancedRenderRegistry.EntityConfig<T> configure(net.minecraft.world.entity.EntityType<T> type)
      Get an object to configure the instancing controller for the given entity type.
      Type Parameters:
      T - The type of the entity.
      Parameters:
      type - The entity type to configure.
      Returns:
      The configuration object.
    • getController

      @Nullable public static <T extends net.minecraft.world.level.block.entity.BlockEntity> BlockEntityInstancingController<? super T> getController(net.minecraft.world.level.block.entity.BlockEntityType<T> type)
      Gets the instancing controller for the given block entity type, if one exists.
      Type Parameters:
      T - The type of the block entity.
      Parameters:
      type - The block entity type to get the instancing controller for.
      Returns:
      The instancing controller for the given block entity type, or null if none exists.
    • getController

      @Nullable public static <T extends net.minecraft.world.entity.Entity> EntityInstancingController<? super T> getController(net.minecraft.world.entity.EntityType<T> type)
      Gets the instancing controller for the given entity type, if one exists.
      Type Parameters:
      T - The type of the entity.
      Parameters:
      type - The entity type to get the instancing controller for.
      Returns:
      The instancing controller for the given entity type, or null if none exists.
    • setController

      public static <T extends net.minecraft.world.level.block.entity.BlockEntity> void setController(net.minecraft.world.level.block.entity.BlockEntityType<T> type, BlockEntityInstancingController<? super T> instancingController)
      Sets the instancing controller for the given block entity type.
      Type Parameters:
      T - The type of the block entity.
      Parameters:
      type - The block entity type to set the instancing controller for.
      instancingController - The instancing controller to set.
    • setController

      public static <T extends net.minecraft.world.entity.Entity> void setController(net.minecraft.world.entity.EntityType<T> type, EntityInstancingController<? super T> instancingController)
      Sets the instancing controller for the given entity type.
      Type Parameters:
      T - The type of the entity.
      Parameters:
      type - The entity type to set the instancing controller for.
      instancingController - The instancing controller to set.
    • getType

      public static <T extends net.minecraft.world.level.block.entity.BlockEntity> net.minecraft.world.level.block.entity.BlockEntityType<? super T> getType(T blockEntity)
      Gets the type of the given block entity.
      Type Parameters:
      T - The type of the block entity.
      Parameters:
      blockEntity - The block entity to get the type of.
      Returns:
      The BlockEntityType associated with the given block entity.
    • getType

      public static <T extends net.minecraft.world.entity.Entity> net.minecraft.world.entity.EntityType<? super T> getType(T entity)
      Gets the type of the given entity.
      Type Parameters:
      T - The type of the entity.
      Parameters:
      entity - The entity to get the type of.
      Returns:
      The EntityType associated with the given entity.