kettingpowered / Ketting-1-20-x

A fork of MinecraftForge with added Bukkit & Spigot patches
Other
84 stars 14 forks source link

Using items whilst on cooldown blocks all further interactions #339

Closed Xiantrius closed 2 months ago

Xiantrius commented 3 months ago

Basic questions:

What Minecraft Version is your Server on?

1.20.1

Full Ketting Version

0.3.22

Description of behavior

If I use normal Forge, the Corail Tombstone works perfectly. No error messages are displayed. I strongly suspect that the mod is only partially compatible with the Ketting Server.

If my character dies I have the key. As soon as I use the key on my gravestone, nothing happens. The server continues to run normally and no error message pops up. To fix the secondary error I have to log out and log back in. Then I can collect the keys to get my items back from the gravestone. As you know, I wrote something about secondary, which means if I die again I have to do the whole procedure again.

Reproduction Steps

Here i can reproduce.
1. If my character dies I have the key.
2. As soon as I use the key on my gravestone, nothing happens. The server continues to run normally and no error message pops up.
3. To fix the secondary error I have to log out and log back in. Then I can collect the keys to get my items back from the gravestone.
4. As you know, I wrote something about secondary, which means if I die again I have to do the whole procedure again.

Logs

No Error Logs and no Crash Log Found.

Additional context

My Modlist: HT's TreeChop, YUNG's Better Dungeons, KumaAPI, SuperMartijn642's Config Library, Matter Transporter, Extended Crafting, Connectivity Mod, Sophisticated Core, InsaneLib, Structure Essentials mod, More MobGriefing Options, Controlling, Placebo, ModernFix, YUNG's API, MixinExtras, Sophisticated Backpacks, Just Enough Effects Descriptions, Corail Spawners, Balm, Just Enough Resources, YUNG's Better Nether Fortresses, Cloth Config v10 API, Refined Storage, haumon, Industrial Foregoing, Fast IP Ping, Better Compatibility Checker, Just Enough Archaeology, Better Tags, Artan'sProjectCoreMOD, SuperMartijn642's Core Lib, Curios API, Patchouli, Energy Meter, Searchables, YUNG's Extras, PingHUD, Angel Ring 2, GunpowderLib, YUNG's Better Strongholds, Inventory Profiles Next, Architectury, Just Enough Calculation, AI-Improvements, Cupboard utilities, Light Overlay, flib, Haste Enchantment, Inventory Essentials, Framework, RuneCraft, Tom's Simple Storage Mod, Portable Crafting Table, Observable, Fast Leaf Decay, CodeChicken Lib, Server Tab Info, Enchanting Infuser, TES, Fastload-Reforged, Cucumber Library, Flat Bedrock, Just Enough Items, Waystones, Clumps, Journeymap, Simple Storage Network, Configured, SimpleTeleportersReloaded, Farsight mod, JeiTweaker, Speed Enchantment, Memory Leak Fix, EnderStorage, CraftTweaker, Puzzles Access Api, Forge, Just Enough Immersive Multiblocks, Iron Chests, Zero CORE 2, Extreme Reactors, Minecraft, CoFH Core, Thermal Series, Redstone Arsenal, Thermal Innovation, Thermal Foundation, Thermal Expansion, Thermal Locomotion, Smoothchunk mod, libIPN, The One Probe, Applied Energistics 2, AE2WTLib, Titanium, Immersive Engineering, Forbidden & Arcanus, Smooth Boot (Reloaded), ChickenChunks, Roughly Enough Items (REI), Ender IO, Exchangers, Kotlin For Forge, JEI Integration, Pipez, Thermal Cultivation, Fast Workbench, Just Enough Professions (JEP), Corail Recycler, Corail Tombstone, Storage Drawers, betterchunkloading mod, DimensionalDoors, FPS Monitor, FastFurnace, Ferrite Core, Puzzles Lib, BetterF3, Valhelsia Core, chunksending mod, Mob Ball, XP Tome

i have mods plugins upload with config, If you are interested, just install the Ketting server and that's it. https://workupload.com/file/R5RyXVv9VDk Now you can experiment with it.

C0D3-M4513R commented 3 months ago

Even when I tested with your server, enabled essentials, enabled tombstone and disabled corpse I never encountered this behavior.

Xiantrius commented 3 months ago

corpse is an alternative mod to prevent the bug. with corail tombstone.

Corail31 commented 2 months ago

