(IBlockSource source, ItemStack stack)
| 25 | private static final IBehaviorDispenseItem dispenserBehavior = new BehaviorDefaultDispenseItem() |
| 26 | { |
| 27 | protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) |
| 28 | { |
| 29 | BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata())); |
| 30 | int i = blockpos.getX(); |
| 31 | int j = blockpos.getY(); |
| 32 | int k = blockpos.getZ(); |
| 33 | AxisAlignedBB axisalignedbb = new AxisAlignedBB(i, j, k, i + 1, j + 1, k + 1); |
| 34 | List<EntityLivingBase> list = source.getWorld().<EntityLivingBase>getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb, Predicates.<EntityLivingBase> and (EntitySelectors.NOT_SPECTATING, new EntitySelectors.ArmoredMob(stack))); |
| 35 | |
| 36 | if (!list.isEmpty()) |
| 37 | { |
| 38 | EntityLivingBase entitylivingbase = list.get(0); |
| 39 | int l = entitylivingbase instanceof EntityPlayer ? 1 : 0; |
| 40 | int i1 = EntityLiving.getArmorPosition(stack); |
| 41 | ItemStack itemstack = stack.copy(); |
| 42 | itemstack.stackSize = 1; |
| 43 | entitylivingbase.setCurrentItemOrArmor(i1 - l, itemstack); |
| 44 | |
| 45 | if (entitylivingbase instanceof EntityLiving) |
| 46 | { |
| 47 | ((EntityLiving)entitylivingbase).setEquipmentDropChance(i1, 2.0F); |
| 48 | } |
| 49 | |
| 50 | --stack.stackSize; |
| 51 | return stack; |
| 52 | } |
| 53 | else |
| 54 | { |
| 55 | return super.dispenseStack(source, stack); |
| 56 | } |
| 57 | } |
| 58 | }; |
| 59 | |
| 60 | /** |
nothing calls this directly
no test coverage detected