diff --git a/common/src/main/java/dev/itsmeow/betteranimalsplus/client/ClientLifecycleHandler.java b/common/src/main/java/dev/itsmeow/betteranimalsplus/client/ClientLifecycleHandler.java index 7f94d1e3..91d9c368 100644 --- a/common/src/main/java/dev/itsmeow/betteranimalsplus/client/ClientLifecycleHandler.java +++ b/common/src/main/java/dev/itsmeow/betteranimalsplus/client/ClientLifecycleHandler.java @@ -215,6 +215,7 @@ public static void registerEntityRenders() { .mEntry(ModelGazelle::new, "erlanger_gazelle") .mEntry(ModelGazelle::new, "springbok_gazelle")); R.addRender(ModEntities.CROCODILE::getEntityType, 0.8F, r -> r.tVariant().mSingle(ModelCrocodile::new, "crocodile").childScale(0.6F)); + R.addRender(ModEntities.ALLIGATOR::getEntityType, 0.8F, r -> r.tVariant().mSingle(ModelAlligator::new, "alligator").childScale(0.6F)); RenderFactory.addRender(ModEntities.PROJECTILE_BADGER_DIRT::get, RenderFactory.nothing()); } @@ -255,6 +256,7 @@ public static void layerDefinitions(ImmutableMap.Builder extends ModelBAP { + + public ModelPart butt; + public ModelPart chest; + public ModelPart neck; + public ModelPart head; + public ModelPart topJaw; + public ModelPart snout; + public ModelPart cranium; + public ModelPart lowJaw; + public ModelPart lowJaw2; + public ModelPart lArm1; + public ModelPart lArm2; + public ModelPart lFoot; + public ModelPart rArm1; + public ModelPart rArm2; + public ModelPart rHand; + public ModelPart tail1; + public ModelPart tail2; + public ModelPart tail3; + public ModelPart tail4; + public ModelPart tail5; + public ModelPart tail6; + public ModelPart lLeg1; + public ModelPart lLeg2; + public ModelPart lFoot2; + public ModelPart rLeg; + public ModelPart rLeg2; + public ModelPart rFoot; + + public ModelAlligator(ModelPart root) { + this.butt = root.getChild("butt"); + this.chest = butt.getChild("chest"); + this.neck = chest.getChild("neck"); + this.head = neck.getChild("head"); + this.topJaw = head.getChild("topJaw"); + this.snout = topJaw.getChild("snout"); + this.cranium = snout.getChild("cranium"); + this.lowJaw = head.getChild("lowJaw"); + this.lowJaw2 = lowJaw.getChild("lowJaw2"); + this.lArm1 = chest.getChild("lArm1"); + this.lArm2 = lArm1.getChild("lArm2"); + this.lFoot = lArm2.getChild("lFoot"); + this.rArm1 = chest.getChild("rArm1"); + this.rArm2 = rArm1.getChild("rArm2"); + this.rHand = rArm2.getChild("rHand"); + this.tail1 = butt.getChild("tail1"); + this.tail2 = tail1.getChild("tail2"); + this.tail3 = tail2.getChild("tail3"); + this.tail4 = tail3.getChild("tail4"); + this.tail5 = tail4.getChild("tail5"); + this.tail6 = tail5.getChild("tail6"); + this.lLeg1 = butt.getChild("lLeg1"); + this.lLeg2 = lLeg1.getChild("lLeg2"); + this.lFoot2 = lLeg2.getChild("lFoot2"); + this.rLeg = butt.getChild("rLeg"); + this.rLeg2 = rLeg.getChild("rLeg2"); + this.rFoot = rLeg2.getChild("rFoot"); + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + PartDefinition butt = partdefinition.addOrReplaceChild("butt", CubeListBuilder.create().texOffs(0, 0).addBox(-7.0F, -2.0F, -0.1F, 14.0F, 10.0F, 16.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 15.5F, -7.5F)); + PartDefinition chest = butt.addOrReplaceChild("chest", CubeListBuilder.create().texOffs(0, 26).addBox(-6.5F, 0.0F, -12.0F, 13.0F, 9.0F, 11.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -1.7F, 1.3F, 0.0911F, 0.0F, 0.0F)); + PartDefinition neck = chest.addOrReplaceChild("neck", CubeListBuilder.create().texOffs(0, 46).addBox(-4.5F, -1.0F, -8.0F, 9.0F, 8.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 1.0F, -11.2F, 0.0456F, 0.0F, 0.0F)); + PartDefinition head = neck.addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 62).addBox(-4.5F, -2.0F, -4.0F, 9.0F, 5.0F, 4.0F, new CubeDeformation(0.01F)), PartPose.offsetAndRotation(0.0F, 1.0F, -7.5F, -0.0911F, 0.0F, 0.0F)); + PartDefinition topJaw = head.addOrReplaceChild("topJaw", CubeListBuilder.create().texOffs(0, 72).addBox(-3.5F, -2.0F, -12.0F, 7.0F, 2.0F, 12.0F, new CubeDeformation(0.0F)) + .texOffs(28, 59).addBox(-3.5F, 0.0F, -12.0F, 7.0F, 1.0F, 12.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 3.0F, -3.9F)); + PartDefinition snout = topJaw.addOrReplaceChild("snout", CubeListBuilder.create().texOffs(0, 95).addBox(-3.0F, -3.0F, -2.0F, 6.0F, 1.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, -9.7F)); + PartDefinition cranium = snout.addOrReplaceChild("cranium", CubeListBuilder.create().texOffs(0, 100).addBox(-3.0F, 0.0F, 0.0F, 6.0F, 2.0F, 10.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -2.8F, 0.0F, 0.1227F, 0.0F, 0.0F)); + PartDefinition lowJaw = head.addOrReplaceChild("lowJaw", CubeListBuilder.create().texOffs(0, 116).addBox(-4.5F, 0.0F, -4.0F, 9.0F, 2.0F, 4.0F, new CubeDeformation(-0.001F)), PartPose.offset(0.0F, 2.9F, 0.0F)); + PartDefinition lowJaw2 = lowJaw.addOrReplaceChild("lowJaw2", CubeListBuilder.create().texOffs(42, 149).addBox(-3.0F, 0.0F, -11.75F, 6.0F, 2.0F, 12.0F, new CubeDeformation(0.0F)) + .texOffs(39, 130).addBox(-3.0F, -1.0F, -11.75F, 6.0F, 1.0F, 12.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, -3.9F)); + PartDefinition lArm1 = chest.addOrReplaceChild("lArm1", CubeListBuilder.create().texOffs(46, 0).mirror().addBox(-2.0F, -1.0F, -2.0F, 4.0F, 7.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(6.0F, 6.0F, -7.0F, 0.0F, 0.0F, -1.309F)); + PartDefinition lArm2 = lArm1.addOrReplaceChild("lArm2", CubeListBuilder.create().texOffs(63, 0).mirror().addBox(-1.5F, 0.158F, -1.9263F, 3.0F, 7.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(0.0F, 5.5F, 0.75F, -1.2298F, 0.0F, 0.0F)); + PartDefinition lFoot = lArm2.addOrReplaceChild("lFoot", CubeListBuilder.create().texOffs(72, 10).addBox(-2.0F, -0.25F, -4.0F, 4.0F, 1.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 7.0F, 0.0F, 0.4887F, -1.0996F, 1.1519F)); + PartDefinition rArm1 = chest.addOrReplaceChild("rArm1", CubeListBuilder.create().texOffs(46, 0).addBox(-2.0F, -1.0F, -2.0F, 4.0F, 7.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-6.0F, 6.0F, -7.0F, 0.0F, 0.0F, 1.309F)); + PartDefinition rArm2 = rArm1.addOrReplaceChild("rArm2", CubeListBuilder.create().texOffs(63, 0).addBox(-1.5F, 0.158F, -1.9263F, 3.0F, 7.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 5.5F, 0.75F, -1.2298F, 0.0F, 0.0F)); + PartDefinition rHand = rArm2.addOrReplaceChild("rHand", CubeListBuilder.create().texOffs(72, 10).addBox(-2.0F, -0.25F, -4.0F, 4.0F, 1.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 7.0F, 0.0F, 0.4887F, 1.0996F, -1.1519F)); + PartDefinition tail1 = butt.addOrReplaceChild("tail1", CubeListBuilder.create().texOffs(0, 146).addBox(-6.0F, -4.5F, 0.0F, 12.0F, 9.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 3.0F, 15.0F, -0.1367F, 0.0F, 0.0F)); + PartDefinition tail2 = tail1.addOrReplaceChild("tail2", CubeListBuilder.create().texOffs(0, 162).addBox(-5.0F, -4.0F, 0.0F, 10.0F, 8.0F, 9.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -0.5F, 6.7F)); + PartDefinition tail3 = tail2.addOrReplaceChild("tail3", CubeListBuilder.create().texOffs(0, 179).addBox(-4.0F, -3.5F, 0.0F, 8.0F, 7.0F, 9.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -0.5F, 8.7F)); + PartDefinition tail4 = tail3.addOrReplaceChild("tail4", CubeListBuilder.create().texOffs(0, 195).addBox(-3.5F, -3.0F, 0.0F, 7.0F, 6.0F, 9.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -0.5F, 8.7F, 0.0456F, 0.0F, 0.0F)); + PartDefinition tail5 = tail4.addOrReplaceChild("tail5", CubeListBuilder.create().texOffs(0, 210).addBox(-2.5F, -2.5F, 0.0F, 5.0F, 5.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -0.5F, 8.7F, -0.0456F, 0.0F, 0.0F)); + PartDefinition tail6 = tail5.addOrReplaceChild("tail6", CubeListBuilder.create().texOffs(0, 223).addBox(-1.5F, -2.0F, 0.0F, 3.0F, 4.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -0.5F, 7.7F)); + PartDefinition tailSpikesL6 = tail6.addOrReplaceChild("tailSpikesL6", CubeListBuilder.create().texOffs(47, 105).addBox(0.0F, -3.0F, 0.0F, 0.0F, 4.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-1.0F, -2.7F, 0.0F, 0.0F, 0.0911F, 0.0F)); + PartDefinition tailSpikesR6 = tail6.addOrReplaceChild("tailSpikesR6", CubeListBuilder.create().texOffs(47, 105).addBox(0.0F, -3.0F, 0.0F, 0.0F, 4.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(1.0F, -2.7F, 0.0F, 0.0F, -0.0911F, 0.0F)); + PartDefinition tailSpikesL5 = tail5.addOrReplaceChild("tailSpikesL5", CubeListBuilder.create().texOffs(47, 92).addBox(0.0F, -3.0F, 0.0F, 0.0F, 4.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-2.0F, -3.2F, 0.0F, 0.0F, 0.0911F, 0.0F)); + PartDefinition tailSpikesR5 = tail5.addOrReplaceChild("tailSpikesR5", CubeListBuilder.create().texOffs(47, 92).addBox(0.0F, -3.0F, 0.0F, 0.0F, 4.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(2.0F, -3.2F, 0.0F, 0.0F, -0.0911F, 0.0F)); + PartDefinition tailSpikesL4 = tail4.addOrReplaceChild("tailSpikesL4", CubeListBuilder.create().texOffs(57, 84).addBox(0.0F, -3.0F, 0.0F, 0.0F, 4.0F, 9.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-3.0F, -3.8F, 0.0F, 0.0F, 0.0911F, 0.0F)); + PartDefinition tailSpikesR4 = tail4.addOrReplaceChild("tailSpikesR4", CubeListBuilder.create().texOffs(57, 84).addBox(0.0F, -3.0F, 0.0F, 0.0F, 4.0F, 9.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(3.0F, -3.8F, 0.0F, 0.0F, -0.0911F, 0.0F)); + PartDefinition tailSpikesL3 = tail3.addOrReplaceChild("tailSpikesL3", CubeListBuilder.create().texOffs(27, 96).addBox(0.0F, -2.0F, 0.0F, 0.0F, 3.0F, 9.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-3.5F, -4.2F, 0.0F, 0.0F, 0.0911F, 0.0F)); + PartDefinition tailSpikesR3 = tail3.addOrReplaceChild("tailSpikesR3", CubeListBuilder.create().texOffs(27, 96).addBox(0.0F, -2.0F, 0.0F, 0.0F, 3.0F, 9.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(3.5F, -4.2F, 0.0F, 0.0F, -0.0911F, 0.0F)); + PartDefinition tailSpikesL2 = tail2.addOrReplaceChild("tailSpikesL2", CubeListBuilder.create().texOffs(32, 80).addBox(0.0F, -2.0F, 0.0F, 0.0F, 3.0F, 9.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-4.5F, -4.8F, 0.0F, 0.0F, 0.0911F, 0.0F)); + PartDefinition tailSpikesR2 = tail2.addOrReplaceChild("tailSpikesR2", CubeListBuilder.create().texOffs(32, 80).addBox(0.0F, -2.0F, 0.0F, 0.0F, 3.0F, 9.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(4.1F, -4.8F, 0.0F, 0.0F, -0.0911F, 0.0F)); + PartDefinition tailSpikesL1 = tail1.addOrReplaceChild("tailSpikesL1", CubeListBuilder.create().texOffs(20, 87).addBox(0.0F, -2.0F, 0.0F, 0.0F, 3.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-5.2F, -5.0F, 0.0F, 0.0F, 0.0911F, 0.0F)); + PartDefinition tailSpikesR1 = tail1.addOrReplaceChild("tailSpikesR1", CubeListBuilder.create().texOffs(20, 87).addBox(0.0F, -2.0F, 0.0F, 0.0F, 3.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(4.8F, -5.0F, 0.0F, 0.0F, -0.0911F, 0.0F)); + PartDefinition lLeg1 = butt.addOrReplaceChild("lLeg1", CubeListBuilder.create().texOffs(58, 23).addBox(-3.0F, 0.0F, -2.5F, 5.0F, 8.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(7.0F, 1.0F, 15.5F, -1.0908F, 0.0F, -0.5672F)); + PartDefinition lLeg2 = lLeg1.addOrReplaceChild("lLeg2", CubeListBuilder.create().texOffs(51, 40).addBox(-2.0F, 0.0F, -1.5F, 4.0F, 8.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-0.5F, 7.5F, -0.25F, 1.9635F, 0.0F, 0.0F)); + PartDefinition lFoot2 = lLeg2.addOrReplaceChild("lFoot2", CubeListBuilder.create().texOffs(66, 40).addBox(-2.5F, 0.0F, -5.75F, 5.0F, 1.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 7.75F, 1.5F, -0.6109F, -0.1396F, 0.8727F)); + PartDefinition rLeg = butt.addOrReplaceChild("rLeg", CubeListBuilder.create().texOffs(58, 23).addBox(-3.0F, 0.0F, -2.5F, 5.0F, 8.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-6.0F, 1.5F, 15.5F, -1.0908F, 0.0F, 0.5672F)); + PartDefinition rLeg2 = rLeg.addOrReplaceChild("rLeg2", CubeListBuilder.create().texOffs(51, 40).addBox(-2.0F, 0.0F, -1.5F, 4.0F, 8.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-0.5F, 7.5F, -0.25F, 1.9635F, 0.0F, 0.0F)); + PartDefinition rFoot = rLeg2.addOrReplaceChild("rFoot", CubeListBuilder.create().texOffs(66, 40).addBox(-2.5F, 0.0F, -5.75F, 5.0F, 1.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 7.75F, 1.5F, -0.6109F, 0.1396F, -0.8727F)); + return LayerDefinition.create(meshdefinition, 90, 256); + } + + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + butt.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); + } + + @Override + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + + } + +} \ No newline at end of file diff --git a/common/src/main/java/dev/itsmeow/betteranimalsplus/common/entity/EntityAlligator.java b/common/src/main/java/dev/itsmeow/betteranimalsplus/common/entity/EntityAlligator.java new file mode 100644 index 00000000..3f8204cf --- /dev/null +++ b/common/src/main/java/dev/itsmeow/betteranimalsplus/common/entity/EntityAlligator.java @@ -0,0 +1,29 @@ +package dev.itsmeow.betteranimalsplus.common.entity; + +import dev.itsmeow.betteranimalsplus.common.entity.util.abstracts.EntityAnimalWithTypes; +import dev.itsmeow.betteranimalsplus.common.entity.util.abstracts.EntityCrocidilian; +import dev.itsmeow.betteranimalsplus.init.ModEntities; +import dev.itsmeow.imdlib.entity.EntityTypeContainer; +import dev.itsmeow.imdlib.entity.util.variant.IVariant; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.level.Level; + +public class EntityAlligator extends EntityCrocidilian { + + public EntityAlligator(EntityType entityType, Level level) { + super(entityType, level); + } + + @Override + public EntityTypeContainer getContainer() { + return ModEntities.ALLIGATOR; + } + + @Override + public IVariant getRandomType() { + if(this.getRandom().nextFloat() <= 0.125F) { + return getContainer().getVariantForName("albino").orElse(null); + } + return getContainer().getVariantForName("american").orElse(null); + } +} diff --git a/common/src/main/java/dev/itsmeow/betteranimalsplus/common/entity/EntityCrocodile.java b/common/src/main/java/dev/itsmeow/betteranimalsplus/common/entity/EntityCrocodile.java index 850db5e6..1485e8a3 100644 --- a/common/src/main/java/dev/itsmeow/betteranimalsplus/common/entity/EntityCrocodile.java +++ b/common/src/main/java/dev/itsmeow/betteranimalsplus/common/entity/EntityCrocodile.java @@ -1,7 +1,7 @@ package dev.itsmeow.betteranimalsplus.common.entity; +import dev.itsmeow.betteranimalsplus.common.entity.util.abstracts.EntityAnimalWithTypes; import dev.itsmeow.betteranimalsplus.common.entity.util.abstracts.EntityCrocidilian; -import dev.itsmeow.betteranimalsplus.common.entity.util.abstracts.EntityWaterMobPathing; import dev.itsmeow.betteranimalsplus.init.ModEntities; import dev.itsmeow.imdlib.entity.EntityTypeContainer; import dev.itsmeow.imdlib.entity.interfaces.ISelectiveVariantTypes; @@ -14,17 +14,17 @@ import java.util.Set; -public class EntityCrocodile extends EntityCrocidilian implements ISelectiveVariantTypes { +public class EntityCrocodile extends EntityCrocidilian implements ISelectiveVariantTypes { private static final String[] ALL_TYPE = {"american", "nile"}; private static final String[] SAVANNA_TYPE = {"nile"}; - public EntityCrocodile(EntityType entityType, Level level) { + public EntityCrocodile(EntityType entityType, Level level) { super(entityType, level); } @Override - public EntityTypeContainer getContainer() { + public EntityTypeContainer getContainer() { return ModEntities.CROCODILE; } diff --git a/common/src/main/java/dev/itsmeow/betteranimalsplus/common/entity/util/abstracts/EntityCrocidilian.java b/common/src/main/java/dev/itsmeow/betteranimalsplus/common/entity/util/abstracts/EntityCrocidilian.java index 91c39005..702b25bb 100644 --- a/common/src/main/java/dev/itsmeow/betteranimalsplus/common/entity/util/abstracts/EntityCrocidilian.java +++ b/common/src/main/java/dev/itsmeow/betteranimalsplus/common/entity/util/abstracts/EntityCrocidilian.java @@ -1,26 +1,36 @@ package dev.itsmeow.betteranimalsplus.common.entity.util.abstracts; +import dev.itsmeow.betteranimalsplus.common.entity.ai.HybridMoveController; +import dev.itsmeow.betteranimalsplus.common.entity.ai.HybridPathNavigator; import dev.itsmeow.betteranimalsplus.common.entity.ai.PeacefulNearestAttackableTargetGoal; import dev.itsmeow.betteranimalsplus.common.entity.util.IPeacefulAware; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.Difficulty; +import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.ai.control.SmoothSwimmingLookControl; -import net.minecraft.world.entity.ai.control.SmoothSwimmingMoveControl; +import net.minecraft.world.entity.MobType; +import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.ai.goal.BreathAirGoal; import net.minecraft.world.entity.ai.goal.MeleeAttackGoal; import net.minecraft.world.entity.ai.goal.RandomSwimmingGoal; import net.minecraft.world.entity.ai.goal.TryFindWaterGoal; import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; +import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.monster.Enemy; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; +import net.minecraft.world.level.pathfinder.BlockPathTypes; +import net.minecraft.world.phys.Vec3; -public abstract class EntityCrocidilian extends EntityWaterMobPathingWithTypesAirBreathing implements Enemy, IPeacefulAware { +public abstract class EntityCrocidilian extends EntityAnimalWithTypes implements Enemy, IPeacefulAware { public EntityCrocidilian(EntityType entityType, Level level) { super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 25, 7, 1F, 1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 12); + this.setPathfindingMalus(BlockPathTypes.WALKABLE, 1.5F); + this.setPathfindingMalus(BlockPathTypes.WATER, 1.5F); + this.setPathfindingMalus(BlockPathTypes.WATER_BORDER, 1F); + this.moveControl = new HybridMoveController(this); + this.maxUpStep = 1F; } @Override @@ -42,4 +52,65 @@ public boolean canUse() { public boolean isPeaceful() { return this.level.getDifficulty() == Difficulty.PEACEFUL; } + + @Override + protected PathNavigation createNavigation(Level worldIn) { + return new HybridPathNavigator<>(this, worldIn, e -> e.getTarget() == null || (e.getTarget().isInWater() && this.isInWater()) || (!e.getTarget().isInWater() && this.isInWater())); + } + + @Override + public void travel(Vec3 moveVec) { + if(this.isEffectiveAi() && this.isInWater()) { + this.moveRelative(0.1F, moveVec); + this.move(MoverType.SELF, this.getDeltaMovement()); + this.setDeltaMovement(this.getDeltaMovement().scale(0.9D)); + if(this.getTarget() == null) { + this.setDeltaMovement(this.getDeltaMovement().add(0.0D, -0.005D, 0.0D)); + } + } else { + super.travel(moveVec); + } + + } + + @Override + public boolean canBeLeashed(Player player) { + return false; + } + + @Override + public int getMaxAirSupply() { + return 4800; + } + + @Override + protected int increaseAirSupply(int currentAir) { + return this.getMaxAirSupply(); + } + + @Override + public boolean canBreatheUnderwater() { + return false; + } + + @Override + public boolean isPushedByFluid() { + return false; + } + + @Override + public MobType getMobType() { + return MobType.WATER; + } + + @Override + public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob ageable) { + return null; + } + + @Override + protected EntityAnimalWithTypes getBaseChild() { + return null; + } + } diff --git a/common/src/main/java/dev/itsmeow/betteranimalsplus/init/ModEntities.java b/common/src/main/java/dev/itsmeow/betteranimalsplus/init/ModEntities.java index 9618a390..48d4a1f3 100644 --- a/common/src/main/java/dev/itsmeow/betteranimalsplus/init/ModEntities.java +++ b/common/src/main/java/dev/itsmeow/betteranimalsplus/init/ModEntities.java @@ -511,6 +511,17 @@ public class ModEntities { .size(2.2F, 0.8F) .biomesOverworld(BiomeTypes.SWAMP, BiomeTypes.SAVANNA) .variants("american", "nile")); + public static final EntityTypeContainer ALLIGATOR = H.add(EntityAlligator.class, EntityAlligator::new, "alligator", () -> Mob.createMobAttributes() + .add(Attributes.MAX_HEALTH, 25.0D) + .add(Attributes.MOVEMENT_SPEED, 1.2D) + .add(Attributes.ATTACK_DAMAGE) + .add(Attributes.ATTACK_DAMAGE, 3D), b -> b + .spawn(MobCategory.WATER_CREATURE, 3, 1, 3) + .waterPlacement() + .egg(0x113d0c, 0x362f21) + .size(2.2F, 0.8F) + .biomesOverworld(BiomeTypes.SWAMP) + .variants("american", "albino")); public static LinkedHashMap> getEntities() { return H.ENTITIES; diff --git a/common/src/main/resources/assets/betteranimalsplus/lang/en_us.json b/common/src/main/resources/assets/betteranimalsplus/lang/en_us.json index 88cdc3aa..15e5b6da 100644 --- a/common/src/main/resources/assets/betteranimalsplus/lang/en_us.json +++ b/common/src/main/resources/assets/betteranimalsplus/lang/en_us.json @@ -109,6 +109,7 @@ "entity.betteranimalsplus.octopus": "Octopus", "entity.betteranimalsplus.gazelle": "Gazelle", "entity.betteranimalsplus.crocodile": "Crocodile", + "entity.betteranimalsplus.alligator": "Alligator", "entity.betteranimalsplus.eel_saltwater.type.conger": "Conger", "entity.betteranimalsplus.eel_saltwater.type.dragon": "Dragon", diff --git a/common/src/main/resources/assets/betteranimalsplus/models/item/alligator_spawn_egg.json b/common/src/main/resources/assets/betteranimalsplus/models/item/alligator_spawn_egg.json new file mode 100644 index 00000000..7a2c6da8 --- /dev/null +++ b/common/src/main/resources/assets/betteranimalsplus/models/item/alligator_spawn_egg.json @@ -0,0 +1,3 @@ +{ + "parent": "item/template_spawn_egg" +} \ No newline at end of file diff --git a/common/src/main/resources/assets/betteranimalsplus/textures/entity/alligator_albino.png b/common/src/main/resources/assets/betteranimalsplus/textures/entity/alligator_albino.png new file mode 100644 index 00000000..8757cd61 Binary files /dev/null and b/common/src/main/resources/assets/betteranimalsplus/textures/entity/alligator_albino.png differ diff --git a/common/src/main/resources/assets/betteranimalsplus/textures/entity/alligator_american.png b/common/src/main/resources/assets/betteranimalsplus/textures/entity/alligator_american.png new file mode 100644 index 00000000..505603ff Binary files /dev/null and b/common/src/main/resources/assets/betteranimalsplus/textures/entity/alligator_american.png differ