Advertisement
Guest User

Untitled

a guest
May 3rd, 2015
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. public void breakBlock(World world, int x, int y, int z, Block oldBlock, int oldMetadata)
  2. {
  3. if(!keepInventory)
  4. {
  5.  
  6. TileEntityElectricFurnace tileEntity = (TileEntityElectricFurnace)world.getTileEntity(x, y, z);
  7. // TileEntityElectricGrinder tileEntity = (TileEntityElectricGrinder)world.getTileEntity(x, y, z);
  8. // TileEntityElectricCompressor tileEntity = (TileEntityElectricCompressor)world.getTileEntity(x, y, z);
  9.  
  10. if(tileEntity != null)
  11. {
  12. for(int i = 0; i < tileEntity.getSizeInventory(); i++)
  13. {
  14. ItemStack itemStack = tileEntity.getStackInSlot(i);
  15.  
  16. if(itemStack != null)
  17. {
  18. float f = this.rand.nextFloat() * 0.8F + 0.1F;
  19. float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
  20. float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
  21.  
  22. while(itemStack.stackSize > 0)
  23. {
  24. int j = this.rand.nextInt(21) + 10;
  25.  
  26. if(j > itemStack.stackSize)
  27. j = itemStack.stackSize;
  28.  
  29. itemStack.stackSize -= j;
  30.  
  31. EntityItem item = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemStack.getItem(), j, itemStack.getItemDamage()));
  32.  
  33. if(itemStack.hasTagCompound())
  34. item.getEntityItem().setTagCompound((NBTTagCompound)itemStack.getTagCompound().copy());
  35.  
  36. world.spawnEntityInWorld(item);
  37. }
  38. }
  39. }
  40. world.func_147453_f(x, y, z, oldBlock);
  41. }
  42. }
  43. super.breakBlock(world, x, y, z, oldBlock, oldMetadata);
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement