testserver/CraftBukkit-Patches/0036-Player-Collision-API.p...

93 lines
3.5 KiB
Diff
Raw Normal View History

2015-09-01 08:07:28 +00:00
From 3fe39dbb7f7395a69b32f2a1055eadd08f930f3a 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
2015-09-01 08:07:28 +00:00
index ab4373a..f571649 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -427,6 +427,7 @@ public abstract class EntityHuman extends EntityLiving {
List list = this.world.getEntities(this, axisalignedbb);
2014-11-28 01:17:45 +00:00
+ 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);
@@ -434,6 +435,7 @@ public abstract class EntityHuman extends EntityLiving {
2014-11-28 01:17:45 +00:00
this.d(entity);
}
}
+ } // Spigot
}
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
2015-09-01 08:07:28 +00:00
index bd30895..6d1a743 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
2015-09-01 08:07:28 +00:00
@@ -1675,7 +1675,7 @@ public abstract class EntityLiving extends Entity {
2015-02-28 11:36:22 +00:00
}
}));
2015-02-28 11:36:22 +00:00
- if (!list.isEmpty()) {
+ if (this.ad() && !list.isEmpty()) { // Spigot: Add this.ad() condition
for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i);
2015-02-28 11:36:22 +00:00
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
2015-09-01 08:07:28 +00:00
index a7a0516..4a415f6 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
2014-11-28 01:17:45 +00:00
@@ -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
2014-11-28 01:17:45 +00:00
+ public boolean ad()
+ {
2014-11-28 01:17:45 +00:00
+ return this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving)
+ }
+
+ @Override
2014-11-28 01:17:45 +00:00
+ public boolean ae()
+ {
2014-11-28 01:17:45 +00:00
+ 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 d4d6259..3a07a7b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1345,6 +1345,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()
--
2015-05-09 20:23:26 +00:00
2.1.4