/** 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; }
/** Get the position where the dispenser at the given Coordinates should dispense to. */ public static IPosition getDispensePosition(IBlockSource coords) { EnumDirection var1 = getFacing(coords.getBlockMetadata()); double var2 = coords.getX() + 0.7D * var1.getOffsetX(); double var4 = coords.getY() + 0.7D * var1.getOffsetY(); double var6 = coords.getZ() + 0.7D * var1.getOffsetZ(); return new PositionImpl(var2, var4, var6); }