mezz / JustEnoughItems

Item and Recipe viewing mod for Minecraft
https://www.curseforge.com/minecraft/mc-mods/jei
MIT License
787 stars 306 forks source link

[1.18.1] Cheat Mode Doesn't Work on Vanilla Multiplayer (when it has been added to the server list) #2672

Closed sirj0k3r closed 2 years ago

sirj0k3r commented 2 years ago

Summary: It seems JEI on Cheat Mode does not work on servers that have been saved (a.k.a present in servers.dat).

Steps to Reproduce:

With Server Saved:

Without Server Saved

Other (might be relevant) Info:

mezz commented 2 years ago

Thanks for the report! When "it does not work", what do you see? Does JEI print an error message in the chat, or are there any logs in the server showing that the request was denied?

sirj0k3r commented 2 years ago

No errors on either:

mezz commented 2 years ago

Sorry, to help me understand the issue,

What exact steps do you take to "Try it out"? and What do you see when it does "not work"?

mezz commented 2 years ago

For example, do you enable cheat mode in the config file and nothing seems to happen, or do you use a hotkey to enable cheat mode and your game closes immediately, etc?

sirj0k3r commented 2 years ago

Sorry, to help me understand the issue,

What exact steps do you take to "Try it out"? and What do you see when it does "not work"?

Sorry. I now see how vague what I wrote was...

By "try it out" I mean:

By "should not work" I mean that the item is not given to you ("you" being an op).

Game doesn't crash nor produces error logs (apparently).

mezz commented 2 years ago

I tried these steps using just JEI and Forge, but never ran into the issue you described. Do you have any other mods installed? There may be something that causes a conflict.

sirj0k3r commented 2 years ago

Have you added the server to the server list?

I just replicated the following steps using MultiMC:

And it didn't work. No error message, no crash, no item on my inventory either.

Ommina commented 2 years ago

Do you get the "Gave 1 [Thingie]..." message in chat?

I just tried via (albeit Vanilla launcher, not MultiMC), did the "add server" step, entered the server, toggled cheat mode on, and it worked.

That said! Nothing appeared on the cursor, and I had to close and reopen Inventory to see the item, but I did get the "Gave" message, and the item was there.

sirj0k3r commented 2 years ago

No. I didn't get the usual message when items are given.

Maybe it's a problem with MultiMC then...

It does however work just fine if the server is not added to the server list.

sirj0k3r commented 2 years ago

Weird... Just tested it on Minecraft's official launcher (forge installer's instance) and the behavior is the same.

I'll try creating a new server and test it out...

sirj0k3r commented 2 years ago

Just tested it out but the behavior remains the same.

server.properties is as follows:

#Minecraft server properties
#Thu Jan 13 15:50:01 WET 2022
enable-jmx-monitoring=false
rcon.port=25575
enable-command-block=false
gamemode=survival
enable-query=false
level-name=world
motd=A Minecraft Server
query.port=25565
pvp=true
difficulty=easy
network-compression-threshold=256
max-tick-time=60000
require-resource-pack=false
max-players=20
use-native-transport=true
online-mode=true
enable-status=true
allow-flight=false
broadcast-rcon-to-ops=true
view-distance=10
server-ip=
resource-pack-prompt=
allow-nether=true
server-port=25566
enable-rcon=false
sync-chunk-writes=true
op-permission-level=4
prevent-proxy-connections=false
hide-online-players=false
resource-pack=
entity-broadcast-range-percentage=100
simulation-distance=10
rcon.password=
player-idle-timeout=0
force-gamemode=false
rate-limit=0
hardcore=false
white-list=false
broadcast-console-to-ops=true
spawn-npcs=true
spawn-animals=true
function-permission-level=2
text-filtering-config=
spawn-monsters=true
enforce-whitelist=false
resource-pack-sha1=
spawn-protection=16
max-world-size=29999984

Do you see anything that stands out?

sirj0k3r commented 2 years ago

I tried on another machine and the issue still occurs.

To clarify:

