Fix item gravity on inactive items, remove dumb active skipping

This commit is contained in:
Nassim Jahnke
2024-10-30 14:06:43 +01:00
parent 666560fcdd
commit 7dc7d6ef96
2 changed files with 23 additions and 30 deletions

View File

@@ -32,14 +32,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- }
+ }*/ // Paper - comment out EAR 2
// Spigot end
+ final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity); // Paper - EAR 2
entity.setOldPosAndRot();
ProfilerFiller gameprofilerfiller = Profiler.get();
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
});
gameprofilerfiller.incrementCounter("tickNonPassenger");
+ final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity); // Paper - EAR 2
+ if (isActive) { // Paper - EAR 2
entity.tick();
entity.postTick(); // CraftBukkit
@@ -651,11 +650,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ if (entity instanceof Mob && ((Mob) entity).targetSelector.hasTasks() ) {
+ return 0;
+ }
}
+ if (entity instanceof Pillager) {
+ Pillager pillager = (Pillager) entity;
+ // TODO:?
}
+ }
+ // Paper end
}
// SPIGOT-6644: Otherwise the target refresh tick will be missed
@@ -706,14 +705,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ // Paper end
isActive = true;
+
}
// Add a little performance juice to active entities. Skip 1/4 if not immune.
- } else if ( !entity.defaultActivationState && (entity.tickCount + entity.getId()) % 4 == 0 && !ActivationRange.checkEntityImmunities( entity ) ) // Paper - Ensure checking item movement is offset from Spigot's entity activation range check
+ } else if ( (entity.tickCount + entity.getId()) % 4 == 0 && ActivationRange.checkEntityImmunities( entity ) < 0 ) // Paper
{
isActive = false;
}
} else if (entity instanceof net.minecraft.world.entity.item.ItemEntity && (entity.tickCount + entity.getId()) % 4 == 0) { // Paper - Needed for item gravity, see ItemEntity tick
isActive = true;
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java