Skip to content

Commit

Permalink
Partial backport from 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mechalopa committed Feb 25, 2024
1 parent 12d2f9b commit 0720e71
Show file tree
Hide file tree
Showing 103 changed files with 365 additions and 344 deletions.
14 changes: 5 additions & 9 deletions src/main/java/com/github/mechalopa/hmag/ModEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.github.mechalopa.hmag.util.ModTags;
import com.github.mechalopa.hmag.util.ModUtils;
import com.github.mechalopa.hmag.world.entity.IModMob;
import com.github.mechalopa.hmag.world.entity.KashaEntity;
import com.github.mechalopa.hmag.world.item.AncientShieldItem;
import com.github.mechalopa.hmag.world.item.ILevelItem;
import com.github.mechalopa.hmag.world.item.InsomniaSwordItem;
Expand Down Expand Up @@ -40,9 +39,7 @@
import net.minecraft.world.entity.SpawnGroupData;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.goal.AvoidEntityGoal;
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
import net.minecraft.world.entity.monster.Creeper;
import net.minecraft.world.entity.monster.EnderMan;
import net.minecraft.world.entity.npc.VillagerProfession;
import net.minecraft.world.entity.npc.VillagerTrades.ItemListing;
Expand Down Expand Up @@ -394,7 +391,7 @@ public void onEntityJoinWorld(EntityJoinWorldEvent event)
{
EnderMan endermanentity = (EnderMan)event.getEntity();
endermanentity.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(endermanentity, LivingEntity.class, 10, false, false, (p) -> {
if (!(p instanceof EnderMan) && p.hasEffect(ModEffects.ENDER_RAGE.get()))
if (p.hasEffect(ModEffects.ENDER_RAGE.get()))
{
final double d0 = 8.0D + p.getEffect(ModEffects.ENDER_RAGE.get()).getAmplifier() * 12.0D;
return p.distanceToSqr(endermanentity) <= d0 * d0;
Expand All @@ -405,11 +402,6 @@ public void onEntityJoinWorld(EntityJoinWorldEvent event)
}
}).setUnseenMemoryTicks(30));
}
else if (event.getEntity() instanceof Creeper)
{
Creeper creeerentity = (Creeper)event.getEntity();
creeerentity.goalSelector.addGoal(3, new AvoidEntityGoal<>(creeerentity, KashaEntity.class, 6.0F, 1.0D, 1.2D));
}
}
}
catch (Exception e)
Expand Down Expand Up @@ -633,8 +625,12 @@ public void onWandererTrades(WandererTradesEvent event)
}

