Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/dev/amble/ait/client/AITModClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ public static void blockEntityRendererRegister() {
BlockEntityRendererFactories.register(AITBlockEntityTypes.CONSOLE_GENERATOR_ENTITY_TYPE,
ConsoleGeneratorRenderer::new);
BlockEntityRendererFactories.register(AITBlockEntityTypes.EXTERIOR_BLOCK_ENTITY_TYPE, ExteriorRenderer::new);
BlockEntityRendererFactories.register(AITBlockEntityTypes.TOYOTA_SPINNING_ROTOR_ENTITY_TYPE, ToyotaSpinningRotorRenderer::new);
BlockEntityRendererFactories.register(AITBlockEntityTypes.DOOR_BLOCK_ENTITY_TYPE, DoorRenderer::new);
BlockEntityRendererFactories.register(AITBlockEntityTypes.CORAL_BLOCK_ENTITY_TYPE, CoralRenderer::new);
BlockEntityRendererFactories.register(AITBlockEntityTypes.MONITOR_BLOCK_ENTITY_TYPE, MonitorRenderer::new);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package dev.amble.ait.client.animation.machines;// Save this class in your mod and generate all required imports

import net.minecraft.client.render.entity.animation.Animation;
import net.minecraft.client.render.entity.animation.AnimationHelper;
import net.minecraft.client.render.entity.animation.Keyframe;
import net.minecraft.client.render.entity.animation.Transformation;

/**
* Made with Blockbench 4.12.4
* Exported for Minecraft version 1.19 or later with Yarn mappings
* @author Loqor
*/
public class ToyotaSpinningRotorAnimation {
public static final Animation START_UP = Animation.Builder.create(9.0F).looping()
.addBoneAnimation("ring1", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.875F, AnimationHelper.createRotationalVector(0.0F, -15.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.7083F, AnimationHelper.createRotationalVector(0.0F, -35.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(2.5417F, AnimationHelper.createRotationalVector(0.0F, -60.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(3.25F, AnimationHelper.createRotationalVector(0.0F, -90.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(9.0F, AnimationHelper.createRotationalVector(0.0F, -360.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.addBoneAnimation("ring2", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.875F, AnimationHelper.createRotationalVector(0.0F, 15.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.7083F, AnimationHelper.createRotationalVector(0.0F, 35.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(2.5417F, AnimationHelper.createRotationalVector(0.0F, 60.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(3.25F, AnimationHelper.createRotationalVector(0.0F, 90.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(9.0F, AnimationHelper.createRotationalVector(0.0F, 360.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.build();

public static final Animation FLIGHT = Animation.Builder.create(9.0F).looping()
.addBoneAnimation("ring1", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(9.0F, AnimationHelper.createRotationalVector(0.0F, -360.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.addBoneAnimation("ring2", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(9.0F, AnimationHelper.createRotationalVector(0.0F, 360.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.build();

public static final Animation STOP = Animation.Builder.create(9.0F)
.addBoneAnimation("ring1", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 360.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(6.25F, AnimationHelper.createRotationalVector(0.0F, 90.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(6.9583F, AnimationHelper.createRotationalVector(0.0F, 60.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(7.5417F, AnimationHelper.createRotationalVector(0.0F, 35.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(8.125F, AnimationHelper.createRotationalVector(0.0F, 15.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(9.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.addBoneAnimation("ring2", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, -360.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(6.25F, AnimationHelper.createRotationalVector(0.0F, -90.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(6.9583F, AnimationHelper.createRotationalVector(0.0F, -60.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(7.5417F, AnimationHelper.createRotationalVector(0.0F, -35.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(8.125F, AnimationHelper.createRotationalVector(0.0F, -15.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(9.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.build();

public static final Animation FLIGHT_APERTURE = Animation.Builder.create(9.0F).looping()
.addBoneAnimation("ring1", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(9.0F, AnimationHelper.createRotationalVector(0.0F, -720.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.addBoneAnimation("ring3", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(9.0F, AnimationHelper.createRotationalVector(0.0F, -1440.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.addBoneAnimation("ring2", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(9.0F, AnimationHelper.createRotationalVector(0.0F, -1440.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.build();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package dev.amble.ait.client.models.machines;

import java.util.function.Function;

import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.entity.animation.Animation;
import net.minecraft.client.render.entity.model.SinglePartEntityModel;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.util.Identifier;

import dev.amble.ait.AITMod;
import dev.amble.ait.core.blockentities.ToyotaSpinningRotorBlockEntity;
import dev.amble.ait.core.tardis.handler.travel.TravelHandlerBase;

@SuppressWarnings("rawtypes")
public abstract class SpinningRotorModel extends SinglePartEntityModel {
public SpinningRotorModel() {
this(RenderLayer::getEntityCutoutNoCull);
}

public SpinningRotorModel(Function<Identifier, RenderLayer> function) {
super(function);
}

public void animateBlockEntity(ToyotaSpinningRotorBlockEntity rotor, TravelHandlerBase.State state, boolean hasPower) {
// fyi, this is directly referencing camel animation code, its just specific
// according to
// the
// block entity that
// is being used
// to detect different states. - Loqor
this.getPart().traverse().forEach(ModelPart::resetTransform);

if (hasPower && AITMod.CONFIG.CLIENT.ANIMATE_CONSOLE) {
this.updateAnimation(rotor.ANIM_STATE, this.getAnimationForState(state), rotor.getAge(), 1.0f);
}
}

public void renderWithAnimations(ToyotaSpinningRotorBlockEntity console, ModelPart root, MatrixStack matrices,
VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float pAlpha) {
root.render(matrices, vertices, light, overlay, red, green, blue, pAlpha);
}

@Override
public void setAngles(Entity entity, float limbAngle, float limbDistance, float animationProgress, float headYaw,
float headPitch) {
}

public abstract Animation getAnimationForState(TravelHandlerBase.State state);
}
Loading