Your server list must include at least one server (ideally the one you're entering), as shown in the following image: image

mezz commented 2 years ago

Does this occur on modded servers, or only on vanilla servers? I only tried on a modded server that didn't have JEI installed.

sirj0k3r commented 2 years ago

I tested on a Vanilla server. I can try testing in a modded server without JEI and I'll follow-up on that later.

sirj0k3r commented 2 years ago

Does this occur on modded servers, or only on vanilla servers? I only tried on a modded server that didn't have JEI installed.

I can confirm that on a modded server (with or without JEI) the described issue does not occur.

mezz commented 2 years ago

Thanks for checking! I am able to reproduce this issue now.

Narrowing this down, it only happens when all of the following are true:

I don't know if adding the server to the list matters, I have tried without the server on the list and still see the issue.

sirj0k3r commented 2 years ago

I don't know if adding the server to the list matters, I have tried without the server on the list and still see the issue.

Try removing all the servers from the server list (changing servers.dat name for example to prevent data to be loss) and it should work again.

From what I've been able to test it only happens when one or more servers are present on the server list.

mezz commented 2 years ago

It looks like my detection for whether the server has JEI on it is pretty broken for Vanilla servers.

Forge added a second type of connection response from vanilla servers here, that I don't handle: https://github.com/MinecraftForge/MinecraftForge/commit/2a4e05c982fe4cbe49631492c30f998d81d391f0#diff-9f879a9717c22449e79447631d472fad798068c12e4afb8ad8a47b0290ce637dR63-R64

My check only happens when:

Importantly, my check doesn't happen when joining a Vanilla server at all, it's just using whatever result it last saw from the server list, which is super incorrect.

I'll see what I can do to fix this up.

mezz commented 2 years ago

I have pushed a fix for this in JEI version 9.2.3, please test it out and let me know how it goes and if you run into any other issues!

sirj0k3r commented 2 years ago

Just tested it and it seems to be running just fine 👍

Thanks for the hard work.

mezz commented 2 years ago

Thanks for sticking with me through the rounds of questions and confirmations, this was a tricky one!

ExodusBF4 commented 2 years ago

I am also having this issue in my multiplayer server. I cannot use the JEI cheating function by pressing control+wrench. All it says is "Install the Configured mod to access the in-game config." So, i installed Configured. I'm playing with a forge instillation, but on a vanilla server with just a few plugins and some client-side mods that should have zero effect on JEI. When i installed Configured, cheating still wouldn't work. I can't grab items out of of the JEI menu like normal. My server is a simple Paper server that's running vanilla only. This is very frustrating as the /give command isn't perfect. Any ideas on how to fix this? Here is an image of all the client-side mods i'm using in my server, these shouldn't be causing this. JEI cheat mode works normally for me in pure singleplayer, but it's not working in multiplayer. Screenshot (2143)

ExodusBF4 commented 2 years ago

Aaaand i just noticed Mezz is working on a fix for this. I should have scrolled up to see your comment, lol. Sorry for the redundant comment.

sirj0k3r commented 2 years ago

Aaaand i just noticed Mezz is working on a fix for this. I should have scrolled up to see your comment, lol. Sorry for the redundant comment.

If you install the latest beta available on Curse Forge you should see the issue go away.

ExodusBF4 commented 2 years ago

Aaaand i just noticed Mezz is working on a fix for this. I should have scrolled up to see your comment, lol. Sorry for the redundant comment.

If you install the latest beta available on Curse Forge you should see the issue go away.

This doesn't work. I just installed the latest beta and it's still not letting me use cheat mode. EDIT: I just re-installed the latest version of Configured for forge, it still doesn't work. This is something Mezz needs to fix.

sirj0k3r commented 2 years ago

Check your bindings or add a new one to toggle cheat mode. I have Configurator installed and I can both enter the configuration screen and enable (and use) cheat mode as it was confirmed before.

For me, for example, I don't use Ctrl + LMB on the wrench. I only use LMB

ExodusBF4 commented 2 years ago

Check your bindings or add a new one to toggle cheat mode. I have Configurator installed and I can both enter the configuration screen and enable (and use) cheat mode as it was confirmed before.

For me, for example, I don't use Ctrl + LMB on the wrench. I only use LMB

Ah, no wonder why i wasn't able to use it. I've been so used to the old style of Ctrl+LMB. I got it to work after messing around with my keybinds for a bit, thanks.