genericTrades.add(new BasicItemListing(new ItemStack(ModItems.ANCIENT_STONE.get(), 2), new ItemStack(Items.EMERALD, 1), 32, 1, 0.05F));
genericTrades.add(new BasicItemListing(new ItemStack(ModItems.OGRE_HORN.get(), 1), new ItemStack(Items.EMERALD, 3), 32, 1, 0.05F));
genericTrades.add(new BasicItemListing(2, new ItemStack(ModItems.LEMON.get()), 5, 1, 1.0F));
genericTrades.add(new BasicItemListing(5, new ItemStack(ModItems.FIRE_BOTTLE.get()), 8, 1, 1.0F));
rareTrades.add(new BasicItemListing(32, new ItemStack(ModItems.LIGHTNING_PARTICLE.get()), 5, 1, 0.05F));
rareTrades.add(new BasicItemListing(1, new ItemStack(ModItems.SOUL_POWDER.get()), 8, 1, 0.05F));
rareTrades.add(new BasicItemListing(64, new ItemStack(ModItems.LIGHTNING_PARTICLE.get()), 5, 1, 0.05F));
rareTrades.add(new BasicItemListing(32, new ItemStack(ModItems.PURIFICATION_CLOTH.get()), 3, 1, 0.05F));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public static MeshDefinition createMesh(CubeDeformation cd, float yOffset, int b
public void setupAnim(T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch)
{
super.setupAnim(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);

this.bust.xRot = ((float)Math.PI / 4.0F) + ((float)Math.PI / 18.0F);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
@OnlyIn(Dist.CLIENT)
public class AlrauneModel<T extends Mob> extends AbstractAdvancedGirlModel<T>
{
// private ModelPart rightArmPart1;
// private ModelPart leftArmPart1;
private ModelPart rightHair1;
private ModelPart leftHair1;
private ModelPart rightHair2;
Expand Down Expand Up @@ -73,6 +75,8 @@ public class AlrauneModel<T extends Mob> extends AbstractAdvancedGirlModel<T>
public AlrauneModel(ModelPart modelPart)
{
super(modelPart);
// this.rightArmPart1 = this.rightArm.getChild("right_arm_part_1");
// this.leftArmPart1 = this.leftArm.getChild("left_arm_part_1");
this.rightHair1 = this.head.getChild("right_hair_1");
this.leftHair1 = this.head.getChild("left_hair_1");
this.rightHair2 = this.rightHair1.getChild("right_hair_2");
Expand Down Expand Up @@ -139,12 +143,14 @@ public static MeshDefinition createMesh(CubeDeformation cd)
{
MeshDefinition md = AbstractAdvancedGirlModel.createMesh(cd, 0.0F);
PartDefinition pd = md.getRoot();
ModClientUtils.addC(pd, cd, "right_arm", 40, 16, 0.0F, -2.0F, -1.0F, 2.0F, 12.0F, 2.0F, -5.0F, 2.0F, 0.0F);
ModClientUtils.addC(pd, cd, "left_arm", 40, 16, -2.0F, -2.0F, -1.0F, 2.0F, 12.0F, 2.0F, 5.0F, 2.0F, 0.0F, true);
PartDefinition rapd = ModClientUtils.addC(pd, cd, "right_arm", 40, 16, 0.0F, -2.0F, -1.0F, 2.0F, 12.0F, 2.0F, -5.0F, 2.0F, 0.0F);
PartDefinition lapd = ModClientUtils.addC(pd, cd, "left_arm", 40, 16, -2.0F, -2.0F, -1.0F, 2.0F, 12.0F, 2.0F, 5.0F, 2.0F, 0.0F, true);
ModClientUtils.addC(rapd, cd, "right_arm_part_1", 48, 32, -0.5F, 0.0F, -1.5F, 3.0F, 1.0F, 3.0F, 0.0F, 7.0F, 0.0F);
ModClientUtils.addC(lapd, cd, "left_arm_part_1", 48, 32, -2.5F, 0.0F, -1.5F, 3.0F, 1.0F, 3.0F, 0.0F, 7.0F, 0.0F, true);

PartDefinition headpd = pd.getChild("head");
PartDefinition rh1pd = ModClientUtils.addC(headpd, cd, "right_hair_1", 48, 64, -0.5F, -1.0F, 0.0F, 1.0F, 10.0F, 1.0F, -4.0F, -8.0F, 1.5F, 0.25F);
PartDefinition lh1pd = ModClientUtils.addC(headpd, cd, "left_hair_1", 48, 64, -0.5F, -1.0F, 0.0F, 1.0F, 10.0F, 1.0F, 4.0F, -8.0F, 1.5F, true, 0.25F);
PartDefinition rh1pd = ModClientUtils.addC(headpd, cd, "right_hair_1", 48, 64, -0.5F, -1.0F, 0.0F, 1.0F, 10.0F, 1.0F, -4.0F, -8.0F, 0.5F, 0.25F);
PartDefinition lh1pd = ModClientUtils.addC(headpd, cd, "left_hair_1", 48, 64, -0.5F, -1.0F, 0.0F, 1.0F, 10.0F, 1.0F, 4.0F, -8.0F, 0.5F, true, 0.25F);
PartDefinition rh2pd = ModClientUtils.addC(rh1pd, cd, "right_hair_2", 32, 48, -1.0F, -0.5F, -0.5F, 2.0F, 6.0F, 1.0F, 0.0F, 9.5F, 0.0F);
PartDefinition lh2pd = ModClientUtils.addC(lh1pd, cd, "left_hair_2", 32, 48, -1.0F, -0.5F, -0.5F, 2.0F, 6.0F, 1.0F, 0.0F, 9.5F, 0.0F, true);
ModClientUtils.addC(rh2pd, cd, "right_hair_3", 32, 56, -1.0F, -0.5F, -0.5F, 2.0F, 5.0F, 1.0F, 0.0F, 5.5F, 0.0F);
Expand Down Expand Up @@ -228,9 +234,9 @@ public static LayerDefinition createBodyLayer()
}

@Override
public void setupAnim(T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch)
public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch)
{
super.setupAnim(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);
super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);

this.rightArm.zRot = ((float)Math.PI / 8.0F);
this.leftArm.zRot = -((float)Math.PI / 8.0F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ public static MeshDefinition createPowerArmorMesh(CubeDeformation cd)
}

@Override
public void setupAnim(T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch)
public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch)
{
super.setupAnim(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);

CreeperGirlModel.doAnim(entityIn, ageInTicks, this.attackTime, this);
super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);
CreeperGirlModel.doAnim(entity, ageInTicks, this.attackTime, this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,16 @@ public static LayerDefinition createBodyLayer()
}

@Override
public void setupAnim(T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch)
public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch)
{
super.setupAnim(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);

doAnim(entityIn, ageInTicks, this.attackTime, this);

super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);
doAnim(entity, ageInTicks, this.attackTime, this);
// this.skirt1.xRot = 0.0F;
// this.skirt2.xRot = 0.0F;
// this.hatPart.xRot = 0.0F;
}

