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

Method attachToFence

src/main/java/net/minecraft/item/ItemLead.java:49–73  ·  view source on GitHub ↗
(EntityPlayer player, World worldIn, BlockPos fence)

Source from the content-addressed store, hash-verified

47 }
48
49 public static boolean attachToFence(EntityPlayer player, World worldIn, BlockPos fence)
50 {
51 EntityLeashKnot entityleashknot = EntityLeashKnot.getKnotForPosition(worldIn, fence);
52 boolean flag = false;
53 double d0 = 7.0D;
54 int i = fence.getX();
55 int j = fence.getY();
56 int k = fence.getZ();
57
58 for (EntityLiving entityliving : worldIn.getEntitiesWithinAABB(EntityLiving.class, new AxisAlignedBB((double)i - d0, (double)j - d0, (double)k - d0, (double)i + d0, (double)j + d0, (double)k + d0)))
59 {
60 if (entityliving.getLeashed() && entityliving.getLeashedToEntity() == player)
61 {
62 if (entityleashknot == null)
63 {
64 entityleashknot = EntityLeashKnot.createKnot(worldIn, fence);
65 }
66
67 entityliving.setLeashedToEntity(entityleashknot, true);
68 flag = true;
69 }
70 }
71
72 return flag;
73 }
74}

Callers 2

onItemUseMethod · 0.95
onBlockActivatedMethod · 0.95

Calls 9

getKnotForPositionMethod · 0.95
createKnotMethod · 0.95
getLeashedMethod · 0.80
getLeashedToEntityMethod · 0.80
setLeashedToEntityMethod · 0.80
getXMethod · 0.65
getYMethod · 0.65
getZMethod · 0.65
getEntitiesWithinAABBMethod · 0.45

Tested by

no test coverage detected