ReikaKalseki / Reika_Mods_Issues

The issue tracker for all of my mods - RotaryCraft, its addons, ChromatiCraft, and everything else.
46 stars 13 forks source link

Item inserter can open GUIs for its placer remotely, locking players out of the game #783

Open Builderb0y opened 8 years ago

Builderb0y commented 8 years ago

Given the fact that it can right click constantly, this means you can very easily create a system to lock yourself out of the game, or even someone else on multiplayer if you have access to their inserter; they won't be able to do anything if they can't close a constantly re-opening GUI. The only way to fix it at that point is to use MCEdit to remove the inserter, or hope you can find someone else on a server that can come to your base to remove it for you. I've come up with a few ways to fix this behavior:

1: Always use a fake player for right click mode. This also has the benefit that it can't be used on forestry's clockwork engine, IC2's manual kinetic generator (which is already blacklisted anyway), forestry's clockwork engine, or other blocks that don't allow fake player automation.

2: Don't allow right clicking on blocks that don't have an inventory. This won't help if it's bound to a chest, for instance, but it does help it act more like an item inserter as it was intended and less like a free, wireless, infinite-range autonomous activator that many people see it as.

3: Cache blocks that it's bound to and do not attempt to insert items if the block hasn't changed since the last attempt. However, this would most likely be horribly un-performant to constantly iterate through every NBT tag a tile entity has and compare it to a cache. Plus, this wouldn't help at all for anything that extends your base tile entity, since their age changes every tick.

Additionally, a whitelist could be added for blocks that require a real player to insert items; like item stands, for instance. Alternatively, a whitelist for the "inventory" mode could be added instead to force items to be inserted to those blocks, since they don't normally allow for automation.

ReikaKalseki commented 8 years ago

Fake players are not an option because they were explicitly designed to automate insertion into systems that require a real player, including CC.

Turmfalke2 commented 8 years ago

Seems I just encountered this issue after crafting my first item insert and trying to figure it out by clicking all the buttons. @ReikaKalseki could we have some safe mode options that disables the item inserter's rightclick mode so we don't have to rely on MCEdit to recover a world?

Builderb0y commented 8 years ago

How would a safe mode work? And how would it be enabled? If it can be toggled in-game, then it's not useful if someone doesn't know to enable it; nor would it help if someone's already disabled it and locked themselves out. If it were a config option, that could save you in singleplayer; but I foresee many server admins either refusing to enable it just because you made a mistake or, more likely, keeping it enabled constantly because "free, infinite-range autonomous activators are overpowered", thus negating its main purpose.

Looking back on this issue, what was the reason a whitelist system couldn't be implemented? If it was designed to automate things that required a real player, then why not restrict real-player-interaction to only those things?

Also, I did think of another (hacky) idea: check the player's current GUI before and after right clicking, and if they don't match, switch back to the old one. However, I have no idea if this can recover exactly where you were in the old GUI, or if this can be done from the server-side (since GUIs are usually only ever opened from the server via packets, with the exception of your mods).

Turmfalke2 commented 8 years ago

I was thinking of singleplayer, on server you usually have the option of asking someone to come help you.
In my world I managed to catapult me far enough away after chrashing several times to that network/gui vanilla bug. Pretty good way to reproduce that bug.

ReikaKalseki commented 8 years ago

check the player's current GUI

Not on the server.

metnavman commented 7 years ago

Just had this happen to me as well, not knowing exactly what I was doing with the inserter and messing around with it. Had to get enough lag going to let me break the block in SSP to make it stop.

Edit: It also apparently wiped my character's data, making it act like I'd just spawned in the world. Gave me new copies of all your books (RoC, ReC, etc) and wiping my Chromaticraft progression. Lexicon still has all the fragments, but everything has "?" like I'd just started the game, and all progression ticks are gone. Will have to revert the save or doctor the progression from an older cache.

Edit numba 2: The Chromaticraft ProgressionCache .dat file was affected by this, so I deleted it and overwrote my player.dat files from a previous backup to see if that restores my previous progression.

Edit numba 3: This required rolling back everything about my character to a previous save, while keeping the world data intact. Amusingly enough, I have to complete the Dimension monument again. ><