    001    package net.minecraft.src;
    002
    003    import net.minecraft.server.MinecraftServer;
    004
    005    public class BehaviorDispenseMinecart extends BehaviorDefaultDispenseItem
    006    {
    007        private final BehaviorDefaultDispenseItem field_82491_c;
    008
    009        final MinecraftServer field_82490_b;
    010
    011        public BehaviorDispenseMinecart(MinecraftServer par1MinecraftServer)
    012        {
    013            this.field_82490_b = par1MinecraftServer;
    014            this.field_82491_c = new BehaviorDefaultDispenseItem();
    015        }
    016
    017        public ItemStack func_82487_b(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
    018        {
    019            EnumFacing var3 = EnumFacing.func_82600_a(par1IBlockSource.func_82620_h());
    020            World var4 = par1IBlockSource.func_82618_k();
    021            double var5 = par1IBlockSource.func_82615_a() + (double)((float)var3.func_82601_c() * 1.125F);
    022            double var7 = par1IBlockSource.func_82617_b();
    023            double var9 = par1IBlockSource.func_82616_c() + (double)((float)var3.func_82599_e() * 1.125F);
    024            int var11 = par1IBlockSource.func_82623_d() + var3.func_82601_c();
    025            int var12 = par1IBlockSource.func_82622_e();
    026            int var13 = par1IBlockSource.func_82621_f() + var3.func_82599_e();
    027            int var14 = var4.getBlockId(var11, var12, var13);
    028            double var15;
    029
    030            if (BlockRail.isRailBlock(var14))
    031            {
    032                var15 = 0.0D;
    033            }
    034            else
    035            {
    036                if (var14 != 0 || !BlockRail.isRailBlock(var4.getBlockId(var11, var12 - 1, var13)))
    037                {
    038                    return this.field_82491_c.func_82482_a(par1IBlockSource, par2ItemStack);
    039                }
    040
    041                var15 = -1.0D;
    042            }
    043
    044            EntityMinecart var17 = new EntityMinecart(var4, var5, var7 + var15, var9, ((ItemMinecart)par2ItemStack.getItem()).minecartType);
    045            var4.spawnEntityInWorld(var17);
    046            par2ItemStack.splitStack(1);
    047            return par2ItemStack;
    048        }
    049
    050        protected void func_82485_a(IBlockSource par1IBlockSource)
    051        {
    052            par1IBlockSource.func_82618_k().playAuxSFX(1000, par1IBlockSource.func_82623_d(), par1IBlockSource.func_82622_e(), par1IBlockSource.func_82621_f(), 0);
    053        }
    054    }