@Xiantrius Corpse is incompatible with my mod (like any grave mod). You shouldn't use them together or you should disable my handling of death in config (i finally got that it's a bukkit plugin and not the forge mod). I also mentioned you to test to interact by holding the 'crouching' key over the grave to see if you don't have a problem of permission.

Xiantrius commented 2 months ago

that was all experimental and an alternative solution. The real Corpse is the plugin EssentialsX. Which is also not compatible with Mohist. I looked at it there too. It was even worse there because when I tested it, no items remained in the inventory when I died and the key from Tombstone was not there either and the grave was gone. I could only see where I died. That means Mohist is in an even worse situation than Ketting.

I know that Gravestone, Corspe and Corail Tombstone should not be loaded together under any circumstances. I knew that before anyone pointed it out to me. Of the three mods, Corail Tombstone is my favorite, as long as it doesn't cause any problems.

Currently: Tombstone is enabled again and Corpse is disabled. EssentialsX is disabled and alternative is plugin Mobi_Homes[3.0] - MC_1.13.X-1.21.X.jar enabled It doesn't have all the requirements like EssentialsX, but I prefer it to the annoying bug that happens when a player dies. Ender IO did not have to be deleted. We can resolve the issue here, but if there are any problems with your mod somewhere, I will get back to you. I think your mod is great and have been using it since Minecraft v1.12.2. Thank you for taking part. :)

Xiantrius commented 2 months ago

how is permission from commands tombstone?

Corail31 commented 2 months ago

The permissions of Tombstone commands are set to 2 on dedicated server, and no permission needed in singleplayer if you're the "SingleplayerOwner". But when i talk about permission to interact, it's about block and your other mods/plugins (and why you don't have problems with a plugin interacting with entity~corpse). But you never answer to my suggestion to test with 'crouching key' if it works.

Xiantrius commented 2 months ago

i use luckperm plugin. That's why I asked. There were commands that couldn't be used on the server without permissions. They only worked if I activated Operator on myself. The rest of the commands worked without Permissions from Tombstone.

This is what happened on the Singeplayer world: Here i can use corspe with tombstone. The tombstone does not have the items and the corpse from Corpse mod. Here I use the crouched position to get to the tombstone.

This happened on the Ketting Server: I just tested tombstone with corpse. When I die, I can't use the key to get the items from the tombstone while crouched. I must reconnect this server. On the second attempt it suddenly worked after I tested it in the single player world. Is it another bug that happens randomly when Corspe is on it with Tombstone? I don't really understand the point. I prefer Tombstone because it is better implemented and can do more.

Corail31 commented 2 months ago

You need to hold the 'crouching' key, not just press it once (and be above the grave). (i also explained you to not use Corpse on the same time 2 messages above, only one mod/plugin has to handle the drops). If 'crouching' works, you will need to find which mod/plugin to configure about permission to interact with right click.

Xiantrius commented 2 months ago

I think I understand what you were getting at.

Ketting Server with my mods and plugins: I think I can now reproduce the error in a controlled way. I've gone through it 5 times now. No idea if you can do it too. If the key is enchanted and I teleport to the gravestone while crouching and keep holding everything down, the gravestone is collected, but a bug occurs that means I can no longer perform actions with other objects such as chests, etc. This happens if I hold the crouched and use key down for too long while I've already removed the gravestone with my enchanted key. If I die again, I can no longer open the gravestone unless I stand on the gravestone and hold down the crouch key. But I can no longer open the other things. This works in the main world that I play in all the time and also when I've started a completely new world. I have to log out of the server and log back in so that everything works normally again.

Ketting Server with just Tombstone alone: I can't find any improvement here either, the same problem occurs here. So I don't have to download individual mods or plugins. The question now is, is it the Ketting Server or the Tombstone mod itself that is causing an error in the code somewhere. Someone should be able to correct the problem. I would be very grateful if you could look into who is really to blame. I have done my part as a player.

Forge Server test with Tombstone alone: Everything is OK here, I tested it twice and tried to reproduce the bug here, but it worked perfectly here. It is very likely that Tombstone has some incompatibility issues. I can't say more than that, as I didn't write the projects you write in Java.

Corail31 commented 2 months ago

@Xiantrius I don't have incompatibilities, if you have desync bug, it's completely the fault of others mods/plugins, the death handling is a straight forward code.

Xiantrius commented 2 months ago

@Xiantrius I don't have incompatibilities, if you have desync bug, it's completely the fault of others mods/plugins, the death handling is a straight forward code.

u have read Ketting Server with just Tombstone alone: bug again here without other mods and plugins.

forge have 0 problems.

i can u say 100% is not other mod or plugin problem.

this is alone corail tombstone with ketting server problem. I have tested it extensively. But if you don't believe me, the error remains.

Corail31 commented 2 months ago

@Xiantrius It was just an affirmation (the bug can't be on my side in others words), you have done your test nicely :) Note that english is not my main language (i'm belgian), and i prefer to not mention directly Ketting :p

JustRed23 commented 2 months ago

@Xiantrius It was just an affirmation (the bug can't be on my side in others words), you have done your test nicely :) Note that english is not my main language (i'm belgian), and i prefer to not mention directly Ketting :p

ayy fellow belgian

C0D3-M4513R commented 2 months ago

I've tried getting to the bottom of this, but I can't see anything that would cause Interactions to be canceled like this in either Ketting or Corail Tombstones.

I've also looked at the effect removal code (The issue happening when you Break a Block with ghostly shape massively reduces the search scope), but that's also fairly straight forward. I need to get other stuff done and I don't feel like working on this issue.

One thing I don't get is why @Corail31 uses the ObfuscationReflectionHandler for the onEffectRemoved method, when you could just use an Access Transformer or Accessor Mixin. But that doesn't really matter for this.

Corail31 commented 2 months ago

@C0D3-M4513R It's a protected method (i'm sure that you will find the reason of Forge Forum) and i avoid mixin as much as possible (because i can't backport theses codes to 1.12.2 where Forge doesn't ship Mixin). @Xiantrius if the problem is related to Ghostly Shape, can you test by changing the duration of Ghostly Shape to 0 in config ? (ghostly_shape_duration)

