EntityAIWolfAutoEat.java 文件源码

java
阅读 18 收藏 0 点赞 0 评论 0

项目:wolfarmor 作者:
@Override
public void updateTask() {
    --eatCooldown;
    if(eatingFood != ItemStack.EMPTY) {
        if (foodEatTime > 0) {
            if (--foodEatTime % 4 == 0) {
                PacketHandler.getChannel().sendToAllAround(
                    new WolfEatMessage(entity.getEntityId(), eatingFood),
                    new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 60));
                this.entity.playSound(SoundEvents.ENTITY_GENERIC_EAT,
                        0.5F,
                        (this.entity.getRNG().nextFloat() - this.entity.getRNG().nextFloat()) * 0.2F + 1);
            }
        } else if (!hasHealedSinceLastReset) {
            hasHealedSinceLastReset = true;
            PacketHandler.getChannel().sendToAllAround(
                new WolfHealMessage(entity.getEntityId()),
                new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 60));
            this.entity.heal((float) ((ItemFood) eatingFood.getItem()).getHealAmount(eatingFood));
            this.eatingFood.shrink(1);
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号