use of biomesoplenty.common.entities.EntityPixie in project BiomesOPlenty by Glitchfiend.
the class ItemJarEmpty method itemInteractionForEntity.
@Override
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase target, EnumHand hand) {
// right clicking a pixie with an empty jar catches it in the jar
if (target instanceof EntityPixie) {
EntityPixie pixie = (EntityPixie) target;
pixie.setDead();
stack.setCount(stack.getCount() - 1);
ItemStack pixieJar = new ItemStack(BOPItems.jar_filled, 1, ItemJarFilled.JarContents.PIXIE.ordinal());
EntityItem pixieJarEntity = new EntityItem(player.world, player.posX, player.posY, player.posZ, pixieJar);
if (!player.world.isRemote) {
player.world.spawnEntity(pixieJarEntity);
if (!(player instanceof FakePlayer)) {
pixieJarEntity.onCollideWithPlayer(player);
}
}
return true;
}
return false;
}
use of biomesoplenty.common.entities.EntityPixie in project BiomesOPlenty by Glitchfiend.
the class ItemJarFilled method releasePixie.
// TODO: should you get back an empty jar?
public boolean releasePixie(ItemStack stack, World world, EntityPlayer player, Vec3d releasePoint) {
if (world.provider.isSurfaceWorld()) {
EntityPixie pixie = new EntityPixie(world);
pixie.setLocationAndAngles(releasePoint.x, releasePoint.y, releasePoint.z, MathHelper.wrapDegrees(world.rand.nextFloat() * 360.0F), 0.0F);
world.spawnEntity(pixie);
pixie.playLivingSound();
if (stack.hasDisplayName()) {
pixie.setCustomNameTag(stack.getDisplayName());
}
return true;
} else {
player.sendMessage(new TextComponentString("\u00a75Pixies cannot survive in this environment!"));
return false;
}
}
Aggregations