Search in sources :

Example 1 with EntityParrot

use of net.minecraft.entity.passive.EntityParrot in project Bewitchment by Um-Mitternacht.

the class FortuneMeetParrot method apply.

@Override
public boolean apply(EntityPlayer player) {
    for (int i = 0; i < 10; i++) {
        BlockPos pos = new BlockPos(player.posX + player.getRNG().nextGaussian() * 4, player.posY, player.posZ + player.getRNG().nextGaussian() * 4);
        EntityParrot parrot = new EntityParrot(player.world);
        if (player.world.isAirBlock(pos) && player.world.isAirBlock(pos.up()) && player.world.getBlockState(pos.down()).canEntitySpawn(parrot)) {
            parrot.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
            parrot.onInitialSpawn(player.world.getDifficultyForLocation(pos), null);
            parrot.setTamedBy(player);
            player.world.spawnEntity(parrot);
            return true;
        }
    }
    return false;
}
Also used : EntityParrot(net.minecraft.entity.passive.EntityParrot) BlockPos(net.minecraft.util.math.BlockPos)

Example 2 with EntityParrot

use of net.minecraft.entity.passive.EntityParrot in project takumicraft by TNTModders.

the class EntityParrotCreeper method takumiExplodeEvent.

@Override
public boolean takumiExplodeEvent(Detonate event) {
    for (Entity entity : event.getAffectedEntities()) {
        if (!this.world.isRemote && entity instanceof EntityPlayer) {
            EntityParrot parrot = new EntityParrot(this.world);
            parrot.copyLocationAndAnglesFrom(this);
            NBTTagCompound tagCompound = parrot.getEntityData();
            tagCompound.setBoolean("creeper", true);
            parrot.setVariant(2);
            parrot.setCustomNameTag(TakumiUtils.takumiTranslate("entity.parrotcreeper.name"));
            parrot.setEntityOnShoulder((EntityPlayer) entity);
        }
    }
    event.getAffectedEntities().clear();
    return true;
}
Also used : EntityParrot(net.minecraft.entity.passive.EntityParrot) Entity(net.minecraft.entity.Entity) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Aggregations

EntityParrot (net.minecraft.entity.passive.EntityParrot)2 Entity (net.minecraft.entity.Entity)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 BlockPos (net.minecraft.util.math.BlockPos)1