diff options
author | Parker Hawke <hawkeboyz2@hotmail.com> | 2018-05-01 15:27:59 -0400 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-05-06 14:12:19 +1000 |
commit | d0a3620c2dc8a22438808f395348c100a183a618 (patch) | |
tree | 6c0273dd282391eda89a6b1f0ea6235767bc823f | |
parent | 61ca7d92c1fc78e1ddb3339637493ad6e36a93a8 (diff) | |
download | craftbukkit-d0a3620c2dc8a22438808f395348c100a183a618.tar craftbukkit-d0a3620c2dc8a22438808f395348c100a183a618.tar.gz craftbukkit-d0a3620c2dc8a22438808f395348c100a183a618.tar.lz craftbukkit-d0a3620c2dc8a22438808f395348c100a183a618.tar.xz craftbukkit-d0a3620c2dc8a22438808f395348c100a183a618.zip |
Implement Arrow tile methods
-rw-r--r-- | nms-patches/EntityArrow.patch | 13 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java | 16 |
2 files changed, 29 insertions, 0 deletions
diff --git a/nms-patches/EntityArrow.patch b/nms-patches/EntityArrow.patch index 8da69dc2..3d27615c 100644 --- a/nms-patches/EntityArrow.patch +++ b/nms-patches/EntityArrow.patch @@ -14,6 +14,19 @@ public abstract class EntityArrow extends Entity implements IProjectile { private static final Predicate<Entity> f = Predicates.and(new Predicate[] { IEntitySelector.e, IEntitySelector.a, new Predicate() { +@@ -17,9 +24,9 @@ + } + }}); + private static final DataWatcherObject<Byte> g = DataWatcher.a(EntityArrow.class, DataWatcherRegistry.a); +- private int h; +- private int at; +- private int au; ++ public int h; // PAIL: private->public ++ public int at; // PAIL: private->public ++ public int au; // PAIL: private->public + private Block av; + private int aw; + public boolean inGround; @@ -50,6 +57,7 @@ public EntityArrow(World world, EntityLiving entityliving) { this(world, entityliving.locX, entityliving.locY + (double) entityliving.getHeadHeight() - 0.10000000149011612D, entityliving.locZ); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java index 3974778d..99425767 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java @@ -4,6 +4,7 @@ import com.google.common.base.Preconditions; import net.minecraft.server.EntityArrow; import org.apache.commons.lang.Validate; +import org.bukkit.block.Block; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Arrow; import org.bukkit.entity.EntityType; @@ -47,6 +48,21 @@ public class CraftArrow extends AbstractProjectile implements Arrow { } @Override + public boolean isInBlock() { + return getHandle().inGround; + } + + @Override + public Block getAttachedBlock() { + if (!isInBlock()) { + return null; + } + + EntityArrow handle = getHandle(); + return getWorld().getBlockAt(handle.h, handle.at, handle.au); // PAIL: rename tileX, tileY, tileZ + } + + @Override public PickupStatus getPickupStatus() { return PickupStatus.values()[getHandle().fromPlayer.ordinal()]; } |