PaperSpigot-Parent/CraftBukkit-Patches/0037-Player-Collision-API.patch
Zach Brown 19972e09b8 Update SpigotMC's patches
5a0150f586ed3eb15fe6f1f596d1a5a7d806f0f9 Fix ITEM_BREAK
e6a3911057bd94d8bd7021cbb4923fb84fb106d1 Upstream merge
d1cdcf8d4c3639f956474f02ed662517cffbe23e Remove old patch
068df64aeee368377e1673667bffc7a6dcf90554 Rebuild all patches
2014-11-30 16:16:48 -06:00

93 lines
3.7 KiB
Diff

From 9c7a158367c21ce04eab04c353170509b4a01534 Mon Sep 17 00:00:00 2001
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
index 7635555..87356e4 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -425,6 +425,7 @@ public abstract class EntityHuman extends EntityLiving {
List list = this.world.getEntities(this, axisalignedbb);
+ if (this.ae()) { // Spigot: Add this.ae() condition (second !this.isDead near bottom of EntityLiving)
for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i);
@@ -432,6 +433,7 @@ public abstract class EntityHuman extends EntityLiving {
this.d(entity);
}
}
+ } // Spigot
}
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 86474de..6358f5e 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -1616,7 +1616,7 @@ public abstract class EntityLiving extends Entity {
protected void bK() {
List list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
- if (list != null && !list.isEmpty()) {
+ if (this.ad() && list != null && !list.isEmpty()) { // Spigot: Add this.ad() 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
index 8d0fc36..d8c8151 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -62,6 +62,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public double maxHealthCache;
public boolean joining = true;
// CraftBukkit end
+ // Spigot start
+ public boolean collidesWithEntities = true;
+
+ @Override
+ public boolean ad()
+ {
+ return this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving)
+ }
+
+ @Override
+ public boolean ae()
+ {
+ return this.collidesWithEntities && super.ae(); // (second !this.isDead near bottom of EntityLiving)
+ }
+ // Spigot end
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
super(worldserver, gameprofile);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index a0df1d2..88c45f1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1314,6 +1314,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Spigot start
private final Player.Spigot spigot = new Player.Spigot()
{
+
+ @Override
+ public boolean getCollidesWithEntities()
+ {
+ return getHandle().collidesWithEntities;
+ }
+
+ @Override
+ public void setCollidesWithEntities(boolean collides)
+ {
+ getHandle().collidesWithEntities = collides;
+ getHandle().k = collides; // First boolean of Entity
+ }
};
public Player.Spigot spigot()
--
2.1.0