Xiantrius commented 2 months ago

here is version with mods and plugin next i create new video without mods and plugin. https://github.com/user-attachments/assets/7295ed81-cea5-4a1d-a2ef-311d0839c752

@C0D3-M4513R It's a protected method (i'm sure that you will find the reason of Forge Forum) and i avoid mixin as much as possible (because i can't backport theses codes to 1.12.2 where Forge doesn't ship Mixin). @Xiantrius if the problem is related to Ghostly Shape, can you test by changing the duration of Ghostly Shape to 0 in config ? (ghostly_shape_duration)

i can try that.

C0D3-M4513R commented 2 months ago

You do know I reproduced the issue like 8h ago, right? (see the label change from can't reproduce to confirmed)

The reason why I couldn't reproduce the issue initially is because the reproduction steps were wrong:

1. If my character dies I have the key.
2. As soon as I use the key on my gravestone, nothing happens. [...]

In the clip you do these things instead: die and get the key; use the enhanced key to teleport; try to use the key on the gravestone. Teleporting with an enhanced key is the key to reproducing this issue (you can also make it happen by breaking any block though, I found).

Also to Corail: Access Transformers should allow you to call a protected method. Ketting uses that for a lot of methods. The only part where Access Transformers tend to not work is abstract methods. Also I have 0 want to delve into the Forge Forum for anything. Also Access Transformers do work with mods last time I checked. I don't know exactly how cross version compatible that is though.

Corail31 commented 2 months ago

Also to Corail: Access Transformers should allow you to call a protected method. Ketting uses that for a lot of methods. The only part where Access Transformers tend to not work is abstract methods. Also I have 0 want to delve into the Forge Forum for anything. Also Access Transformers do work with mods last time I checked. I don't know exactly how cross version compatible that is though.

https://forums.minecraftforge.net/topic/105101-access-transformer-not-working-i-would-like-to-use-some-protected-methods/

ok^^

C0D3-M4513R commented 2 months ago

Ah, in that case you would need to add an Access Transformer for ServerPlayer.onEffectRemoved and LivingEntity.onEffectRemoved. (So essentially add an Access Transformer for all Overrides of the method you are trying to modify)

That issue occurrs, because with the Access Transformer LivingEntity.onEffectRemoved is marked as public, but if you don't do anything to ServerPlayer.onEffectRemoved it will be protected, which is invalid.

The message: attempting to assign weaker access privileges; was public is in this case referring to ServerPlayer.onEffectRemoved.

Corail31 commented 2 months ago

and any mod doing it...

C0D3-M4513R commented 2 months ago

Ah yeah. I haven't thought about that. You are right in that regard, thanks.

Thankfully, due to some miracle, we have never once come across mod incompatibilities, due to Access Transformers. Though not introducing such incompatibilities is definitely the better way.

C0D3-M4513R commented 2 months ago

We still have no clue, if it's a Tombstone issue (though it likely isn't, but I have not tested on a dedicated forge server).

