diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2013-03-16 16:35:30 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2013-03-16 16:48:08 -0500 |
commit | fbe609bdbe11d480cba162385926c2f0a36c8a49 (patch) | |
tree | 172a26a2c182899ec3dabcc612c5c90ca05e45d5 /src/main/java/net/minecraft/server/DispenseBehaviorArmor.java | |
parent | ff1c1daf692ab0efacba81e77cd26d5ccdecd20c (diff) | |
download | craftbukkit-fbe609bdbe11d480cba162385926c2f0a36c8a49.tar craftbukkit-fbe609bdbe11d480cba162385926c2f0a36c8a49.tar.gz craftbukkit-fbe609bdbe11d480cba162385926c2f0a36c8a49.tar.lz craftbukkit-fbe609bdbe11d480cba162385926c2f0a36c8a49.tar.xz craftbukkit-fbe609bdbe11d480cba162385926c2f0a36c8a49.zip |
Add new DispenseBehavior files from mc-dev for diff visibility.
Diffstat (limited to 'src/main/java/net/minecraft/server/DispenseBehaviorArmor.java')
-rw-r--r-- | src/main/java/net/minecraft/server/DispenseBehaviorArmor.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorArmor.java b/src/main/java/net/minecraft/server/DispenseBehaviorArmor.java new file mode 100644 index 00000000..06e77b62 --- /dev/null +++ b/src/main/java/net/minecraft/server/DispenseBehaviorArmor.java @@ -0,0 +1,32 @@ +package net.minecraft.server; + +import java.util.List; + +final class DispenseBehaviorArmor extends DispenseBehaviorItem { + + DispenseBehaviorArmor() {} + + protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) { + EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h()); + int i = isourceblock.getBlockX() + enumfacing.c(); + int j = isourceblock.getBlockY() + enumfacing.d(); + int k = isourceblock.getBlockZ() + enumfacing.e(); + AxisAlignedBB axisalignedbb = AxisAlignedBB.a().a((double) i, (double) j, (double) k, (double) (i + 1), (double) (j + 1), (double) (k + 1)); + List list = isourceblock.k().a(EntityLiving.class, axisalignedbb, (IEntitySelector) (new EntitySelectorEquipable(itemstack))); + + if (list.size() > 0) { + EntityLiving entityliving = (EntityLiving) list.get(0); + int l = entityliving instanceof EntityHuman ? 1 : 0; + int i1 = EntityLiving.b(itemstack); + ItemStack itemstack1 = itemstack.cloneItemStack(); + + itemstack1.count = 1; + entityliving.setEquipment(i1 - l, itemstack1); + entityliving.a(i1, 2.0F); + --itemstack.count; + return itemstack; + } else { + return super.b(isourceblock, itemstack); + } + } +} |