Search in sources :

Example 1 with MovementBehaviour

use of com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour in project Create by Creators-of-Create.

the class ContraptionInstanceManager method createActor.

@Nullable
public ActorInstance createActor(Pair<StructureBlockInfo, MovementContext> actor) {
    StructureBlockInfo blockInfo = actor.getLeft();
    MovementContext context = actor.getRight();
    MovementBehaviour movementBehaviour = AllMovementBehaviours.of(blockInfo.state);
    if (movementBehaviour != null && movementBehaviour.hasSpecialInstancedRendering()) {
        ActorInstance instance = movementBehaviour.createInstance(materialManager, renderWorld, context);
        actors.add(instance);
        return instance;
    }
    return null;
}
Also used : StructureBlockInfo(net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo) MovementContext(com.simibubi.create.content.contraptions.components.structureMovement.MovementContext) MovementBehaviour(com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour) Nullable(javax.annotation.Nullable)

Example 2 with MovementBehaviour

use of com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour in project Create by Creators-of-Create.

the class ContraptionRenderDispatcher method renderActors.

protected static void renderActors(Level world, VirtualRenderWorld renderWorld, Contraption c, ContraptionMatrices matrices, MultiBufferSource buffer) {
    PoseStack m = matrices.getModel();
    for (Pair<StructureTemplate.StructureBlockInfo, MovementContext> actor : c.getActors()) {
        MovementContext context = actor.getRight();
        if (context == null)
            continue;
        if (context.world == null)
            context.world = world;
        StructureTemplate.StructureBlockInfo blockInfo = actor.getLeft();
        MovementBehaviour movementBehaviour = AllMovementBehaviours.of(blockInfo.state);
        if (movementBehaviour != null) {
            m.pushPose();
            TransformStack.cast(m).translate(blockInfo.pos);
            movementBehaviour.renderInContraption(context, renderWorld, matrices, buffer);
            m.popPose();
        }
    }
}
Also used : PoseStack(com.mojang.blaze3d.vertex.PoseStack) StructureTemplate(net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate) MovementContext(com.simibubi.create.content.contraptions.components.structureMovement.MovementContext) MovementBehaviour(com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour)

Aggregations

MovementBehaviour (com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour)2 MovementContext (com.simibubi.create.content.contraptions.components.structureMovement.MovementContext)2 PoseStack (com.mojang.blaze3d.vertex.PoseStack)1 Nullable (javax.annotation.Nullable)1 StructureTemplate (net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate)1 StructureBlockInfo (net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo)1