diff --git a/src/main/java/com/ninni/spawn/client/model/SunfishModel.java b/src/main/java/com/ninni/spawn/client/model/SunfishModel.java index f78946b..794f18f 100644 --- a/src/main/java/com/ninni/spawn/client/model/SunfishModel.java +++ b/src/main/java/com/ninni/spawn/client/model/SunfishModel.java @@ -60,7 +60,7 @@ public void setupAnim(Sunfish entity, float limbSwing, float limbSwingAmount, fl } else { if (!entity.isInWaterOrBubble()) this.all.zRot = pi/2; else this.all.zRot = 0; - this.all.y = Mth.cos(animationProgress * 0.2F) * 1.5F * 0.25F + (entity.getSunfishAge() == -2 ? 22.5F : 19.0F); + this.all.y = Mth.sin(animationProgress * 0.2F) * 1.5F * 0.5F + (entity.getSunfishAge() == -2 ? 22.5F : 19.0F); this.all.yRot = Mth.cos(animationProgress * 0.2F) * 0.4F * 0.25F; this.tailFin.yRot = Mth.cos(animationProgress * 0.4F) * 0.8F * 0.25F; this.leftFin.yRot = Mth.cos(animationProgress * 0.4F) * 0.8F * 0.25F + 0.8F; diff --git a/src/main/java/com/ninni/spawn/mixin/client/ParrotOnShoulderLayerMixin.java b/src/main/java/com/ninni/spawn/mixin/client/ParrotOnShoulderLayerMixin.java index dff8a8a..7f8d997 100644 --- a/src/main/java/com/ninni/spawn/mixin/client/ParrotOnShoulderLayerMixin.java +++ b/src/main/java/com/ninni/spawn/mixin/client/ParrotOnShoulderLayerMixin.java @@ -41,6 +41,6 @@ public ParrotOnShoulderLayerMixin(RenderLayerParent> renderLay @Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/world/entity/player/Player;FFFFZ)V", at = @At("HEAD"), cancellable = true) private void S$render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, T player, float f, float g, float h, float j, boolean bl, CallbackInfo ci) { - if (Minecraft.getInstance().getResourceManager().getResource(new ResourceLocation("textures/entity/parrot/remodel_enabler.txt")).isPresent()) this.model = this.remodel; + if (Minecraft.getInstance().getResourceManager().getResource(new ResourceLocation("tweaks/parrot_remodel.txt")).isPresent()) this.model = this.remodel; } } diff --git a/src/main/java/com/ninni/spawn/mixin/client/ParrotRendererMixin.java b/src/main/java/com/ninni/spawn/mixin/client/ParrotRendererMixin.java index ce7cb96..978b3dc 100644 --- a/src/main/java/com/ninni/spawn/mixin/client/ParrotRendererMixin.java +++ b/src/main/java/com/ninni/spawn/mixin/client/ParrotRendererMixin.java @@ -34,7 +34,7 @@ public ParrotRendererMixin(EntityRendererProvider.Context context, ParrotModel e @Override public void render(Parrot mob, float f, float g, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) { - if (Minecraft.getInstance().getResourceManager().getResource(new ResourceLocation("textures/entity/parrot/remodel_enabler.txt")).isPresent()) this.model = this.remodel; + if (Minecraft.getInstance().getResourceManager().getResource(new ResourceLocation("tweaks/parrot_remodel.txt")).isPresent()) this.model = this.remodel; super.render(mob, f, g, poseStack, multiBufferSource, i); } } diff --git a/src/main/java/com/ninni/spawn/mixin/client/TurtleModelMixin.java b/src/main/java/com/ninni/spawn/mixin/client/TurtleModelMixin.java new file mode 100644 index 0000000..52459b7 --- /dev/null +++ b/src/main/java/com/ninni/spawn/mixin/client/TurtleModelMixin.java @@ -0,0 +1,164 @@ +package com.ninni.spawn.mixin.client; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.QuadrupedModel; +import net.minecraft.client.model.TurtleModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.animal.Turtle; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(TurtleModel.class) +public abstract class TurtleModelMixin extends QuadrupedModel { + + @Shadow @Final private ModelPart eggBelly; + + protected TurtleModelMixin(ModelPart modelPart, boolean bl, float f, float g, float h, float i, int j) { + super(modelPart, bl, f, g, h, i, j); + } + + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int i, int j, float f, float g, float h, float k) { + if (Minecraft.getInstance().getResourceManager().getResource(new ResourceLocation("tweaks/turtle_baby_head_scale.txt")).isPresent()) { + + if (this.young) { + poseStack.pushPose(); + float scaleHead = 0.4f; + poseStack.scale(scaleHead, scaleHead, scaleHead); + poseStack.translate(0.0f, 2.2, 4.0f / 16.0f); + this.headParts().forEach(modelPart -> modelPart.render(poseStack, vertexConsumer, i, j, f, g, h, k)); + poseStack.popPose(); + + poseStack.pushPose(); + float scaleBody = 0.2f; + poseStack.scale(scaleBody, scaleBody, scaleBody); + poseStack.translate(0.0f, 6, 0.0f); + this.bodyParts().forEach(modelPart -> modelPart.render(poseStack, vertexConsumer, i, j, f, g, h, k)); + poseStack.popPose(); + } else { + super.renderToBuffer(poseStack, vertexConsumer, i, j, f, g, h, k); + } + } else { + super.renderToBuffer(poseStack, vertexConsumer, i, j, f, g, h, k); + } + + } + + @Inject(method = "setupAnim(Lnet/minecraft/world/entity/animal/Turtle;FFFFF)V", at = @At("HEAD"), cancellable = true) + private void setupAnim(T turtle, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch, CallbackInfo ci) { + if (Minecraft.getInstance().getResourceManager().getResource(new ResourceLocation("tweaks/turtle_animations.txt")).isPresent()) { + ci.cancel(); + + float pi = (float) Math.PI; + limbDistance = Mth.clamp(limbDistance, -0.45F, 0.45F); + this.head.xRot = headPitch * (pi / 180); + this.head.yRot = headYaw * (pi / 180); + float o = Math.min(limbDistance / 0.1f, 1.0f); + + if (!turtle.isInWaterOrBubble()) { + + //idle anim + + this.body.y = 11; + this.head.y = 19; + this.head.z = -10; + this.leftFrontLeg.y = 21; + this.rightFrontLeg.y =21; + this.leftHindLeg.y = 22; + this.rightHindLeg.y = 22; + + this.body.xRot = pi/2 - 0.05f; + + this.leftFrontLeg.zRot = 0.15f; + this.leftFrontLeg.z = -8.0f; + this.leftFrontLeg.x = 6.0f; + this.leftFrontLeg.yRot = -0.4f; + + this.rightFrontLeg.zRot = -0.15f; + this.rightFrontLeg.z = -8.0f; + this.rightFrontLeg.x = -6.0f; + this.rightFrontLeg.yRot = 0.4f; + + this.leftHindLeg.yRot = 0.4f; + this.leftHindLeg.zRot = 0.15f; + this.leftHindLeg.xRot = 0; + + this.rightHindLeg.yRot = -0.4f; + this.rightHindLeg.zRot = -0.15f; + this.rightHindLeg.xRot = 0; + + //move anim + float k = turtle.isLayingEgg() ? 4.0f : 1.0f; + float l = turtle.isLayingEgg() ? 2.0f : 1.0f; + + this.rightFrontLeg.yRot += Mth.cos(k * limbAngle * 5.0f + pi) * 8.0f * limbDistance * l; + this.rightFrontLeg.zRot += Mth.sin(limbAngle * 5.0f + pi) * 6.0f * limbDistance + (0.4f * o); + + this.leftFrontLeg.yRot += Mth.cos(k * limbAngle * 5.0f) * 8.0f * limbDistance * l; + this.leftFrontLeg.zRot += Mth.sin(limbAngle * 5.0f) * 6.0f * limbDistance - (0.4f * o); + + this.body.y += Mth.sin(limbAngle * 5.0f) * 6.0f * limbDistance; + + this.rightHindLeg.yRot += Mth.sin(limbAngle * 5.0f + pi) * 3.0f * limbDistance; + this.leftHindLeg.yRot += Mth.sin(limbAngle * 5.0f) * 3.0f * limbDistance; + + } else { + + //idle anim + this.body.y = Mth.sin(animationProgress * 0.1F) * 0.25F + 11; + this.head.y = Mth.cos(animationProgress * 0.1F) * 0.25F + 19; + this.head.z = -10 + Mth.sin(animationProgress * 0.1F) * 1.5F * -0.2F; + this.leftFrontLeg.y = Mth.sin(animationProgress * 0.1F) * 3 * 0.25F + 23; + this.rightFrontLeg.y = Mth.sin(animationProgress * 0.1F) * 3 * 0.25F + 23; + this.leftHindLeg.y = Mth.sin(animationProgress * 0.1F) * 2.5F * 0.25F + 22; + this.rightHindLeg.y = Mth.sin(animationProgress * 0.1F) * 2.5F * 0.25F + 22; + + this.body.xRot = pi/2 - Mth.sin(animationProgress * 0.1F) * 0.5F * 0.1F; + + this.leftFrontLeg.zRot = Mth.cos(animationProgress * 0.1F) * 0.5F * -0.25F + 0.4f; + this.leftFrontLeg.z = -8.0f; + this.leftFrontLeg.x = 6.0f; + this.leftFrontLeg.yRot = -0.2f; + + this.rightFrontLeg.zRot = Mth.cos(animationProgress * 0.1F + pi) * 0.5F * -0.25F - 0.4f; + this.rightFrontLeg.z = -8.0f; + this.rightFrontLeg.x = -6.0f; + this.rightFrontLeg.yRot = 0.2f; + + this.leftHindLeg.yRot = 0.2f; + this.leftHindLeg.zRot = 0f; + this.leftHindLeg.xRot = Mth.cos(animationProgress * 0.1F + 0.2f) * 0.25F; + + this.rightHindLeg.yRot = -0.2f; + this.rightHindLeg.zRot = 0f; + this.rightHindLeg.xRot = Mth.cos(animationProgress * 0.1F+ 0.4f) * 0.25F; + + //swim anim + + this.body.y += Mth.sin(limbAngle * 0.4F) * 0.25F * limbDistance; + this.head.y += Mth.cos(limbAngle * 0.4F) * 0.25F * limbDistance; + this.head.z += Mth.sin(limbAngle * 0.4F) * 1.5F * -limbDistance; + this.leftHindLeg.y += Mth.sin(limbAngle * 0.4F) * 8 * limbDistance; + this.rightHindLeg.y += Mth.sin(limbAngle * 0.4F) * 8 * limbDistance; + + this.body.xRot += - Mth.sin(limbAngle * 0.4F) * 0.25F * limbDistance; + + this.leftFrontLeg.zRot += Mth.cos(limbAngle * 0.4F) * 1.75F * limbDistance; + this.rightFrontLeg.zRot += Mth.cos(limbAngle * 0.4F + pi) * 1.75F * limbDistance; + + this.leftHindLeg.xRot += Mth.cos(limbAngle * 0.4F + 0.2f) * 0.5f * limbDistance; + this.rightHindLeg.xRot += Mth.cos(limbAngle * 0.4F + 0.4f) * 0.5f * limbDistance; + + } + this.eggBelly.visible = !this.young && turtle.hasEgg(); + } + } +} diff --git a/src/main/java/com/ninni/spawn/registry/SpawnVanillaIntegration.java b/src/main/java/com/ninni/spawn/registry/SpawnVanillaIntegration.java index f883974..7872618 100644 --- a/src/main/java/com/ninni/spawn/registry/SpawnVanillaIntegration.java +++ b/src/main/java/com/ninni/spawn/registry/SpawnVanillaIntegration.java @@ -64,7 +64,7 @@ public static void serverInit() { public static void addResourcePacks() { ModContainer modContainer = FabricLoader.getInstance().getModContainer(MOD_ID).orElseThrow(() -> new IllegalStateException("Spawn's ModContainer couldn't be found!")); - ResourceManagerHelper.registerBuiltinResourcePack(new ResourceLocation(MOD_ID, "remodeled_parrots"), modContainer, "Remodeled Parrots", ResourcePackActivationType.DEFAULT_ENABLED); + ResourceManagerHelper.registerBuiltinResourcePack(new ResourceLocation(MOD_ID, "animal_tweaks"), modContainer, "Animal Tweaks", ResourcePackActivationType.DEFAULT_ENABLED); } private static void registerBiomeModifications() { diff --git a/src/main/resources/resourcepacks/remodeled_parrots/assets/minecraft/textures/entity/parrot/parrot_blue.png b/src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/textures/entity/parrot/parrot_blue.png similarity index 100% rename from src/main/resources/resourcepacks/remodeled_parrots/assets/minecraft/textures/entity/parrot/parrot_blue.png rename to src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/textures/entity/parrot/parrot_blue.png diff --git a/src/main/resources/resourcepacks/remodeled_parrots/assets/minecraft/textures/entity/parrot/parrot_green.png b/src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/textures/entity/parrot/parrot_green.png similarity index 100% rename from src/main/resources/resourcepacks/remodeled_parrots/assets/minecraft/textures/entity/parrot/parrot_green.png rename to src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/textures/entity/parrot/parrot_green.png diff --git a/src/main/resources/resourcepacks/remodeled_parrots/assets/minecraft/textures/entity/parrot/parrot_grey.png b/src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/textures/entity/parrot/parrot_grey.png similarity index 100% rename from src/main/resources/resourcepacks/remodeled_parrots/assets/minecraft/textures/entity/parrot/parrot_grey.png rename to src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/textures/entity/parrot/parrot_grey.png diff --git a/src/main/resources/resourcepacks/remodeled_parrots/assets/minecraft/textures/entity/parrot/parrot_red_blue.png b/src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/textures/entity/parrot/parrot_red_blue.png similarity index 100% rename from src/main/resources/resourcepacks/remodeled_parrots/assets/minecraft/textures/entity/parrot/parrot_red_blue.png rename to src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/textures/entity/parrot/parrot_red_blue.png diff --git a/src/main/resources/resourcepacks/remodeled_parrots/assets/minecraft/textures/entity/parrot/parrot_yellow_blue.png b/src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/textures/entity/parrot/parrot_yellow_blue.png similarity index 100% rename from src/main/resources/resourcepacks/remodeled_parrots/assets/minecraft/textures/entity/parrot/parrot_yellow_blue.png rename to src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/textures/entity/parrot/parrot_yellow_blue.png diff --git a/src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/tweaks/parrot_remodel.txt b/src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/tweaks/parrot_remodel.txt new file mode 100644 index 0000000..9ba6c86 --- /dev/null +++ b/src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/tweaks/parrot_remodel.txt @@ -0,0 +1 @@ +Include this file in your resource pack to enable a new parrot model and animations if Spawn is installed. \ No newline at end of file diff --git a/src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/tweaks/turtle_animations.txt b/src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/tweaks/turtle_animations.txt new file mode 100644 index 0000000..4908b9f --- /dev/null +++ b/src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/tweaks/turtle_animations.txt @@ -0,0 +1 @@ +Include this file in your resource pack to enable new turtle animations if Spawn is installed. \ No newline at end of file diff --git a/src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/tweaks/turtle_baby_head_scale.txt b/src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/tweaks/turtle_baby_head_scale.txt new file mode 100644 index 0000000..e94b321 --- /dev/null +++ b/src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/tweaks/turtle_baby_head_scale.txt @@ -0,0 +1 @@ +Include this file in your resource pack to enable baby turtle head scaling if Spawn is installed. \ No newline at end of file diff --git a/src/main/resources/resourcepacks/animal_tweaks/pack.mcmeta b/src/main/resources/resourcepacks/animal_tweaks/pack.mcmeta new file mode 100644 index 0000000..27749e1 --- /dev/null +++ b/src/main/resources/resourcepacks/animal_tweaks/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "pack_format": 15, + "description": "§7Minecraft Animal Remodels and New Animations!" + } +} \ No newline at end of file diff --git a/src/main/resources/resourcepacks/remodeled_parrots/pack.png b/src/main/resources/resourcepacks/animal_tweaks/pack.png similarity index 100% rename from src/main/resources/resourcepacks/remodeled_parrots/pack.png rename to src/main/resources/resourcepacks/animal_tweaks/pack.png diff --git a/src/main/resources/resourcepacks/remodeled_parrots/assets/minecraft/textures/entity/parrot/remodel_enabler.txt b/src/main/resources/resourcepacks/remodeled_parrots/assets/minecraft/textures/entity/parrot/remodel_enabler.txt deleted file mode 100644 index 6771f56..0000000 --- a/src/main/resources/resourcepacks/remodeled_parrots/assets/minecraft/textures/entity/parrot/remodel_enabler.txt +++ /dev/null @@ -1 +0,0 @@ -Include this file in your resource pack to enable the new model if Spawn is installed. \ No newline at end of file diff --git a/src/main/resources/resourcepacks/remodeled_parrots/pack.mcmeta b/src/main/resources/resourcepacks/remodeled_parrots/pack.mcmeta deleted file mode 100644 index e6fc1b1..0000000 --- a/src/main/resources/resourcepacks/remodeled_parrots/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack": { - "pack_format": 15, - "description": "§7Parrot touch ups!" - } -} \ No newline at end of file diff --git a/src/main/resources/spawn.mixins.json b/src/main/resources/spawn.mixins.json index 28a82bd..d02ade5 100644 --- a/src/main/resources/spawn.mixins.json +++ b/src/main/resources/spawn.mixins.json @@ -24,7 +24,8 @@ "client.BlockEntityWithoutLevelRendererMixin", "client.ParrotOnShoulderLayerMixin", "client.ParrotRendererMixin", - "client.PufferfishRendererMixin" + "client.PufferfishRendererMixin", + "client.TurtleModelMixin" ], "injectors": { "defaultRequire": 1