mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
API for ArmorStand movement and option for entity lookups
This commit is contained in:
parent
cae453c16b
commit
c8fb4667af
3 changed files with 125 additions and 0 deletions
|
@ -0,0 +1,36 @@
|
|||
From 7226ac4a27ddff4001102f91265fbd8e0cb1e722 Mon Sep 17 00:00:00 2001
|
||||
From: kashike <kashike@vq.lc>
|
||||
Date: Wed, 21 Dec 2016 11:47:25 -0600
|
||||
Subject: [PATCH] Add API methods to control if armour stands can move
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java
|
||||
index b4f0451..099da6c 100644
|
||||
--- a/src/main/java/org/bukkit/entity/ArmorStand.java
|
||||
+++ b/src/main/java/org/bukkit/entity/ArmorStand.java
|
||||
@@ -258,4 +258,22 @@ public interface ArmorStand extends LivingEntity {
|
||||
* @param marker whether this is a marker
|
||||
*/
|
||||
void setMarker(boolean marker);
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Tests if this armor stand can move.
|
||||
+ *
|
||||
+ * <p>The default value is {@code true}.</p>
|
||||
+ *
|
||||
+ * @return {@code true} if this armour stand can move, {@code false} otherwise
|
||||
+ */
|
||||
+ boolean canMove();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if this armor stand can move.
|
||||
+ *
|
||||
+ * @param move {@code true} if this armour stand can move, {@code false} otherwise
|
||||
+ */
|
||||
+ void setCanMove(boolean move);
|
||||
+ // Paper end
|
||||
}
|
||||
--
|
||||
2.9.3
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
From f1ec82f7d05366e3b71f50a52b3886376e0fed60 Mon Sep 17 00:00:00 2001
|
||||
From: kashike <kashike@vq.lc>
|
||||
Date: Wed, 21 Dec 2016 11:47:25 -0600
|
||||
Subject: [PATCH] Add API methods to control if armour stands can move
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
|
||||
index 96bb110..7738ca3 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
|
||||
@@ -50,6 +50,7 @@ public class EntityArmorStand extends EntityLiving {
|
||||
public Vector3f rightArmPose;
|
||||
public Vector3f leftLegPose;
|
||||
public Vector3f rightLegPose;
|
||||
+ public boolean canMove = true; // Paper
|
||||
|
||||
public EntityArmorStand(World world) {
|
||||
super(world);
|
||||
@@ -763,4 +764,13 @@ public class EntityArmorStand extends EntityLiving {
|
||||
public boolean cK() {
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public void move(EnumMoveType moveType, double x, double y, double z) {
|
||||
+ if (this.canMove) {
|
||||
+ super.move(moveType, x, y, z);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
|
||||
index 2b66a08..8a06cb1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
|
||||
@@ -211,4 +211,14 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
|
||||
public void setMarker(boolean marker) {
|
||||
getHandle().setMarker(marker);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canMove() {
|
||||
+ return getHandle().canMove;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCanMove(boolean move) {
|
||||
+ getHandle().canMove = move;
|
||||
+ }
|
||||
}
|
||||
--
|
||||
2.9.3
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
From b5fc17d23094f1c25d9bae76e0bff778afea011e Mon Sep 17 00:00:00 2001
|
||||
From: kashike <kashike@vq.lc>
|
||||
Date: Wed, 21 Dec 2016 11:52:04 -0600
|
||||
Subject: [PATCH] Option to prevent armor stands from doing entity lookups
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index a655b33..e8762c4 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -409,4 +409,9 @@ public class PaperWorldConfig {
|
||||
log("Treasure Maps will return already discovered locations");
|
||||
}
|
||||
}
|
||||
+
|
||||
+ public boolean armorStandEntityLookups = true;
|
||||
+ private void armorStandEntityLookups() {
|
||||
+ armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 2911c65..6d548dd 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1332,6 +1332,7 @@ public abstract class World implements IBlockAccess {
|
||||
|
||||
this.a(entity, axisalignedbb, false, arraylist);
|
||||
if (entity != null) {
|
||||
+ if (entity instanceof EntityArmorStand && !entity.world.paperConfig.armorStandEntityLookups) return arraylist; // Paper
|
||||
List list = this.getEntities(entity, axisalignedbb.g(0.25D));
|
||||
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
--
|
||||
2.9.3
|
||||
|
Loading…
Reference in a new issue