コード例 #1
0
  /** Dispense the specified stack, play the dispense sound and spawn particles. */
  public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) {
    EnumFacing var3 = EnumFacing.func_82600_a(par1IBlockSource.func_82620_h());
    World var4 = par1IBlockSource.getWorld();
    double var5 = par1IBlockSource.getX() + (double) ((float) var3.func_82601_c() * 1.125F);
    double var7 = par1IBlockSource.getY();
    double var9 = par1IBlockSource.getZ() + (double) ((float) var3.func_82599_e() * 1.125F);
    int var11 = par1IBlockSource.getXInt() + var3.func_82601_c();
    int var12 = par1IBlockSource.getYInt();
    int var13 = par1IBlockSource.getZInt() + var3.func_82599_e();
    Material var14 = var4.getBlockMaterial(var11, var12, var13);
    double var15;

    if (Material.water.equals(var14)) {
      var15 = 1.0D;
    } else {
      if (!Material.air.equals(var14)
          || !Material.water.equals(var4.getBlockMaterial(var11, var12 - 1, var13))) {
        return this.defaultItemDispenseBehavior.dispense(par1IBlockSource, par2ItemStack);
      }

      var15 = 0.0D;
    }

    EntityBoat var17 = new EntityBoat(var4, var5, var7 + var15, var9);
    var4.spawnEntityInWorld(var17);
    par2ItemStack.splitStack(1);
    return par2ItemStack;
  }
  /** Dispense the specified stack, play the dispense sound and spawn particles. */
  public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) {
    EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
    World world = par1IBlockSource.getWorld();
    double d0 = par1IBlockSource.getX() + (double) ((float) enumfacing.getFrontOffsetX() * 1.125F);
    double d1 = par1IBlockSource.getY() + (double) ((float) enumfacing.getFrontOffsetY() * 1.125F);
    double d2 = par1IBlockSource.getZ() + (double) ((float) enumfacing.getFrontOffsetZ() * 1.125F);
    int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
    int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
    int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
    Material material = world.getBlockMaterial(i, j, k);
    double d3;

    if (Material.water.equals(material)) {
      d3 = 1.0D;
    } else {
      if (!Material.air.equals(material)
          || !Material.water.equals(world.getBlockMaterial(i, j - 1, k))) {
        return this.defaultDispenserItemBehavior.dispense(par1IBlockSource, par2ItemStack);
      }

      d3 = 0.0D;
    }

    EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
    world.spawnEntityInWorld(entityboat);
    par2ItemStack.splitStack(1);
    return par2ItemStack;
  }
 /** Play the dispense sound from the specified block. */
 protected void playDispenseSound(IBlockSource par1IBlockSource) {
   par1IBlockSource
       .getWorld()
       .playAuxSFX(
           1000,
           par1IBlockSource.getXInt(),
           par1IBlockSource.getYInt(),
           par1IBlockSource.getZInt(),
           0);
 }
コード例 #4
0
  /** Dispense the specified stack, play the dispense sound and spawn particles. */
  public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) {
    EnumFacing var3 = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
    double var4 = par1IBlockSource.getX() + (double) var3.getFrontOffsetX();
    double var6 = (double) ((float) par1IBlockSource.getYInt() + 0.2F);
    double var8 = par1IBlockSource.getZ() + (double) var3.getFrontOffsetZ();
    Entity var10 =
        ItemMonsterPlacer.spawnCreature(
            par1IBlockSource.getWorld(), par2ItemStack.getItemDamage(), var4, var6, var8);

    if (var10 instanceof EntityLiving && par2ItemStack.hasDisplayName()) {
      ((EntityLiving) var10).func_94058_c(par2ItemStack.getDisplayName());
    }

    par2ItemStack.splitStack(1);
    return par2ItemStack;
  }
 /** Dispense the specified stack, play the dispense sound and spawn particles. */
 protected ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) {
   EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
   World world = par1IBlockSource.getWorld();
   int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
   int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
   int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
   EntityTNTPrimed entitytntprimed =
       new EntityTNTPrimed(
           world,
           (double) ((float) i + 0.5F),
           (double) ((float) j + 0.5F),
           (double) ((float) k + 0.5F),
           (EntityLivingBase) null);
   world.spawnEntityInWorld(entitytntprimed);
   --par2ItemStack.stackSize;
   return par2ItemStack;
 }