-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
179 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
164 changes: 164 additions & 0 deletions
164
src/main/java/com/ninni/spawn/mixin/client/TurtleModelMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<T extends Turtle> extends QuadrupedModel<T> { | ||
|
||
@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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions
1
src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/tweaks/parrot_remodel.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Include this file in your resource pack to enable a new parrot model and animations if Spawn is installed. |
1 change: 1 addition & 0 deletions
1
src/main/resources/resourcepacks/animal_tweaks/assets/minecraft/tweaks/turtle_animations.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Include this file in your resource pack to enable new turtle animations if Spawn is installed. |
1 change: 1 addition & 0 deletions
1
.../resources/resourcepacks/animal_tweaks/assets/minecraft/tweaks/turtle_baby_head_scale.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Include this file in your resource pack to enable baby turtle head scaling if Spawn is installed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"pack": { | ||
"pack_format": 15, | ||
"description": "§7Minecraft Animal Remodels and New Animations!" | ||
} | ||
} |
File renamed without changes
1 change: 0 additions & 1 deletion
1
...sourcepacks/remodeled_parrots/assets/minecraft/textures/entity/parrot/remodel_enabler.txt
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
src/main/resources/resourcepacks/remodeled_parrots/pack.mcmeta
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters