diff --git a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/CamelBehaviour.java b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/CamelBehaviour.java new file mode 100644 index 00000000..3d677d55 --- /dev/null +++ b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/CamelBehaviour.java @@ -0,0 +1,17 @@ +package com.minelittlepony.unicopia.entity.behaviour; + +import com.minelittlepony.unicopia.entity.player.Pony; +import net.minecraft.entity.passive.CamelEntity; + +public class CamelBehaviour extends EntityBehaviour { + @Override + public void update(Pony player, CamelEntity entity, Disguise spell) { + entity.setDashing(player.asEntity().isSprinting()); + + if (player.asEntity().isSneaking()) { + entity.startSitting(); + } else { + entity.startStanding(); + } + } +} diff --git a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityAppearance.java b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityAppearance.java index 92d92a05..50085cf0 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityAppearance.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityAppearance.java @@ -17,6 +17,7 @@ import com.minelittlepony.unicopia.ability.magic.Caster; import com.minelittlepony.unicopia.compat.pehkui.PehkUtil; import com.minelittlepony.unicopia.entity.collision.EntityCollisions; import com.minelittlepony.unicopia.entity.mob.ButterflyEntity; +import com.minelittlepony.unicopia.entity.mob.SombraEntity; import com.minelittlepony.unicopia.entity.mob.UEntityAttributes; import com.minelittlepony.unicopia.entity.player.PlayerDimensions; import com.minelittlepony.unicopia.entity.player.Pony; @@ -233,6 +234,7 @@ public class EntityAppearance implements NbtSerialisable, PlayerDimensions.Provi || entity instanceof ButterflyEntity || entity instanceof ShulkerBulletEntity || entity instanceof Flutterer + || entity instanceof SombraEntity || ProjectileUtil.isFlyingProjectile(entity)) { return FlightType.INSECTOID; } diff --git a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityBehaviour.java b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityBehaviour.java index 22127261..189ee33d 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityBehaviour.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityBehaviour.java @@ -290,6 +290,7 @@ public class EntityBehaviour { register(ChickenBehaviour::new, EntityType.CHICKEN); register(BlazeBehaviour::new, EntityType.BLAZE); register(MinecartBehaviour::new, EntityType.CHEST_MINECART, EntityType.COMMAND_BLOCK_MINECART, EntityType.FURNACE_MINECART, EntityType.HOPPER_MINECART, EntityType.MINECART, EntityType.SPAWNER_MINECART, EntityType.TNT_MINECART); + register(CamelBehaviour::new, EntityType.CAMEL); } public static void bootstrap() {} diff --git a/src/main/java/com/minelittlepony/unicopia/entity/mob/SombraEntity.java b/src/main/java/com/minelittlepony/unicopia/entity/mob/SombraEntity.java index 2e924249..38b63835 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/mob/SombraEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/mob/SombraEntity.java @@ -7,6 +7,7 @@ import java.util.stream.Stream; import org.jetbrains.annotations.Nullable; import com.minelittlepony.unicopia.USounds; +import com.minelittlepony.unicopia.ability.magic.spell.AbstractDisguiseSpell; import com.minelittlepony.unicopia.advancement.UCriteria; import com.minelittlepony.unicopia.entity.AmuletSelectors; import com.minelittlepony.unicopia.entity.EntityReference; @@ -82,7 +83,9 @@ import net.minecraft.world.event.GameEvent; public class SombraEntity extends HostileEntity implements ArenaCombatant, ParticleSource { static final byte BITE = 70; static final int MAX_BITE_TIME = 20; - static final Predicate EFFECT_TARGET_PREDICATE = EntityPredicates.VALID_LIVING_ENTITY.and(EntityPredicates.EXCEPT_CREATIVE_OR_SPECTATOR); + static final Predicate EFFECT_TARGET_PREDICATE = EntityPredicates.VALID_LIVING_ENTITY + .and(EntityPredicates.EXCEPT_CREATIVE_OR_SPECTATOR) + .and(e -> !(AbstractDisguiseSpell.getAppearance(e) instanceof SombraEntity)); private static final TrackedData> HOME_POS = DataTracker.registerData(SombraEntity.class, TrackedDataHandlerRegistry.OPTIONAL_BLOCK_POS); private static final TrackedData TARGET_SIZE = DataTracker.registerData(SombraEntity.class, TrackedDataHandlerRegistry.FLOAT); @@ -282,8 +285,11 @@ public class SombraEntity extends HostileEntity implements ArenaCombatant, Parti } } - if (random.nextInt(150) == 0) { - for (BlockPos p : BlockPos.iterateRandomly(random, 3, getBlockPos(), 20)) { + float healthPercentage = 100 * (getHealth() / getMaxHealth()); + float difference = MathHelper.abs(healthPercentage - MathHelper.floor(healthPercentage)); + + if (random.nextInt(healthPercentage < 90 && difference < 0.25F ? 19 : 120) == 0) { + for (BlockPos p : BlockPos.iterateRandomly(random, 5, getBlockPos(), 20)) { CrystalShardsEntity.infestBlock((ServerWorld)getWorld(), p); } } diff --git a/src/main/resources/assets/unicopia/lang/en_us.json b/src/main/resources/assets/unicopia/lang/en_us.json index 3a2337a7..f86b092f 100644 --- a/src/main/resources/assets/unicopia/lang/en_us.json +++ b/src/main/resources/assets/unicopia/lang/en_us.json @@ -803,6 +803,9 @@ "unicopia.subtitle.entity.jar.throw": "Jar thrown", "unicopia.subtitle.entity.crystal_heart.activate": "Crystal heart activates", "unicopia.subtitle.entity.crystal_heart.deactivate": "Crystal heart deactivates", + "unicopia.subtitle.entity.sombra.ambient": "Evil Laughter", + "unicopia.subtitle.entity.sombra.laugh": "King Sombra Laughs", + "unicopia.subtitle.entity.sombra.snicker": "King Sombra Snickers", "unicopia.subtitle.item.amulet.charging": "Amulet charges", "unicopia.subtitle.item.amulet.recharge": "Amulet recharged", "unicopia.subtitle.item.icarus_wings.resonate": "Icarus wings resonate",