Exemple #1
0
 @Override
 public void onBlockPreDestroy(World world, int x, int y, int z, int meta) {
   if (!world.isRemote) {
     TEOilLamp te = (TEOilLamp) world.getTileEntity(x, y, z);
     if ((meta & 8) != 0) meta -= 8;
     if (te != null) {
       if (te.getFuel() != null) {
         ItemStack is = new ItemStack(this, 1, meta);
         NBTTagCompound nbt = te.getFuel().writeToNBT(new NBTTagCompound());
         is.setTagCompound(nbt);
         EntityItem ei = new EntityItem(world, x, y, z, is);
         world.spawnEntityInWorld(ei);
       } else {
         ItemStack is = new ItemStack(this, 1, meta);
         EntityItem ei = new EntityItem(world, x, y, z, is);
         world.spawnEntityInWorld(ei);
       }
     }
   }
 }