mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 02:55:47 +01:00
69c09cdb00
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing CraftBukkit Changes: e1a6197e SPIGOT-5565: Animals still spawn from chunk gen when spawn-animals=false
68 lines
3.3 KiB
Diff
68 lines
3.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: kickash32 <kickash32@gmail.com>
|
|
Date: Sat, 21 Dec 2019 15:22:09 -0500
|
|
Subject: [PATCH] Tracking Range Improvements
|
|
|
|
Sets tracking range of watermobs to animals instead of misc and simplifies code
|
|
|
|
Also ignores Enderdragon, defaulting it to Mojang's setting
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
|
|
index cee5a73c2e5b9eed0ed5b271a9648d8929bb829b..fd1924016518d6edc0508311704763841d8c8493 100644
|
|
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
|
|
@@ -1797,6 +1797,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
|
while (iterator.hasNext()) {
|
|
Entity entity = (Entity) iterator.next();
|
|
int j = entity.getEntityType().getChunkRange() * 16;
|
|
+ j = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, j); // Paper
|
|
|
|
if (j > i) {
|
|
i = j;
|
|
diff --git a/src/main/java/org/spigotmc/TrackingRange.java b/src/main/java/org/spigotmc/TrackingRange.java
|
|
index 0449451142d59e828a32fe237751c7d8484894a2..3277a8aaffb6a25624967aa0c62f61309a517739 100644
|
|
--- a/src/main/java/org/spigotmc/TrackingRange.java
|
|
+++ b/src/main/java/org/spigotmc/TrackingRange.java
|
|
@@ -25,26 +25,26 @@ public class TrackingRange
|
|
if ( entity instanceof EntityPlayer )
|
|
{
|
|
return config.playerTrackingRange;
|
|
- } else if ( entity.activationType == ActivationRange.ActivationType.MONSTER || entity.activationType == ActivationRange.ActivationType.RAIDER )
|
|
- {
|
|
- return config.monsterTrackingRange;
|
|
- } else if ( entity instanceof EntityGhast )
|
|
- {
|
|
- if ( config.monsterTrackingRange > config.monsterActivationRange )
|
|
- {
|
|
+ // Paper start - Simplify and set water mobs to animal tracking range
|
|
+ }
|
|
+ switch (entity.activationType) {
|
|
+ case RAIDER:
|
|
+ case MONSTER:
|
|
+ case FLYING_MONSTER:
|
|
return config.monsterTrackingRange;
|
|
- } else
|
|
- {
|
|
- return config.monsterActivationRange;
|
|
- }
|
|
- } else if ( entity.activationType == ActivationRange.ActivationType.ANIMAL )
|
|
- {
|
|
- return config.animalTrackingRange;
|
|
- } else if ( entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityExperienceOrb )
|
|
+ case WATER:
|
|
+ case VILLAGER:
|
|
+ case ANIMAL:
|
|
+ return config.animalTrackingRange;
|
|
+ case MISC:
|
|
+ }
|
|
+ if ( entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityExperienceOrb )
|
|
+ // Paper end
|
|
{
|
|
return config.miscTrackingRange;
|
|
} else
|
|
{
|
|
+ if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon) return ((net.minecraft.server.level.WorldServer)(entity.getWorld())).getChunkProvider().playerChunkMap.getLoadViewDistance(); // Paper - enderdragon is exempt
|
|
return config.otherTrackingRange;
|
|
}
|
|
}
|