Update Paper to MC 1.11
This commit is contained in:
@@ -8,86 +8,34 @@ diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
+import com.google.common.base.Predicate; // Paper
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import java.util.Arrays;
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
private final ItemCooldown bW = this.l();
|
||||
private final ItemCooldown bV;
|
||||
@Nullable
|
||||
public EntityFishingHook hookedFish;
|
||||
+ public boolean affectsSpawning = true; // Paper - AffectsSpawning API
|
||||
|
||||
+ // Paper start - affectsSpawning API
|
||||
+ public boolean affectsSpawning = true;
|
||||
+
|
||||
+ public static Predicate<EntityHuman> affectsSpawningFilter() {
|
||||
+ return new Predicate<EntityHuman>() {
|
||||
+ @Override
|
||||
+ public boolean apply(EntityHuman entityHuman) {
|
||||
+ return entityHuman.affectsSpawning;
|
||||
+ }
|
||||
+ };
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
// CraftBukkit start
|
||||
public boolean fauxSleeping;
|
||||
public String spawnWorld = "";
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
if (this.persistent) {
|
||||
this.ticksFarFromPlayer = 0;
|
||||
} else {
|
||||
- EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
|
||||
+ EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D, EntityHuman.affectsSpawningFilter()); // Paper - affectsSpawning filter
|
||||
--- a/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||
@@ -0,0 +0,0 @@ public final class IEntitySelector {
|
||||
};
|
||||
public static final Predicate<Entity> e = new Predicate() {
|
||||
public boolean a(@Nullable Entity entity) {
|
||||
- return !(entity instanceof EntityHuman) || !((EntityHuman) entity).isSpectator();
|
||||
+ return !(entity instanceof EntityHuman) || !((EntityHuman) entity).isSpectator() || !((EntityHuman) entity).affectsSpawning; // Paper - Affects Spawning API
|
||||
}
|
||||
|
||||
if (entityhuman != null) {
|
||||
double d0 = entityhuman.locX - this.locX;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntitySilverfish.java b/src/main/java/net/minecraft/server/EntitySilverfish.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntitySilverfish.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntitySilverfish.java
|
||||
@@ -0,0 +0,0 @@ public class EntitySilverfish extends EntityMonster {
|
||||
public boolean apply(@Nullable Object object) {
|
||||
return this.a((Entity) object);
|
||||
}
|
||||
};
|
||||
+ public static final Predicate<Entity> CAN_MOBS_TARGET = e; // Paper - OBFHELPER
|
||||
|
||||
public boolean cK() {
|
||||
if (super.cK()) {
|
||||
- EntityHuman entityhuman = this.world.b(this, 5.0D);
|
||||
+ EntityHuman entityhuman = this.world.findNearbyPlayerNotInCreativeMode(this, 5.0D, EntityHuman.affectsSpawningFilter()); // Paper - affectsSpawning filter
|
||||
|
||||
return entityhuman == null;
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
|
||||
|
||||
if (this.world.getType(new BlockPosition(i1, j1 - 1, k1)).q() && this.world.getLightLevel(new BlockPosition(i1, j1, k1)) < 10) {
|
||||
entityzombie.setPosition((double) i1, (double) j1, (double) k1);
|
||||
- if (!this.world.isPlayerNearby((double) i1, (double) j1, (double) k1, 7.0D) && this.world.a(entityzombie.getBoundingBox(), (Entity) entityzombie) && this.world.getCubes(entityzombie, entityzombie.getBoundingBox()).isEmpty() && !this.world.containsLiquid(entityzombie.getBoundingBox())) {
|
||||
+ if (!this.world.isPlayerNearby((double) i1, (double) j1, (double) k1, 7.0D, EntityHuman.affectsSpawningFilter()) && this.world.a(entityzombie.getBoundingBox(), (Entity) entityzombie) && this.world.getCubes(entityzombie, entityzombie.getBoundingBox()).isEmpty() && !this.world.containsLiquid(entityzombie.getBoundingBox())) { // Paper - affectsSpawning filter
|
||||
this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
|
||||
entityzombie.setGoalTarget(entityliving, EntityTargetEvent.TargetReason.REINFORCEMENT_TARGET, true);
|
||||
entityzombie.prepare(this.world.D(new BlockPosition(entityzombie)), (GroupDataEntity) null);
|
||||
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract {
|
||||
private boolean h() {
|
||||
BlockPosition blockposition = this.b();
|
||||
|
||||
- return this.a().isPlayerNearby((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange);
|
||||
+ return this.a().isPlayerNearby((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange, EntityHuman.affectsSpawningFilter()); // Paper - affectsSpawning filter
|
||||
}
|
||||
|
||||
public void c() {
|
||||
public static <T extends Entity> Predicate<T> a(final double d0, final double d1, final double d2, double d3) {
|
||||
final double d4 = d3 * d3;
|
||||
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
|
||||
@@ -96,93 +44,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
while (iterator.hasNext()) {
|
||||
EntityHuman entityhuman = (EntityHuman) iterator.next();
|
||||
|
||||
+ if (!entityhuman.affectsSpawning) continue; // Paper - affectsSpawning check
|
||||
+
|
||||
if (!entityhuman.isSpectator()) {
|
||||
- if (!entityhuman.isSpectator()) {
|
||||
+ if (!entityhuman.isSpectator() && entityhuman.affectsSpawning) { // Paper - AffectsSpawning API
|
||||
int l = MathHelper.floor(entityhuman.locX / 16.0D);
|
||||
|
||||
@@ -0,0 +0,0 @@ public final class SpawnerCreature {
|
||||
float f = (float) j3 + 0.5F;
|
||||
float f1 = (float) l3 + 0.5F;
|
||||
|
||||
- if (!worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) {
|
||||
+ if (!worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D, EntityHuman.affectsSpawningFilter()) && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) { // Paper - affectsSpawning filter
|
||||
if (biomebase_biomemeta == null) {
|
||||
biomebase_biomemeta = worldserver.a(enumcreaturetype, (BlockPosition) blockposition_mutableblockposition);
|
||||
if (biomebase_biomemeta == null) {
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Predicate;
|
||||
+import com.google.common.base.Predicates; // Paper
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
|
||||
@Nullable
|
||||
public EntityHuman findNearbyPlayer(Entity entity, double d0) {
|
||||
- return this.a(entity.locX, entity.locY, entity.locZ, d0, false);
|
||||
+ // Paper start - Add filter parameter
|
||||
+ return findNearbyPlayer(entity, d0, Predicates.<EntityHuman>alwaysTrue());
|
||||
+ }
|
||||
+
|
||||
+ public EntityHuman findNearbyPlayer(Entity entity, double d0, Predicate<EntityHuman> filter) {
|
||||
+ return this.findNearbyPlayer(entity.locX, entity.locY, entity.locZ, d0, false, filter);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public EntityHuman b(Entity entity, double d0) {
|
||||
- return this.a(entity.locX, entity.locY, entity.locZ, d0, true);
|
||||
+ return this.findNearbyPlayerNotInCreativeMode(entity, d0, Predicates.<EntityHuman>alwaysTrue());
|
||||
+ }
|
||||
+
|
||||
+ public EntityHuman findNearbyPlayerNotInCreativeMode(Entity entity, double d0, Predicate<EntityHuman> filter) {
|
||||
+ return this.findNearbyPlayer(entity.locX, entity.locY, entity.locZ, d0, true, filter);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public EntityHuman a(double d0, double d1, double d2, double d3, boolean flag) {
|
||||
+ return findNearbyPlayer(d0, d1, d2, d3, flag, Predicates.<EntityHuman>alwaysTrue());
|
||||
+ }
|
||||
+
|
||||
+ public EntityHuman findNearbyPlayer(double d0, double d1, double d2, double d3, boolean flag, Predicate<EntityHuman> filter) {
|
||||
+ // FYI the flag means "exclude creative mode players"
|
||||
+ // Paper end
|
||||
double d4 = -1.0D;
|
||||
EntityHuman entityhuman = null;
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
+ if (!filter.apply(entityhuman1)) continue; // Paper - check filter
|
||||
+
|
||||
if ((IEntitySelector.d.apply(entityhuman1) || !flag) && (IEntitySelector.e.apply(entityhuman1) || flag)) {
|
||||
double d5 = entityhuman1.e(d0, d1, d2);
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
public boolean isPlayerNearby(double d0, double d1, double d2, double d3) {
|
||||
+ // Paper start - add filter parameter
|
||||
+ return isPlayerNearby(d0, d1, d2, d3, Predicates.<EntityHuman>alwaysTrue());
|
||||
+ }
|
||||
+
|
||||
+ public boolean isPlayerNearby(double d0, double d1, double d2, double d3, Predicate<EntityHuman> filter) {
|
||||
+ // Paper end
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
EntityHuman entityhuman = (EntityHuman) this.players.get(i);
|
||||
|
||||
+ if (!filter.apply(entityhuman)) continue; // Paper - check filter
|
||||
+
|
||||
if (IEntitySelector.e.apply(entityhuman)) {
|
||||
double d4 = entityhuman.e(d0, d1, d2);
|
||||
|
||||
j = MathHelper.floor(entityhuman.locZ / 16.0D);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
|
||||
Reference in New Issue
Block a user