Interface TurtleUpgradeModeller<T extends ITurtleUpgrade>
- Type Parameters:
T
- The type of turtle upgrade this modeller applies to.
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.
Example
Fabric
FabricComputerCraftAPIClient.registerTurtleUpgradeModeller(ExampleMod.EXAMPLE_TURTLE_UPGRADE, TurtleUpgradeModeller.flatItem());
Forge
FabricComputerCraftAPIClient.registerTurtleUpgradeModeller(ExampleMod.EXAMPLE_TURTLE_UPGRADE, TurtleUpgradeModeller.flatItem());
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends ITurtleUpgrade>
TurtleUpgradeModeller<T>flatItem()
A basicTurtleUpgradeModeller
which renders using the upgrade's UpgradeBase.getUpgradeItem(CompoundTag) upgrade item}.default Collection<net.minecraft.resources.ResourceLocation>
Get a list of models that this turtle modeller depends on.getModel
(T upgrade, @Nullable ITurtleAccess turtle, TurtleSide side) Obtain the model to be used when rendering a turtle peripheral.default TransformedModel
getModel
(T upgrade, net.minecraft.nbt.CompoundTag data, TurtleSide side) Obtain the model to be used when rendering a turtle peripheral.static <T extends ITurtleUpgrade>
TurtleUpgradeModeller<T>sided
(net.minecraft.client.resources.model.ModelResourceLocation left, net.minecraft.client.resources.model.ModelResourceLocation right) Construct aTurtleUpgradeModeller
which has a single model for the left and right side.static <T extends ITurtleUpgrade>
TurtleUpgradeModeller<T>sided
(net.minecraft.resources.ResourceLocation left, net.minecraft.resources.ResourceLocation right) Construct aTurtleUpgradeModeller
which has a single model for the left and right side.
-
Method Details
-
getModel
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, unlessgetModel(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
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
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
A basicTurtleUpgradeModeller
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 aTurtleUpgradeModeller
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 aTurtleUpgradeModeller
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.
-