(context: Xiantrius asked, if there would be any update to the Corail Tombstone mod, but apparently he just deleted the comment)

Xiantrius commented 2 months ago

So will there be a fix with the Tombstone Mod in the future? sorry file 10mb max compressed in zip. Forge-Server with tombstone alone.zip

Ketting-Server with tombstone alone.zip

Corail31 commented 2 months ago

@Xiantrius Why do you want a fix in Tombstone ? It's working in Forge. Was it working by disabling Ghostly Shape in config ? (was my last question to you). Depending on this, i could continue the discussion. (i don't open zip if i don't know the context to do it) Actually, i don't think that i can test myself a ketting server as i lost my 'official' account during the migration to microsoft mail that i didn't want (around 2019/2020) so i can only rely on your provided informations.

C0D3-M4513R commented 2 months ago

You can still run and join a ketting server. Offline mode should function just fine (you need to set both the server and the client to offline mode ofc). If you need any help with ketting, just hop onto our discord.

Minecraft's official accounts are only a way to get api access basically.

Corail31 commented 2 months ago

@C0D3-M4513R Ok, i can confirm that i can log in from my workspace (but i needed to do a second try to successfully connect). I tested to create a grave (by being /op and in creative mode) twice:

C0D3-M4513R commented 2 months ago

I assumne it's not directly related to removing the effect, but a side effect of it. I just recalled, that with the first method, the message from cancelling ghostly shape never appears.

For me what made the bug appear was:

  1. Dying, Making the key enhanced, Using the enhanced key to teleport to the grave
  2. Dying, Break a Block Edit: I was mistaken about this.

After both scenarios, you are unable to:

  1. claim the grave with the key, by right-clicking
  2. Open Chests
  3. Place blocks
  4. And probably all other interactions other than breaking blocks?
Corail31 commented 2 months ago

In my case, i used the command /tbteleport grave Btw, this log is strange "[01:24:49] [Server thread/ERROR] [or.ke.ke.co.Ketting/]: Could not inject Potion into Bukkit: TOMBSTONE_SPECTRAL. Effect is null", the potion spectral is just an ingredient for others potions. Additionally, i can make the bug happening after the teleportation with the key (so it's not about Ghostly Shape). I will have a look tomorrow to find the reason (it's late and the time to continue to read my book BloodSworn ^^). @Xiantrius Thanks for your investigation, i won't need your help anymore as i can test it. @C0D3-M4513R It's how water/mundane/thick/awkward potions are anyway (new Potion() )

C0D3-M4513R commented 2 months ago

Could not inject Potion into Bukkit: TOMBSTONE_SPECTRAL. Effect is null

All this means, that the tombstone:spectral potion in the ForgeRegistries.POTIONS has no effects (so potion.getEffects().isEmpty() would be true).

The code relating to that is here: https://github.com/kettingpowered/Ketting-1-20-x/blob/4e57e445d829269222ca9bd7bebf3d694a5931b5/src/main/java/org/kettingpowered/ketting/inject/ForgeInject.java#L423-L434

Fwiw we do not need to worry about that. It simply means, that bukkit plugins don't know of that Potion type.

Edit: I did a little diggig and this is the root issue: new Potion(new MobEffectInstance[0]) in the ovh.corail.tombstone.registry.ModPotions class. Having a potion with no effect instances seems a little silly, but I also don't know if the registry entry is just needed for other things (e.g. applying effects or anything like that).

C0D3-M4513R commented 2 months ago

It's how water/mundane/thick/awkward potions are anyway (new Potion() )

Yeah, that might be true, but those don't need to be injected and are in bukkit by default.

https://github.com/kettingpowered/Ketting-1-20-x/blob/4e57e445d829269222ca9bd7bebf3d694a5931b5/src/main/java/org/bukkit/potion/PotionType.java#L9-L14

We could theoretically inject Potions with a null PotionEffectType, but there are probably plugins which don't handle such things correctly, so I think we decided that it'd be better to just not expose such things.

Xiantrius commented 2 months ago

@Xiantrius Why do you want a fix in Tombstone ? It's working in Forge. Was it working by disabling Ghostly Shape in config ? (was my last question to you). Depending on this, i could continue the discussion. (i don't open zip if i don't know the context to do it) Actually, i don't think that i can test myself a ketting server as i lost my 'official' account during the migration to microsoft mail that i didn't want (around 2019/2020) so i can only rely on your provided informations.

