zlainsama / CosmeticArmorReworked

This mod allows you to wear two sets of armor, one for display, one for function.
https://minecraft.curseforge.com/projects/cosmetic-armor-reworked
Other
17 stars 18 forks source link

Disabling mod button #93

Closed snakehugo closed 9 months ago

snakehugo commented 10 months ago

Hello, I'm using CosmeticArmorReworked in 1.16.5

In the client configuration, we have CosArmorGuiButton_Hidden = true, that's nice for disabling the button and then trigger hide/show of the armor in the server side (using your API)

Could it be possible for you to add an option for disabling (or just doing nothing) the "Open inventory Cosmetic Armor" control in the options list? I don't want players to be able to manage their own cosmetic armor using these buttons

Thanks for reading this issue!

zlainsama commented 10 months ago

If you are able to make addon mod for my mod, you should be able to just create a mod that detects Cosmetic Inventory and forces the player to close it. If the player manage to swap items due to network latency or something, you can monitor the content changes through InventoryCosArmor.setUpdateListener() and act accordingly.

snakehugo commented 10 months ago

I think that's too complicated for me, I will try to compile your mod in 1.16.5 and hide the control button in options.

Also, do you have a discord server in case I struggle?

snakehugo commented 10 months ago

Your mod is incredibly well constructed, well job, I saw worse mods and without any code commenting...

In lain.mods.cos.impl.client.KeyHandler.java I added a condition for the key control:

 public void registerEvents() {
        if (!ModConfigs.CosArmorGuiButton_Hidden.get()) {
            ClientRegistry.registerKeyBinding(keyOpenCosArmorInventory);
            MinecraftForge.EVENT_BUS.addListener(this::handleClientTick);
        }
    }

And imported ModConfigs package