protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
   EnumFacing var3 = BlockDispenser.getFacing(source.getBlockMetadata());
   IPosition var4 = BlockDispenser.getDispensePosition(source);
   ItemStack var5 = stack.splitStack(1);
   doDispense(source.getWorld(), var5, 6, var3, var4);
   return stack;
 }
  /** 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;
  }
Пример #3
0
 /** 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);
 }
Пример #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;
 }
 public final ItemStack dispense(IBlockSource source, ItemStack stack) {
   ItemStack var3 = this.dispenseStack(source, stack);
   this.playDispenseSound(source);
   this.spawnDispenseParticles(source, BlockDispenser.getFacing(source.getBlockMetadata()));
   return var3;
 }