mirror of
https://github.com/FancyInnovations/FancyPlugins.git
synced 2025-12-06 07:43:36 +00:00
fancynpcs: Try to fix npcs disappearing
This commit is contained in:
@@ -17,6 +17,7 @@ import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.RemoteChatSession;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.*;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@@ -106,6 +107,7 @@ public class Npc_1_20_6 extends Npc {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Packet<? super ClientGamePacketListener>> packets = new ArrayList<>();
|
||||
|
||||
if (npc instanceof ServerPlayer npcPlayer) {
|
||||
EnumSet<ClientboundPlayerInfoUpdatePacket.Action> actions = EnumSet.noneOf(ClientboundPlayerInfoUpdatePacket.Action.class);
|
||||
@@ -116,7 +118,7 @@ public class Npc_1_20_6 extends Npc {
|
||||
}
|
||||
|
||||
ClientboundPlayerInfoUpdatePacket playerInfoPacket = new ClientboundPlayerInfoUpdatePacket(actions, getEntry(npcPlayer, serverPlayer));
|
||||
serverPlayer.connection.send(playerInfoPacket);
|
||||
packets.add(playerInfoPacket);
|
||||
|
||||
if (data.isSpawnEntity()) {
|
||||
npc.setPos(data.getLocation().x(), data.getLocation().y(), data.getLocation().z());
|
||||
@@ -136,6 +138,9 @@ public class Npc_1_20_6 extends Npc {
|
||||
}, removeNpcsFromPlayerlistDelay, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
ClientboundBundlePacket bundlePacket = new ClientboundBundlePacket(packets);
|
||||
serverPlayer.connection.send(bundlePacket);
|
||||
|
||||
update(player);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user