Class ArmatureBlockRenderer<T extends net.minecraft.world.level.block.entity.BlockEntity>
java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.armature.render.ArmatureBlockRenderer<T>
- All Implemented Interfaces:
net.minecraft.client.renderer.blockentity.BlockEntityRenderer<T, ArmatureBlockRenderer.State>
public class ArmatureBlockRenderer<T extends net.minecraft.world.level.block.entity.BlockEntity>
extends Object
implements net.minecraft.client.renderer.blockentity.BlockEntityRenderer<T, ArmatureBlockRenderer.State>
Draws a block entity with an armature, standing on the bottom of its block and turned to the block's
facing if it
has one (the model's front, north in Blockbench, toward that side). Blockbench "Java Block" models, whose origin is
a corner, are moved to fit by themselves. Give the block RenderShape.INVISIBLE so only the armature shows.
BlockEntityRendererRegistry.register(MyBlocks.TURRET_ENTITY, ArmatureBlockRenderer.of(Armature.of("mymod", "turret"), renderer -> renderer
.animate(animator -> {
animator.lookAt("barrel").range(12).smoothing(0.3F);
animator.layer("base").drive(ctx -> ctx.<TurretEntity>owner().isFiring() ? FIRE : IDLE);
})));
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classWhat an armature-driven block entity is drawn from, each frame. -
Constructor Summary
ConstructorsConstructorDescriptionArmatureBlockRenderer(net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context context, Armature armature) -
Method Summary
Modifier and TypeMethodDescriptionarmature()attach(String point, ArmatureAttachment attachment) voidextractRenderState(T blockEntity, ArmatureBlockRenderer.State state, float partialTicks, net.minecraft.world.phys.Vec3 cameraPosition, @Nullable net.minecraft.client.renderer.feature.ModelFeatureRenderer.CrumblingOverlay breakProgress) facing(boolean facing) Whether the model turns to the block'sfacing; on by default.protected net.minecraft.core.DirectionWhich way the model faces; by default the block'sfacing, or north.intstatic <T extends net.minecraft.world.level.block.entity.BlockEntity>
net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider<T, ArmatureBlockRenderer.State> static <T extends net.minecraft.world.level.block.entity.BlockEntity>
net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider<T, ArmatureBlockRenderer.State> of(Armature armature, Consumer<ArmatureBlockRenderer<T>> configure) scale(float scale) protected voidsetupAnimator(Animator animator, T blockEntity) Sets up a new animator, after theanimate(Consumer)setups; for subclasses.booleanvoidsubmit(ArmatureBlockRenderer.State state, com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.renderer.SubmitNodeCollector collector, net.minecraft.client.renderer.state.level.CameraRenderState camera) viewDistance(int blocks) How far away, in blocks, it is still drawn; 64 by default.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.renderer.blockentity.BlockEntityRenderer
shouldRender
-
Constructor Details
-
ArmatureBlockRenderer
public ArmatureBlockRenderer(net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider.Context context, Armature armature)
-
-
Method Details
-
of
public static <T extends net.minecraft.world.level.block.entity.BlockEntity> net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider<T, ArmatureBlockRenderer.State> of(Armature armature, Consumer<ArmatureBlockRenderer<T>> configure) -
of
public static <T extends net.minecraft.world.level.block.entity.BlockEntity> net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider<T, ArmatureBlockRenderer.State> of(Armature armature) -
armature
-
animate
-
texture
public ArmatureBlockRenderer<T> texture(Function<T, @Nullable net.minecraft.resources.Identifier> texture) -
scale
-
facing
Whether the model turns to the block'sfacing; on by default. -
viewDistance
How far away, in blocks, it is still drawn; 64 by default. -
attach
-
setupAnimator
Sets up a new animator, after theanimate(Consumer)setups; for subclasses. -
facing
protected net.minecraft.core.Direction facing(T blockEntity, net.minecraft.world.level.block.state.BlockState state) Which way the model faces; by default the block'sfacing, or north. -
createRenderState
- Specified by:
createRenderStatein interfacenet.minecraft.client.renderer.blockentity.BlockEntityRenderer<T extends net.minecraft.world.level.block.entity.BlockEntity, ArmatureBlockRenderer.State>
-
extractRenderState
public void extractRenderState(T blockEntity, ArmatureBlockRenderer.State state, float partialTicks, net.minecraft.world.phys.Vec3 cameraPosition, @Nullable net.minecraft.client.renderer.feature.ModelFeatureRenderer.CrumblingOverlay breakProgress) - Specified by:
extractRenderStatein interfacenet.minecraft.client.renderer.blockentity.BlockEntityRenderer<T extends net.minecraft.world.level.block.entity.BlockEntity, ArmatureBlockRenderer.State>
-
submit
public void submit(ArmatureBlockRenderer.State state, com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.renderer.SubmitNodeCollector collector, net.minecraft.client.renderer.state.level.CameraRenderState camera) - Specified by:
submitin interfacenet.minecraft.client.renderer.blockentity.BlockEntityRenderer<T extends net.minecraft.world.level.block.entity.BlockEntity, ArmatureBlockRenderer.State>
-
shouldRenderOffScreen
public boolean shouldRenderOffScreen()- Specified by:
shouldRenderOffScreenin interfacenet.minecraft.client.renderer.blockentity.BlockEntityRenderer<T extends net.minecraft.world.level.block.entity.BlockEntity, ArmatureBlockRenderer.State>
-
getViewDistance
public int getViewDistance()- Specified by:
getViewDistancein interfacenet.minecraft.client.renderer.blockentity.BlockEntityRenderer<T extends net.minecraft.world.level.block.entity.BlockEntity, ArmatureBlockRenderer.State>
-