2013-09-08 00:36:30 +02:00
|
|
|
From 1d4628a69a0585ad73dda98159ccbe810a9a0da5 Mon Sep 17 00:00:00 2001
|
2013-08-03 11:27:26 +02:00
|
|
|
From: md_5 <md_5@live.com.au>
|
|
|
|
Date: Sat, 3 Aug 2013 19:27:07 +1000
|
|
|
|
Subject: [PATCH] Player Collision API
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
2013-08-03 11:35:01 +02:00
|
|
|
index adb27d8..0a35df8 100644
|
2013-08-03 11:27:26 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
2013-08-03 11:35:01 +02:00
|
|
|
@@ -411,7 +411,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
|
2013-08-03 11:27:26 +02:00
|
|
|
|
|
|
|
List list = this.world.getEntities(this, axisalignedbb);
|
|
|
|
|
|
|
|
- if (list != null) {
|
|
|
|
+ if (list != null && this.L()) { // Spigot: Add this.L() condition
|
|
|
|
for (int i = 0; i < list.size(); ++i) {
|
|
|
|
Entity entity = (Entity) list.get(i);
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
|
|
index 6b8b8dd..34683a5 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
|
|
@@ -1462,7 +1462,7 @@ public abstract class EntityLiving extends Entity {
|
|
|
|
protected void bi() {
|
|
|
|
List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
|
|
|
|
|
|
|
|
- if (list != null && !list.isEmpty()) {
|
|
|
|
+ if (this.L() && list != null && !list.isEmpty()) { // Spigot: Add this.L() condition
|
|
|
|
for (int i = 0; i < list.size(); ++i) {
|
|
|
|
Entity entity = (Entity) list.get(i);
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
2013-08-03 11:35:01 +02:00
|
|
|
index f9ac1e1..9ff8c86 100644
|
2013-08-03 11:27:26 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
2013-08-03 11:35:01 +02:00
|
|
|
@@ -54,6 +54,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2013-08-03 11:27:26 +02:00
|
|
|
public double maxHealthCache;
|
2013-08-03 11:35:01 +02:00
|
|
|
public int lastPing = -1; // Spigot
|
2013-08-03 11:27:26 +02:00
|
|
|
// CraftBukkit end
|
|
|
|
+ // Spigot start
|
|
|
|
+ public boolean collidesWithEntities = true;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean L()
|
|
|
|
+ {
|
|
|
|
+ return this.collidesWithEntities && super.L();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean K()
|
|
|
|
+ {
|
|
|
|
+ return this.collidesWithEntities && super.K();
|
|
|
|
+ }
|
|
|
|
+ // Spigot end
|
|
|
|
|
|
|
|
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, PlayerInteractManager playerinteractmanager) {
|
|
|
|
super(world, s);
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2013-08-03 11:59:46 +02:00
|
|
|
index 9da9863..654c3c9 100644
|
2013-08-03 11:27:26 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2013-08-03 11:35:01 +02:00
|
|
|
@@ -1122,6 +1122,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
|
|
|
|
getHandle().playerConnection.sendPacket( packet );
|
|
|
|
}
|
|
|
|
+
|
2013-08-03 11:27:26 +02:00
|
|
|
+ @Override
|
|
|
|
+ public boolean getCollidesWithEntities()
|
|
|
|
+ {
|
|
|
|
+ return getHandle().collidesWithEntities;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setCollidesWithEntities(boolean collides)
|
|
|
|
+ {
|
|
|
|
+ getHandle().collidesWithEntities = collides;
|
|
|
|
+ getHandle().m = collides; // First boolean of Entity
|
|
|
|
+ }
|
|
|
|
};
|
|
|
|
|
2013-08-03 11:59:46 +02:00
|
|
|
public Player.Spigot spigot()
|
2013-08-03 11:27:26 +02:00
|
|
|
--
|
|
|
|
1.8.1.2
|
|
|
|
|