예제 #1
0
  public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityBrewingStand) {
      InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityBrewingStand) tileentity);
    }

    super.breakBlock(worldIn, pos, state);
  }
예제 #2
0
  @Override
  public void breakBlock(World world, int x, int y, int z, int i1, int i2) {
    TileEntityBasicMachine tileEntity = (TileEntityBasicMachine) world.getBlockTileEntity(x, y, z);

    if (tileEntity != null) {
      for (int i = 0; i < tileEntity.getSizeInventory(); ++i) {
        ItemStack slotStack = tileEntity.getStackInSlot(i);

        if (slotStack != null) {
          float xRandom = machineRand.nextFloat() * 0.8F + 0.1F;
          float yRandom = machineRand.nextFloat() * 0.8F + 0.1F;
          float zRandom = machineRand.nextFloat() * 0.8F + 0.1F;

          while (slotStack.stackSize > 0) {
            int j = machineRand.nextInt(21) + 10;

            if (j > slotStack.stackSize) {
              j = slotStack.stackSize;
            }

            slotStack.stackSize -= j;
            EntityItem item =
                new EntityItem(
                    world,
                    (double) ((float) x + xRandom),
                    (double) ((float) y + yRandom),
                    (double) ((float) z + zRandom),
                    new ItemStack(slotStack.itemID, j, slotStack.getItemDamage()));

            if (slotStack.hasTagCompound()) {
              item.item.setTagCompound((NBTTagCompound) slotStack.getTagCompound().copy());
            }

            float k = 0.05F;
            item.motionX = (double) ((float) machineRand.nextGaussian() * k);
            item.motionY = (double) ((float) machineRand.nextGaussian() * k + 0.2F);
            item.motionZ = (double) ((float) machineRand.nextGaussian() * k);
            world.spawnEntityInWorld(item);
          }
        }
      }
      tileEntity.invalidate();
    }

    super.breakBlock(world, x, y, z, i1, i2);
  }
  /** ejects contained items into the world, and notifies neighbours of an update, as appropriate */
  public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) {
    TileEntityChest var7 = (TileEntityChest) par1World.getBlockTileEntity(par2, par3, par4);

    if (var7 != null) {
      for (int var8 = 0; var8 < var7.getSizeInventory(); ++var8) {
        ItemStack var9 = var7.getStackInSlot(var8);

        if (var9 != null) {
          float var10 = this.random.nextFloat() * 0.8F + 0.1F;
          float var11 = this.random.nextFloat() * 0.8F + 0.1F;
          EntityItem var14;

          for (float var12 = this.random.nextFloat() * 0.8F + 0.1F;
              var9.stackSize > 0;
              par1World.spawnEntityInWorld(var14)) {
            int var13 = this.random.nextInt(21) + 10;

            if (var13 > var9.stackSize) {
              var13 = var9.stackSize;
            }

            var9.stackSize -= var13;
            var14 =
                new EntityItem(
                    par1World,
                    (double) ((float) par2 + var10),
                    (double) ((float) par3 + var11),
                    (double) ((float) par4 + var12),
                    new ItemStack(var9.itemID, var13, var9.getItemDamage()));
            float var15 = 0.05F;
            var14.motionX = (double) ((float) this.random.nextGaussian() * var15);
            var14.motionY = (double) ((float) this.random.nextGaussian() * var15 + 0.2F);
            var14.motionZ = (double) ((float) this.random.nextGaussian() * var15);

            if (var9.hasTagCompound()) {
              var14.getEntityItem().setTagCompound((NBTTagCompound) var9.getTagCompound().copy());
            }
          }
        }
      }
    }

    super.breakBlock(par1World, par2, par3, par4, par5, par6);
  }
예제 #4
0
  /** ejects contained items into the world, and notifies neighbours of an update, as appropriate */
  public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) {
    if (!par1World.isRemote) {
      if ((par6 & 8) == 0) {
        ItemStack var7 =
            new ItemStack(
                Item.skull.shiftedIndex, 1, this.getDamageValue(par1World, par2, par3, par4));
        TileEntitySkull var8 = (TileEntitySkull) par1World.getBlockTileEntity(par2, par3, par4);

        if (var8.func_82117_a() == 3
            && var8.func_82120_c() != null
            && var8.func_82120_c().length() > 0) {
          var7.setTagCompound(new NBTTagCompound());
          var7.getTagCompound().setString("SkullOwner", var8.func_82120_c());
        }

        this.dropBlockAsItem_do(par1World, par2, par3, par4, var7);
      }

      super.breakBlock(par1World, par2, par3, par4, par5, par6);
    }
  }
 @Override
 public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
   dropInventory(world, x, y, z);
   super.breakBlock(world, x, y, z, block, meta);
 }
 public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
   this.dropRecord(worldIn, pos, state);
   super.breakBlock(worldIn, pos, state);
 }
 /** ejects contained items into the world, and notifies neighbours of an update, as appropriate */
 public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) {
   this.ejectRecord(par1World, par2, par3, par4);
   super.breakBlock(par1World, par2, par3, par4, par5, par6);
 }