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(DataComponentPatch) upgrade item}.default Stream
<net.minecraft.resources.ResourceLocation> Get the models that this turtle modeller depends on.getModel
(T upgrade, @Nullable ITurtleAccess turtle, TurtleSide side, net.minecraft.core.component.DataComponentPatch data) Obtain the model to be used when rendering a turtle peripheral.static <T extends ITurtleUpgrade>
TurtleUpgradeModeller<T> sided
(ModelLocation left, ModelLocation 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
TransformedModel getModel(T upgrade, @Nullable ITurtleAccess turtle, TurtleSide side, net.minecraft.core.component.DataComponentPatch data) 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, side and data.
- 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.side
- Which side of the turtle (left or right) the upgrade resides on.data
- Upgrade data instance for current turtle side.- Returns:
- The model that you wish to be used to render your upgrade.
-
getDependencies
Get the models that this turtle modeller depends on.Models included in this stream 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:
-
flatItem
A basicTurtleUpgradeModeller
which renders using the upgrade's UpgradeBase.getUpgradeItem(DataComponentPatch) 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.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.
-
sided
static <T extends ITurtleUpgrade> TurtleUpgradeModeller<T> sided(ModelLocation left, ModelLocation 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.
-