86 Zeilen
3.5 KiB
Diff
86 Zeilen
3.5 KiB
Diff
|
From 7e036a2f853ca31801801c3661d75a74cfee38f3 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 54c77f8..4bde9c1 100644
|
||
|
--- 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.S()) { // Spigot: Add this.S() condition (second !this.isDead near bottom of EntityLiving)
|
||
|
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 92ad5c7..859e91f 100644
|
||
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||
|
@@ -1596,7 +1596,7 @@ public abstract class EntityLiving extends Entity {
|
||
|
protected void bo() {
|
||
|
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
|
||
|
index adfaddf..f74e175 100644
|
||
|
--- 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 R()
|
||
|
+ {
|
||
|
+ return this.collidesWithEntities && super.R(); // (first !this.isDead near bottom of EntityLiving)
|
||
|
+ }
|
||
|
+
|
||
|
+ @Override
|
||
|
+ public boolean S()
|
||
|
+ {
|
||
|
+ return this.collidesWithEntities && super.S(); // (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 8b599f2..ab1c5d8 100644
|
||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||
|
@@ -1289,6 +1289,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()
|
||
|
--
|
||
|
1.9.1
|
||
|
|