diff --git a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/BeeBehaviour.java b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/BeeBehaviour.java new file mode 100644 index 00000000..24790512 --- /dev/null +++ b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/BeeBehaviour.java @@ -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 { + @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); + } + } +} 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 1c4bf91c..a691915f 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityBehaviour.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/behaviour/EntityBehaviour.java @@ -178,6 +178,7 @@ public class EntityBehaviour { 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);