MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / dispenseStack

Method dispenseStack

src/main/java/net/minecraft/item/ItemArmor.java:27–57  ·  view source on GitHub ↗
(IBlockSource source, ItemStack stack)

Source from the content-addressed store, hash-verified

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 /**

Callers

nothing calls this directly

Calls 15

getFacingMethod · 0.95
getArmorPositionMethod · 0.95
setCurrentItemOrArmorMethod · 0.95
getBlockPosMethod · 0.65
getBlockMetadataMethod · 0.65
getXMethod · 0.65
getYMethod · 0.65
getZMethod · 0.65
getWorldMethod · 0.65
getMethod · 0.65
offsetMethod · 0.45

Tested by

no test coverage detected