Interface TurtleUpgradeModeller<T extends ITurtleUpgrade>

Type Parameters:
T - The type of turtle upgrade this modeller applies to.

public interface TurtleUpgradeModeller<T extends ITurtleUpgrade>
Provides models for a ITurtleUpgrade.

Use dan200.computercraft.api.client.FabricComputerCraftAPIClient#registerTurtleUpgradeModeller to register a modeller on Fabric and dan200.computercraft.api.client.turtle.RegisterTurtleModellersEvent to register one on Forge

See Also:
  • Method Details

    • getModel

      TransformedModel getModel(T upgrade, @Nullable ITurtleAccess turtle, TurtleSide side)
      Obtain the model to be used when rendering a turtle peripheral.

      When the current turtle is null, this function should be constant for a given upgrade and side.

      Parameters:
      upgrade - The upgrade that you're getting the model for.
      turtle - Access to the turtle that the upgrade resides on. This will be null when getting item models, unless getModel(ITurtleUpgrade, CompoundTag, TurtleSide) is overriden.
      side - Which side of the turtle (left or right) the upgrade resides on.
      Returns:
      The model that you wish to be used to render your upgrade.
    • getModel

      default TransformedModel getModel(T upgrade, net.minecraft.nbt.CompoundTag data, TurtleSide side)
      Obtain the model to be used when rendering a turtle peripheral.

      This is used when rendering the turtle's item model, and so no ITurtleAccess is available.

      Parameters:
      upgrade - The upgrade that you're getting the model for.
      data - Upgrade data instance for current turtle side.
      side - Which side of the turtle (left or right) the upgrade resides on.
      Returns:
      The model that you wish to be used to render your upgrade.
    • getDependencies

      default Collection<net.minecraft.resources.ResourceLocation> getDependencies()
      Get a list of models that this turtle modeller depends on.

      Models included in this list will be loaded and baked alongside item and block models, and so may be referenced by TransformedModel.of(ResourceLocation). You do not need to override this method if you will load models by other means.

      Returns:
      A list of models that this modeller depends on.
      See Also:
      • UnbakedModel.getDependencies()
    • flatItem

      static <T extends ITurtleUpgrade> TurtleUpgradeModeller<T> flatItem()
      A basic TurtleUpgradeModeller which renders using the upgrade's UpgradeBase.getUpgradeItem(CompoundTag) upgrade item}.

      This uses appropriate transformations for "flat" items, namely those extending the minecraft:item/generated model type. It will not appear correct for 3D models with additional depth, such as blocks.

      Type Parameters:
      T - The type of the turtle upgrade.
      Returns:
      The constructed modeller.
    • sided

      static <T extends ITurtleUpgrade> TurtleUpgradeModeller<T> sided(net.minecraft.client.resources.model.ModelResourceLocation left, net.minecraft.client.resources.model.ModelResourceLocation right)
      Construct a TurtleUpgradeModeller which has a single model for the left and right side.
      Type Parameters:
      T - The type of the turtle upgrade.
      Parameters:
      left - The model to use on the left.
      right - The model to use on the right.
      Returns:
      The constructed modeller.
    • sided

      static <T extends ITurtleUpgrade> TurtleUpgradeModeller<T> sided(net.minecraft.resources.ResourceLocation left, net.minecraft.resources.ResourceLocation right)
      Construct a TurtleUpgradeModeller which has a single model for the left and right side.
      Type Parameters:
      T - The type of the turtle upgrade.
      Parameters:
      left - The model to use on the left.
      right - The model to use on the right.
      Returns:
      The constructed modeller.