mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 18:45:54 +01:00
76 lines
3.6 KiB
Diff
76 lines
3.6 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/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
index 72471db48a9c67ced8b1ef1ebb3381be4f773e06..e6ae3405995c4e472a731311695de7ef9b2d704b 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
@@ -1885,6 +1885,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
|
while (iterator.hasNext()) {
|
|
Entity entity = (Entity) iterator.next();
|
|
int j = entity.getType().clientTrackingRange() * 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 2d5cb8991e368372f1ab227735aac0c060deb199..24b1dfcf91d36947c87e9e5c2524317f8775ba95 100644
|
|
--- a/src/main/java/org/spigotmc/TrackingRange.java
|
|
+++ b/src/main/java/org/spigotmc/TrackingRange.java
|
|
@@ -6,7 +6,6 @@ import net.minecraft.world.entity.ExperienceOrb;
|
|
import net.minecraft.world.entity.decoration.ItemFrame;
|
|
import net.minecraft.world.entity.decoration.Painting;
|
|
import net.minecraft.world.entity.item.ItemEntity;
|
|
-import net.minecraft.world.entity.monster.Ghast;
|
|
|
|
public class TrackingRange
|
|
{
|
|
@@ -29,26 +28,26 @@ public class TrackingRange
|
|
if ( entity instanceof ServerPlayer )
|
|
{
|
|
return config.playerTrackingRange;
|
|
- } else if ( entity.activationType == ActivationRange.ActivationType.MONSTER || entity.activationType == ActivationRange.ActivationType.RAIDER )
|
|
- {
|
|
- return config.monsterTrackingRange;
|
|
- } else if ( entity instanceof Ghast )
|
|
- {
|
|
- 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 ItemFrame || entity instanceof Painting || entity instanceof ItemEntity || entity instanceof ExperienceOrb )
|
|
+ case WATER:
|
|
+ case VILLAGER:
|
|
+ case ANIMAL:
|
|
+ return config.animalTrackingRange;
|
|
+ case MISC:
|
|
+ }
|
|
+ if ( entity instanceof ItemFrame || entity instanceof Painting || entity instanceof ItemEntity || entity instanceof ExperienceOrb )
|
|
+ // Paper end
|
|
{
|
|
return config.miscTrackingRange;
|
|
} else
|
|
{
|
|
+ if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon) return ((net.minecraft.server.level.ServerLevel)(entity.getCommandSenderWorld())).getChunkSource().chunkMap.getLoadViewDistance(); // Paper - enderdragon is exempt
|
|
return config.otherTrackingRange;
|
|
}
|
|
}
|