mirror of
https://github.com/BG-Software-LLC/WildLoaders.git
synced 2024-11-21 11:46:46 +01:00
Fixed loading distance in some Paper versions
This commit is contained in:
parent
7f504ee2d9
commit
f22df7c611
@ -1,5 +1,7 @@
|
||||
package com.bgsoftware.wildloaders.nms.v1_12_R1;
|
||||
|
||||
import com.bgsoftware.common.reflection.ReflectField;
|
||||
import com.bgsoftware.common.reflection.ReflectMethod;
|
||||
import com.bgsoftware.wildloaders.handlers.NPCHandler;
|
||||
import com.bgsoftware.wildloaders.npc.DummyChannel;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@ -38,6 +40,11 @@ import java.util.UUID;
|
||||
|
||||
public final class ChunkLoaderNPC extends EntityPlayer implements com.bgsoftware.wildloaders.api.npc.ChunkLoaderNPC {
|
||||
|
||||
private static final ReflectMethod<Void> PLAYER_SET_VIEW_DISTANCE = new ReflectMethod<>(
|
||||
EntityPlayer.class, "setViewDistance", int.class);
|
||||
private static final ReflectField<Boolean> PLAYER_AFFECTS_SPAWNING = new ReflectField<>(
|
||||
EntityPlayer.class, boolean.class, "affectsSpawning");
|
||||
|
||||
private final AxisAlignedBB boundingBox;
|
||||
private final AdvancementDataPlayer advancements;
|
||||
|
||||
@ -53,8 +60,15 @@ public final class ChunkLoaderNPC extends EntityPlayer implements com.bgsoftware
|
||||
this.advancements = new DummyPlayerAdvancements(server, this);
|
||||
|
||||
this.playerInteractManager.setGameMode(EnumGamemode.CREATIVE);
|
||||
|
||||
fallDistance = 0.0F;
|
||||
fauxSleeping = true;
|
||||
|
||||
if (PLAYER_SET_VIEW_DISTANCE.isValid())
|
||||
PLAYER_SET_VIEW_DISTANCE.invoke(this, 0);
|
||||
if (PLAYER_AFFECTS_SPAWNING.isValid())
|
||||
PLAYER_AFFECTS_SPAWNING.set(this, true);
|
||||
|
||||
spawnIn(world);
|
||||
setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
|
||||
|
@ -40,6 +40,7 @@ import java.util.UUID;
|
||||
|
||||
public final class ChunkLoaderNPC extends EntityPlayer implements com.bgsoftware.wildloaders.api.npc.ChunkLoaderNPC {
|
||||
|
||||
|
||||
private final AxisAlignedBB boundingBox;
|
||||
private final AdvancementDataPlayer advancements;
|
||||
|
||||
@ -57,9 +58,16 @@ public final class ChunkLoaderNPC extends EntityPlayer implements com.bgsoftware
|
||||
this.advancements = new DummyPlayerAdvancements(server, this);
|
||||
|
||||
this.playerInteractManager.setGameMode(EnumGamemode.CREATIVE);
|
||||
clientViewDistance = 1;
|
||||
|
||||
fallDistance = 0.0F;
|
||||
fauxSleeping = true;
|
||||
clientViewDistance = 0;
|
||||
|
||||
try {
|
||||
// Paper
|
||||
affectsSpawning = true;
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
|
||||
spawnIn(world);
|
||||
setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
|
@ -56,9 +56,16 @@ public final class ChunkLoaderPlayer extends ServerPlayer {
|
||||
this.advancements = new DummyPlayerAdvancements(minecraftServer, this);
|
||||
|
||||
SET_GAMEMODE.invoke(this.gameMode, GameType.CREATIVE, null);
|
||||
clientViewDistance = 1;
|
||||
|
||||
fallDistance = 0.0F;
|
||||
fauxSleeping = true;
|
||||
clientViewDistance = 0;
|
||||
|
||||
try {
|
||||
// Paper
|
||||
affectsSpawning = true;
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
|
||||
spawnIn(this.serverLevel);
|
||||
moveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
|
@ -58,9 +58,16 @@ public final class ChunkLoaderNPCImpl extends ServerPlayer implements ChunkLoade
|
||||
this.advancements = new DummyPlayerAdvancements(minecraftServer, this);
|
||||
|
||||
SET_GAMEMODE.invoke(this.gameMode, GameType.CREATIVE, null);
|
||||
clientViewDistance = 1;
|
||||
|
||||
fallDistance = 0.0F;
|
||||
fauxSleeping = true;
|
||||
clientViewDistance = 0;
|
||||
|
||||
try {
|
||||
// Paper
|
||||
affectsSpawning = true;
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
|
||||
spawnIn(this.serverLevel);
|
||||
moveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
|
@ -60,9 +60,16 @@ public final class ChunkLoaderNPCImpl extends ServerPlayer implements ChunkLoade
|
||||
this.advancements = new DummyPlayerAdvancements(minecraftServer, this);
|
||||
|
||||
SET_GAMEMODE.invoke(this.gameMode, GameType.CREATIVE, null);
|
||||
clientViewDistance = 1;
|
||||
|
||||
fallDistance = 0.0F;
|
||||
fauxSleeping = true;
|
||||
clientViewDistance = 0;
|
||||
|
||||
try {
|
||||
// Paper
|
||||
affectsSpawning = true;
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
|
||||
spawnIn(this.serverLevel);
|
||||
moveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
|
@ -60,9 +60,19 @@ public final class ChunkLoaderNPCImpl extends ServerPlayer implements ChunkLoade
|
||||
this.advancements = new DummyPlayerAdvancements(minecraftServer, this);
|
||||
|
||||
SET_GAMEMODE.invoke(this.gameMode, GameType.CREATIVE, null);
|
||||
clientViewDistance = 1;
|
||||
|
||||
fallDistance = 0.0F;
|
||||
fauxSleeping = true;
|
||||
clientViewDistance = 0;
|
||||
|
||||
try {
|
||||
// Paper
|
||||
setLoadViewDistance(2);
|
||||
setTickViewDistance(2);
|
||||
setSendViewDistance(2);
|
||||
affectsSpawning = true;
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
|
||||
spawnIn(this.serverLevel);
|
||||
moveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
|
@ -64,16 +64,19 @@ public final class ChunkLoaderNPCImpl extends ServerPlayer implements ChunkLoade
|
||||
this.advancements = new DummyPlayerAdvancements(minecraftServer, this);
|
||||
|
||||
SET_GAMEMODE.invoke(this.gameMode, GameType.CREATIVE, null);
|
||||
|
||||
fallDistance = 0.0F;
|
||||
fauxSleeping = true;
|
||||
|
||||
try {
|
||||
setLoadViewDistance(2);
|
||||
setTickViewDistance(2);
|
||||
setSendViewDistance(2);
|
||||
affectsSpawning = true;
|
||||
} catch (Throwable ignored) {
|
||||
// Doesn't exist on Spigot
|
||||
}
|
||||
|
||||
fauxSleeping = true;
|
||||
|
||||
spawnIn(this.serverLevel);
|
||||
moveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
|
||||
|
@ -64,16 +64,19 @@ public final class ChunkLoaderNPCImpl extends ServerPlayer implements ChunkLoade
|
||||
this.advancements = new DummyPlayerAdvancements(minecraftServer, this);
|
||||
|
||||
SET_GAMEMODE.invoke(this.gameMode, GameType.CREATIVE, null);
|
||||
|
||||
fallDistance = 0.0F;
|
||||
fauxSleeping = true;
|
||||
|
||||
try {
|
||||
setLoadViewDistance(2);
|
||||
setTickViewDistance(2);
|
||||
setSendViewDistance(2);
|
||||
affectsSpawning = true;
|
||||
} catch (Throwable ignored) {
|
||||
// Doesn't exist on Spigot
|
||||
}
|
||||
|
||||
fauxSleeping = true;
|
||||
|
||||
spawnIn(this.serverLevel);
|
||||
moveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
|
||||
|
@ -64,16 +64,19 @@ public final class ChunkLoaderNPCImpl extends ServerPlayer implements ChunkLoade
|
||||
this.advancements = new DummyPlayerAdvancements(minecraftServer, this);
|
||||
|
||||
SET_GAMEMODE.invoke(this.gameMode, GameType.CREATIVE, null);
|
||||
|
||||
fallDistance = 0.0F;
|
||||
fauxSleeping = true;
|
||||
|
||||
try {
|
||||
setLoadViewDistance(2);
|
||||
setTickViewDistance(2);
|
||||
setSendViewDistance(2);
|
||||
affectsSpawning = true;
|
||||
} catch (Throwable ignored) {
|
||||
// Doesn't exist on Spigot
|
||||
}
|
||||
|
||||
fauxSleeping = true;
|
||||
|
||||
spawnIn(this.serverLevel);
|
||||
moveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
|
||||
|
@ -41,8 +41,8 @@ public final class ChunkLoaderNPC extends EntityPlayer implements com.bgsoftware
|
||||
playerConnection = new DummyPlayerConnection(server, this);
|
||||
|
||||
playerInteractManager.setGameMode(EnumGamemode.CREATIVE);
|
||||
fallDistance = 0.0F;
|
||||
|
||||
fallDistance = 0.0F;
|
||||
fauxSleeping = true;
|
||||
|
||||
spawnIn(world);
|
||||
|
@ -48,13 +48,14 @@ public final class ChunkLoaderNPC extends EntityPlayer implements com.bgsoftware
|
||||
playerConnection = new DummyPlayerConnection(server, this);
|
||||
|
||||
playerInteractManager.setGameMode(WorldSettings.EnumGamemode.CREATIVE);
|
||||
fallDistance = 0.0F;
|
||||
|
||||
fallDistance = 0.0F;
|
||||
fauxSleeping = true;
|
||||
|
||||
try {
|
||||
// Paper
|
||||
affectsSpawning = true;
|
||||
viewDistance = 0;
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user