public static void doAnim(CreeperGirlEntity entityIn, float ageInTicks, float attackTime, AbstractGirlModel<?> model)
public static void doAnim(CreeperGirlEntity entity, float ageInTicks, float attackTime, AbstractGirlModel<?> model)
{
float f = Mth.sin(attackTime * (float)Math.PI);
float f1 = Mth.sin((1.0F - (1.0F - attackTime) * (1.0F - attackTime)) * (float)Math.PI);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static MeshDefinition createMesh(CubeDeformation cd)
PartDefinition headpd = pd.getChild("head");
PartDefinition h1pd = ModClientUtils.addC(headpd, cd, "hair_part_1", 40, 48, -4.0F, 0.0F, -1.0F, 8.0F, 4.0F, 1.0F, 0.0F, 0.0F, 4.0F);
ModClientUtils.addC(h1pd, cd, "hair_part_2", 42, 56, -4.0F, 0.0F, -1.0F, 8.0F, 8.0F, 1.0F, 0.0F, 4.0F, 0.0F);
PartDefinition ribbonpd = ModClientUtils.addC(headpd, cd, "ribbon_1", 16, 32, -1.0F, -1.5F, -0.5F, 2.0F, 3.0F, 1.0F, 0.0F, -7.0F, 4.25F);
PartDefinition ribbonpd = ModClientUtils.addC(headpd, cd, "ribbon_1", 18, 32, -1.0F, -1.5F, -0.5F, 2.0F, 3.0F, 1.0F, 0.0F, -7.0F, 4.25F);
ModClientUtils.addC(ribbonpd, cd, "ribbon_right_part", 0, 96, 0.0F, -3.5F, -1.0F, 6.0F, 7.0F, 1.0F, 1.0F, 0.0F, 0.25F);
ModClientUtils.addC(ribbonpd, cd, "ribbon_left_part", 16, 96, -6.0F, -3.5F, -1.0F, 6.0F, 7.0F, 1.0F, -1.0F, 0.0F, 0.25F);
ModClientUtils.addC(ribbonpd, cd, "ribbon_2", 0, 104, -4.5F, 0.0F, -1.0F, 9.0F, 5.0F, 1.0F, 0.0F, 1.5F, 0.25F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public class DodomekiModel<T extends Mob> extends AbstractAdvancedGirlModel<T>
private ModelPart skirt3;
private ModelPart hairPart1;
private ModelPart hairPart2;
private ModelPart ribbonBase;
private ModelPart ribbonRightPart;
private ModelPart ribbonLeftPart;
// private ModelPart headwearPart;

public DodomekiModel(ModelPart modelPart)
Expand All @@ -34,6 +37,9 @@ public DodomekiModel(ModelPart modelPart)
this.skirt3 = this.skirt2.getChild("skirt_3");
this.hairPart1 = this.head.getChild("hair_part_1");
this.hairPart2 = this.hairPart1.getChild("hair_part_2");
this.ribbonBase = this.head.getChild("ribbon_base");
this.ribbonRightPart = this.ribbonBase.getChild("ribbon_right_part");
this.ribbonLeftPart = this.ribbonBase.getChild("ribbon_left_part");
// this.headwearPart = this.hat.getChild("hat_part");
}

Expand All @@ -53,6 +59,9 @@ public static MeshDefinition createMesh(CubeDeformation cd)
PartDefinition headpd = pd.getChild("head");
PartDefinition h1pd = ModClientUtils.addC(headpd, cd, "hair_part_1", 0, 72, -4.0F, 0.0F, -1.0F, 8.0F, 4.0F, 1.0F, 0.0F, 0.0F, 4.0F);
ModClientUtils.addC(h1pd, cd, "hair_part_2", 0, 80, -4.0F, 0.0F, -1.0F, 8.0F, 8.0F, 1.0F, 0.0F, 4.0F, 0.0F);
PartDefinition ribbonpd = ModClientUtils.addC(headpd, cd, "ribbon_base", 16, 52, -1.0F, -0.5F, -0.5F, 2.0F, 1.0F, 1.0F, -4.375F, -8.0F, -1.5F);
ModClientUtils.addC(ribbonpd, cd, "ribbon_right_part", 16, 56, 0.0F, -2.5F, 0.0F, 4.0F, 5.0F, 1.0F, 0.5F, 0.0F, -0.25F, -0.25F);
ModClientUtils.addC(ribbonpd, cd, "ribbon_left_part", 16, 64, -4.0F, -2.5F, 0.0F, 4.0F, 5.0F, 1.0F, -0.5F, 0.0F, -0.25F, -0.25F);
PartDefinition hatpd = pd.getChild("hat");
ModClientUtils.addC(hatpd, cd, "hat_part", 32, 80, -4.0F, -2.0F, -4.0F, 8.0F, 2.0F, 8.0F, 0.0F, 3.0F, 0.0F, 0.5F);
return md;
Expand All @@ -64,11 +73,11 @@ public static LayerDefinition createBodyLayer()
}

