mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-31 00:20:44 +01:00
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
This commit is contained in:
parent
7b1d3d673a
commit
c7b38e2bc7
2 changed files with 23 additions and 16 deletions
|
@ -386,3 +386,11 @@
|
||||||
if (flag) {
|
if (flag) {
|
||||||
if (this.seenBy.add(player.connection)) {
|
if (this.seenBy.add(player.connection)) {
|
||||||
this.serverEntity.addPairing(player);
|
this.serverEntity.addPairing(player);
|
||||||
|
@@ -1506,6 +1592,7 @@
|
||||||
|
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;
|
||||||
|
|
|
@ -7,7 +7,6 @@ import net.minecraft.world.entity.ExperienceOrb;
|
||||||
import net.minecraft.world.entity.decoration.ItemFrame;
|
import net.minecraft.world.entity.decoration.ItemFrame;
|
||||||
import net.minecraft.world.entity.decoration.Painting;
|
import net.minecraft.world.entity.decoration.Painting;
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
import net.minecraft.world.entity.monster.Ghast;
|
|
||||||
|
|
||||||
public class TrackingRange
|
public class TrackingRange
|
||||||
{
|
{
|
||||||
|
@ -30,22 +29,21 @@ public class TrackingRange
|
||||||
if ( entity instanceof ServerPlayer )
|
if ( entity instanceof ServerPlayer )
|
||||||
{
|
{
|
||||||
return config.playerTrackingRange;
|
return config.playerTrackingRange;
|
||||||
} else if ( entity.activationType == ActivationRange.ActivationType.MONSTER || entity.activationType == ActivationRange.ActivationType.RAIDER )
|
// Paper start - Simplify and set water mobs to animal tracking range
|
||||||
{
|
}
|
||||||
return config.monsterTrackingRange;
|
switch (entity.activationType) {
|
||||||
} else if ( entity instanceof Ghast )
|
case RAIDER:
|
||||||
{
|
case MONSTER:
|
||||||
if ( config.monsterTrackingRange > config.monsterActivationRange )
|
case FLYING_MONSTER:
|
||||||
{
|
|
||||||
return config.monsterTrackingRange;
|
return config.monsterTrackingRange;
|
||||||
} else
|
case WATER:
|
||||||
{
|
case VILLAGER:
|
||||||
return config.monsterActivationRange;
|
case ANIMAL:
|
||||||
}
|
return config.animalTrackingRange;
|
||||||
} else if ( entity.activationType == ActivationRange.ActivationType.ANIMAL )
|
case MISC:
|
||||||
{
|
}
|
||||||
return config.animalTrackingRange;
|
if ( entity instanceof ItemFrame || entity instanceof Painting || entity instanceof ItemEntity || entity instanceof ExperienceOrb )
|
||||||
} else if ( entity instanceof ItemFrame || entity instanceof Painting || entity instanceof ItemEntity || entity instanceof ExperienceOrb )
|
// Paper end
|
||||||
{
|
{
|
||||||
return config.miscTrackingRange;
|
return config.miscTrackingRange;
|
||||||
} else if ( entity instanceof Display )
|
} else if ( entity instanceof Display )
|
||||||
|
@ -53,6 +51,7 @@ public class TrackingRange
|
||||||
return config.displayTrackingRange;
|
return config.displayTrackingRange;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon) return ((net.minecraft.server.level.ServerLevel)(entity.getCommandSenderWorld())).getChunkSource().chunkMap.serverViewDistance; // Paper - enderdragon is exempt
|
||||||
return config.otherTrackingRange;
|
return config.otherTrackingRange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue