@ForgeSubscribe public void onLivingDrops(LivingDropsEvent event) { if (event.entityLiving == null) { return; } if (event.entityLiving instanceof EntityDragon) { if (event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.source.getEntity(); if (!player.worldObj.isRemote) { EntityItem item = new EntityItem(player.worldObj, player.posX + 0.5D, player.posY + 0.5D, player.posZ + 0.5D, new ItemStack(Registries.dragonEgg, 1, 0)); player.worldObj.spawnEntityInWorld(item); if (!(player instanceof FakePlayer)) { item.onCollideWithPlayer(player); } } } } }
@Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float j, float k, float l) { TileEntityBush te = (TileEntityBush)world.getBlockTileEntity(x, y, z); int meta = world.getBlockMetadata(x, y, z); if (te.growthStage >= 15) { if (world.isRemote) { return true; } te.grow(-3, world, x, y, z); EntityItem entityitem = new EntityItem(world, player.posX, player.posY - 1.0D, player.posZ, new ItemStack(HerbologicaStuff.herbologicaBerry.itemID, 1, meta)); world.spawnEntityInWorld(entityitem); if (!(player instanceof FakePlayer)) { entityitem.onCollideWithPlayer(player); } return true; } return false; }
public static void spawnItemAtPlayer(EntityPlayer player, ItemStack stack) { EntityItem entityitem = new EntityItem(player.worldObj, player.posX + 0.5D, player.posY + 0.5D, player.posZ + 0.5D, stack); player.worldObj.spawnEntityInWorld(entityitem); if (!(player instanceof FakePlayer)) entityitem.onCollideWithPlayer(player); }
public static void spawnItemAtPlayer (EntityPlayer player, ItemStack stack) { EntityItem entityitem = new EntityItem(player.worldObj, player.posX + 0.5D, player.posY + 0.5D, player.posZ + 0.5D, stack); player.worldObj.spawnEntityInWorld(entityitem); if (!(player instanceof FakePlayer)){ entityitem.onCollideWithPlayer(player); } }
public static void spawnItemAtPlayer (EntityPlayer player, ItemStack stack){ EntityItem entityitem = new EntityItem(player.worldObj, player.posX + 0.5D, player.posY + 0.5D, player.posZ + 0.5D, stack); player.worldObj.spawnEntityInWorld(entityitem); if (!(player instanceof FakePlayer)) entityitem.onCollideWithPlayer(player); }