Solved How do you send a look-at packet?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

SirEnder125

New Member
Aug 14, 2023
5
0
1
23
Hello. I want to write a Skript code to add a command which makes all players look at the player running the command.
When I run the command, it says an internal error occured, and there is no other information given. What should I do?


code_language.skript:
command /lookatme:
    trigger:
        set {_loc} to location of player
        set {_packet} to new play_server_look_at packet
        set field 0 of {_packet} to 1
        set field 1 of {_packet} to x-coordinate of {_loc}
        set field 2 of {_packet} to y-coordinate of {_loc}
        set field 3 of {_packet} to z-coordinate of {_loc}
        set field 4 of {_packet} to false
        set field 6 of {_packet} to 1

        loop all players:
            loop-player is not player
            send loop-player packet {_packet}

Skript-packet and ThatPacketPlugin are downloaded on the server.
 
i dont know what ThatPacketPlugin is but if you meant ThatPacketAddon you shouldn't have 2 packet addons at the same to begin with
and we cant say anything without seeing the stack trace in the console
 
i dont know what ThatPacketPlugin is but if you meant ThatPacketAddon you shouldn't have 2 packet addons at the same to begin with
and we cant say anything without seeing the stack trace in the console
Oh, yea, that was a typo, we should probably get rid of one, thanks. Anyway... Stack trace:

Code:
14.08 21:00:12 [Server] Server thread/[ERROR] #!#! java.lang.IllegalStateException: Unable to set value of field private final net.minecraft.commands.arguments.ArgumentAnchor$Anchor net.minecraft.network.protocol.game.PacketPlayOutLookAt.e
 
Code:
14.08 21:43:43 [Server] Server thread/[INFO] SirEnder125 issued server command: /lookatme
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! 
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! [Skript] Severe Error:
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! 
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! You're running outdated version of Skript! Please try updating it NOW; it might fix this.
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! Run /sk update check to get a download link to latest Skript!
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! You will be given instructions how to report this error if it persists after update.
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! 
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! Stack trace:
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! java.lang.IllegalStateException: Unable to set value of field private final net.minecraft.commands.arguments.ArgumentAnchor$Anchor net.minecraft.network.protocol.game.PacketPlayOutLookAt.e
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor.set(DefaultFieldAccessor.java:44)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at com.comphenix.protocol.reflect.StructureModifier.writeInternal(StructureModifier.java:359)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at com.comphenix.protocol.reflect.StructureModifier.writeSafely(StructureModifier.java:335)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at fr.anarchick.skriptpacket.packets.PacketManager.setField(PacketManager.java:168)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at fr.anarchick.skriptpacket.elements.expressions.packet.ExprPacketField.change(ExprPacketField.java:118)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.effects.EffChange.execute(EffChange.java:282)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.lang.Effect.run(Effect.java:50)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.lang.Trigger.execute(Trigger.java:56)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.command.ScriptCommand.execute2(ScriptCommand.java:285)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.command.ScriptCommand.lambda$execute$0(ScriptCommand.java:250)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.command.ScriptCommand.execute(ScriptCommand.java:255)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.command.Commands.handleCommand(Commands.java:260)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.command.Commands$1.onPlayerCommand(Commands.java:177)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at jdk.internal.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at java.base/java.lang.reflect.Method.invoke(Method.java:568)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:589)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:576)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1933)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.network.PlayerConnection.lambda$18(PlayerConnection.java:1919)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.util.thread.IAsyncTaskHandler.b(SourceFile:67)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.TickTask.run(SourceFile:18)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.util.thread.IAsyncTaskHandler.d(SourceFile:156)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(SourceFile:23)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1154)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:1)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.util.thread.IAsyncTaskHandler.x(SourceFile:130)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.MinecraftServer.bi(MinecraftServer.java:1133)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1126)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.util.thread.IAsyncTaskHandler.c(SourceFile:139)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.MinecraftServer.i_(MinecraftServer.java:1110)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1021)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at java.base/java.lang.Thread.run(Thread.java:833)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! Caused by: java.lang.ClassCastException: Cannot cast java.lang.Boolean to net.minecraft.commands.arguments.ArgumentAnchor$Anchor
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at java.base/java.lang.Class.cast(Class.java:3889)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor.set(DefaultFieldAccessor.java:41)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at com.comphenix.protocol.reflect.StructureModifier.writeInternal(StructureModifier.java:359)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at com.comphenix.protocol.reflect.StructureModifier.writeSafely(StructureModifier.java:335)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at fr.anarchick.skriptpacket.packets.PacketManager.setField(PacketManager.java:168)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at fr.anarchick.skriptpacket.elements.expressions.packet.ExprPacketField.change(ExprPacketField.java:118)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.effects.EffChange.execute(EffChange.java:282)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.lang.Effect.run(Effect.java:50)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.lang.Trigger.execute(Trigger.java:56)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.command.ScriptCommand.execute2(ScriptCommand.java:285)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.command.ScriptCommand.lambda$execute$0(ScriptCommand.java:250)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.command.ScriptCommand.execute(ScriptCommand.java:255)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.command.Commands.handleCommand(Commands.java:260)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at ch.njol.skript.command.Commands$1.onPlayerCommand(Commands.java:177)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at jdk.internal.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at java.base/java.lang.reflect.Method.invoke(Method.java:568)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:589)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:576)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1933)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.network.PlayerConnection.lambda$18(PlayerConnection.java:1919)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.util.thread.IAsyncTaskHandler.b(SourceFile:67)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.TickTask.run(SourceFile:18)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.util.thread.IAsyncTaskHandler.d(SourceFile:156)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(SourceFile:23)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1154)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:1)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.util.thread.IAsyncTaskHandler.x(SourceFile:130)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.MinecraftServer.bi(MinecraftServer.java:1133)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1126)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.util.thread.IAsyncTaskHandler.c(SourceFile:139)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.MinecraftServer.i_(MinecraftServer.java:1110)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1021)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     at java.base/java.lang.Thread.run(Thread.java:833)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! 
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! Version Information:
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!   Skript: 2.6.2 (OUTDATED)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     Flavor: skriptlang-github
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!     Date: 19:12:53.596652600
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!   Bukkit: 1.19.4-R0.1-SNAPSHOT
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!   Minecraft: 1.19.4
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!   Java: 17.0.7 (OpenJDK 64-Bit Server VM 17.0.7+7)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!   OS: Linux amd64 4.18.0-425.13.1.el8_7.x86_64
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! 
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! Server platform: Spigot
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! 
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! Current node: null
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! Current item: set [packet] field 4 of %packet% to [[boolean:false]]
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! Current trigger: command /lookatme (simple event) (packets.sk, line 1)
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! 
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! Thread: Server thread
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! 
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! Language: english
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! Link parse mode: DISABLED
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! 
14.08 21:43:43 [Server] Server thread/[ERROR] #!#! End of Error.
14.08 21:43:43 [Server] Server thread/[ERROR] #!#!
 
Field 4 was supposed to be an Anchor but you put a boolean instead, i think wiki.vg is wrong this time (happens sometimes)
 
Oh, alright. Thank you! What exactly is an anchor? Feet/eyes?
yes but you cant just type "feet", you need to use that enum assuming you know reflect
or just use nms if you are willing to update your code in some major updates (rarely minor update) its more reliable
 
yes but you cant just type "feet", you need to use that enum assuming you know reflect
or just use nms if you are willing to update your code in some major updates (rarely minor update) its more reliable
it seems i've got a lot of stuff to learn... (still no idea what nms stands for)

but anyway, thanks for your help!