From b5f49c33c559bfe106b92f73e76058dbc51a5279 Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Mon, 8 Apr 2024 21:20:56 +0800 Subject: [PATCH 01/30] Animate Rebuilded --- build.gradle | 6 ++++-- settings.gradle | 3 ++- .../content/client/pose/MetalGolemPose.java | 5 ++++- .../entity/common/AbstractGolemEntity.java | 6 ++++-- .../entity/metalgolem/MetalGolemModel.java | 6 +++--- .../content/item/wand/SquadWandItem.java | 20 +++++++++++++++++-- 6 files changed, 35 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index 5eb0382d5..d2043cceb 100644 --- a/build.gradle +++ b/build.gradle @@ -13,6 +13,9 @@ buildscript { plugins { id 'net.minecraftforge.gradle' version '[6.0,6.2)' } +plugins { + id 'org.parchmentmc.librarian.forgegradle' version '1.+' +} apply plugin: 'maven-publish' apply plugin: 'org.spongepowered.mixin' @@ -27,8 +30,7 @@ if (lljij.toBoolean()) jarJar.enable() java.toolchain.languageVersion = JavaLanguageVersion.of(17) minecraft { - //mappings channel: 'parchment', version: '1.19.3-2023.03.12-1.19.4' - mappings channel: 'official', version: "${minecraft_version}" + mappings channel: 'parchment', version: '2023.06.26-1.20.1' accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') runs { client { diff --git a/settings.gradle b/settings.gradle index dfb0a696f..1007c3f2b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,9 +1,10 @@ pluginManagement { repositories { + maven { url = 'https://maven.parchmentmc.org' } gradlePluginPortal() maven { name="MinecraftForge" - url = 'https://maven.minecraftforge.net/' } + url = 'https://maven.minecraftforge.net/'} } } plugins { diff --git a/src/main/java/dev/xkmc/modulargolems/content/client/pose/MetalGolemPose.java b/src/main/java/dev/xkmc/modulargolems/content/client/pose/MetalGolemPose.java index 008581c21..40900d114 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/client/pose/MetalGolemPose.java +++ b/src/main/java/dev/xkmc/modulargolems/content/client/pose/MetalGolemPose.java @@ -2,6 +2,10 @@ import dev.xkmc.modulargolems.content.entity.metalgolem.MetalGolemEntity; import dev.xkmc.modulargolems.content.entity.metalgolem.MetalGolemModel; +import net.minecraft.client.animation.AnimationChannel; +import net.minecraft.client.animation.AnimationDefinition; +import net.minecraft.client.animation.Keyframe; +import net.minecraft.client.animation.KeyframeAnimations; import net.minecraft.util.Mth; public class MetalGolemPose { @@ -14,7 +18,6 @@ public void attackModel(MetalGolemEntity entity, MetalGolemModel model, float at model.rightForeArm.xRot = 0; model.leftForeArm.xRot = 0; } - public void aggressive(MetalGolemEntity entity, MetalGolemModel model, float walkTick, float speed, float pTick) { walking(entity, model, walkTick, speed, pTick); } diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/common/AbstractGolemEntity.java b/src/main/java/dev/xkmc/modulargolems/content/entity/common/AbstractGolemEntity.java index a7264b147..e3c09c711 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/common/AbstractGolemEntity.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/common/AbstractGolemEntity.java @@ -487,7 +487,7 @@ public void handleEntityEvent(byte event) { private static final EntityDataAccessor DATA_MODE = GOLEM_DATA.define(SyncedData.INT, 0, "follow_mode"); private static final EntityDataAccessor GUARD_POS = GOLEM_DATA.define(SyncedData.BLOCK_POS, BlockPos.ZERO, "guard_pos"); - + private static final EntityDataAccessor SQUAD_POS = GOLEM_DATA.define(SyncedData.BLOCK_POS, BlockPos.ZERO, "cap_pos"); public GolemMode getMode() { return GolemModes.get(this.entityData.get(DATA_MODE)); } @@ -500,7 +500,9 @@ public void setMode(int mode, BlockPos pos) { this.entityData.set(DATA_MODE, mode); this.entityData.set(GUARD_POS, pos); } - + public void setCapDistance(BlockPos pos){ + this.entityData.set(SQUAD_POS,pos); + } public boolean initMode(@Nullable Player player) { var config = getConfigEntry(null); int mode = config == null ? 0 : config.defaultMode; diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index cff397b49..ccd041785 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -1,5 +1,4 @@ package dev.xkmc.modulargolems.content.entity.metalgolem; - import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.math.Axis; @@ -16,7 +15,8 @@ import net.minecraft.world.entity.EquipmentSlot; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; - +import dev.xkmc.modulargolems.content.client.pose.CustomModelAnimation; +import net.minecraft.client.animation.KeyframeAnimations; @OnlyIn(Dist.CLIENT) public class MetalGolemModel extends HierarchicalModel implements IGolemModel, IHeadedModel { @@ -80,7 +80,7 @@ public void prepareMobModel(MetalGolemEntity entity, float bob, float speed, flo if (atkTick > 0) { pose.attackModel(entity, this, atkTick - pTick); } else if (entity.isAggressive()) { - pose.aggressive(entity, this, bob, speed, pTick); + pose.aggressive(entity,this,bob,speed,pTick); } else { pose.walking(entity, this, bob, speed, pTick); } diff --git a/src/main/java/dev/xkmc/modulargolems/content/item/wand/SquadWandItem.java b/src/main/java/dev/xkmc/modulargolems/content/item/wand/SquadWandItem.java index d78210bbe..4ae5c5252 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/item/wand/SquadWandItem.java +++ b/src/main/java/dev/xkmc/modulargolems/content/item/wand/SquadWandItem.java @@ -23,7 +23,7 @@ public class SquadWandItem extends BaseWandItem implements GolemInteractItem, IGlowingTarget { - + private static final String KEY_OWNER = "config_captain"; private static final int RANGE = 64; public SquadWandItem(Properties properties, @Nullable ItemEntry base) { @@ -77,9 +77,25 @@ private static boolean choose(Level level, Player user, AbstractGolemEntity Date: Tue, 16 Apr 2024 22:15:26 +0800 Subject: [PATCH 02/30] Animate Rebuilded --- .../entity/metalgolem/MetalGolemEntity.java | 14 +++++----- .../entity/metalgolem/MetalGolemModel.java | 26 ++++--------------- 2 files changed, 11 insertions(+), 29 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java index e1a7835e4..ae0a0f53b 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java @@ -16,6 +16,7 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.AnimationState; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -34,6 +35,8 @@ @SerialClass public class MetalGolemEntity extends SweepGolemEntity { + public final AnimationState attackAnimationState = new AnimationState(); + public MetalGolemEntity(EntityType type, Level level) { super(type, level); this.setMaxUpStep(1); @@ -63,7 +66,6 @@ protected void registerGoals() { this.goalSelector.addGoal(2, new GolemMeleeGoal(this)); super.registerGoals(); } - public void aiStep() { super.aiStep(); if (this.attackAnimationTick > 0) { @@ -109,14 +111,10 @@ public IronGolem.Crackiness getCrackiness() { return IronGolem.Crackiness.byFraction(this.getHealth() / this.getMaxHealth()); } - public void handleEntityEvent(byte event) { - if (event == 4) { - this.attackAnimationTick = 10; - this.playSound(SoundEvents.IRON_GOLEM_ATTACK, 1.0F, 1.0F); - } else { - super.handleEntityEvent(event); + public void handleEntityEvent(byte pId) { + if (pId == 4) { + this.attackAnimationState.start(this.tickCount); } - } public int getAttackAnimationTick() { diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index ccd041785..6b0f74722 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -7,6 +7,7 @@ import dev.xkmc.modulargolems.content.client.pose.WeaponPose; import dev.xkmc.modulargolems.content.entity.common.IGolemModel; import dev.xkmc.modulargolems.content.entity.common.IHeadedModel; +import net.minecraft.client.animation.definitions.FrogAnimation; import net.minecraft.client.model.HierarchicalModel; import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelPart; @@ -62,28 +63,11 @@ public void copyFrom(MetalGolemModel other) { rightForeArm.copyFrom(other.rightForeArm); } - public void setupAnim(MetalGolemEntity entity, float f1, float f2, float f3, float f4, float f5) { - this.head.yRot = f4 * ((float) Math.PI / 180F); - this.head.xRot = f5 * ((float) Math.PI / 180F); - this.rightLeg.xRot = -1.5F * Mth.triangleWave(f1, 13.0F) * f2; - this.leftLeg.xRot = 1.5F * Mth.triangleWave(f1, 13.0F) * f2; - this.rightLeg.yRot = 0.0F; - this.leftLeg.yRot = 0.0F; - } + public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) { + this.root().getAllParts().forEach(ModelPart::resetPose); + + this.animate(pEntity.attackAnimationState, CustomModelAnimation.offensive, pAgeInTicks); - public void prepareMobModel(MetalGolemEntity entity, float bob, float speed, float pTick) { - MetalGolemPose pose = MetalGolemPose.DEFAULT; - if (!entity.getMainHandItem().isEmpty()) { - pose = WeaponPose.WEAPON; - } - int atkTick = entity.getAttackAnimationTick(); - if (atkTick > 0) { - pose.attackModel(entity, this, atkTick - pTick); - } else if (entity.isAggressive()) { - pose.aggressive(entity,this,bob,speed,pTick); - } else { - pose.walking(entity, this, bob, speed, pTick); - } } public void renderToBufferInternal(MetalGolemPartType type, PoseStack stack, VertexConsumer consumer, int i, int j, float f1, float f2, float f3, float f4) { From 3cd42e2eaacdf306bf91f79b8923898a202fe83b Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Tue, 16 Apr 2024 22:24:37 +0800 Subject: [PATCH 03/30] Animate Rebuilded --- .../content/entity/metalgolem/MetalGolemEntity.java | 9 ++++++--- .../content/entity/metalgolem/MetalGolemModel.java | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java index ae0a0f53b..ebadb7ccc 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java @@ -35,7 +35,8 @@ @SerialClass public class MetalGolemEntity extends SweepGolemEntity { - public final AnimationState attackAnimationState = new AnimationState(); + public final AnimationState armedAttackAnimationState = new AnimationState(); + public final AnimationState armedStandardAnimationState = new AnimationState(); public MetalGolemEntity(EntityType type, Level level) { super(type, level); @@ -111,9 +112,11 @@ public IronGolem.Crackiness getCrackiness() { return IronGolem.Crackiness.byFraction(this.getHealth() / this.getMaxHealth()); } - public void handleEntityEvent(byte pId) { + public void handleEntityEvent(MetalGolemEntity pEntity,byte pId) { if (pId == 4) { - this.attackAnimationState.start(this.tickCount); + if (!pEntity.getMainHandItem().isEmpty()) { + this.armedStandardAnimationState.start(this.tickCount); + } } } diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index 6b0f74722..016e27c1f 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -65,9 +65,9 @@ public void copyFrom(MetalGolemModel other) { public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) { this.root().getAllParts().forEach(ModelPart::resetPose); - - this.animate(pEntity.attackAnimationState, CustomModelAnimation.offensive, pAgeInTicks); - + if (!pEntity.getMainHandItem().isEmpty()) { + this.animate(pEntity.armedStandardAnimationState, CustomModelAnimation.standard, pAgeInTicks); + } } public void renderToBufferInternal(MetalGolemPartType type, PoseStack stack, VertexConsumer consumer, int i, int j, float f1, float f2, float f3, float f4) { From ab0a1bfa90f5c9cfcd45160803c53438d80419d3 Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Fri, 19 Apr 2024 14:52:59 +0800 Subject: [PATCH 04/30] Animate Rebuilded --- .../content/entity/metalgolem/MetalGolemEntity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java index ebadb7ccc..7ad463d07 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java @@ -114,6 +114,7 @@ public IronGolem.Crackiness getCrackiness() { public void handleEntityEvent(MetalGolemEntity pEntity,byte pId) { if (pId == 4) { + this.attackAnimationTick=4; if (!pEntity.getMainHandItem().isEmpty()) { this.armedStandardAnimationState.start(this.tickCount); } From 080c2cfefb920b67acc70cf3dc0eff8a4a0d7b0c Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Fri, 19 Apr 2024 14:58:36 +0800 Subject: [PATCH 05/30] Animate Rebuilded --- .../content/entity/metalgolem/MetalGolemEntity.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java index 7ad463d07..c674f295f 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java @@ -121,10 +121,6 @@ public void handleEntityEvent(MetalGolemEntity pEntity,byte pId) { } } - public int getAttackAnimationTick() { - return this.attackAnimationTick; - } - protected SoundEvent getHurtSound(DamageSource p_28872_) { return SoundEvents.IRON_GOLEM_HURT; } From b1d8c5f15e9e7e7bddd58897cead2247b60fd6f9 Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Mon, 22 Apr 2024 22:15:31 +0800 Subject: [PATCH 06/30] Animate Rebuilded --- .../client/pose/CustomModelAnimation.java | 37 +++++++++++++++++++ .../entity/metalgolem/MetalGolemEntity.java | 9 +++-- .../entity/metalgolem/MetalGolemModel.java | 1 + 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java diff --git a/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java b/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java new file mode 100644 index 000000000..d616a6300 --- /dev/null +++ b/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java @@ -0,0 +1,37 @@ +package dev.xkmc.modulargolems.content.client.pose;// Save this class in your mod and generate all required imports + +import net.minecraft.client.animation.AnimationChannel; +import net.minecraft.client.animation.AnimationDefinition; +import net.minecraft.client.animation.Keyframe; +import net.minecraft.client.animation.KeyframeAnimations; + +/** + * Made with Blockbench 4.9.4 + * Exported for Minecraft version 1.19 or later with Mojang mappings + * @author Author + */ +public class CustomModelAnimation { + public static final AnimationDefinition standard = AnimationDefinition.Builder.withLength(1.0F) + .addAnimation("rightArm", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.0833F, KeyframeAnimations.degreeVec(-110.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("rightForeArm", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(-2160.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(-75.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .build(); + + public static final AnimationDefinition offensive = AnimationDefinition.Builder.withLength(1.25F) + .addAnimation("rightArm", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(-110.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(-32.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(-110.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("rightForeArm", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(-75.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(-75.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .build(); +} \ No newline at end of file diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java index c674f295f..d84bbfc02 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java @@ -112,12 +112,13 @@ public IronGolem.Crackiness getCrackiness() { return IronGolem.Crackiness.byFraction(this.getHealth() / this.getMaxHealth()); } - public void handleEntityEvent(MetalGolemEntity pEntity,byte pId) { + public void handleEntityEvent(byte pId) { if (pId == 4) { this.attackAnimationTick=4; - if (!pEntity.getMainHandItem().isEmpty()) { - this.armedStandardAnimationState.start(this.tickCount); - } + this.armedAttackAnimationState.start(this.tickCount); + this.playSound(SoundEvents.IRON_GOLEM_ATTACK, 1.0F, 1.0F); + }else{ + super.handleEntityEvent(pId); } } diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index 016e27c1f..266074803 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -67,6 +67,7 @@ public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwi this.root().getAllParts().forEach(ModelPart::resetPose); if (!pEntity.getMainHandItem().isEmpty()) { this.animate(pEntity.armedStandardAnimationState, CustomModelAnimation.standard, pAgeInTicks); + this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.offensive, pAgeInTicks); } } From a80237cf58d5fc81dd5e2e7eb7141a918f6b6d54 Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Thu, 9 May 2024 23:31:25 +0800 Subject: [PATCH 07/30] Animate Rebuilded --- .../content/entity/metalgolem/MetalGolemModel.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index 266074803..4a7eeded0 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -69,6 +69,12 @@ public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwi this.animate(pEntity.armedStandardAnimationState, CustomModelAnimation.standard, pAgeInTicks); this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.offensive, pAgeInTicks); } + this.head.yRot = pNetHeadYaw * ((float) Math.PI / 180F); + this.head.xRot = pHeadPitch * ((float) Math.PI / 180F); + this.rightLeg.xRot = -1.5F * Mth.triangleWave(pLimbSwing, 13.0F) * pLimbSwingAmount; + this.leftLeg.xRot = 1.5F * Mth.triangleWave(pLimbSwing, 13.0F) * pLimbSwingAmount; + this.rightLeg.yRot = 0.0F; + this.leftLeg.yRot = 0.0F; } public void renderToBufferInternal(MetalGolemPartType type, PoseStack stack, VertexConsumer consumer, int i, int j, float f1, float f2, float f3, float f4) { From 0a8ef45a199f23f4ef2b77de0962175055bf0137 Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Fri, 10 May 2024 17:44:14 +0800 Subject: [PATCH 08/30] Animate Rebuilded --- .../content/entity/metalgolem/MetalGolemModel.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index 4a7eeded0..d0d4b8c64 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -3,11 +3,8 @@ import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.math.Axis; import dev.xkmc.modulargolems.content.client.armor.GolemEquipmentModels; -import dev.xkmc.modulargolems.content.client.pose.MetalGolemPose; -import dev.xkmc.modulargolems.content.client.pose.WeaponPose; import dev.xkmc.modulargolems.content.entity.common.IGolemModel; import dev.xkmc.modulargolems.content.entity.common.IHeadedModel; -import net.minecraft.client.animation.definitions.FrogAnimation; import net.minecraft.client.model.HierarchicalModel; import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelPart; @@ -17,7 +14,6 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import dev.xkmc.modulargolems.content.client.pose.CustomModelAnimation; -import net.minecraft.client.animation.KeyframeAnimations; @OnlyIn(Dist.CLIENT) public class MetalGolemModel extends HierarchicalModel implements IGolemModel, IHeadedModel { From 3186bbc69abd21cba7947cb68dc8e4ed5dd2ef40 Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Fri, 10 May 2024 19:31:05 +0800 Subject: [PATCH 09/30] Animate Rebuilded --- .../entity/metalgolem/MetalGolemModel.java | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index d0d4b8c64..80c44d1f1 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -65,14 +65,27 @@ public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwi this.animate(pEntity.armedStandardAnimationState, CustomModelAnimation.standard, pAgeInTicks); this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.offensive, pAgeInTicks); } - this.head.yRot = pNetHeadYaw * ((float) Math.PI / 180F); - this.head.xRot = pHeadPitch * ((float) Math.PI / 180F); - this.rightLeg.xRot = -1.5F * Mth.triangleWave(pLimbSwing, 13.0F) * pLimbSwingAmount; - this.leftLeg.xRot = 1.5F * Mth.triangleWave(pLimbSwing, 13.0F) * pLimbSwingAmount; - this.rightLeg.yRot = 0.0F; - this.leftLeg.yRot = 0.0F; - } + } + private void animateWalk(float pNetHeadYaw, float pHeadPitch,float pLimbSwing,float pLimbSwingAmount) { + this.head.yRot = pNetHeadYaw * ((float) Math.PI / 180F); + this.head.xRot = pHeadPitch * ((float) Math.PI / 180F); + this.rightLeg.xRot = -1.5F * Mth.triangleWave(pLimbSwing, 13.0F) * pLimbSwingAmount; + this.leftLeg.xRot = 1.5F * Mth.triangleWave(pLimbSwing, 13.0F) * pLimbSwingAmount; + this.rightLeg.yRot = 0.0F; + this.leftLeg.yRot = 0.0F; + this.resetArmPoses(); + } + private void resetArmPoses() { + this.leftArm.yRot = 0.0F; + this.leftArm.z = 1.0F; + this.leftArm.x = 13.0F; + this.leftArm.y = -13.0F; + this.rightArm.yRot = 0.0F; + this.rightArm.z = 1.0F; + this.rightArm.x = -13.0F; + this.rightArm.y = -13.0F; + } public void renderToBufferInternal(MetalGolemPartType type, PoseStack stack, VertexConsumer consumer, int i, int j, float f1, float f2, float f3, float f4) { if (type == MetalGolemPartType.BODY) { this.body.render(stack, consumer, i, j, f1, f2, f3, f4); From d9ff501d39b467f3bb4e0c630122c5de907646be Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Fri, 10 May 2024 19:33:28 +0800 Subject: [PATCH 10/30] Animate Rebuilded --- .../content/entity/metalgolem/MetalGolemModel.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index 80c44d1f1..a3c598952 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -74,6 +74,10 @@ private void animateWalk(float pNetHeadYaw, float pHeadPitch,float pLimbSwing,fl this.leftLeg.xRot = 1.5F * Mth.triangleWave(pLimbSwing, 13.0F) * pLimbSwingAmount; this.rightLeg.yRot = 0.0F; this.leftLeg.yRot = 0.0F; + this.rightArm.xRot = (-0.2F + 1.5F * Mth.triangleWave(walkTick, 13.0F)) * speed; + this.leftArm.xRot = (-0.2F - 1.5F * Mth.triangleWave(walkTick, 13.0F)) * speed; + this.rightForeArm.xRot = 0; + this.leftForeArm.xRot = 0; this.resetArmPoses(); } private void resetArmPoses() { From 2ffd6d1969b6c656b2e166429e7d8a375407d6af Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Fri, 10 May 2024 19:46:28 +0800 Subject: [PATCH 11/30] Animate Rebuilded --- .../entity/metalgolem/MetalGolemModel.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index a3c598952..bdb1dcc64 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -65,7 +65,7 @@ public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwi this.animate(pEntity.armedStandardAnimationState, CustomModelAnimation.standard, pAgeInTicks); this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.offensive, pAgeInTicks); } - + this.animateWalk(pNetHeadYaw,pHeadPitch,pLimbSwing,pLimbSwingAmount); } private void animateWalk(float pNetHeadYaw, float pHeadPitch,float pLimbSwing,float pLimbSwingAmount) { this.head.yRot = pNetHeadYaw * ((float) Math.PI / 180F); @@ -74,21 +74,21 @@ private void animateWalk(float pNetHeadYaw, float pHeadPitch,float pLimbSwing,fl this.leftLeg.xRot = 1.5F * Mth.triangleWave(pLimbSwing, 13.0F) * pLimbSwingAmount; this.rightLeg.yRot = 0.0F; this.leftLeg.yRot = 0.0F; - this.rightArm.xRot = (-0.2F + 1.5F * Mth.triangleWave(walkTick, 13.0F)) * speed; - this.leftArm.xRot = (-0.2F - 1.5F * Mth.triangleWave(walkTick, 13.0F)) * speed; + this.rightArm.xRot = (-0.2F + 1.5F * Mth.triangleWave(pLimbSwing, 13.0F)) * pLimbSwingAmount; + this.leftArm.xRot = (-0.2F - 1.5F * Mth.triangleWave(pLimbSwing, 13.0F)) * pLimbSwingAmount; this.rightForeArm.xRot = 0; this.leftForeArm.xRot = 0; this.resetArmPoses(); } private void resetArmPoses() { this.leftArm.yRot = 0.0F; - this.leftArm.z = 1.0F; - this.leftArm.x = 13.0F; - this.leftArm.y = -13.0F; + this.leftArm.z = 0.0F; + this.leftArm.x = 0.0F; + this.leftArm.y = -0.0F; this.rightArm.yRot = 0.0F; - this.rightArm.z = 1.0F; - this.rightArm.x = -13.0F; - this.rightArm.y = -13.0F; + this.rightArm.z = 0.0F; + this.rightArm.x = -0.0F; + this.rightArm.y = -0.0F; } public void renderToBufferInternal(MetalGolemPartType type, PoseStack stack, VertexConsumer consumer, int i, int j, float f1, float f2, float f3, float f4) { if (type == MetalGolemPartType.BODY) { From bdea4c36a4d7e2d7978f66df7e435f6a31fe6fa6 Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Fri, 10 May 2024 21:47:08 +0800 Subject: [PATCH 12/30] Animate Rebuilded --- .../content/entity/metalgolem/MetalGolemModel.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index bdb1dcc64..07c7854ce 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -61,11 +61,10 @@ public void copyFrom(MetalGolemModel other) { public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) { this.root().getAllParts().forEach(ModelPart::resetPose); + this.animateWalk(pNetHeadYaw,pHeadPitch,pLimbSwing,pLimbSwingAmount); if (!pEntity.getMainHandItem().isEmpty()) { - this.animate(pEntity.armedStandardAnimationState, CustomModelAnimation.standard, pAgeInTicks); this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.offensive, pAgeInTicks); } - this.animateWalk(pNetHeadYaw,pHeadPitch,pLimbSwing,pLimbSwingAmount); } private void animateWalk(float pNetHeadYaw, float pHeadPitch,float pLimbSwing,float pLimbSwingAmount) { this.head.yRot = pNetHeadYaw * ((float) Math.PI / 180F); @@ -84,11 +83,11 @@ private void resetArmPoses() { this.leftArm.yRot = 0.0F; this.leftArm.z = 0.0F; this.leftArm.x = 0.0F; - this.leftArm.y = -0.0F; + this.leftArm.y = -7.0F; this.rightArm.yRot = 0.0F; this.rightArm.z = 0.0F; this.rightArm.x = -0.0F; - this.rightArm.y = -0.0F; + this.rightArm.y = -7.0F; } public void renderToBufferInternal(MetalGolemPartType type, PoseStack stack, VertexConsumer consumer, int i, int j, float f1, float f2, float f3, float f4) { if (type == MetalGolemPartType.BODY) { From 54f55b35dae6db9dafcba10a6a1c480cb90a9df3 Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Fri, 10 May 2024 21:57:38 +0800 Subject: [PATCH 13/30] Animate Rebuilded --- .../content/client/pose/MetalGolemPose.java | 31 ------------------- .../content/client/pose/WeaponPose.java | 31 ------------------- .../entity/metalgolem/MetalGolemModel.java | 8 +++-- 3 files changed, 6 insertions(+), 64 deletions(-) delete mode 100644 src/main/java/dev/xkmc/modulargolems/content/client/pose/MetalGolemPose.java delete mode 100644 src/main/java/dev/xkmc/modulargolems/content/client/pose/WeaponPose.java diff --git a/src/main/java/dev/xkmc/modulargolems/content/client/pose/MetalGolemPose.java b/src/main/java/dev/xkmc/modulargolems/content/client/pose/MetalGolemPose.java deleted file mode 100644 index 40900d114..000000000 --- a/src/main/java/dev/xkmc/modulargolems/content/client/pose/MetalGolemPose.java +++ /dev/null @@ -1,31 +0,0 @@ -package dev.xkmc.modulargolems.content.client.pose; - -import dev.xkmc.modulargolems.content.entity.metalgolem.MetalGolemEntity; -import dev.xkmc.modulargolems.content.entity.metalgolem.MetalGolemModel; -import net.minecraft.client.animation.AnimationChannel; -import net.minecraft.client.animation.AnimationDefinition; -import net.minecraft.client.animation.Keyframe; -import net.minecraft.client.animation.KeyframeAnimations; -import net.minecraft.util.Mth; - -public class MetalGolemPose { - - public static final MetalGolemPose DEFAULT = new MetalGolemPose(); - - public void attackModel(MetalGolemEntity entity, MetalGolemModel model, float atkTick) { - model.rightArm.xRot = -2.0F + 1.5F * Mth.triangleWave(atkTick, 10.0F); - model.leftArm.xRot = -2.0F + 1.5F * Mth.triangleWave(atkTick, 10.0F); - model.rightForeArm.xRot = 0; - model.leftForeArm.xRot = 0; - } - public void aggressive(MetalGolemEntity entity, MetalGolemModel model, float walkTick, float speed, float pTick) { - walking(entity, model, walkTick, speed, pTick); - } - - public void walking(MetalGolemEntity entity, MetalGolemModel model, float walkTick, float speed, float pTick) { - model.rightArm.xRot = (-0.2F + 1.5F * Mth.triangleWave(walkTick, 13.0F)) * speed; - model.leftArm.xRot = (-0.2F - 1.5F * Mth.triangleWave(walkTick, 13.0F)) * speed; - model.rightForeArm.xRot = 0; - model.leftForeArm.xRot = 0; - } -} diff --git a/src/main/java/dev/xkmc/modulargolems/content/client/pose/WeaponPose.java b/src/main/java/dev/xkmc/modulargolems/content/client/pose/WeaponPose.java deleted file mode 100644 index d9013dbf2..000000000 --- a/src/main/java/dev/xkmc/modulargolems/content/client/pose/WeaponPose.java +++ /dev/null @@ -1,31 +0,0 @@ -package dev.xkmc.modulargolems.content.client.pose; - -import dev.xkmc.modulargolems.content.entity.metalgolem.MetalGolemEntity; -import dev.xkmc.modulargolems.content.entity.metalgolem.MetalGolemModel; -import net.minecraft.client.model.AnimationUtils; - -public class WeaponPose extends MetalGolemPose { - - public static final MetalGolemPose WEAPON = new WeaponPose(); - - @Override - public void attackModel(MetalGolemEntity entity, MetalGolemModel model, float atkTick) { - AnimationUtils.swingWeaponDown(model.rightArm, model.leftArm, entity, model.attackTime, atkTick); - model.leftArm.xRot = 0; - model.rightForeArm.xRot = 0; - model.leftForeArm.xRot = 0; - } - - @Override - public void aggressive(MetalGolemEntity entity, MetalGolemModel model, float walkTick, float speed, float pTick) { - model.rightArm.xRot = -1.8f; - model.leftArm.xRot = 0; - model.rightForeArm.xRot = 0; - model.leftForeArm.xRot = 0; - } - - public void walking(MetalGolemEntity entity, MetalGolemModel model, float walkTick, float speed, float pTick) { - super.walking(entity, model, walkTick, speed, pTick); - } - -} diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index 07c7854ce..de4368b69 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -61,9 +61,13 @@ public void copyFrom(MetalGolemModel other) { public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) { this.root().getAllParts().forEach(ModelPart::resetPose); - this.animateWalk(pNetHeadYaw,pHeadPitch,pLimbSwing,pLimbSwingAmount); if (!pEntity.getMainHandItem().isEmpty()) { - this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.offensive, pAgeInTicks); + int atkTick = pEntity.getAttackAnimationTick(); + if (atkTick > 0) { + this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.offensive, pAgeInTicks); + } else { + this.animateWalk(pNetHeadYaw,pHeadPitch,pLimbSwing,pLimbSwingAmount); + } } } private void animateWalk(float pNetHeadYaw, float pHeadPitch,float pLimbSwing,float pLimbSwingAmount) { From 5dd1945714f299eca35185727c5ce83d52919bee Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Fri, 10 May 2024 22:35:18 +0800 Subject: [PATCH 14/30] Animate Rebuilded --- .../content/client/pose/CustomModelAnimation.java | 8 ++++---- .../content/entity/metalgolem/MetalGolemEntity.java | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java b/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java index d616a6300..d6533bd7a 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java +++ b/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java @@ -12,23 +12,23 @@ */ public class CustomModelAnimation { public static final AnimationDefinition standard = AnimationDefinition.Builder.withLength(1.0F) - .addAnimation("rightArm", new AnimationChannel(AnimationChannel.Targets.ROTATION, + .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(0.0833F, KeyframeAnimations.degreeVec(-110.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) - .addAnimation("rightForeArm", new AnimationChannel(AnimationChannel.Targets.ROTATION, + .addAnimation("right_forearm", new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(-2160.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(0.5F, KeyframeAnimations.degreeVec(-75.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) .build(); public static final AnimationDefinition offensive = AnimationDefinition.Builder.withLength(1.25F) - .addAnimation("rightArm", new AnimationChannel(AnimationChannel.Targets.ROTATION, + .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(-110.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(0.25F, KeyframeAnimations.degreeVec(-32.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(0.5F, KeyframeAnimations.degreeVec(-110.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) - .addAnimation("rightForeArm", new AnimationChannel(AnimationChannel.Targets.ROTATION, + .addAnimation("right_forearm", new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(-75.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(0.25F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(0.5F, KeyframeAnimations.degreeVec(-75.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java index d84bbfc02..83cf1599d 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java @@ -107,7 +107,9 @@ public boolean hurt(DamageSource source, float amount) { } return flag; } - + public int getAttackAnimationTick() { + return this.attackAnimationTick; + } public IronGolem.Crackiness getCrackiness() { return IronGolem.Crackiness.byFraction(this.getHealth() / this.getMaxHealth()); } From 601d87d1ce658b4ef6c4a780ffe8edf8b9033c26 Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Sat, 11 May 2024 23:13:07 +0800 Subject: [PATCH 15/30] Animate Rebuilded --- .../client/pose/CustomModelAnimation.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java b/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java index d6533bd7a..6c8d739fd 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java +++ b/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java @@ -34,4 +34,28 @@ public class CustomModelAnimation { new Keyframe(0.5F, KeyframeAnimations.degreeVec(-75.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) .build(); + public static final AnimationDefinition attackInSpear = AnimationDefinition.Builder.withLength(0.9583F) + .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(85.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(-57.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(85.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("right_forearm", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(87.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("weapon", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(47.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .build(); + + public static final AnimationDefinition WarningInSpear = AnimationDefinition.Builder.withLength(0.7083F) + .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.2083F, KeyframeAnimations.degreeVec(85.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .build(); } \ No newline at end of file From c2c00500edb9062cb3c0e2db60417b22a2ad103c Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Sat, 11 May 2024 23:28:49 +0800 Subject: [PATCH 16/30] Animate Rebuilded --- .../content/client/pose/CustomModelAnimation.java | 5 +++-- .../content/entity/metalgolem/MetalGolemModel.java | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java b/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java index 6c8d739fd..b5043e207 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java +++ b/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java @@ -11,7 +11,7 @@ * @author Author */ public class CustomModelAnimation { - public static final AnimationDefinition standard = AnimationDefinition.Builder.withLength(1.0F) + public static final AnimationDefinition warningInSpear = AnimationDefinition.Builder.withLength(1.0F) .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(0.0833F, KeyframeAnimations.degreeVec(-110.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) @@ -22,7 +22,8 @@ public class CustomModelAnimation { )) .build(); - public static final AnimationDefinition offensive = AnimationDefinition.Builder.withLength(1.25F) + + public static final AnimationDefinition attackInAxe = AnimationDefinition.Builder.withLength(1.25F) .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(-110.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(0.25F, KeyframeAnimations.degreeVec(-32.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index de4368b69..b00fb3812 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -61,10 +61,11 @@ public void copyFrom(MetalGolemModel other) { public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) { this.root().getAllParts().forEach(ModelPart::resetPose); + int atkTick = pEntity.getAttackAnimationTick(); if (!pEntity.getMainHandItem().isEmpty()) { - int atkTick = pEntity.getAttackAnimationTick(); + if (atkTick > 0) { - this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.offensive, pAgeInTicks); + this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.attackInAxe, pAgeInTicks); } else { this.animateWalk(pNetHeadYaw,pHeadPitch,pLimbSwing,pLimbSwingAmount); } From 60445cfa0c3898f8a7d99526c1c78db96d82a01b Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Sun, 12 May 2024 19:04:07 +0800 Subject: [PATCH 17/30] Animate Rebuilded --- .../entity/metalgolem/MetalGolemModel.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index b00fb3812..7f623b63e 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -5,12 +5,14 @@ import dev.xkmc.modulargolems.content.client.armor.GolemEquipmentModels; import dev.xkmc.modulargolems.content.entity.common.IGolemModel; import dev.xkmc.modulargolems.content.entity.common.IHeadedModel; +import dev.xkmc.modulargolems.init.material.GolemWeaponType; import net.minecraft.client.model.HierarchicalModel; import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.Item; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import dev.xkmc.modulargolems.content.client.pose.CustomModelAnimation; @@ -58,16 +60,20 @@ public void copyFrom(MetalGolemModel other) { leftForeArm.copyFrom(other.leftForeArm); rightForeArm.copyFrom(other.rightForeArm); } - - public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) { + public void setupAnim(GolemWeaponType gwt,MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, + float pNetHeadYaw, float pHeadPitch) { this.root().getAllParts().forEach(ModelPart::resetPose); int atkTick = pEntity.getAttackAnimationTick(); if (!pEntity.getMainHandItem().isEmpty()) { + switch (gwt) { + case AXE: + if (atkTick > 0) { + this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.attackInAxe, pAgeInTicks); + } else if () { - if (atkTick > 0) { - this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.attackInAxe, pAgeInTicks); } else { - this.animateWalk(pNetHeadYaw,pHeadPitch,pLimbSwing,pLimbSwingAmount); + this.animateWalk(pNetHeadYaw, pHeadPitch, pLimbSwing, pLimbSwingAmount); + } } } } From 971ce50ca7e9f183d7956508debe454ea86fca77 Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Tue, 14 May 2024 23:43:29 +0800 Subject: [PATCH 18/30] Animate Rebuilded --- .../entity/metalgolem/MetalGolemModel.java | 14 ++++++++------ .../item/equipments/MetalGolemWeaponItem.java | 8 ++++---- .../init/material/GolemWeaponType.java | 18 +++++++++--------- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index 7f623b63e..1235fdd3a 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -5,6 +5,7 @@ import dev.xkmc.modulargolems.content.client.armor.GolemEquipmentModels; import dev.xkmc.modulargolems.content.entity.common.IGolemModel; import dev.xkmc.modulargolems.content.entity.common.IHeadedModel; +import dev.xkmc.modulargolems.content.item.equipments.MetalGolemWeaponItem; import dev.xkmc.modulargolems.init.material.GolemWeaponType; import net.minecraft.client.model.HierarchicalModel; import net.minecraft.client.model.geom.EntityModelSet; @@ -13,6 +14,7 @@ import net.minecraft.util.Mth; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import dev.xkmc.modulargolems.content.client.pose.CustomModelAnimation; @@ -60,22 +62,22 @@ public void copyFrom(MetalGolemModel other) { leftForeArm.copyFrom(other.leftForeArm); rightForeArm.copyFrom(other.rightForeArm); } - public void setupAnim(GolemWeaponType gwt,MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, - float pNetHeadYaw, float pHeadPitch) { + public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) { this.root().getAllParts().forEach(ModelPart::resetPose); int atkTick = pEntity.getAttackAnimationTick(); - if (!pEntity.getMainHandItem().isEmpty()) { - switch (gwt) { + ItemStack it =pEntity.getMainHandItem(); + if(it.getItem() instanceof MetalGolemWeaponItem wi){ + switch () { case AXE: if (atkTick > 0) { this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.attackInAxe, pAgeInTicks); - } else if () { + } else if (pEntity.isAggressive()) { } else { this.animateWalk(pNetHeadYaw, pHeadPitch, pLimbSwing, pLimbSwingAmount); } } - } + } } private void animateWalk(float pNetHeadYaw, float pHeadPitch,float pLimbSwing,float pLimbSwingAmount) { this.head.yRot = pNetHeadYaw * ((float) Math.PI / 180F); diff --git a/src/main/java/dev/xkmc/modulargolems/content/item/equipments/MetalGolemWeaponItem.java b/src/main/java/dev/xkmc/modulargolems/content/item/equipments/MetalGolemWeaponItem.java index fac7f024c..39b293ea9 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/item/equipments/MetalGolemWeaponItem.java +++ b/src/main/java/dev/xkmc/modulargolems/content/item/equipments/MetalGolemWeaponItem.java @@ -1,5 +1,6 @@ package dev.xkmc.modulargolems.content.item.equipments; +import dev.xkmc.modulargolems.init.material.GolemWeaponType; import dev.xkmc.modulargolems.init.registrate.GolemTypes; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.ai.attributes.AttributeModifier; @@ -11,7 +12,7 @@ public class MetalGolemWeaponItem extends GolemEquipmentItem { - public MetalGolemWeaponItem(Properties properties, int attackDamage, double percentAttack, float range, float sweep) { + public MetalGolemWeaponItem(Properties properties, int attackDamage, double percentAttack, float range, float sweep,GolemWeaponType gwt) { super(properties, EquipmentSlot.MAINHAND, GolemTypes.ENTITY_GOLEM::get, builder -> { var uuid = UUID.get(EquipmentSlot.MAINHAND); if (attackDamage > 0) { @@ -28,17 +29,14 @@ public MetalGolemWeaponItem(Properties properties, int attackDamage, double perc } }); } - @Override public boolean isEnchantable(ItemStack stack) { return true; } - @Override public int getEnchantmentValue() { return 15; } - @Override public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { if (enchantment.category == EnchantmentCategory.WEAPON) { @@ -46,5 +44,7 @@ public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantmen } return super.canApplyAtEnchantingTable(stack, enchantment); } + public GolemWeaponType getGolemWeaponType(MetalGolemWeaponItem i) { + } } diff --git a/src/main/java/dev/xkmc/modulargolems/init/material/GolemWeaponType.java b/src/main/java/dev/xkmc/modulargolems/init/material/GolemWeaponType.java index c6fadd60f..54bf08bed 100644 --- a/src/main/java/dev/xkmc/modulargolems/init/material/GolemWeaponType.java +++ b/src/main/java/dev/xkmc/modulargolems/init/material/GolemWeaponType.java @@ -10,20 +10,21 @@ import java.util.function.BiFunction; import static dev.xkmc.modulargolems.init.ModularGolems.REGISTRATE; - +interface MGFunction{ + MetalGolemWeaponItem create(Item.Properties properties, int rank, GolemWeaponType type); +} public enum GolemWeaponType { - SPEAR("item/long_weapon", (p, i) -> new MetalGolemWeaponItem(p, i, 0, 2, 0), "TII", " SI", "S T"), + SPEAR("item/long_weapon", (p, i) -> new MetalGolemWeaponItem(p, i, 0, 2, 0,), "TII", " SI", "S T"), AXE("item/battle_axe", (p, i) -> new MetalGolemWeaponItem(p, 0, i * 0.05, 0, 2), "III", "IS ", "TST"), - SWORD("item/sword", (p, i) -> new MetalGolemWeaponItem(p, i, 0, 1, 2), "TII", "ISI", "SIT"), - ; + SWORD("item/sword", (p, i) -> new MetalGolemWeaponItem(p, i, 0, 1, 2), "TII", "ISI", "SIT"),; - private final BiFunction factory; + private final MGFunction function; private final String[] pattern; private final String model; - GolemWeaponType(String model, BiFunction factory, String... pattern) { + GolemWeaponType(String model, MGFunction function, String... pattern) { this.model = model; - this.factory = factory; + this.function = function; this.pattern = pattern; } @@ -32,7 +33,7 @@ public String getName() { } public ItemEntry buildItem(IGolemWeaponMaterial material) { - return REGISTRATE.item(material.getName() + "_" + getName(), p -> factory.apply(material.modify(p.stacksTo(1)), material.getDamage())) + return REGISTRATE.item(material.getName() + "_" + getName(), p -> function.create(material.modify(p.stacksTo(1)), material.getDamage(),this)) .model((ctx, pvd) -> pvd.getBuilder(ctx.getName()).parent(new ModelFile.UncheckedModelFile(pvd.modLoc(model))) .texture("layer0", pvd.modLoc("item/equipments/" + ctx.getName()))) .defaultLang().register(); @@ -56,5 +57,4 @@ public ShapedRecipeBuilder pattern(ShapedRecipeBuilder unlock) { } return unlock; } - } From 4c5eafd163d26c037bcba64b0a153f4b82853a72 Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Wed, 15 May 2024 18:28:50 +0800 Subject: [PATCH 19/30] Animate Rebuilded --- .../content/entity/metalgolem/MetalGolemModel.java | 6 +++--- .../content/item/equipments/MetalGolemWeaponItem.java | 8 +++++--- .../xkmc/modulargolems/init/material/GolemWeaponType.java | 7 +++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index 1235fdd3a..d7aa7e561 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -65,9 +65,9 @@ public void copyFrom(MetalGolemModel other) { public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) { this.root().getAllParts().forEach(ModelPart::resetPose); int atkTick = pEntity.getAttackAnimationTick(); - ItemStack it =pEntity.getMainHandItem(); - if(it.getItem() instanceof MetalGolemWeaponItem wi){ - switch () { + Item its =pEntity.getMainHandItem().getItem(); + if(its instanceof MetalGolemWeaponItem wi){ + switch (wi.getGolemWeaponType(wi)) { case AXE: if (atkTick > 0) { this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.attackInAxe, pAgeInTicks); diff --git a/src/main/java/dev/xkmc/modulargolems/content/item/equipments/MetalGolemWeaponItem.java b/src/main/java/dev/xkmc/modulargolems/content/item/equipments/MetalGolemWeaponItem.java index 39b293ea9..9e671a733 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/item/equipments/MetalGolemWeaponItem.java +++ b/src/main/java/dev/xkmc/modulargolems/content/item/equipments/MetalGolemWeaponItem.java @@ -11,8 +11,8 @@ import net.minecraftforge.common.ForgeMod; public class MetalGolemWeaponItem extends GolemEquipmentItem { - - public MetalGolemWeaponItem(Properties properties, int attackDamage, double percentAttack, float range, float sweep,GolemWeaponType gwt) { + protected final GolemWeaponType gwt; + public MetalGolemWeaponItem(Properties properties, int attackDamage, double percentAttack, float range, float sweep, GolemWeaponType gwt) { super(properties, EquipmentSlot.MAINHAND, GolemTypes.ENTITY_GOLEM::get, builder -> { var uuid = UUID.get(EquipmentSlot.MAINHAND); if (attackDamage > 0) { @@ -28,6 +28,7 @@ public MetalGolemWeaponItem(Properties properties, int attackDamage, double perc builder.put(GolemTypes.GOLEM_SWEEP.get(), new AttributeModifier(uuid, "spear_sweep", sweep, AttributeModifier.Operation.ADDITION)); } }); + this.gwt = gwt; } @Override public boolean isEnchantable(ItemStack stack) { @@ -37,6 +38,7 @@ public boolean isEnchantable(ItemStack stack) { public int getEnchantmentValue() { return 15; } + @Override public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { if (enchantment.category == EnchantmentCategory.WEAPON) { @@ -45,6 +47,6 @@ public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantmen return super.canApplyAtEnchantingTable(stack, enchantment); } public GolemWeaponType getGolemWeaponType(MetalGolemWeaponItem i) { - + return i.gwt; } } diff --git a/src/main/java/dev/xkmc/modulargolems/init/material/GolemWeaponType.java b/src/main/java/dev/xkmc/modulargolems/init/material/GolemWeaponType.java index 54bf08bed..bb8c6c405 100644 --- a/src/main/java/dev/xkmc/modulargolems/init/material/GolemWeaponType.java +++ b/src/main/java/dev/xkmc/modulargolems/init/material/GolemWeaponType.java @@ -7,16 +7,15 @@ import net.minecraftforge.client.model.generators.ModelFile; import java.util.Locale; -import java.util.function.BiFunction; import static dev.xkmc.modulargolems.init.ModularGolems.REGISTRATE; interface MGFunction{ MetalGolemWeaponItem create(Item.Properties properties, int rank, GolemWeaponType type); } public enum GolemWeaponType { - SPEAR("item/long_weapon", (p, i) -> new MetalGolemWeaponItem(p, i, 0, 2, 0,), "TII", " SI", "S T"), - AXE("item/battle_axe", (p, i) -> new MetalGolemWeaponItem(p, 0, i * 0.05, 0, 2), "III", "IS ", "TST"), - SWORD("item/sword", (p, i) -> new MetalGolemWeaponItem(p, i, 0, 1, 2), "TII", "ISI", "SIT"),; + SPEAR("item/long_weapon", (p, i,t) -> new MetalGolemWeaponItem(p, i, 0, 2, 0,t),"TII", " SI", "S T"), + AXE("item/battle_axe", (p, i,t) -> new MetalGolemWeaponItem(p, 0, i * 0.05, 0, 2,t), "III", "IS ", "TST"), + SWORD("item/sword", (p, i,t) -> new MetalGolemWeaponItem(p, i, 0, 1, 2,t), "TII", "ISI", "SIT"),; private final MGFunction function; private final String[] pattern; From 6bb9a9180c7a554ff5a2231af5f000019d3de6ed Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Wed, 15 May 2024 19:50:36 +0800 Subject: [PATCH 20/30] Animate Rebuilded --- .../content/client/pose/CustomModelAnimation.java | 4 ++-- .../content/entity/metalgolem/MetalGolemEntity.java | 2 +- .../content/entity/metalgolem/MetalGolemModel.java | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java b/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java index b5043e207..b9fff96a2 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java +++ b/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java @@ -11,7 +11,7 @@ * @author Author */ public class CustomModelAnimation { - public static final AnimationDefinition warningInSpear = AnimationDefinition.Builder.withLength(1.0F) + public static final AnimationDefinition warningInAxe = AnimationDefinition.Builder.withLength(1.0F) .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(0.0833F, KeyframeAnimations.degreeVec(-110.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) @@ -53,7 +53,7 @@ public class CustomModelAnimation { )) .build(); - public static final AnimationDefinition WarningInSpear = AnimationDefinition.Builder.withLength(0.7083F) + public static final AnimationDefinition warningInSpear = AnimationDefinition.Builder.withLength(0.7083F) .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(0.2083F, KeyframeAnimations.degreeVec(85.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java index 83cf1599d..f7044692d 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java @@ -36,7 +36,7 @@ @SerialClass public class MetalGolemEntity extends SweepGolemEntity { public final AnimationState armedAttackAnimationState = new AnimationState(); - public final AnimationState armedStandardAnimationState = new AnimationState(); + public final AnimationState axeWarningAnimationState = new AnimationState(); public MetalGolemEntity(EntityType type, Level level) { super(type, level); diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index d7aa7e561..6c1b18169 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -6,7 +6,6 @@ import dev.xkmc.modulargolems.content.entity.common.IGolemModel; import dev.xkmc.modulargolems.content.entity.common.IHeadedModel; import dev.xkmc.modulargolems.content.item.equipments.MetalGolemWeaponItem; -import dev.xkmc.modulargolems.init.material.GolemWeaponType; import net.minecraft.client.model.HierarchicalModel; import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelPart; @@ -14,7 +13,6 @@ import net.minecraft.util.Mth; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import dev.xkmc.modulargolems.content.client.pose.CustomModelAnimation; @@ -72,7 +70,7 @@ public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwi if (atkTick > 0) { this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.attackInAxe, pAgeInTicks); } else if (pEntity.isAggressive()) { - + this.animate(pEntity.axeWarningAnimationState, CustomModelAnimation.warningInAxe, pAgeInTicks); } else { this.animateWalk(pNetHeadYaw, pHeadPitch, pLimbSwing, pLimbSwingAmount); } From 38de6d5db02eacbbcc20b76d3cdc7610a7542ba5 Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Wed, 15 May 2024 21:14:57 +0800 Subject: [PATCH 21/30] Animate Rebuilded --- .../content/entity/metalgolem/MetalGolemModel.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index 6c1b18169..fd7baea9c 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -66,15 +66,23 @@ public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwi Item its =pEntity.getMainHandItem().getItem(); if(its instanceof MetalGolemWeaponItem wi){ switch (wi.getGolemWeaponType(wi)) { + case SWORD: case AXE: if (atkTick > 0) { this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.attackInAxe, pAgeInTicks); } else if (pEntity.isAggressive()) { this.animate(pEntity.axeWarningAnimationState, CustomModelAnimation.warningInAxe, pAgeInTicks); - } else { - this.animateWalk(pNetHeadYaw, pHeadPitch, pLimbSwing, pLimbSwingAmount); - } } + break; + case SPEAR: + if (atkTick > 0) { + this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.attackInSpear, pAgeInTicks); + } else if (pEntity.isAggressive()) { + this.animate(pEntity.axeWarningAnimationState, CustomModelAnimation.warningInSpear, pAgeInTicks); + } + return; + } + this.animateWalk(pNetHeadYaw, pHeadPitch, pLimbSwing, pLimbSwingAmount); } } private void animateWalk(float pNetHeadYaw, float pHeadPitch,float pLimbSwing,float pLimbSwingAmount) { From 22e916b1daa32ff30019640d203b9b83d771d04c Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Wed, 15 May 2024 21:41:51 +0800 Subject: [PATCH 22/30] Animate Rebuilded --- .../entity/metalgolem/MetalGolemModel.java | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index fd7baea9c..390597411 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -64,25 +64,24 @@ public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwi this.root().getAllParts().forEach(ModelPart::resetPose); int atkTick = pEntity.getAttackAnimationTick(); Item its =pEntity.getMainHandItem().getItem(); + this.animateWalk(pNetHeadYaw, pHeadPitch, pLimbSwing, pLimbSwingAmount); if(its instanceof MetalGolemWeaponItem wi){ - switch (wi.getGolemWeaponType(wi)) { - case SWORD: - case AXE: - if (atkTick > 0) { - this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.attackInAxe, pAgeInTicks); - } else if (pEntity.isAggressive()) { - this.animate(pEntity.axeWarningAnimationState, CustomModelAnimation.warningInAxe, pAgeInTicks); - } - break; - case SPEAR: - if (atkTick > 0) { - this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.attackInSpear, pAgeInTicks); - } else if (pEntity.isAggressive()) { - this.animate(pEntity.axeWarningAnimationState, CustomModelAnimation.warningInSpear, pAgeInTicks); + switch (wi.getGolemWeaponType(wi)) { + case SWORD, AXE -> { + if (atkTick > 0) { + this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.attackInAxe, pAgeInTicks); + }if (pEntity.isAggressive()) { + this.animate(pEntity.axeWarningAnimationState, CustomModelAnimation.warningInAxe, pAgeInTicks); + } } - return; - } - this.animateWalk(pNetHeadYaw, pHeadPitch, pLimbSwing, pLimbSwingAmount); + case SPEAR -> { + if (atkTick > 0) { + this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.attackInSpear, pAgeInTicks); + } else if (pEntity.isAggressive()) { + this.animate(pEntity.axeWarningAnimationState, CustomModelAnimation.warningInSpear, pAgeInTicks); + } + } + } } } private void animateWalk(float pNetHeadYaw, float pHeadPitch,float pLimbSwing,float pLimbSwingAmount) { From 7c86e615fa3b328ac2bf83e173f52f233f6b8622 Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Thu, 16 May 2024 12:54:31 +0800 Subject: [PATCH 23/30] Animate Rebuilded --- .../content/entity/metalgolem/MetalGolemModel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index 390597411..24af503a8 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -70,7 +70,7 @@ public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwi case SWORD, AXE -> { if (atkTick > 0) { this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.attackInAxe, pAgeInTicks); - }if (pEntity.isAggressive()) { + }else if (pEntity.isAggressive()) { this.animate(pEntity.axeWarningAnimationState, CustomModelAnimation.warningInAxe, pAgeInTicks); } } From 3a848c8d9270b67793e69d20705ab8ce1d7c696e Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Thu, 16 May 2024 13:09:42 +0800 Subject: [PATCH 24/30] Animate Rebuilded --- .../content/entity/metalgolem/MetalGolemEntity.java | 7 ++++--- .../content/entity/metalgolem/MetalGolemModel.java | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java index f7044692d..ee645a4ae 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java @@ -35,9 +35,10 @@ @SerialClass public class MetalGolemEntity extends SweepGolemEntity { - public final AnimationState armedAttackAnimationState = new AnimationState(); + public final AnimationState axeAttackAnimationState = new AnimationState(); public final AnimationState axeWarningAnimationState = new AnimationState(); - + public final AnimationState spearAttackAnimationState = new AnimationState(); + public final AnimationState spearWarningAnimationState = new AnimationState(); public MetalGolemEntity(EntityType type, Level level) { super(type, level); this.setMaxUpStep(1); @@ -117,7 +118,7 @@ public IronGolem.Crackiness getCrackiness() { public void handleEntityEvent(byte pId) { if (pId == 4) { this.attackAnimationTick=4; - this.armedAttackAnimationState.start(this.tickCount); + this.axeAttackAnimationState.start(this.tickCount); this.playSound(SoundEvents.IRON_GOLEM_ATTACK, 1.0F, 1.0F); }else{ super.handleEntityEvent(pId); diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index 24af503a8..515e6be2e 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -69,16 +69,16 @@ public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwi switch (wi.getGolemWeaponType(wi)) { case SWORD, AXE -> { if (atkTick > 0) { - this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.attackInAxe, pAgeInTicks); + this.animate(pEntity.axeAttackAnimationState, CustomModelAnimation.attackInAxe, pAgeInTicks); }else if (pEntity.isAggressive()) { this.animate(pEntity.axeWarningAnimationState, CustomModelAnimation.warningInAxe, pAgeInTicks); } } case SPEAR -> { if (atkTick > 0) { - this.animate(pEntity.armedAttackAnimationState, CustomModelAnimation.attackInSpear, pAgeInTicks); + this.animate(pEntity.spearAttackAnimationState, CustomModelAnimation.attackInSpear, pAgeInTicks); } else if (pEntity.isAggressive()) { - this.animate(pEntity.axeWarningAnimationState, CustomModelAnimation.warningInSpear, pAgeInTicks); + this.animate(pEntity.spearAttackAnimationState, CustomModelAnimation.warningInSpear, pAgeInTicks); } } } From 92aedf8b6bcc1086262403f1de8451d0ae56deda Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Thu, 16 May 2024 13:11:49 +0800 Subject: [PATCH 25/30] Animate Rebuilded --- .../content/entity/metalgolem/MetalGolemModel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index 515e6be2e..dc5b244f5 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -70,7 +70,7 @@ public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwi case SWORD, AXE -> { if (atkTick > 0) { this.animate(pEntity.axeAttackAnimationState, CustomModelAnimation.attackInAxe, pAgeInTicks); - }else if (pEntity.isAggressive()) { + }else if(pEntity.isAggressive()) { this.animate(pEntity.axeWarningAnimationState, CustomModelAnimation.warningInAxe, pAgeInTicks); } } From 72cc5816ef507e1d63a57f6cb6326e7999c95480 Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Thu, 16 May 2024 16:42:43 +0800 Subject: [PATCH 26/30] Animate Rebuilded --- .../content/entity/metalgolem/MetalGolemModel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index dc5b244f5..7f88522f7 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -78,7 +78,7 @@ public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwi if (atkTick > 0) { this.animate(pEntity.spearAttackAnimationState, CustomModelAnimation.attackInSpear, pAgeInTicks); } else if (pEntity.isAggressive()) { - this.animate(pEntity.spearAttackAnimationState, CustomModelAnimation.warningInSpear, pAgeInTicks); + this.animate(pEntity.spearWarningAnimationState, CustomModelAnimation.warningInSpear, pAgeInTicks); } } } From ac0a1af22461d78788ee54066ddb9366b4c676a6 Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Thu, 16 May 2024 16:57:08 +0800 Subject: [PATCH 27/30] Animate Rebuilded --- .../client/pose/CustomModelAnimation.java | 19 ------------------- .../entity/metalgolem/MetalGolemEntity.java | 2 -- .../entity/metalgolem/MetalGolemModel.java | 4 ++-- 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java b/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java index b9fff96a2..f4e2f46cb 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java +++ b/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java @@ -11,18 +11,6 @@ * @author Author */ public class CustomModelAnimation { - public static final AnimationDefinition warningInAxe = AnimationDefinition.Builder.withLength(1.0F) - .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, - new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.0833F, KeyframeAnimations.degreeVec(-110.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) - )) - .addAnimation("right_forearm", new AnimationChannel(AnimationChannel.Targets.ROTATION, - new Keyframe(0.0F, KeyframeAnimations.degreeVec(-2160.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.5F, KeyframeAnimations.degreeVec(-75.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) - )) - .build(); - - public static final AnimationDefinition attackInAxe = AnimationDefinition.Builder.withLength(1.25F) .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(-110.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), @@ -52,11 +40,4 @@ public class CustomModelAnimation { new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) .build(); - - public static final AnimationDefinition warningInSpear = AnimationDefinition.Builder.withLength(0.7083F) - .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, - new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.2083F, KeyframeAnimations.degreeVec(85.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) - )) - .build(); } \ No newline at end of file diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java index ee645a4ae..0b747d5cf 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java @@ -36,9 +36,7 @@ @SerialClass public class MetalGolemEntity extends SweepGolemEntity { public final AnimationState axeAttackAnimationState = new AnimationState(); - public final AnimationState axeWarningAnimationState = new AnimationState(); public final AnimationState spearAttackAnimationState = new AnimationState(); - public final AnimationState spearWarningAnimationState = new AnimationState(); public MetalGolemEntity(EntityType type, Level level) { super(type, level); this.setMaxUpStep(1); diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index 7f88522f7..14d35534d 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -71,14 +71,14 @@ public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwi if (atkTick > 0) { this.animate(pEntity.axeAttackAnimationState, CustomModelAnimation.attackInAxe, pAgeInTicks); }else if(pEntity.isAggressive()) { - this.animate(pEntity.axeWarningAnimationState, CustomModelAnimation.warningInAxe, pAgeInTicks); + } } case SPEAR -> { if (atkTick > 0) { this.animate(pEntity.spearAttackAnimationState, CustomModelAnimation.attackInSpear, pAgeInTicks); } else if (pEntity.isAggressive()) { - this.animate(pEntity.spearWarningAnimationState, CustomModelAnimation.warningInSpear, pAgeInTicks); + } } } From 2dd5e8275685c2e4f6fc42c23d1e3a4bd68702f5 Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Thu, 16 May 2024 17:24:15 +0800 Subject: [PATCH 28/30] Animate Rebuilded --- .../content/client/pose/CustomModelAnimation.java | 15 +++++---------- .../entity/metalgolem/MetalGolemModel.java | 6 +----- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java b/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java index f4e2f46cb..27b2e59e6 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java +++ b/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java @@ -23,21 +23,16 @@ public class CustomModelAnimation { new Keyframe(0.5F, KeyframeAnimations.degreeVec(-75.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) .build(); - public static final AnimationDefinition attackInSpear = AnimationDefinition.Builder.withLength(0.9583F) + public static final AnimationDefinition attackInSpear = AnimationDefinition.Builder.withLength(1.75F) .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(85.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.25F, KeyframeAnimations.degreeVec(-57.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.5F, KeyframeAnimations.degreeVec(85.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + new Keyframe(0.5F, KeyframeAnimations.degreeVec(-55.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(82.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) .addAnimation("right_forearm", new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.25F, KeyframeAnimations.degreeVec(87.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) - )) - .addAnimation("weapon", new AnimationChannel(AnimationChannel.Targets.ROTATION, - new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.25F, KeyframeAnimations.degreeVec(47.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + new Keyframe(0.5F, KeyframeAnimations.degreeVec(87.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) .build(); } \ No newline at end of file diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index 14d35534d..a43933f50 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -70,15 +70,11 @@ public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwi case SWORD, AXE -> { if (atkTick > 0) { this.animate(pEntity.axeAttackAnimationState, CustomModelAnimation.attackInAxe, pAgeInTicks); - }else if(pEntity.isAggressive()) { - } } case SPEAR -> { if (atkTick > 0) { - this.animate(pEntity.spearAttackAnimationState, CustomModelAnimation.attackInSpear, pAgeInTicks); - } else if (pEntity.isAggressive()) { - + this.animate(pEntity.spearAttackAnimationState, CustomModelAnimation.attackInSpear, atkTick); } } } From 22e1f10d0f6e49d58af89567189b98fbb7876628 Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Thu, 16 May 2024 17:32:43 +0800 Subject: [PATCH 29/30] Animate Rebuilded --- .../client/pose/CustomModelAnimation.java | 34 ++++++++++++++++--- .../entity/metalgolem/MetalGolemEntity.java | 2 ++ .../entity/metalgolem/MetalGolemModel.java | 6 +++- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java b/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java index 27b2e59e6..b9fff96a2 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java +++ b/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java @@ -11,6 +11,18 @@ * @author Author */ public class CustomModelAnimation { + public static final AnimationDefinition warningInAxe = AnimationDefinition.Builder.withLength(1.0F) + .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.0833F, KeyframeAnimations.degreeVec(-110.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("right_forearm", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(-2160.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(-75.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .build(); + + public static final AnimationDefinition attackInAxe = AnimationDefinition.Builder.withLength(1.25F) .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(-110.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), @@ -23,16 +35,28 @@ public class CustomModelAnimation { new Keyframe(0.5F, KeyframeAnimations.degreeVec(-75.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) .build(); - public static final AnimationDefinition attackInSpear = AnimationDefinition.Builder.withLength(1.75F) + public static final AnimationDefinition attackInSpear = AnimationDefinition.Builder.withLength(0.9583F) .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(85.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.5F, KeyframeAnimations.degreeVec(-55.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.0F, KeyframeAnimations.degreeVec(82.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + new Keyframe(0.25F, KeyframeAnimations.degreeVec(-57.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(85.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) .addAnimation("right_forearm", new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.5F, KeyframeAnimations.degreeVec(87.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + new Keyframe(0.25F, KeyframeAnimations.degreeVec(87.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("weapon", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(47.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .build(); + + public static final AnimationDefinition warningInSpear = AnimationDefinition.Builder.withLength(0.7083F) + .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.2083F, KeyframeAnimations.degreeVec(85.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) .build(); } \ No newline at end of file diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java index 0b747d5cf..ee645a4ae 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemEntity.java @@ -36,7 +36,9 @@ @SerialClass public class MetalGolemEntity extends SweepGolemEntity { public final AnimationState axeAttackAnimationState = new AnimationState(); + public final AnimationState axeWarningAnimationState = new AnimationState(); public final AnimationState spearAttackAnimationState = new AnimationState(); + public final AnimationState spearWarningAnimationState = new AnimationState(); public MetalGolemEntity(EntityType type, Level level) { super(type, level); this.setMaxUpStep(1); diff --git a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java index a43933f50..7f88522f7 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java +++ b/src/main/java/dev/xkmc/modulargolems/content/entity/metalgolem/MetalGolemModel.java @@ -70,11 +70,15 @@ public void setupAnim(MetalGolemEntity pEntity, float pLimbSwing, float pLimbSwi case SWORD, AXE -> { if (atkTick > 0) { this.animate(pEntity.axeAttackAnimationState, CustomModelAnimation.attackInAxe, pAgeInTicks); + }else if(pEntity.isAggressive()) { + this.animate(pEntity.axeWarningAnimationState, CustomModelAnimation.warningInAxe, pAgeInTicks); } } case SPEAR -> { if (atkTick > 0) { - this.animate(pEntity.spearAttackAnimationState, CustomModelAnimation.attackInSpear, atkTick); + this.animate(pEntity.spearAttackAnimationState, CustomModelAnimation.attackInSpear, pAgeInTicks); + } else if (pEntity.isAggressive()) { + this.animate(pEntity.spearWarningAnimationState, CustomModelAnimation.warningInSpear, pAgeInTicks); } } } From ec57aa5d2a3650ee8a3d59d1d826a4de17dacee3 Mon Sep 17 00:00:00 2001 From: D12epic <1545919889@qq.com> Date: Thu, 16 May 2024 19:42:52 +0800 Subject: [PATCH 30/30] Animate Rebuilded --- .../client/pose/CustomModelAnimation.java | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java b/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java index b9fff96a2..f2afccaa1 100644 --- a/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java +++ b/src/main/java/dev/xkmc/modulargolems/content/client/pose/CustomModelAnimation.java @@ -24,33 +24,29 @@ public class CustomModelAnimation { public static final AnimationDefinition attackInAxe = AnimationDefinition.Builder.withLength(1.25F) - .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, - new Keyframe(0.0F, KeyframeAnimations.degreeVec(-110.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.25F, KeyframeAnimations.degreeVec(-32.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.5F, KeyframeAnimations.degreeVec(-110.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) - )) - .addAnimation("right_forearm", new AnimationChannel(AnimationChannel.Targets.ROTATION, - new Keyframe(0.0F, KeyframeAnimations.degreeVec(-75.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.25F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.5F, KeyframeAnimations.degreeVec(-75.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) - )) - .build(); - public static final AnimationDefinition attackInSpear = AnimationDefinition.Builder.withLength(0.9583F) .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, - new Keyframe(0.0F, KeyframeAnimations.degreeVec(85.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.25F, KeyframeAnimations.degreeVec(-57.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.5F, KeyframeAnimations.degreeVec(85.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + new Keyframe(0.0F, KeyframeAnimations.degreeVec(-110.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(-32.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) .addAnimation("right_forearm", new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.25F, KeyframeAnimations.degreeVec(87.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(80.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) - .addAnimation("weapon", new AnimationChannel(AnimationChannel.Targets.ROTATION, - new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), - new Keyframe(0.25F, KeyframeAnimations.degreeVec(47.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + .build(); + + public static final AnimationDefinition attackInSpear = AnimationDefinition.Builder.withLength(1.75F) + .addAnimation("right_arm", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(85.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(-57.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) + .addAnimation("right_forearm", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(87.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(-2.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) .build(); public static final AnimationDefinition warningInSpear = AnimationDefinition.Builder.withLength(0.7083F)