Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-16 11:30:06 +01:00
93 Zeilen
3.7 KiB
Diff
93 Zeilen
3.7 KiB
Diff
From d3abf8e422cced1d74772b9b14e361d65dc2a0f8 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 ce50925..7738af4 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
@@ -376,6 +376,7 @@ public abstract class EntityHuman extends EntityLiving {
|
|
|
|
List list = this.world.getEntities(this, axisalignedbb);
|
|
|
|
+ if (this.isCollidable()) { // Spigot: Add isCollidable() condition (second !this.isDead near bottom of EntityLiving)
|
|
for (int i = 0; i < list.size(); ++i) {
|
|
Entity entity = (Entity) list.get(i);
|
|
|
|
@@ -383,6 +384,7 @@ public abstract class EntityHuman extends EntityLiving {
|
|
this.c(entity);
|
|
}
|
|
}
|
|
+ } // Spigot
|
|
}
|
|
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index 36ef280..c2f5ee1 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -1966,7 +1966,7 @@ public abstract class EntityLiving extends Entity {
|
|
protected void cn() {
|
|
List list = this.world.a((Entity) this, this.getBoundingBox(), IEntitySelector.a(this));
|
|
|
|
- if (!list.isEmpty()) {
|
|
+ if (this.isInteractable() && !list.isEmpty()) { // Spigot: Add isInteractable() condition
|
|
for (int i = 0; i < list.size(); ++i) {
|
|
Entity entity = (Entity) list.get(i);
|
|
// TODO better check now?
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
index 846566e..6cda7b9 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
@@ -65,6 +65,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 isInteractable()
|
|
+ {
|
|
+ return this.collidesWithEntities && super.isInteractable(); // (first !this.isDead near bottom of EntityLiving)
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isCollidable()
|
|
+ {
|
|
+ return this.collidesWithEntities && super.isCollidable(); // (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 cd51b41..17a074a 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -1411,6 +1411,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().i = collides; // First boolean of Entity
|
|
+ }
|
|
};
|
|
|
|
public Player.Spigot spigot()
|
|
--
|
|
2.5.0
|
|
|