gnembon / fabric-carpet

Fabric Carpet
MIT License
1.7k stars 269 forks source link

Cannot spawn fake player. #1954

Open shasankp000 opened 1 month ago

shasankp000 commented 1 month ago

With reference to issue: #1602

I have encountered the same issue but there is something interesting I noticed.

I myself am working on a minecraft mod which relies on carpet mod's player spawning feature, here is the code in case if someone wishes to inspect:

https://github.com/shasankp000/AI-Player/blob/master/src/main/java/net/shasankp000/Commands/spawnFakePlayer.java

And whenever I tested it in intelij's environment, it always works.

However when I test the same in the actual game, nothing happens.

Simply, nothing happens when I execute /player xyz spawn or my own command /spawnBot which is basically calling the same method /player spawn uses.

I also enabled the carpet rules in my carpet.conf file in my world and the global carpet configurations as well

allowListingFakePlayers true superSecretSetting true commandPlayer true commandScript true perfPermissionLevel 4 allowSpawningOfflinePlayers true commandSpawn true However, interestingly when I try to execute the same command (carpet's inbuilt command or my own command) using a command block, the game crashes.

And I think I found what's been causing the issue

` [15:41:46] [Server thread/ERROR]: This crash report has been saved to: C:\Users\shasa\AppData\Roaming.tlauncher\legacy\Minecraft\game\crash-reports\crash-2024-07-23_15.41.46-server.txt

---- Minecraft Crash Report ---- // There are four lights!

Time: 2024-07-23 15:41:46 Description: Executing command block

java.lang.NoSuchMethodError: 'void com.mojang.authlib.GameProfileRepository.findProfilesByNames(java.lang.String[], com.mojang.authlib.ProfileLookupCallback)' at net.minecraft.class_3312.method_14509(class_3312.java:95) at net.minecraft.class_3312.method_14515(class_3312.java:150) at carpet.commands.PlayerCommand.cantSpawn(PlayerCommand.java:197) at carpet.commands.PlayerCommand.spawn(PlayerCommand.java:249) at com.mojang.brigadier.context.ContextChain.runExecutable(ContextChain.java:73) at net.minecraft.class_8865.method_54416(class_8865.java:29) at net.minecraft.class_8865.execute(class_8865.java:13) at net.minecraft.class_8856.method_54405(class_8856.java:8) at net.minecraft.class_8847.method_54388(class_8847.java:8) at net.minecraft.class_8854.method_54390(class_8854.java:107) at net.minecraft.class_2170.method_54313(class_2170.java:378) at net.minecraft.class_2170.method_9249(class_2170.java:308) at net.minecraft.class_2170.method_44252(class_2170.java:298) at net.minecraft.class_1918.method_8301(class_1918.java:124) at net.minecraft.class_2288.method_9780(class_2288.java:125) at net.minecraft.class_2288.method_9588(class_2288.java:113) at net.minecraft.class_4970$class_4971.method_26192(class_4970.java:1203) at net.minecraft.class_3218.method_14189(class_3218.java:750) at net.minecraft.class_6757.method_39390(class_6757.java:215) at net.minecraft.class_6757.method_39377(class_6757.java:98) at net.minecraft.class_3218.method_18765(class_3218.java:330) at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:948) at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:845) at net.minecraft.class_1132.method_3748(class_1132.java:110) at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:683) at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:270) at java.base/java.lang.Thread.run(Thread.java:1583) `

This is due to a missing method findProfilesByNames in com.mojang.authlib.GameProfileRepository.

However, on an even thorough examination, the method does exist.

image

This is what I could find so far.

shasankp000 commented 1 month ago

You know what? I later realised that this is happening because I was playing in offline mode.

However since carpet does a check to see where allowSpawningOfflinePlayers is enabled or not. It still doesn't work with having the setting enabled.

Might wanna look into that maybe?