mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-12-03 17:37:59 +01:00
Implement disguise behaviours for the camel and king sombra
This commit is contained in:
parent
c938de219c
commit
b8eb6435a9
5 changed files with 32 additions and 3 deletions
|
@ -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<CamelEntity> {
|
||||
@Override
|
||||
public void update(Pony player, CamelEntity entity, Disguise spell) {
|
||||
entity.setDashing(player.asEntity().isSprinting());
|
||||
|
||||
if (player.asEntity().isSneaking()) {
|
||||
entity.startSitting();
|
||||
} else {
|
||||
entity.startStanding();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -290,6 +290,7 @@ public class EntityBehaviour<T extends Entity> {
|
|||
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() {}
|
||||
|
|
|
@ -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<SombraEntity> {
|
||||
static final byte BITE = 70;
|
||||
static final int MAX_BITE_TIME = 20;
|
||||
static final Predicate<Entity> EFFECT_TARGET_PREDICATE = EntityPredicates.VALID_LIVING_ENTITY.and(EntityPredicates.EXCEPT_CREATIVE_OR_SPECTATOR);
|
||||
static final Predicate<Entity> EFFECT_TARGET_PREDICATE = EntityPredicates.VALID_LIVING_ENTITY
|
||||
.and(EntityPredicates.EXCEPT_CREATIVE_OR_SPECTATOR)
|
||||
.and(e -> !(AbstractDisguiseSpell.getAppearance(e) instanceof SombraEntity));
|
||||
|
||||
private static final TrackedData<Optional<BlockPos>> HOME_POS = DataTracker.registerData(SombraEntity.class, TrackedDataHandlerRegistry.OPTIONAL_BLOCK_POS);
|
||||
private static final TrackedData<Float> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue