shit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package dev.tggamesyt.szar.client;
|
||||
|
||||
import dev.tggamesyt.szar.HitterEntity;
|
||||
import dev.tggamesyt.szar.NiggerEntity;
|
||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||
import net.minecraft.client.render.entity.MobEntityRenderer;
|
||||
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
||||
import net.minecraft.client.render.entity.model.EntityModelLayers;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class HitterEntityRenderer
|
||||
extends MobEntityRenderer<HitterEntity, BipedEntityModel<HitterEntity>> {
|
||||
|
||||
public HitterEntityRenderer(EntityRendererFactory.Context context) {
|
||||
super(
|
||||
context,
|
||||
new BipedEntityModel<>(context.getPart(EntityModelLayers.PLAYER)),
|
||||
0.5F
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getTexture(HitterEntity entity) {
|
||||
return new Identifier("szar", "textures/entity/hitter.png");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package dev.tggamesyt.szar.client;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.entity.animation.Animation;
|
||||
|
||||
import static dev.tggamesyt.szar.PlaneAnimation.*;
|
||||
import dev.tggamesyt.szar.PlaneAnimation;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class PlaneAnimationResolver {
|
||||
|
||||
public static Animation resolve(PlaneAnimation anim) {
|
||||
return switch (anim) {
|
||||
case START_ENGINE -> PlaneEntityAnimations.start_engine;
|
||||
case STOP_ENGINE -> PlaneEntityAnimations.stop_engine;
|
||||
case FLYING -> PlaneEntityAnimations.flying;
|
||||
case LANDING -> PlaneEntityAnimations.landing;
|
||||
case LAND_STARTED -> PlaneEntityAnimations.land_started;
|
||||
case LIFT_UP -> PlaneEntityAnimations.lift_up;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
package dev.tggamesyt.szar.client;// 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 5.0.7
|
||||
* Exported for Minecraft version 1.19 or later with Yarn mappings
|
||||
* @author Author
|
||||
*/
|
||||
public class PlaneEntityAnimations {
|
||||
public static final Animation start_engine = Animation.Builder.create(2.2917F)
|
||||
.addBoneAnimation("rotor", new Transformation(Transformation.Targets.ROTATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 360.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 180.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 90.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.7917F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -180.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -900.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(2.2917F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -2520.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.build();
|
||||
|
||||
public static final Animation stop_engine = Animation.Builder.create(2.0F)
|
||||
.addBoneAnimation("rotor", new Transformation(Transformation.Targets.ROTATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -2070.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -1440.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -1980.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -2250.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -2520.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.build();
|
||||
|
||||
public static final Animation land_started = Animation.Builder.create(0.25F).looping()
|
||||
.addBoneAnimation("rotor", new Transformation(Transformation.Targets.ROTATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2520.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.build();
|
||||
|
||||
public static final Animation flying = Animation.Builder.create(0.25F).looping()
|
||||
.addBoneAnimation("rotor", new Transformation(Transformation.Targets.ROTATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2520.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("right_wheel", new Transformation(Transformation.Targets.ROTATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -107.5F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("right_wheel", new Transformation(Transformation.Targets.TRANSLATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("left_wheel", new Transformation(Transformation.Targets.ROTATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 107.5F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("left_wheel", new Transformation(Transformation.Targets.TRANSLATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.build();
|
||||
|
||||
public static final Animation landing = Animation.Builder.create(2.0F)
|
||||
.addBoneAnimation("base", new Transformation(Transformation.Targets.TRANSLATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.75F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("rotor", new Transformation(Transformation.Targets.ROTATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2520.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 1800.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 720.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -360.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.25F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -1800.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -3240.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -4320.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -5760.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("rotor", new Transformation(Transformation.Targets.TRANSLATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.75F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("back_wing", new Transformation(Transformation.Targets.TRANSLATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.75F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("right_wing", new Transformation(Transformation.Targets.TRANSLATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.75F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("left_wing", new Transformation(Transformation.Targets.TRANSLATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.75F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("right_wheel", new Transformation(Transformation.Targets.ROTATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -107.5F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -107.5F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("right_wheel", new Transformation(Transformation.Targets.TRANSLATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("left_wheel", new Transformation(Transformation.Targets.ROTATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 107.5F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 107.5F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("left_wheel", new Transformation(Transformation.Targets.TRANSLATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.build();
|
||||
|
||||
public static final Animation lift_up = Animation.Builder.create(1.5F)
|
||||
.addBoneAnimation("base", new Transformation(Transformation.Targets.ROTATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("base", new Transformation(Transformation.Targets.TRANSLATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.25F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("rotor", new Transformation(Transformation.Targets.ROTATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2520.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 1800.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -2160.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -3600.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.25F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -4680.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -6120.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("rotor", new Transformation(Transformation.Targets.TRANSLATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.25F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("back_wing", new Transformation(Transformation.Targets.TRANSLATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.25F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("right_wing", new Transformation(Transformation.Targets.TRANSLATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.25F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("left_wing", new Transformation(Transformation.Targets.TRANSLATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.25F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("right_wheel", new Transformation(Transformation.Targets.ROTATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -107.5F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("right_wheel", new Transformation(Transformation.Targets.TRANSLATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("left_wheel", new Transformation(Transformation.Targets.ROTATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 107.5F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.addBoneAnimation("left_wheel", new Transformation(Transformation.Targets.TRANSLATE,
|
||||
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
|
||||
new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR)
|
||||
))
|
||||
.build();
|
||||
}
|
||||
124
src/client/java/dev/tggamesyt/szar/client/PlaneEntityModel.java
Normal file
124
src/client/java/dev/tggamesyt/szar/client/PlaneEntityModel.java
Normal file
@@ -0,0 +1,124 @@
|
||||
package dev.tggamesyt.szar.client;
|
||||
|
||||
import dev.tggamesyt.szar.PlaneEntity;
|
||||
import dev.tggamesyt.szar.PlaneAnimation;
|
||||
import net.minecraft.client.model.*;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.entity.animation.Animation;
|
||||
import net.minecraft.client.render.entity.animation.AnimationHelper;
|
||||
import net.minecraft.client.render.entity.model.SinglePartEntityModel;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.AnimationState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
// Made with Blockbench 5.0.7
|
||||
// Exported for Minecraft version 1.17+ for Yarn
|
||||
// Paste this class into your mod and generate all required imports
|
||||
public class PlaneEntityModel extends SinglePartEntityModel<Entity> {
|
||||
private final Vector3f tempVec = new Vector3f();
|
||||
private final ModelPart root;
|
||||
private final ModelPart right_wheel;
|
||||
private final ModelPart base;
|
||||
private final ModelPart left_wheel;
|
||||
private final ModelPart left_wing;
|
||||
private final ModelPart right_wing;
|
||||
private final ModelPart back_wing;
|
||||
private final ModelPart rotor;
|
||||
public PlaneEntityModel(ModelPart root) {
|
||||
this.root = root;
|
||||
this.right_wheel = root.getChild("right_wheel");
|
||||
this.base = root.getChild("base");
|
||||
this.left_wheel = root.getChild("left_wheel");
|
||||
this.left_wing = root.getChild("left_wing");
|
||||
this.right_wing = root.getChild("right_wing");
|
||||
this.back_wing = root.getChild("back_wing");
|
||||
this.rotor = root.getChild("rotor");
|
||||
}
|
||||
public final AnimationState engineStart = new AnimationState();
|
||||
public final AnimationState flying = new AnimationState();
|
||||
public final AnimationState engineStop = new AnimationState();
|
||||
|
||||
public static TexturedModelData getTexturedModelData() {
|
||||
ModelData modelData = new ModelData();
|
||||
ModelPartData modelPartData = modelData.getRoot();
|
||||
ModelPartData right_wheel = modelPartData.addChild("right_wheel", ModelPartBuilder.create().uv(24, 58).cuboid(-2.0F, 3.0F, -1.0F, 2.0F, 2.0F, 2.0F, new Dilation(0.0F)), ModelTransform.pivot(-3.0F, 19.0F, 0.0F));
|
||||
|
||||
ModelPartData cube_r1 = right_wheel.addChild("cube_r1", ModelPartBuilder.create().uv(32, 58).cuboid(0.0F, -3.0F, -1.0F, 1.0F, 3.0F, 2.0F, new Dilation(0.0F)), ModelTransform.of(-1.0F, 3.0F, 0.0F, 0.0F, 0.0F, 0.3927F));
|
||||
|
||||
ModelPartData base = modelPartData.addChild("base", ModelPartBuilder.create().uv(24, 55).cuboid(-3.0F, 0.0F, -1.0F, 6.0F, 1.0F, 2.0F, new Dilation(0.0F))
|
||||
.uv(0, 24).cuboid(-2.0F, -1.0F, -11.0F, 4.0F, 1.0F, 18.0F, new Dilation(0.0F))
|
||||
.uv(44, 24).cuboid(2.0F, -3.0F, -8.0F, 1.0F, 2.0F, 15.0F, new Dilation(0.0F))
|
||||
.uv(44, 24).cuboid(-3.0F, -3.0F, -8.0F, 1.0F, 2.0F, 15.0F, new Dilation(0.0F))
|
||||
.uv(0, 0).cuboid(-2.0F, -3.0F, -12.0F, 4.0F, 2.0F, 22.0F, new Dilation(0.0F))
|
||||
.uv(44, 41).cuboid(-1.0F, -5.0F, -8.0F, 2.0F, 2.0F, 12.0F, new Dilation(0.0F))
|
||||
.uv(52, 12).cuboid(-1.0F, -10.0F, 13.0F, 2.0F, 7.0F, 4.0F, new Dilation(0.0F))
|
||||
.uv(24, 62).cuboid(-1.0F, -3.0F, -13.0F, 2.0F, 1.0F, 1.0F, new Dilation(0.0F))
|
||||
.uv(0, 55).cuboid(1.0F, -5.0F, -7.0F, 1.0F, 2.0F, 11.0F, new Dilation(0.0F))
|
||||
.uv(0, 55).cuboid(-2.0F, -5.0F, -7.0F, 1.0F, 2.0F, 11.0F, new Dilation(0.0F))
|
||||
.uv(34, 51).cuboid(-1.0F, -4.0F, 4.0F, 2.0F, 1.0F, 3.0F, new Dilation(0.0F))
|
||||
.uv(60, 61).cuboid(1.0F, -4.0F, 4.0F, 1.0F, 1.0F, 2.0F, new Dilation(0.0F))
|
||||
.uv(60, 61).cuboid(-2.0F, -4.0F, 4.0F, 1.0F, 1.0F, 2.0F, new Dilation(0.0F))
|
||||
.uv(52, 0).cuboid(-1.0F, -6.0F, -7.0F, 2.0F, 1.0F, 11.0F, new Dilation(0.0F))
|
||||
.uv(52, 61).cuboid(-1.0F, -5.0F, 4.0F, 2.0F, 1.0F, 2.0F, new Dilation(0.0F))
|
||||
.uv(38, 62).cuboid(-1.0F, -4.0F, -9.0F, 2.0F, 1.0F, 1.0F, new Dilation(0.0F)), ModelTransform.pivot(0.0F, 19.0F, 0.0F));
|
||||
|
||||
ModelPartData cube_r2 = base.addChild("cube_r2", ModelPartBuilder.create().uv(40, 55).cuboid(-1.0F, -2.0F, -1.0F, 2.0F, 3.0F, 4.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, -2.0F, 11.0F, 0.3927F, 0.0F, 0.0F));
|
||||
|
||||
ModelPartData left_wheel = modelPartData.addChild("left_wheel", ModelPartBuilder.create().uv(24, 58).cuboid(0.0F, 3.0F, -1.0F, 2.0F, 2.0F, 2.0F, new Dilation(0.0F)), ModelTransform.pivot(3.0F, 19.0F, 0.0F));
|
||||
|
||||
ModelPartData cube_r3 = left_wheel.addChild("cube_r3", ModelPartBuilder.create().uv(32, 58).cuboid(-1.0F, -3.0F, -1.0F, 1.0F, 3.0F, 2.0F, new Dilation(0.0F)), ModelTransform.of(1.0F, 3.0F, 0.0F, 0.0F, 0.0F, -0.3927F));
|
||||
|
||||
ModelPartData left_wing = modelPartData.addChild("left_wing", ModelPartBuilder.create(), ModelTransform.pivot(2.0F, 18.0F, -5.0F));
|
||||
|
||||
ModelPartData cube_r4 = left_wing.addChild("cube_r4", ModelPartBuilder.create().uv(0, 43).cuboid(0.0F, 0.0F, 0.0F, 15.0F, 1.0F, 7.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 0.0F, -0.3927F, 0.0F));
|
||||
|
||||
ModelPartData right_wing = modelPartData.addChild("right_wing", ModelPartBuilder.create(), ModelTransform.pivot(-2.0F, 18.0F, -5.0F));
|
||||
|
||||
ModelPartData cube_r5 = right_wing.addChild("cube_r5", ModelPartBuilder.create().uv(0, 43).cuboid(-15.0F, 0.0F, 0.0F, 15.0F, 1.0F, 7.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 0.0F, 0.3927F, 0.0F));
|
||||
|
||||
ModelPartData back_wing = modelPartData.addChild("back_wing", ModelPartBuilder.create(), ModelTransform.pivot(0.0F, 16.0F, 14.0F));
|
||||
|
||||
ModelPartData cube_r6 = back_wing.addChild("cube_r6", ModelPartBuilder.create().uv(0, 51).cuboid(-7.0F, -1.0F, 0.0F, 14.0F, 1.0F, 3.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 0.3927F, 0.0F, 0.0F));
|
||||
|
||||
ModelPartData rotor = modelPartData.addChild("rotor", ModelPartBuilder.create().uv(52, 55).cuboid(-3.0F, -3.0F, 0.0F, 6.0F, 6.0F, 0.0F, new Dilation(0.0F)), ModelTransform.pivot(0.0F, 16.0F, -13.0F));
|
||||
return TexturedModelData.of(modelData, 128, 128);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, float red, float green, float blue, float alpha) {
|
||||
right_wheel.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
|
||||
base.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
|
||||
left_wheel.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
|
||||
left_wing.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
|
||||
right_wing.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
|
||||
back_wing.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
|
||||
rotor.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelPart getPart() {
|
||||
return this.root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAngles(Entity entity, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch) {
|
||||
// Reset transforms
|
||||
this.root.traverse().forEach(ModelPart::resetTransform);
|
||||
if (entity instanceof PlaneEntity planeEntity) {
|
||||
PlaneAnimation anim = planeEntity.getCurrentAnimation();
|
||||
|
||||
if (anim != null) {
|
||||
AnimationHelper.animate(
|
||||
this,
|
||||
PlaneAnimationResolver.resolve(anim),
|
||||
planeEntity.age,
|
||||
1.0F,
|
||||
tempVec
|
||||
);
|
||||
} else {
|
||||
this.root.traverse().forEach(ModelPart::resetTransform);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package dev.tggamesyt.szar.client;
|
||||
|
||||
import dev.tggamesyt.szar.PlaneEntity;
|
||||
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.render.entity.*;
|
||||
import net.minecraft.client.render.entity.model.EntityModelLayer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class PlaneEntityRenderer extends EntityRenderer<PlaneEntity> {
|
||||
|
||||
public static final EntityModelLayer MODEL_LAYER =
|
||||
new EntityModelLayer(new Identifier("szar", "plane"), "main");
|
||||
|
||||
private final PlaneEntityModel model;
|
||||
|
||||
public PlaneEntityRenderer(EntityRendererFactory.Context ctx) {
|
||||
super(ctx);
|
||||
this.model = new PlaneEntityModel(ctx.getPart(MODEL_LAYER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getTexture(PlaneEntity entity) {
|
||||
return new Identifier("szar", "textures/entity/plane.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(
|
||||
PlaneEntity entity,
|
||||
float yaw,
|
||||
float tickDelta,
|
||||
MatrixStack matrices,
|
||||
VertexConsumerProvider vertices,
|
||||
int light
|
||||
) {
|
||||
matrices.push();
|
||||
matrices.scale(4.0F, 4.0F, 4.0F);
|
||||
matrices.translate(0.0, 1.5, 0.0);
|
||||
matrices.scale(-1.0F, -1.0F, 1.0F);
|
||||
|
||||
model.setAngles(
|
||||
entity,
|
||||
0,
|
||||
0,
|
||||
entity.age + tickDelta,
|
||||
0,
|
||||
0
|
||||
);
|
||||
|
||||
VertexConsumer consumer =
|
||||
vertices.getBuffer(RenderLayer.getEntityCutout(getTexture(entity)));
|
||||
|
||||
model.render(matrices, consumer, light, OverlayTexture.DEFAULT_UV,
|
||||
1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
matrices.pop();
|
||||
super.render(entity, yaw, tickDelta, matrices, vertices, light);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,24 @@
|
||||
package dev.tggamesyt.szar.client;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import dev.tggamesyt.szar.PlaneEntity;
|
||||
import dev.tggamesyt.szar.Szar;
|
||||
import dev.tggamesyt.szar.PlaneAnimation;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import net.minecraft.client.render.entity.animation.Animation;
|
||||
import net.minecraft.client.render.entity.model.EntityModelLayer;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
@@ -20,11 +26,45 @@ import net.minecraft.util.math.random.Random;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static dev.tggamesyt.szar.Szar.HitterEntityType;
|
||||
import static dev.tggamesyt.szar.Szar.PLANE_ANIM_PACKET;
|
||||
import static javax.swing.text.html.HTML.Attribute.ID;
|
||||
|
||||
public class SzarClient implements ClientModInitializer {
|
||||
private static final Map<KeyBinding, KeyBinding> activeScramble = new HashMap<>();
|
||||
public static final EntityModelLayer PLANE =
|
||||
new EntityModelLayer(
|
||||
new Identifier("szar", "plane"),
|
||||
"main"
|
||||
);
|
||||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
ClientPlayNetworking.registerGlobalReceiver(
|
||||
PLANE_ANIM_PACKET,
|
||||
(client, handler, buf, sender) -> {
|
||||
|
||||
int entityId = buf.readInt();
|
||||
PlaneAnimation anim = buf.readEnumConstant(PlaneAnimation.class);
|
||||
|
||||
client.execute(() -> {
|
||||
if (client.world == null) return;
|
||||
|
||||
Entity e = client.world.getEntityById(entityId);
|
||||
if (!(e instanceof PlaneEntity plane)) return;
|
||||
|
||||
if (anim == null) {
|
||||
plane.stopAnimation();
|
||||
return;
|
||||
}
|
||||
|
||||
plane.playAnimation(anim, anim.looping);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
ClientPlayNetworking.registerGlobalReceiver(
|
||||
Szar.TOTEMPACKET,
|
||||
(client, handler, buf, responseSender) -> {
|
||||
@@ -41,6 +81,10 @@ public class SzarClient implements ClientModInitializer {
|
||||
Szar.NiggerEntityType,
|
||||
NiggerEntityRenderer::new
|
||||
);
|
||||
EntityRendererRegistry.register(
|
||||
Szar.HitterEntityType,
|
||||
HitterEntityRenderer::new
|
||||
);
|
||||
EntityRendererRegistry.register(
|
||||
Szar.PoliceEntityType,
|
||||
PoliceEntityRenderer::new
|
||||
@@ -49,6 +93,14 @@ public class SzarClient implements ClientModInitializer {
|
||||
Szar.TERRORIST_ENTITY_TYPE,
|
||||
TerroristEntityRenderer::new
|
||||
);
|
||||
EntityRendererRegistry.register(
|
||||
Szar.PLANE_ENTITY_TYPE,
|
||||
PlaneEntityRenderer::new
|
||||
);
|
||||
EntityModelLayerRegistry.registerModelLayer(
|
||||
PLANE,
|
||||
PlaneEntityModel::getTexturedModelData
|
||||
);
|
||||
|
||||
EntityRendererRegistry.register(
|
||||
Szar.GYPSY_ENTITY_TYPE,
|
||||
|
||||
Reference in New Issue
Block a user