[CustomEntity] Entity stuff
Some checks are pending
build / build (21) (push) Waiting to run

This commit is contained in:
walrus 2025-01-25 16:27:13 -05:00
parent f6eb9849e8
commit f14d693436
14 changed files with 884 additions and 1 deletions

View File

@ -4,7 +4,14 @@ import jesse.keeblarcraft.gui.ClientHandlers;
// import jesse.keeblarcraft.gui.ScreenManager; // import jesse.keeblarcraft.gui.ScreenManager;
// import jesse.keeblarcraft.gui.widgets.TreeWidget; // import jesse.keeblarcraft.gui.widgets.TreeWidget;
import jesse.keeblarcraft.Shortcuts.ShortcutManager; import jesse.keeblarcraft.Shortcuts.ShortcutManager;
import jesse.keeblarcraft.entity.MAKE_ENTITY_REGISTER;
import jesse.keeblarcraft.entity.ModModelsLayers;
import jesse.keeblarcraft.entity.PorcupineRenderer;
import jesse.keeblarcraft.entity.model.PorcupineModel;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
public class KeeblarcraftClient implements ClientModInitializer { public class KeeblarcraftClient implements ClientModInitializer {
@ -16,6 +23,10 @@ public class KeeblarcraftClient implements ClientModInitializer {
// ScreenManager.GetInstance(); // ScreenManager.GetInstance();
// ScreenManager.AddWidget(TreeWidget.class, 10); // ScreenManager.AddWidget(TreeWidget.class, 10);
//Temp Client side Model rendering
EntityRendererRegistry.register(MAKE_ENTITY_REGISTER.PORCUPINE, PorcupineRenderer::new);
EntityModelLayerRegistry.registerModelLayer(ModModelsLayers.PORCUPINE, PorcupineModel::getTexturedModelData);
} }
} }

View File

@ -0,0 +1,12 @@
package jesse.keeblarcraft.entity;
import jesse.keeblarcraft.Keeblarcraft;
import net.minecraft.client.render.entity.model.EntityModelLayer;
import net.minecraft.util.Identifier;
//for registering the final model layers
public class ModModelsLayers {
public static final EntityModelLayer PORCUPINE =
new EntityModelLayer(new Identifier(Keeblarcraft.MOD_ID + "porcupine"), "main");
}

View File

@ -0,0 +1,34 @@
package jesse.keeblarcraft.entity;
import jesse.keeblarcraft.Keeblarcraft;
import jesse.keeblarcraft.entity.model.PorcupineModel;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;
public class PorcupineRenderer extends MobEntityRenderer<PorcupineEntity, PorcupineModel<PorcupineEntity>> {
// private static final Identifier TEXTURE =
// new Identifier(Keeblarcraft.MOD_ID + "src/main/resources/assets/keeblarcraft/textures/entity/porcupine.png");
public PorcupineRenderer(EntityRendererFactory.Context context) {
super(context, new PorcupineModel<>(context.getPart(ModModelsLayers.PORCUPINE)), (float) .6); //.6 is the shadows size of entity
}
@Override
public Identifier getTexture(PorcupineEntity entity) {
return new Identifier(Keeblarcraft.MOD_ID, "textures/entity/porcupine.png");
}
@Override
public void render(PorcupineEntity mobEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) {
if (mobEntity.isBaby()) {
matrixStack.scale((float).5,(float) .5,(float) 1);
} else {
matrixStack.scale((float)2,(float) 2,(float) 2);
}
super.render(mobEntity, f, g, matrixStack, vertexConsumerProvider, i);
}
}

View File