@Override
public void setupAnim(T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch)
public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch)
{
this.head.zRot = 0.0F;

super.setupAnim(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);
super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);

this.head.zRot += Mth.cos(ageInTicks * 0.054F) * 0.06F;
this.hat.copyFrom(this.head);
Expand All @@ -91,6 +100,17 @@ public void setupAnim(T entityIn, float limbSwing, float limbSwingAmount, float
this.hairPart2.xRot = (float)Math.PI / 21.0F;
this.hairPart2.xRot += Mth.sin(ageInTicks * 0.075F + (float)Math.PI / 4.0F) * 0.06F;

float f = Mth.sin(ageInTicks * 0.075F + (float)Math.PI / 2.0F);
this.ribbonBase.xRot = -((float)Math.PI / 15.0F);
this.ribbonBase.xRot += Mth.sin(ageInTicks * 0.054F + (float)Math.PI / 6.0F) * 0.018F;
this.ribbonBase.zRot = -((float)Math.PI * 3.0F / 12.0F);
this.ribbonRightPart.yRot = -((float)Math.PI / 24.0F);
this.ribbonLeftPart.yRot = (float)Math.PI / 24.0F;
this.ribbonRightPart.yRot -= f * 0.05F;
this.ribbonLeftPart.yRot += f * 0.05F;
this.ribbonRightPart.zRot = -((float)Math.PI / 15.0F);
this.ribbonLeftPart.zRot = (float)Math.PI / 15.0F;

if (this.riding)
{
this.skirt2.xRot = -((float)Math.PI * 2.0F / 5.0F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ public DrownedGirlArmorModel(ModelPart modelPart)
}

@Override
public void prepareMobModel(T entityIn, float limbSwing, float limbSwingAmount, float partialTick)
public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick)
{
this.rightArmPose = HumanoidModel.ArmPose.EMPTY;
this.leftArmPose = HumanoidModel.ArmPose.EMPTY;
ItemStack stack = entityIn.getItemInHand(InteractionHand.MAIN_HAND);
ItemStack stack = entity.getItemInHand(InteractionHand.MAIN_HAND);

if (ModUtils.isTrident(stack) && entityIn.isAggressive())
if (ModUtils.isTrident(stack) && entity.isAggressive())
{
if (entityIn.getMainArm() == HumanoidArm.RIGHT)
if (entity.getMainArm() == HumanoidArm.RIGHT)
{
this.rightArmPose = HumanoidModel.ArmPose.THROW_SPEAR;
}
Expand All @@ -38,14 +38,13 @@ public void prepareMobModel(T entityIn, float limbSwing, float limbSwingAmount,
}
}

super.prepareMobModel(entityIn, limbSwing, limbSwingAmount, partialTick);
super.prepareMobModel(entity, limbSwing, limbSwingAmount, partialTick);
}

@Override
public void setupAnim(T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch)
public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch)
{
super.setupAnim(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);

DrownedGirlModel.doAnim(entityIn, ageInTicks, attackTime, this);
super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);
DrownedGirlModel.doAnim(entity, ageInTicks, attackTime, this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,32 @@ public static LayerDefinition createBodyLayer()
}

