Inventory Profiles Next

Inventory Profiles Next

27M Downloads

I want to understand how this mod works

z1-asdf opened this issue · 5 comments

commented

Hello,
I would like to know how you manage to move items inside the inventory while keeping the mod functional on servers.
Could you provide some example code? Both Kotlin and Java are fine for me.

Thanks!
(translate by chatGPT)

我想知道你是如何讓物品在背包裡移動 並且同時可以在伺服器中運行的 能提供我一些程式碼嗎 不管是kotlin語言或java語言都好

commented

Additional Information:
I guess the relevant code might be inside the platforms directory, so I opened the 1.21.3 version. However, I noticed that it is not written in Java, and there are many things I don’t understand. Because of that, I quickly gave up on reading everything.

Sorry for the disturbance.

補充:我猜可能的程式碼都在platforms裡面 所以我打開了1.21.3版本 但我發現這不是使用java寫的 很多東西都看不懂 所以我很快就放棄全部都看過一遍了 抱歉打擾

commented

90% of the code is in Kotlin, the rest is in Java. If you can't understand it there is no point of me showing you the same thing.

Ask Chat GPT "Show me Kotlin code that sorts the minecraft inventory client side"
It will probably generate code that showcases how the items are moved.

commented

I think it's just a little Kotlin, and you should be able to understand it if you spend some time. chatGPT will only use player.getinventory.main.set to say that it can swap item positions, but in fact it is just simply setting the item in a certain position in the backpack.
and it didn't work on server

我想只是一點Kotlin,花點時間應該還是看得懂的。chatGPT只會一直用player.getinventory.main.set 說是可以交換物品位置,但實際上那只是單純的設定背包某個位置的物品而已。
而且那在伺服器上沒用

commented

what kind of a mod are you going for.

commented

When a monster approaches, it can automatically find a shield and equip it to the off-hand