fix "avoid hopper searches" and make it use an obfhelper

This commit is contained in:
Shane Freeder 2018-10-25 21:27:54 +01:00
parent 0696c672be
commit 34ee08f240
2 changed files with 14 additions and 2 deletions

View File

@ -63,7 +63,7 @@ index 7ac07ac07ac0..7ac07ac07ac0 100644
+ * Make sure the inventory selector stays in sync.
+ * It should be the one that checks `var1 instanceof IInventory && var1.isAlive()`
+ */
+ if (predicate == IEntitySelector.c && inventoryEntityCounts[k] <= 0) continue;
+ if (predicate == IEntitySelector.isInventory() && inventoryEntityCounts[k] <= 0) continue;
+ // Paper end
while (iterator.hasNext()) {
Entity entity1 = (Entity) iterator.next();
@ -87,6 +87,18 @@ index 7ac07ac07ac0..7ac07ac07ac0 100644
Iterator iterator = this.entitySlices[k].iterator(); // Spigot
while (iterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/IEntitySelector.java
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
@@ -10,6 +10,7 @@ public final class IEntitySelector {
public static final Predicate<Entity> c = (entity) -> {
return entity.isAlive() && !entity.isVehicle() && !entity.isPassenger();
};
+ public static final Predicate<Entity> isInventory() { return d; } // Paper - OBFHELPER
public static final Predicate<Entity> d = (entity) -> {
return entity instanceof IInventory && entity.isAlive();
};
--
2.19.1

View File

@ -133,7 +133,7 @@ diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/
index 7ac07ac07ac0..7ac07ac07ac0 100644
--- a/src/main/java/net/minecraft/server/IEntitySelector.java
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
@@ -17,6 +17,7 @@ public final class IEntitySelector {
@@ -18,6 +18,7 @@ public final class IEntitySelector {
public static final Predicate<Entity> e = (entity) -> {
return !(entity instanceof EntityHuman) || !((EntityHuman)entity).isSpectator() && !((EntityHuman)entity).u();
};