@Override
public void prepareMobModel(T entityIn, float limbSwing, float limbSwingAmount, float partialTick)
public void prepareMobModel(T entity, float limbSwing, float limbSwingAmount, float partialTick)
{
prepareDrownedModel(entityIn, this);

super.prepareMobModel(entityIn, limbSwing, limbSwingAmount, partialTick);
prepareDrownedModel(entity, this);
super.prepareMobModel(entity, limbSwing, limbSwingAmount, partialTick);
}

@Override
public void setupAnim(T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch)
public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch)
{
super.setupAnim(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);

doAnim(entityIn, ageInTicks, attackTime, this);

super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);
doAnim(entity, ageInTicks, attackTime, this);
this.rightArmPart.yRot = -((float)Math.PI / 18.0F);
this.rightArmPart.yRot += Mth.sin(ageInTicks * 0.045F + (float)Math.PI) * 0.06F;
this.leftArmPart.yRot = (float)Math.PI / 18.0F;
this.leftArmPart.yRot -= Mth.sin(ageInTicks * 0.045F + (float)Math.PI) * 0.06F;
}

public static void prepareDrownedModel(Zombie entityIn, HumanoidModel<?> model)
public static void prepareDrownedModel(Zombie entity, HumanoidModel<?> model)
{
model.rightArmPose = HumanoidModel.ArmPose.EMPTY;
model.leftArmPose = HumanoidModel.ArmPose.EMPTY;
ItemStack stack = entityIn.getItemInHand(InteractionHand.MAIN_HAND);
ItemStack stack = entity.getItemInHand(InteractionHand.MAIN_HAND);

if (ModUtils.isTrident(stack) && entityIn.isAggressive())
if (ModUtils.isTrident(stack) && entity.isAggressive())
{
if (entityIn.getMainArm() == HumanoidArm.RIGHT)
if (entity.getMainArm() == HumanoidArm.RIGHT)
{
model.rightArmPose = HumanoidModel.ArmPose.THROW_SPEAR;
}
Expand All @@ -87,7 +84,7 @@ public static void prepareDrownedModel(Zombie entityIn, HumanoidModel<?> model)
}
}

public static void doAnim(Zombie entityIn, float ageInTicks, float attackTime, AbstractGirlModel<?> model)
public static void doAnim(Zombie entity, float ageInTicks, float attackTime, AbstractGirlModel<?> model)
{
if (model.leftArmPose == HumanoidModel.ArmPose.THROW_SPEAR)
{
Expand Down
Loading

0 comments on commit 0720e71

Please sign in to comment.