Paper/CraftBukkit-Patches/0043-Player-Collision-API.patch

86 lines
3.4 KiB
Diff
Raw Normal View History

2014-06-22 11:25:10 +02:00
From 87d34d87e622b96a4369337e20b7fc5135a5c4db Mon Sep 17 00:00:00 2001
2014-04-12 06:18:37 +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
2014-04-19 01:15:23 +02:00
index 1fc7a22..d091bcf 100644
2014-04-12 06:18:37 +02:00
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -430,7 +430,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
List list = this.world.getEntities(this, axisalignedbb);
- if (list != null) {
+ if (list != null && this.R()) { // Spigot: Add this.R() 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
2014-05-27 09:40:02 +02:00
index a180c89..dbe58b1 100644
2014-04-12 06:18:37 +02:00
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
2014-05-27 09:40:02 +02:00
@@ -1495,7 +1495,7 @@ public abstract class EntityLiving extends Entity {
2014-04-12 06:18:37 +02:00
protected void bn() {
List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
- if (list != null && !list.isEmpty()) {
+ if (this.R() && list != null && !list.isEmpty()) { // Spigot: Add this.R() 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
2014-04-19 01:15:23 +02:00
index 3a0d679..367472d 100644
2014-04-12 06:18:37 +02:00
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -63,6 +63,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 Q()
+ {
+ return this.collidesWithEntities && super.Q();
+ }
+
+ @Override
+ public boolean R()
+ {
+ return this.collidesWithEntities && super.R();
+ }
+ // 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
2014-05-27 09:40:02 +02:00
index 4d2374d..a5002d8 100644
2014-04-12 06:18:37 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1290,6 +1290,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()
--
2014-04-19 01:15:23 +02:00
1.9.1
2014-04-12 06:18:37 +02:00