Add a bee behaviour

This commit is contained in:
Sollace 2020-09-24 21:26:11 +02:00
parent 1bb305693e
commit d30b22c11c
2 changed files with 31 additions and 0 deletions

View file

@ -0,0 +1,30 @@
package com.minelittlepony.unicopia.entity.behaviour;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.ability.magic.Spell;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.sound.AggressiveBeeSoundInstance;
import net.minecraft.client.sound.PassiveBeeSoundInstance;
import net.minecraft.entity.passive.BeeEntity;
public class BeeBehaviour extends EntityBehaviour<BeeEntity> {
@Override
public void onCreate(BeeEntity entity) {
super.onCreate(entity);
if (entity.world.isClient) {
MinecraftClient.getInstance().getSoundManager().playNextTick(
entity.hasAngerTime() ? new AggressiveBeeSoundInstance(entity) : new PassiveBeeSoundInstance(entity)
);
}
}
@Override
public void update(Caster<?> source, BeeEntity entity, Spell spell) {
if (source.getOwner().isSneaking()) {
entity.setAngerTime(10);
} else {
entity.setAngerTime(0);
}
}
}

View file

@ -178,6 +178,7 @@ public class EntityBehaviour<T extends Entity> {
static {
register(VillagerBehaviour::new, EntityType.VILLAGER, EntityType.WANDERING_TRADER);
register(SheepBehaviour::new, EntityType.SHEEP);
register(BeeBehaviour::new, EntityType.BEE);
register(EndermanBehaviour::new, EntityType.ENDERMAN);
register(SpellcastingIllagerBehaviour::new, EntityType.ILLUSIONER, EntityType.EVOKER);
register(ShulkerBehaviour::new, EntityType.SHULKER);