@ -0,0 +1,464 @@
package jesse.keeblarcraft.entity.animation;
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;
public class ModAnimations {
public static final Animation PORCUPINE_WALK = Animation.Builder.create(2.5f).looping()
.addBoneAnimation("torso",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.4167667f, AnimationHelper.createTranslationalVector(0f, 0f, -0.15f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.9583434f, AnimationHelper.createTranslationalVector(0f, 0f, -0.05f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0.05f),
Transformation.Interpolations.LINEAR),
new Keyframe(2.125f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("left_front_leg",
new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.0834333f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.625f, AnimationHelper.createRotationalVector(-11f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(2.0834335f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("right_front_leg",
new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.20834334f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.5416766f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.0834333f, AnimationHelper.createRotationalVector(-11f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.2916767f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("right_back_leg",
new Transformation(Transformation.Targets.ROTATE,
new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.875f, AnimationHelper.createRotationalVector(-11f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(2.2916765f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("left_back_leg",
new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.875f, AnimationHelper.createRotationalVector(-11f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5834333f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(2.0834335f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR))).build();
public static final Animation PORCUPINE_IDLE = Animation.Builder.create(2f).looping()
.addBoneAnimation("torso",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 0.35f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.875f, AnimationHelper.createTranslationalVector(0f, 0.4f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0.4f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, 0.35f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.875f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("torso",
new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("skull",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0.1f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, 0.2f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.9583433f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("skull",
new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.5f, AnimationHelper.createRotationalVector(2f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.75f, AnimationHelper.createRotationalVector(2f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1f, AnimationHelper.createRotationalVector(-2f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.25f, AnimationHelper.createRotationalVector(-2f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("left_front_leg",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.7083434f, AnimationHelper.createTranslationalVector(0f, 0.1f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("right_front_leg",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.9167666f, AnimationHelper.createTranslationalVector(0f, 0.1f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.7916767f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("right_back_leg",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.125f, AnimationHelper.createTranslationalVector(0f, 0.1f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.7916767f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("left_back_leg",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.2916767f, AnimationHelper.createTranslationalVector(0f, 0.1f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.9167667f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR))).build();
public static final Animation PORCUPINE_ATTACK = Animation.Builder.create(2f).looping()
.addBoneAnimation("torso",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.0416767f, AnimationHelper.createTranslationalVector(0f, 0.5f, -1f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0.5f, -1f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5416767f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.875f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("torso",
new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.4167667f, AnimationHelper.createRotationalVector(5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1f, AnimationHelper.createRotationalVector(5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.0416767f, AnimationHelper.createRotationalVector(5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.25f, AnimationHelper.createRotationalVector(5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5416767f, AnimationHelper.createRotationalVector(5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("skull",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.0416767f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5416767f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.875f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("skull",
new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.4167667f, AnimationHelper.createRotationalVector(15f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1f, AnimationHelper.createRotationalVector(15f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.0416767f, AnimationHelper.createRotationalVector(15f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.25f, AnimationHelper.createRotationalVector(15f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5416767f, AnimationHelper.createRotationalVector(15f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(15f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("hair",
new Transformation(Transformation.Targets.SCALE,
new Keyframe(1f, AnimationHelper.createScalingVector(1f, 1f, 1f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.0416767f, AnimationHelper.createScalingVector(1.25f, 1.25f, 1.25f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.25f, AnimationHelper.createScalingVector(1.25f, 1.25f, 1.25f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createScalingVector(1f, 1f, 1f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("spikes",
new Transformation(Transformation.Targets.SCALE,
new Keyframe(1f, AnimationHelper.createScalingVector(1f, 1f, 1f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.0416767f, AnimationHelper.createScalingVector(1.15f, 1.15f, 1.15f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.25f, AnimationHelper.createScalingVector(1.15f, 1.15f, 1.15f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createScalingVector(1f, 1f, 1f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("spikes2",
new Transformation(Transformation.Targets.SCALE,
new Keyframe(1f, AnimationHelper.createScalingVector(1f, 1f, 1f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.0416767f, AnimationHelper.createScalingVector(1.25f, 1.25f, 1.25f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.25f, AnimationHelper.createScalingVector(1.25f, 1.25f, 1.25f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createScalingVector(1f, 1f, 1f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("spikes3",
new Transformation(Transformation.Targets.SCALE,
new Keyframe(1f, AnimationHelper.createScalingVector(1f, 1f, 1f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.0416767f, AnimationHelper.createScalingVector(1.15f, 1.15f, 1.15f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.25f, AnimationHelper.createScalingVector(1.15f, 1.15f, 1.15f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createScalingVector(1f, 1f, 1f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("spikes4",
new Transformation(Transformation.Targets.SCALE,
new Keyframe(1f, AnimationHelper.createScalingVector(1f, 1f, 1f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.0416767f, AnimationHelper.createScalingVector(1.15f, 1.15f, 1.15f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.25f, AnimationHelper.createScalingVector(1.15f, 1.15f, 1.15f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createScalingVector(1f, 1f, 1f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("spikes5",
new Transformation(Transformation.Targets.SCALE,
new Keyframe(1f, AnimationHelper.createScalingVector(1f, 1f, 1f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.0416767f, AnimationHelper.createScalingVector(1.15f, 1.15f, 1.15f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.25f, AnimationHelper.createScalingVector(1.15f, 1.15f, 1.15f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createScalingVector(1f, 1f, 1f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("spikes6",
new Transformation(Transformation.Targets.SCALE,
new Keyframe(1f, AnimationHelper.createScalingVector(1f, 1f, 1f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.0416767f, AnimationHelper.createScalingVector(1.15f, 1.15f, 1.15f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.25f, AnimationHelper.createScalingVector(1.15f, 1.15f, 1.15f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createScalingVector(1f, 1f, 1f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("spikes7",
new Transformation(Transformation.Targets.SCALE,
new Keyframe(1f, AnimationHelper.createScalingVector(1f, 1f, 1f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.0416767f, AnimationHelper.createScalingVector(1.15f, 1.15f, 1.15f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.25f, AnimationHelper.createScalingVector(1.15f, 1.15f, 1.15f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createScalingVector(1f, 1f, 1f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("spikes8",
new Transformation(Transformation.Targets.SCALE,
new Keyframe(1f, AnimationHelper.createScalingVector(1f, 1f, 1f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.0416767f, AnimationHelper.createScalingVector(1.15f, 1.15f, 1.15f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.25f, AnimationHelper.createScalingVector(1.15f, 1.15f, 1.15f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createScalingVector(1f, 1f, 1f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("left_front_leg",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.25f, AnimationHelper.createTranslationalVector(0f, -0.25f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, -0.25f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, -0.25f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("left_front_leg",
new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.25f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("right_front_leg",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.25f, AnimationHelper.createTranslationalVector(0f, -0.25f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, -0.25f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, -0.25f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("right_front_leg",
new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.25f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("right_back_leg",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.25f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("right_back_leg",
new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.25f, AnimationHelper.createRotationalVector(10f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1f, AnimationHelper.createRotationalVector(10f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createRotationalVector(10f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("left_back_leg",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.25f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("left_back_leg",
new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.25f, AnimationHelper.createRotationalVector(10f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1f, AnimationHelper.createRotationalVector(10f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.5f, AnimationHelper.createRotationalVector(10f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR))).build();
public static final Animation PORCUPINE_SIT = Animation.Builder.create(2f).looping()
.addBoneAnimation("porcupine",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("torso",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -0.3f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(0.4583433f, AnimationHelper.createTranslationalVector(0f, 0.3f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.125f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.7916767f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, -0.3f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("torso",
new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0f, AnimationHelper.createRotationalVector(-15f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("skull",
new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("left_front_leg",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0.25f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("right_front_leg",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0.25f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("right_back_leg",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -1f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, -0.75f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, -1f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("right_back_leg",
new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0f, AnimationHelper.createRotationalVector(5f, 0f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("left_back_leg",
new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -1f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, -0.75f, 0f),
Transformation.Interpolations.LINEAR),
new Keyframe(1.9583433f, AnimationHelper.createTranslationalVector(0f, -1f, 0f),
Transformation.Interpolations.LINEAR)))
.addBoneAnimation("left_back_leg",
new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0f, AnimationHelper.createRotationalVector(5f, 0f, 0f),
Transformation.Interpolations.LINEAR))).build();
}

View File

@ -0,0 +1,192 @@
// Made with Blockbench 4.12.2
// Exported for Minecraft version 1.17+ for Yarn
// Paste this class into your mod and generate all required imports
package jesse.keeblarcraft.entity.model;
import jesse.keeblarcraft.entity.PorcupineEntity;
import jesse.keeblarcraft.entity.animation.ModAnimations;
import net.minecraft.client.model.Dilation;
import net.minecraft.client.model.ModelData;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.model.ModelPartBuilder;
import net.minecraft.client.model.ModelPartData;
import net.minecraft.client.model.ModelTransform;
import net.minecraft.client.model.TexturedModelData;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.entity.model.SinglePartEntityModel;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
public class PorcupineModel<T extends PorcupineEntity> extends SinglePartEntityModel<T> {
private final ModelPart porcupine;
private final ModelPart head;
public PorcupineModel(ModelPart root) {
this.porcupine = root.getChild("porcupine");
this.head = porcupine.getChild("body").getChild("torso").getChild("head");
}
public static TexturedModelData getTexturedModelData() {
ModelData modelData = new ModelData();
ModelPartData modelPartData = modelData.getRoot();
ModelPartData porcupine = modelPartData.addChild("porcupine", ModelPartBuilder.create(), ModelTransform.pivot(0.0F, 24.0F, 0.0F));
ModelPartData body = porcupine.addChild("body", ModelPartBuilder.create(), ModelTransform.pivot(0.0F, -4.0F, 0.0F));
ModelPartData torso = body.addChild("torso", ModelPartBuilder.create().uv(0, 0).cuboid(-3.0F, -3.0F, -4.0F, 6.0F, 5.0F, 8.0F, new Dilation(0.0F)), ModelTransform.pivot(0.0F, 0.0F, 0.0F));
ModelPartData tail = torso.addChild("tail", ModelPartBuilder.create(), ModelTransform.of(0.5F, -1.251F, 4.0F, -0.4363F, 0.0F, 0.0F));
ModelPartData cube_r1 = tail.addChild("cube_r1", ModelPartBuilder.create().uv(11, 25).cuboid(-6.0F, -0.499F, -1.0F, 7.0F, 0.0F, 7.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.25F, 0.0F, 0.0F, 0.9599F, 0.0F));
ModelPartData cube_r2 = tail.addChild("cube_r2", ModelPartBuilder.create().uv(11, 25).cuboid(-6.0F, 0.001F, -1.0F, 7.0F, 0.0F, 7.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.25F, 0.0F, 0.0F, 0.6109F, 0.0F));
ModelPartData head = torso.addChild("head", ModelPartBuilder.create(), ModelTransform.of(0.0F, -1.0F, -4.0F, 0.0F, -0.0436F, 0.0F));
ModelPartData skull = head.addChild("skull", ModelPartBuilder.create().uv(0, 13).cuboid(-2.0F, -2.0F, -4.0F, 4.0F, 4.0F, 4.0F, new Dilation(0.0F))
.uv(0, 14).cuboid(1.1F, -0.75F, -3.25F, 1.0F, 1.0F, 1.0F, new Dilation(0.0F))
.uv(12, 13).cuboid(1.425F, -0.975F, -3.025F, 1.0F, 1.0F, 1.0F, new Dilation(-0.3F))
.uv(0, 14).mirrored().cuboid(-2.1F, -0.75F, -3.25F, 1.0F, 1.0F, 1.0F, new Dilation(0.0F)).mirrored(false)
.uv(12, 13).mirrored().cuboid(-2.425F, -0.975F, -3.025F, 1.0F, 1.0F, 1.0F, new Dilation(-0.3F)).mirrored(false)
.uv(16, 18).cuboid(-1.0F, -0.25F, -5.0F, 2.0F, 2.0F, 1.0F, new Dilation(0.0F)), ModelTransform.pivot(0.0F, 0.0F, 0.0F));
ModelPartData hair = skull.addChild("hair", ModelPartBuilder.create().uv(0, 16).cuboid(0.0F, -4.0F, 0.0F, 0.0F, 5.0F, 5.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, -1.0F, -4.0F, 0.5236F, 0.0F, 0.0F));
ModelPartData cube_r3 = hair.addChild("cube_r3", ModelPartBuilder.create().uv(0, 16).cuboid(0.0F, -4.0F, 0.0F, 0.0F, 5.0F, 5.0F, new Dilation(0.0F)), ModelTransform.of(-0.5F, 0.0F, 0.0F, 0.0F, 0.0F, -0.2618F));
ModelPartData cube_r4 = hair.addChild("cube_r4", ModelPartBuilder.create().uv(0, 16).cuboid(0.0F, -4.0F, 0.0F, 0.0F, 5.0F, 5.0F, new Dilation(0.0F)), ModelTransform.of(0.5F, 0.0F, 0.0F, 0.0F, 0.0F, 0.2618F));
ModelPartData left_eyelid = skull.addChild("left_eyelid", ModelPartBuilder.create().uv(24, 0).cuboid(0.1F, -1.75F, -7.25F, 2.0F, 2.0F, 2.0F, new Dilation(-0.4F)), ModelTransform.pivot(-0.4F, 0.5F, 3.5F));
ModelPartData right_eyelid = skull.addChild("right_eyelid", ModelPartBuilder.create().uv(24, 0).mirrored().cuboid(-2.1F, -1.75F, -7.25F, 2.0F, 2.0F, 2.0F, new Dilation(-0.4F)).mirrored(false), ModelTransform.pivot(0.4F, 0.5F, 3.5F));
ModelPartData spikes = torso.addChild("spikes", ModelPartBuilder.create(), ModelTransform.pivot(0.0F, -3.0F, -3.5F));
ModelPartData spike = spikes.addChild("spike", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -7.0F, 0.0F, 0.0F, 7.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.5F, 0.0F, 0.0F, -0.0436F));
ModelPartData spike2 = spikes.addChild("spike2", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -7.0F, 0.0F, 0.0F, 7.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0873F));
ModelPartData spike5 = spikes.addChild("spike5", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -7.0F, 0.0F, 0.0F, 7.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(2.0F, 0.0F, 0.5F, 0.0F, 0.0F, 0.3491F));
ModelPartData spike3 = spikes.addChild("spike3", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -7.0F, 0.0F, 0.0F, 7.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(-1.0F, 0.0F, 0.0F, 0.0F, 0.0F, -0.1309F));
ModelPartData spike4 = spikes.addChild("spike4", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -7.0F, 0.0F, 0.0F, 7.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(-2.0F, 0.0F, 0.5F, 0.0F, 0.0F, -0.4363F));
ModelPartData spikes2 = torso.addChild("spikes2", ModelPartBuilder.create(), ModelTransform.of(0.5F, -3.0F, -2.5F, 0.3054F, 0.0F, 0.0F));
ModelPartData spike6 = spikes2.addChild("spike6", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -7.0F, 0.0F, 0.0F, 7.0F, 1.0F, new Dilation(0.0F)), ModelTransform.pivot(0.0F, 0.0F, -1.0F));
ModelPartData spike7 = spikes2.addChild("spike7", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -7.0F, 0.0F, 0.0F, 7.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(1.0F, 0.0F, -1.5F, 0.0F, 0.0F, 0.2618F));
ModelPartData spike8 = spikes2.addChild("spike8", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -7.0F, 0.0F, 0.0F, 7.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(2.0F, 0.0F, -1.0F, 0.0F, 0.0F, 0.4363F));
ModelPartData spike9 = spikes2.addChild("spike9", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -7.0F, 0.0F, 0.0F, 7.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(-1.0F, 0.0F, -1.5F, 0.0F, 0.0F, -0.3054F));
ModelPartData spike10 = spikes2.addChild("spike10", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -7.0F, 0.0F, 0.0F, 7.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(-2.0F, 0.0F, -1.0F, 0.0F, 0.0F, -0.6545F));
ModelPartData spikes3 = torso.addChild("spikes3", ModelPartBuilder.create(), ModelTransform.of(0.5F, -3.0F, -2.5F, -0.1745F, 0.0F, 0.0F));
ModelPartData spike11 = spikes3.addChild("spike11", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -7.0F, 0.0F, 0.0F, 7.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.5F, 0.0F, 0.0F, 0.1309F));
ModelPartData spike12 = spikes3.addChild("spike12", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -7.0F, 0.0F, 0.0F, 7.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.1309F));
ModelPartData spike13 = spikes3.addChild("spike13", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -7.0F, 0.0F, 0.0F, 7.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(2.0F, 0.0F, 0.5F, 0.0F, 0.0F, 0.2618F));
ModelPartData spike14 = spikes3.addChild("spike14", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -7.0F, 0.0F, 0.0F, 7.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(-1.0F, 0.0F, 0.0F, 0.0F, 0.0F, -0.0436F));
ModelPartData spike15 = spikes3.addChild("spike15", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -7.0F, 0.0F, 0.0F, 7.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(-2.0F, 0.0F, 0.5F, 0.0F, 0.0F, -0.1745F));
ModelPartData spikes4 = torso.addChild("spikes4", ModelPartBuilder.create(), ModelTransform.of(0.0F, -3.0F, -2.0F, -0.5672F, 0.0F, 0.0F));
ModelPartData spike16 = spikes4.addChild("spike16", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -6.0F, 0.0F, 0.0F, 6.0F, 1.0F, new Dilation(0.0F)), ModelTransform.pivot(0.0F, 0.0F, 0.5F));
ModelPartData spike17 = spikes4.addChild("spike17", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -6.0F, 0.0F, 0.0F, 6.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.1745F));
ModelPartData spike18 = spikes4.addChild("spike18", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -6.0F, 0.0F, 0.0F, 6.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(2.0F, 0.0F, 0.5F, 0.0F, 0.0F, 0.2182F));
ModelPartData spike19 = spikes4.addChild("spike19", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -6.0F, 0.0F, 0.0F, 6.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(-1.0F, 0.0F, 0.0F, 0.0F, 0.0F, -0.0873F));
ModelPartData spike20 = spikes4.addChild("spike20", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -6.0F, 0.0F, 0.0F, 6.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(-2.0F, 0.0F, 0.5F, 0.0F, 0.0F, -0.1309F));
ModelPartData spikes5 = torso.addChild("spikes5", ModelPartBuilder.create(), ModelTransform.of(0.0F, -3.0F, 0.0F, -0.7854F, 0.0F, 0.0F));
ModelPartData spike21 = spikes5.addChild("spike21", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -6.0F, 0.0F, 0.0F, 6.0F, 1.0F, new Dilation(0.0F)), ModelTransform.pivot(0.0F, 0.0F, 0.5F));
ModelPartData spike22 = spikes5.addChild("spike22", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -6.0F, 0.0F, 0.0F, 6.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.4363F));
ModelPartData spike23 = spikes5.addChild("spike23", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -6.0F, 0.0F, 0.0F, 6.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(2.0F, 0.0F, 0.5F, 0.0F, 0.0F, 0.7854F));
ModelPartData spike24 = spikes5.addChild("spike24", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -6.0F, 0.0F, 0.0F, 6.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(-1.0F, 0.0F, 0.0F, 0.0F, 0.0F, -0.2618F));
ModelPartData spike25 = spikes5.addChild("spike25", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -6.0F, 0.0F, 0.0F, 6.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(-2.0F, 0.0F, 0.5F, 0.0F, 0.0F, -0.5672F));
ModelPartData spikes6 = torso.addChild("spikes6", ModelPartBuilder.create(), ModelTransform.of(0.5F, -3.0F, -0.5F, -0.6545F, 0.0F, 0.0F));
ModelPartData spike26 = spikes6.addChild("spike26", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -5.0F, 0.0F, 0.0F, 5.0F, 1.0F, new Dilation(0.0F)), ModelTransform.pivot(0.0F, 0.0F, 0.5F));
ModelPartData spike27 = spikes6.addChild("spike27", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -5.0F, 0.0F, 0.0F, 5.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.3491F));
ModelPartData spike28 = spikes6.addChild("spike28", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -5.0F, 0.0F, 0.0F, 5.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(2.0F, 0.0F, 0.5F, 0.0F, 0.0F, 0.48F));
ModelPartData spike29 = spikes6.addChild("spike29", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -5.0F, 0.0F, 0.0F, 5.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(-1.0F, 0.0F, 0.0F, 0.0F, 0.0F, -0.2182F));
ModelPartData spike30 = spikes6.addChild("spike30", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -5.0F, 0.0F, 0.0F, 5.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(-2.0F, 0.0F, 0.5F, 0.0F, 0.0F, -0.48F));
ModelPartData spikes7 = torso.addChild("spikes7", ModelPartBuilder.create(), ModelTransform.of(0.5F, -3.0F, 1.5F, -0.9599F, 0.0F, 0.0F));
ModelPartData spike31 = spikes7.addChild("spike31", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -4.0F, 0.0F, 0.0F, 4.0F, 1.0F, new Dilation(0.0F)), ModelTransform.pivot(0.0F, 0.0F, 0.5F));
ModelPartData spike32 = spikes7.addChild("spike32", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -4.0F, 0.0F, 0.0F, 4.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.1309F));
ModelPartData spike33 = spikes7.addChild("spike33", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -4.0F, 0.0F, 0.0F, 4.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(2.0F, 0.0F, 0.5F, 0.0F, 0.0F, 0.3491F));
ModelPartData spike34 = spikes7.addChild("spike34", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -4.0F, 0.0F, 0.0F, 4.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(-1.0F, 0.0F, 0.0F, 0.0F, 0.0F, -0.1309F));
ModelPartData spike35 = spikes7.addChild("spike35", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -4.0F, 0.0F, 0.0F, 4.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(-2.0F, 0.0F, 0.5F, 0.0F, 0.0F, -0.3054F));
ModelPartData spikes8 = torso.addChild("spikes8", ModelPartBuilder.create(), ModelTransform.of(0.0F, -3.0F, 3.0F, -1.0472F, 0.0F, 0.0F));
ModelPartData spike36 = spikes8.addChild("spike36", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -3.0F, 0.0F, 0.0F, 3.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.5F, 0.0F, 0.0F, -0.1309F));
ModelPartData spike37 = spikes8.addChild("spike37", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -3.0F, 0.0F, 0.0F, 3.0F, 1.0F, new Dilation(0.0F)), ModelTransform.pivot(1.0F, 0.0F, 0.0F));
ModelPartData spike38 = spikes8.addChild("spike38", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -3.0F, 0.0F, 0.0F, 3.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(2.0F, 0.0F, 0.5F, 0.0F, 0.0F, 0.3927F));
ModelPartData spike39 = spikes8.addChild("spike39", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -3.0F, 0.0F, 0.0F, 3.0F, 1.0F, new Dilation(0.0F)), ModelTransform.pivot(-1.0F, 0.0F, 0.0F));
ModelPartData spike40 = spikes8.addChild("spike40", ModelPartBuilder.create().uv(20, 0).cuboid(0.0F, -3.0F, 0.0F, 0.0F, 3.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(-2.0F, 0.0F, 0.5F, 0.0F, 0.0F, -0.3054F));
ModelPartData left_front_leg = body.addChild("left_front_leg", ModelPartBuilder.create().uv(0, 0).cuboid(-1.0F, -1.0F, -1.0F, 2.0F, 5.0F, 2.0F, new Dilation(0.0F)), ModelTransform.pivot(3.0F, 0.0F, -2.5F));
ModelPartData right_front_leg = body.addChild("right_front_leg", ModelPartBuilder.create().uv(0, 0).mirrored().cuboid(-1.0F, -1.0F, -1.0F, 2.0F, 5.0F, 2.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.pivot(-3.0F, 0.0F, -2.5F));
ModelPartData right_back_leg = body.addChild("right_back_leg", ModelPartBuilder.create().uv(0, 0).mirrored().cuboid(-1.0F, -1.0F, -1.0F, 2.0F, 5.0F, 2.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.pivot(-3.0F, 0.0F, 2.5F));
ModelPartData left_back_leg = body.addChild("left_back_leg", ModelPartBuilder.create().uv(0, 0).cuboid(-1.0F, -1.0F, -1.0F, 2.0F, 5.0F, 2.0F, new Dilation(0.0F)), ModelTransform.pivot(3.0F, 0.0F, 2.5F));
return TexturedModelData.of(modelData, 32, 32);
}
@Override
public void setAngles(PorcupineEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
this.getPart().traverse().forEach(ModelPart::resetTransform);
setHeadAngles(netHeadYaw, headPitch);
this.animateMovement(ModAnimations.PORCUPINE_WALK, limbSwing, limbSwingAmount, 2, 2);
this.updateAnimation(entity.idlingAnimationState, ModAnimations.PORCUPINE_IDLE, ageInTicks, 1);
}
private void setHeadAngles(float headYaw, float headPitch) {
headYaw = MathHelper.clamp(headYaw, -30, 30);
headPitch = MathHelper.clamp(headPitch, -20, 45);
}
@Override
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, float red, float green, float blue, float alpha) {
porcupine.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
}
@Override
public ModelPart getPart() {
return porcupine;
}
}

View File

@ -151,5 +151,8 @@ public class AttributeMgr {
RegisterAttributeClass(FactionBeacon.class); RegisterAttributeClass(FactionBeacon.class);
RegisterAttributeClass(FactionFlight.class); RegisterAttributeClass(FactionFlight.class);
RegisterAttributeClass(FactionItemRepair.class); RegisterAttributeClass(FactionItemRepair.class);
} }
} }

View File

@ -16,6 +16,7 @@ import net.fabricmc.fabric.api.entity.event.v1.ServerEntityWorldChangeEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerEntityEvents; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerEntityEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
import net.kyrptonaught.customportalapi.api.CustomPortalBuilder; import net.kyrptonaught.customportalapi.api.CustomPortalBuilder;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.entity.mob.HostileEntity; import net.minecraft.entity.mob.HostileEntity;
@ -42,6 +43,9 @@ import jesse.keeblarcraft.EventMgr.ServerTickListener;
import jesse.keeblarcraft.GuiMgr.ScreenHandlerRegistration; import jesse.keeblarcraft.GuiMgr.ScreenHandlerRegistration;
import jesse.keeblarcraft.GuiMgr.TreeHandler; import jesse.keeblarcraft.GuiMgr.TreeHandler;
import jesse.keeblarcraft.Utils.CustomExceptions.SETUP_FAILED_EXCEPTION; import jesse.keeblarcraft.Utils.CustomExceptions.SETUP_FAILED_EXCEPTION;
import jesse.keeblarcraft.entity.MAKE_ENTITY_REGISTER;
import jesse.keeblarcraft.entity.PorcupineEntity;
import jesse.keeblarcraft.entity.SpawnEggItems;
import jesse.keeblarcraft.Utils.Setup; import jesse.keeblarcraft.Utils.Setup;
public class Keeblarcraft implements ModInitializer { public class Keeblarcraft implements ModInitializer {
@ -147,6 +151,12 @@ public class Keeblarcraft implements ModInitializer {
// Screen handlers // Screen handlers
ScreenHandlerRegistration.registerScreenHandlers(); ScreenHandlerRegistration.registerScreenHandlers();
//Temp Entity Register
FabricDefaultAttributeRegistry.register(MAKE_ENTITY_REGISTER.PORCUPINE, PorcupineEntity.createPorcupineAttributes());
//SpawnEggitems Register
SpawnEggItems.RegisterPorcupineSpawnEgg();
} catch (SETUP_FAILED_EXCEPTION e) { } catch (SETUP_FAILED_EXCEPTION e) {
Keeblarcraft.LOGGER.error("ERROR. Setup failed to initialize environment. Mod likely does not have read/write permissions inside area. Mod will now close out."); Keeblarcraft.LOGGER.error("ERROR. Setup failed to initialize environment. Mod likely does not have read/write permissions inside area. Mod will now close out.");

View File

@ -1,10 +1,15 @@
package jesse.keeblarcraft.datagen; package jesse.keeblarcraft.datagen;
import java.util.Optional;
import jesse.keeblarcraft.CustomBlocks.BlockManager; import jesse.keeblarcraft.CustomBlocks.BlockManager;
import jesse.keeblarcraft.entity.SpawnEggItems;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider; import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider;
import net.minecraft.data.client.BlockStateModelGenerator; import net.minecraft.data.client.BlockStateModelGenerator;
import net.minecraft.data.client.ItemModelGenerator; import net.minecraft.data.client.ItemModelGenerator;
import net.minecraft.data.client.Model;
import net.minecraft.util.Identifier;
public class KeeblarModelProvider extends FabricModelProvider { public class KeeblarModelProvider extends FabricModelProvider {
@ -19,7 +24,8 @@ public class KeeblarModelProvider extends FabricModelProvider {
@Override @Override
public void generateItemModels(ItemModelGenerator itemModelGenerator) { public void generateItemModels(ItemModelGenerator itemModelGenerator) {
itemModelGenerator.register(SpawnEggItems.PORCUPINE_SPAWN_EGG, new Model(
Optional.of(new Identifier("item/template_spawn_egg")), Optional.empty()));
} }
} }

View File

@ -0,0 +1,16 @@
package jesse.keeblarcraft.entity;
import jesse.keeblarcraft.Keeblarcraft;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder;
import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
public class MAKE_ENTITY_REGISTER {
public static final EntityType<PorcupineEntity> PORCUPINE = Registry.register(Registries.ENTITY_TYPE,
new Identifier(Keeblarcraft.MOD_ID + "porcupine"),
FabricEntityTypeBuilder.create(SpawnGroup.CREATURE, PorcupineEntity::new).dimensions(EntityDimensions.fixed(1, 1)).build());
}

View File

@ -0,0 +1,114 @@
package jesse.keeblarcraft.entity;
import jesse.keeblarcraft.entity.MAKE_ENTITY_REGISTER;
import net.minecraft.entity.AnimationState;
import net.minecraft.entity.EntityPose;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.goal.AnimalMateGoal;
import net.minecraft.entity.ai.goal.FollowParentGoal;
import net.minecraft.entity.ai.goal.LookAroundGoal;
import net.minecraft.entity.ai.goal.LookAtEntityGoal;
import net.minecraft.entity.ai.goal.SwimGoal;
import net.minecraft.entity.ai.goal.TemptGoal;
import net.minecraft.entity.ai.goal.WanderAroundFarGoal;
import net.minecraft.entity.attribute.DefaultAttributeContainer;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.passive.PassiveEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.recipe.Ingredient;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.world.World;
public class PorcupineEntity extends AnimalEntity {
public final AnimationState idlingAnimationState = new AnimationState();
private int idleAnimationCooldown = 0;
public PorcupineEntity (EntityType<? extends AnimalEntity> entityType, World world) {
super(entityType, world);
}
private void updateAnimations() {
if (this.idleAnimationCooldown <= 0) {
this.idleAnimationCooldown = this.random.nextInt(40) + 80;
this.idlingAnimationState.start(this.age);
} else {
--this.idleAnimationCooldown;
}
}
protected void updateLimbs(float posDelta) {
float f;
if (this.getPose() == EntityPose.STANDING) {
f = Math.min(posDelta * 6.0F, 1.0F);
} else {
f = 0.0F;
}
this.limbAnimator.updateLimbs(f, 0.2F);
}
@Override
public void tick() {
super.tick();
if (this.getWorld().isClient) {
this.updateAnimations();
}
}
@Override
protected void initGoals() {
this.goalSelector.add(0, new SwimGoal(this));
this.goalSelector.add(1, new AnimalMateGoal(this, 5));
this.goalSelector.add(2, new TemptGoal(this, 2, Ingredient.ofItems(Items.BEETROOT), false));
this.goalSelector.add(3, new FollowParentGoal(this, 3));
this.goalSelector.add(4, new WanderAroundFarGoal(this, 2));
this.goalSelector.add(5, new LookAtEntityGoal(this, PlayerEntity.class, 10));
this.goalSelector.add(5, new LookAtEntityGoal(this, LivingEntity.class, 10));
this.goalSelector.add(6, new LookAroundGoal(this));
}
public static DefaultAttributeContainer.Builder createPorcupineAttributes() {
return MobEntity.createMobAttributes()
.add(EntityAttributes.GENERIC_MAX_HEALTH, 10)
.add(EntityAttributes.GENERIC_ATTACK_DAMAGE, 1)
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, .2)
.add(EntityAttributes.GENERIC_ARMOR, 2);
}
@Override
public boolean isBreedingItem(ItemStack stack) {
return stack.isOf(Items.OAK_LOG);
}
@Override
public PassiveEntity createChild(ServerWorld world, PassiveEntity entity) {
return MAKE_ENTITY_REGISTER.PORCUPINE.create(world);
}
@Override
protected SoundEvent getHurtSound(DamageSource source) {
return SoundEvents.ENTITY_GHAST_HURT;
}
protected SoundEvent getDeathSound() {
return SoundEvents.ENTITY_CREEPER_DEATH;
}
}

View File

@ -0,0 +1,15 @@
package jesse.keeblarcraft.entity;
import jesse.keeblarcraft.CustomItems.ItemManager;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.item.Item;
import net.minecraft.item.SpawnEggItem;
public class SpawnEggItems {
//spawn egg
public static final Item PORCUPINE_SPAWN_EGG = new SpawnEggItem(MAKE_ENTITY_REGISTER.PORCUPINE, 0xa54321, 0xa1235, new FabricItemSettings());
public static void RegisterPorcupineSpawnEgg() {
ItemManager.RegisterItem("porcupine_spawn_egg", PORCUPINE_SPAWN_EGG);
}
}

View File

@ -3,6 +3,7 @@
"item.keeblarcraft.metaljacket_chestplate": "MetalJacket Chestplate", "item.keeblarcraft.metaljacket_chestplate": "MetalJacket Chestplate",
"item.keeblarcraft.metaljacket_leggings": "MetalJacket Leggings", "item.keeblarcraft.metaljacket_leggings": "MetalJacket Leggings",
"item.keeblarcraft.metaljacket_boots": "MetalJacket Booties", "item.keeblarcraft.metaljacket_boots": "MetalJacket Booties",
"item.keeblarcraft.porcupine_spawn_egg": "Porcupine_Spawn_Egg",
"itemgroup.keeblarcraft": "Keeblarcraft Modded Items", "itemgroup.keeblarcraft": "Keeblarcraft Modded Items",
@ -14,4 +15,6 @@
"category.keeblarcraft.test": "Keeblarcraft bindings", "category.keeblarcraft.test": "Keeblarcraft bindings",
"key.keeblarcraft.treemap": "Tree GUI", "key.keeblarcraft.treemap": "Tree GUI",
"key.keeblarcraft.globalconfig": "Config menu" "key.keeblarcraft.globalconfig": "Config menu"
} }

View File

@ -0,0 +1,3 @@
{
"parent": "item/template_spawn_egg"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 995 B