2016-03-19 04:46:10 +01:00
|
|
|
From 5cb4c77361fa3df82d795a16680348b0b7a0b10d Mon Sep 17 00:00:00 2001
|
2014-07-21 22:46:54 +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
|
2016-03-19 04:46:10 +01:00
|
|
|
index 74bf367..45c4ef3 100644
|
2014-07-21 22:46:54 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
2016-03-12 10:59:15 +01:00
|
|
|
@@ -377,6 +377,7 @@ public abstract class EntityHuman extends EntityLiving {
|
2014-07-21 22:46:54 +02:00
|
|
|
|
|
|
|
List list = this.world.getEntities(this, axisalignedbb);
|
|
|
|
|
2016-02-29 22:33:06 +01:00
|
|
|
+ if (this.isCollidable()) { // Spigot: Add isCollidable() condition (second !this.isDead near bottom of EntityLiving)
|
2014-11-28 02:17:45 +01:00
|
|
|
for (int i = 0; i < list.size(); ++i) {
|
|
|
|
Entity entity = (Entity) list.get(i);
|
2014-07-21 22:46:54 +02:00
|
|
|
|
2016-03-12 10:59:15 +01:00
|
|
|
@@ -384,6 +385,7 @@ public abstract class EntityHuman extends EntityLiving {
|
2016-02-29 22:33:06 +01:00
|
|
|
this.c(entity);
|
2014-11-28 02:17:45 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
+ } // Spigot
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2014-07-21 22:46:54 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
2016-03-19 04:46:10 +01:00
|
|
|
index 6fabefa..0cf1b90 100644
|
2014-07-21 22:46:54 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
2016-03-19 04:46:10 +01:00
|
|
|
@@ -1974,7 +1974,7 @@ public abstract class EntityLiving extends Entity {
|
2016-02-29 22:33:06 +01:00
|
|
|
protected void cn() {
|
|
|
|
List list = this.world.a((Entity) this, this.getBoundingBox(), IEntitySelector.a(this));
|
2014-07-21 22:46:54 +02:00
|
|
|
|
2015-02-28 12:36:22 +01:00
|
|
|
- if (!list.isEmpty()) {
|
2016-02-29 22:33:06 +01:00
|
|
|
+ if (this.isInteractable() && !list.isEmpty()) { // Spigot: Add isInteractable() condition
|
2014-07-21 22:46:54 +02:00
|
|
|
for (int i = 0; i < list.size(); ++i) {
|
|
|
|
Entity entity = (Entity) list.get(i);
|
2016-02-29 22:33:06 +01:00
|
|
|
// TODO better check now?
|
2014-07-21 22:46:54 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
2016-03-12 10:59:15 +01:00
|
|
|
index 4e34d45..688b359 100644
|
2014-07-21 22:46:54 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
2016-02-29 22:33:06 +01:00
|
|
|
@@ -65,6 +65,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
2014-07-21 22:46:54 +02:00
|
|
|
public double maxHealthCache;
|
|
|
|
public boolean joining = true;
|
|
|
|
// CraftBukkit end
|
|
|
|
+ // Spigot start
|
|
|
|
+ public boolean collidesWithEntities = true;
|
|
|
|
+
|
|
|
|
+ @Override
|
2016-02-29 22:33:06 +01:00
|
|
|
+ public boolean isInteractable()
|
2014-07-21 22:46:54 +02:00
|
|
|
+ {
|
2016-02-29 22:33:06 +01:00
|
|
|
+ return this.collidesWithEntities && super.isInteractable(); // (first !this.isDead near bottom of EntityLiving)
|
2014-07-21 22:46:54 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
2016-02-29 22:33:06 +01:00
|
|
|
+ public boolean isCollidable()
|
2014-07-21 22:46:54 +02:00
|
|
|
+ {
|
2016-02-29 22:33:06 +01:00
|
|
|
+ return this.collidesWithEntities && super.isCollidable(); // (second !this.isDead near bottom of EntityLiving)
|
2014-07-21 22:46:54 +02:00
|
|
|
+ }
|
|
|
|
+ // 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
|
2016-03-07 09:52:16 +01:00
|
|
|
index e93cedb..cdabd78 100644
|
2014-07-21 22:46:54 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2016-03-02 22:28:13 +01:00
|
|
|
@@ -1407,6 +1407,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2014-07-21 22:46:54 +02:00
|
|
|
// 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;
|
2016-02-29 22:33:06 +01:00
|
|
|
+ getHandle().i = collides; // First boolean of Entity
|
2014-07-21 22:46:54 +02:00
|
|
|
+ }
|
|
|
|
};
|
|
|
|
|
|
|
|
public Player.Spigot spigot()
|
|
|
|
--
|
2016-02-29 22:33:06 +01:00
|
|
|
2.5.0
|
2014-07-21 22:46:54 +02:00
|
|
|
|