Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 19:10:09 +01:00
93 Zeilen
3.5 KiB
Diff
93 Zeilen
3.5 KiB
Diff
From 920351331bf866635c2199b4dea47c5450c4ef0a 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 fe26522..d1e6e53 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);
|
|
|
|
+ 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 {
|
|
this.d(entity);
|
|
}
|
|
}
|
|
+ } // Spigot
|
|
}
|
|
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index e3a9e44..6a0b22a 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -1674,7 +1674,7 @@ public abstract class EntityLiving extends Entity {
|
|
}
|
|
}));
|
|
|
|
- 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);
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
index e707dd7..b0681cf 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
@@ -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
|
|
+ public boolean ad()
|
|
+ {
|
|
+ return this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving)
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean ae()
|
|
+ {
|
|
+ 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 098a0d8..0ef7321 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -1325,6 +1325,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()
|
|
--
|
|
2.1.4
|
|
|