The Ghostly Shape effect wasn't there when the bug happened. If you have the key and have died before, you can do actions and when I opened the chest, the Ghostly Shape effect ended prematurely. But the bug still remained, I assume you saw it in the video. The reason I'm not switching to Forge is quite simple, because I also use a few plugins that I need. They don't run on Forge. If I were to use Forge, I would have to try to find mod alternatives from the plugins I use. With LuckPerm, there are rules that you can configure at any time.

In my case, i used the command /tbteleport grave Btw, this log is strange "[01:24:49] [Server thread/ERROR] [or.ke.ke.co.Ketting/]: Could not inject Potion into Bukkit: TOMBSTONE_SPECTRAL. Effect is null", the potion spectral is just an ingredient for others potions. Additionally, i can make the bug happening after the teleportation with the key (so it's not about Ghostly Shape). I will have a look tomorrow to find the reason (it's late and the time to continue to read my book BloodSworn ^^). @Xiantrius Thanks for your investigation, i won't need your help anymore as i can test it. @C0D3-M4513R It's how water/mundane/thick/awkward potions are anyway (new Potion() )

You're welcome, OK, I see that you noticed yourself that it has nothing to do with Ghosty Shape. Well then we can look forward to a fix in the future. :) Thanks for the good cooperation, I really appreciate that, it deserves respect and recognition and I would be happy to work together again in the future if there are other problems with the mod and ketting-server.

Many thanks to you C0D3-M4513R and Corail31.

Corail31 commented 2 months ago

@C0D3-M4513R I located the problem. If i remove the line below to set the global cooldown, there is no problem. player.getCooldowns().addCooldown(item, ticks) in finishUsingItem(ItemStack, Level, LivingEntity) I was also able to make the problem happening with any of my items using a global cooldown (magic scrolls for example). But i'm not sure that the problem is really from that cooldown as Chorus Fruit isn't affected.

To simplify the bug for tests:

It can happen with any item using this setup:

    @Override
    public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
        ItemStack heldStack = player.getItemInHand(hand);
        if (!heldStack.is(this)) {
            return super.use(level, player, hand);
        }
        if (player.getCooldowns().isOnCooldown(this)) {
            return InteractionResultHolder.consume(heldStack);
        }
        player.startUsingItem(hand);
        return InteractionResultHolder.success(heldStack);
    }

    @Override
    public int getUseDuration(ItemStack stack) {
        return 80;
    }

    @Override
    public UseAnim getUseAnimation(ItemStack stack) {
        return UseAnim.BOW;
    }

    @Override
    public ItemStack finishUsingItem(ItemStack stack, @Nullable Level level, LivingEntity entity) {
        if (stack.is(this) && entity instanceof Player player) {
            if (!player.getCooldowns().isOnCooldown(this)) {
                // do something
            }
            player.getCooldowns().addCooldown(this, 20);
        }
        return stack;
    }

I can't really debug Ketting and it's not happening on Forge (was tested on dedicated server).

C0D3-M4513R commented 2 months ago

I've reproduced the issue with minecraft enderpearls. Simply try to use the item while it is on cooldown. I think the root issue is, that we simply forget to reset one variable.

(we introduce a lot of extra variables, which should be local ones, but aren't due to mixin lvt issues.)

Corail31 commented 2 months ago

@C0D3-M4513R Haha, i was lazy to test the ender pearl :) I suppose that it will be easy to fix the issue in Ketting. Btw, it would be nice to change the title of the issue.

C0D3-M4513R commented 2 months ago

Btw, it would be nice to change the title of the issue.

Yeah, changed.

Sorry for putting you through all that and huge thanks for putting in the work to support us.

Xiantrius commented 2 months ago

It's a shame that there isn't often such good cooperation as here. You can really tell that you're putting your all into it, step by step. Big compliments to both of you.

Xiantrius commented 2 months ago

I would like to say a big thank you from here, with this Corail Tombstone v8.7.2 for Minecraft v1.20.1 the bug is now also fixed on the Ketting server. This topic can be closed. :) If other problems with the mod are discovered or I have suggestions for improvement, I will get in touch again.

Corail31 commented 2 months ago

@Xiantrius It's their fix, not related to my mod version.

Xiantrius commented 2 months ago

OK sorry then Ketting fix.

C0D3-M4513R commented 2 months ago

This topic can be closed.

It is closed. I guess I'm locking it now too.