/** Ejects the current record inside of the jukebox. */
  public void ejectRecord(World par1World, int par2, int par3, int par4) {
    if (!par1World.isRemote) {
      TileEntityRecordPlayer var5 =
          (TileEntityRecordPlayer) par1World.getBlockTileEntity(par2, par3, par4);

      if (var5 != null) {
        ItemStack var6 = var5.func_96097_a();

        if (var6 != null) {
          par1World.playAuxSFX(1005, par2, par3, par4, 0);
          par1World.playRecord((String) null, par2, par3, par4);
          var5.func_96098_a((ItemStack) null);
          par1World.setBlockMetadataWithNotify(par2, par3, par4, 0, 2);
          float var7 = 0.7F;
          double var8 =
              (double) (par1World.rand.nextFloat() * var7) + (double) (1.0F - var7) * 0.5D;
          double var10 =
              (double) (par1World.rand.nextFloat() * var7) + (double) (1.0F - var7) * 0.2D + 0.6D;
          double var12 =
              (double) (par1World.rand.nextFloat() * var7) + (double) (1.0F - var7) * 0.5D;
          ItemStack var14 = var6.copy();
          EntityItem var15 =
              new EntityItem(
                  par1World,
                  (double) par2 + var8,
                  (double) par3 + var10,
                  (double) par4 + var12,
                  var14);
          var15.delayBeforeCanPickup = 10;
          par1World.spawnEntityInWorld(var15);
        }
      }
    }
  }
Example #2
0
  public void dropRecord(World world, int i, int j, int k) {
    if (!world.isStatic) {
      TileEntityRecordPlayer tileentityrecordplayer =
          (TileEntityRecordPlayer) world.getTileEntity(i, j, k);

      if (tileentityrecordplayer != null) {
        ItemStack itemstack = tileentityrecordplayer.record;

        if (itemstack != null) {
          world.triggerEffect(1005, i, j, k, 0);
          world.a((String) null, i, j, k);
          tileentityrecordplayer.record = null;
          tileentityrecordplayer.update();
          world.setData(i, j, k, 0);
          float f = 0.7F;
          double d0 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
          double d1 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.2D + 0.6D;
          double d2 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
          ItemStack itemstack1 = itemstack.cloneItemStack();
          EntityItem entityitem =
              new EntityItem(world, (double) i + d0, (double) j + d1, (double) k + d2, itemstack1);

          entityitem.pickupDelay = 10;
          world.addEntity(entityitem);
        }
      }
    }
  }
  /** Insert the specified music disc in the jukebox at the given coordinates */
  public void insertRecord(World par1World, int par2, int par3, int par4, ItemStack par5ItemStack) {
    if (!par1World.isRemote) {
      TileEntityRecordPlayer var6 =
          (TileEntityRecordPlayer) par1World.getBlockTileEntity(par2, par3, par4);

      if (var6 != null) {
        var6.func_96098_a(par5ItemStack.copy());
        par1World.setBlockMetadataWithNotify(par2, par3, par4, 1, 2);
      }
    }
  }
Example #4
0
  public void a(World world, int i, int j, int k, ItemStack itemstack) {
    if (!world.isStatic) {
      TileEntityRecordPlayer tileentityrecordplayer =
          (TileEntityRecordPlayer) world.getTileEntity(i, j, k);

      if (tileentityrecordplayer != null) {
        tileentityrecordplayer.record = itemstack.cloneItemStack();
        tileentityrecordplayer.update();
        world.setData(i, j, k, 1);
      }
    }
  }