protected ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) { EnumFacing var3 = BlockDispenser.func_100009_j_(p_82487_1_.func_82620_h()); int var4 = p_82487_1_.func_82623_d() + var3.func_82601_c(); int var5 = p_82487_1_.func_82622_e() + var3.func_96559_d(); int var6 = p_82487_1_.func_82621_f() + var3.func_82599_e(); AxisAlignedBB var7 = AxisAlignedBB.func_72332_a().func_72299_a((double)var4, (double)var5, (double)var6, (double)(var4 + 1), (double)(var5 + 1), (double)(var6 + 1)); List var8 = p_82487_1_.func_82618_k().func_82733_a(EntityLivingBase.class, var7, new EntitySelectorArmoredMob(p_82487_2_)); if(var8.size() > 0) { EntityLivingBase var9 = (EntityLivingBase)var8.get(0); int var10 = var9 instanceof EntityPlayer?1:0; int var11 = EntityLiving.func_82159_b(p_82487_2_); ItemStack var12 = p_82487_2_.func_77946_l(); var12.field_77994_a = 1; var9.func_70062_b(var11 - var10, var12); if(var9 instanceof EntityLiving) { ((EntityLiving)var9).func_96120_a(var11, 2.0F); } --p_82487_2_.field_77994_a; return p_82487_2_; } else { return super.func_82487_b(p_82487_1_, p_82487_2_); } }
/** * Dispense the specified stack, play the dispense sound and spawn particles. */ protected ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) { EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata()); int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX(); int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY(); int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ(); AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)i, (double)j, (double)k, (double)(i + 1), (double)(j + 1), (double)(k + 1)); List list = par1IBlockSource.getWorld().selectEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb, new EntitySelectorArmoredMob(par2ItemStack)); if (list.size() > 0) { EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0); int l = entitylivingbase instanceof EntityPlayer ? 1 : 0; int i1 = EntityLiving.getArmorPosition(par2ItemStack); ItemStack itemstack1 = par2ItemStack.copy(); itemstack1.stackSize = 1; entitylivingbase.setCurrentItemOrArmor(i1, itemstack1); //BUGFIX Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. if (entitylivingbase instanceof EntityLiving) { ((EntityLiving)entitylivingbase).setEquipmentDropChance(i1, 2.0F); } --par2ItemStack.stackSize; return par2ItemStack; } else { return super.dispenseStack(par1IBlockSource, 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()); int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX(); int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY(); int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ(); AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)i, (double)j, (double)k, (double)(i + 1), (double)(j + 1), (double)(k + 1)); @SuppressWarnings("rawtypes") List list = par1IBlockSource.getWorld().selectEntitiesWithinAABB(EntityLiving.class, axisalignedbb, new EntitySelectorArmoredMob(par2ItemStack)); if (list.size() > 0) { EntityLiving entityliving = (EntityLiving)list.get(0); int l = entityliving instanceof EntityPlayer ? 1 : 0; int i1 = EntityLiving.getArmorPosition(par2ItemStack); ItemStack itemstack1 = par2ItemStack.copy(); itemstack1.stackSize = 1; entityliving.setCurrentItemOrArmor(i1, itemstack1); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. entityliving.func_96120_a(i1, 2.0F); --par2ItemStack.stackSize; return par2ItemStack; } else { return super.dispenseStack(par1IBlockSource, par2ItemStack); } }