Added custom behaviours for chicken disguises

This commit is contained in:
Sollace 2020-09-24 14:54:24 +02:00
parent 2f455ae6a7
commit 9071742a4c
2 changed files with 20 additions and 0 deletions

View file

@ -0,0 +1,19 @@
package com.minelittlepony.unicopia.entity.behaviour;
import com.minelittlepony.unicopia.ability.magic.Caster;
import net.minecraft.entity.Entity;
import net.minecraft.entity.passive.ChickenEntity;
import net.minecraft.util.math.Vec3d;
public class ChickenBehaviour extends EntityBehaviour<ChickenEntity> {
@Override
public void update(Caster<?> source, ChickenEntity entity) {
Entity src = source.getEntity();
Vec3d vel = src.getVelocity();
if (!src.isOnGround() && vel.y < 0) {
src.setVelocity(vel.multiply(1, 0.6, 1));
}
}
}

View file

@ -39,6 +39,7 @@ public abstract class EntityBehaviour<T extends Entity> {
static { static {
register(ShulkerBehaviour::new, EntityType.SHULKER); register(ShulkerBehaviour::new, EntityType.SHULKER);
register(CreeperBehaviour::new, EntityType.CREEPER); register(CreeperBehaviour::new, EntityType.CREEPER);
register(ChickenBehaviour::new, EntityType.CHICKEN);
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(MinecartBehaviour::new, EntityType.CHEST_MINECART, EntityType.COMMAND_BLOCK_MINECART, EntityType.FURNACE_MINECART, EntityType.HOPPER_MINECART, EntityType.MINECART, EntityType.SPAWNER_MINECART, EntityType.TNT_MINECART);
} }
} }