Spawns the given ItemStack as an EntityItem into the World at the given position
(World worldIn, BlockPos pos, ItemStack stack)
| 648 | * Spawns the given ItemStack as an EntityItem into the World at the given position |
| 649 | */ |
| 650 | public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack) |
| 651 | { |
| 652 | if (!worldIn.isRemote && worldIn.getGameRules().getGameRuleBooleanValue("doTileDrops")) |
| 653 | { |
| 654 | float f = 0.5F; |
| 655 | double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; |
| 656 | double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; |
| 657 | double d2 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; |
| 658 | EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, stack); |
| 659 | entityitem.setDefaultPickupDelay(); |
| 660 | worldIn.spawnEntityInWorld(entityitem); |
| 661 | } |
| 662 | } |
| 663 | |
| 664 | /** |
| 665 | * Spawns the given amount of experience into the World as XP orb entities |
no test coverage detected