Implement Arrow tile methods

This commit is contained in:
Parker Hawke 2018-05-01 15:27:59 -04:00 committed by md_5
parent 61ca7d92c1
commit d0a3620c2d
2 changed files with 29 additions and 0 deletions

View File

@ -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);

View File

@ -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;
@ -46,6 +47,21 @@ public class CraftArrow extends AbstractProjectile implements Arrow {
getHandle().projectileSource = shooter;
}
@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()];