diff options
author | Erik Broes <erikbroes@grum.nl> | 2011-11-20 00:01:14 -0800 |
---|---|---|
committer | Erik Broes <erikbroes@ripe.net> | 2011-11-20 00:01:33 -0800 |
commit | 345ea36c7bb3383c6e4825355d0043a646194eaa (patch) | |
tree | df116b57d92315c0a13c2fdc87d792b031c7239a /src/main/java/net/minecraft/server/ItemBoat.java | |
parent | 589f66bd1b766dc1fdd737ee885304196a2ed86a (diff) | |
download | craftbukkit-345ea36c7bb3383c6e4825355d0043a646194eaa.tar craftbukkit-345ea36c7bb3383c6e4825355d0043a646194eaa.tar.gz craftbukkit-345ea36c7bb3383c6e4825355d0043a646194eaa.tar.lz craftbukkit-345ea36c7bb3383c6e4825355d0043a646194eaa.tar.xz craftbukkit-345ea36c7bb3383c6e4825355d0043a646194eaa.zip |
Update for 1.0.0
Diffstat (limited to 'src/main/java/net/minecraft/server/ItemBoat.java')
-rw-r--r-- | src/main/java/net/minecraft/server/ItemBoat.java | 58 |
1 files changed, 42 insertions, 16 deletions
diff --git a/src/main/java/net/minecraft/server/ItemBoat.java b/src/main/java/net/minecraft/server/ItemBoat.java index b84d6656..1bb99704 100644 --- a/src/main/java/net/minecraft/server/ItemBoat.java +++ b/src/main/java/net/minecraft/server/ItemBoat.java @@ -1,5 +1,7 @@ package net.minecraft.server; +import java.util.List; + // CraftBukkit start import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.event.block.Action; @@ -34,31 +36,55 @@ public class ItemBoat extends Item { if (movingobjectposition == null) { return itemstack; } else { - if (movingobjectposition.type == EnumMovingObjectType.TILE) { - int i = movingobjectposition.b; - int j = movingobjectposition.c; - int k = movingobjectposition.d; + Vec3D vec3d2 = entityhuman.d(f); + boolean flag = false; + float f9 = 1.0F; + List list = world.b((Entity) entityhuman, entityhuman.boundingBox.a(vec3d2.a * d3, vec3d2.b * d3, vec3d2.c * d3).b((double) f9, (double) f9, (double) f9)); + + for (int i = 0; i < list.size(); ++i) { + Entity entity = (Entity) list.get(i); - if (!world.isStatic) { - // CraftBukkit start - Boat placement - PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, i, j, k, movingobjectposition.face, itemstack); + if (entity.e_()) { + float f10 = entity.j_(); + AxisAlignedBB axisalignedbb = entity.boundingBox.b((double) f10, (double) f10, (double) f10); - if (event.isCancelled()) { - return itemstack; + if (axisalignedbb.a(vec3d)) { + flag = true; } - // CraftBukkit end + } + } + + if (flag) { + return itemstack; + } else { + if (movingobjectposition.type == EnumMovingObjectType.TILE) { + int j = movingobjectposition.b; + int k = movingobjectposition.c; + int l = movingobjectposition.d; + + if (!world.isStatic) { + // CraftBukkit start - Boat placement + PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, j, k, l, movingobjectposition.face, itemstack); - if (world.getTypeId(i, j, k) == Block.SNOW.id) { - --j; + if (event.isCancelled()) { + return itemstack; + } + // CraftBukkit end + + if (world.getTypeId(j, k, l) == Block.SNOW.id) { + --k; + } + + world.addEntity(new EntityBoat(world, (double) ((float) j + 0.5F), (double) ((float) k + 1.0F), (double) ((float) l + 0.5F))); } - world.addEntity(new EntityBoat(world, (double) ((float) i + 0.5F), (double) ((float) j + 1.0F), (double) ((float) k + 0.5F))); + if (!entityhuman.abilities.canInstantlyBuild) { + --itemstack.count; + } } - --itemstack.count; + return itemstack; } - - return itemstack; } } } |