mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Add a bee behaviour
This commit is contained in:
parent
1bb305693e
commit
d30b22c11c
2 changed files with 31 additions and 0 deletions
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -178,6 +178,7 @@ public class EntityBehaviour<T extends Entity> {
|
||||||
static {
|
static {
|
||||||
register(VillagerBehaviour::new, EntityType.VILLAGER, EntityType.WANDERING_TRADER);
|
register(VillagerBehaviour::new, EntityType.VILLAGER, EntityType.WANDERING_TRADER);
|
||||||
register(SheepBehaviour::new, EntityType.SHEEP);
|
register(SheepBehaviour::new, EntityType.SHEEP);
|
||||||
|
register(BeeBehaviour::new, EntityType.BEE);
|
||||||
register(EndermanBehaviour::new, EntityType.ENDERMAN);
|
register(EndermanBehaviour::new, EntityType.ENDERMAN);
|
||||||
register(SpellcastingIllagerBehaviour::new, EntityType.ILLUSIONER, EntityType.EVOKER);
|
register(SpellcastingIllagerBehaviour::new, EntityType.ILLUSIONER, EntityType.EVOKER);
|
||||||
register(ShulkerBehaviour::new, EntityType.SHULKER);
|
register(ShulkerBehaviour::new, EntityType.SHULKER);
|
||||||
|
|
Loading…
Reference in a new issue