#open inventories when right click
78 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
go ```js
if (Platform.client) {
let $Minecraft = java('net.minecraft.client.Minecraft').instance
let $InventoryMenu = java('net.minecraft.world.inventory.InventoryMenu')
$Minecraft.screen = new $InventoryMenu($Minecraft.player)
}
if you want to open another screen, replace the $InventoryScreen constructor with the constructor of another class
ok
i tried using that code but it didnt work
onEvent('player.right_click', event => {
if (event.item.id === 'minecraft:dirt') {
let $Minecraft = java('net.minecraft.client.Minecraft').instance
let $InventoryMenu = java('net.minecraft.world.inventory.InventoryMenu')
// Abre o inventário do jogador
$Minecraft.screen = new $InventoryMenu($Minecraft.player)
}
})
whats the error
Never say 'it crashed', 'it errored', or 'it didn't work' without providing the full crash report, log, and scripts!
there isnt any errors
Paste version of client.txt from @warm ore
let KEY_E = java('com.mojang.blaze3d.platform.InputConstants$Type').SCANCODE.getOrCreate(69)
let $KeyMapping
onEvent('item.right_click', event => {
if (event.item.id === 'minecraft:dirt') {
if (Platform.clientEnvironment) {
if (!$KeyMapping)
$KeyMapping = java('net.minecraft.client.KeyMapping')
$KeyMapping.click(KEY_E)
}
}
})
```@warm ore try this
yeah still not doing nothing i want to open my inv when i right click while holding the dirt block
didnt work
client_scripts
it should be in server
oh
i didnt know sorry
np its fine
doesnt work as well
did you reload?
This is a list of all the events. Choose your version.
Paste version of server.txt from @warm ore
ok wait
try now
i edited the message
wait
ok its good now @warm ore
it says local player not found
Paste version of server.txt from @warm ore
on the log
Paste version of server.txt from @warm ore
bro
what is going on rn
wait im just stupid
sorry
done actually
it should def work this time
also the code for letter e happens to be 69 lol
you dont need to restart the game yk
just /reload
Paste version of server.txt from @warm ore
it says its the class
ok
oh god my keyboard
it should work fr this time
wait lemme check again
yeah everything looks fine to me
Paste version of server.txt from @warm ore
Idk bro it looks like its all right
wtf this is so odd
let $Minecraft
onEvent('item.right_click', event => {
if (event.item.id === 'minecraft:dirt') {
if (Platform.clientEnvironment) {
if (!$Minecraft)
$Minecraft = java('net.minecraft.client.Minecraft').instance
$Minecraft.player.sendOpenInventory()
}
}
})
```last try, if this doesnt work, i kinda give up
no need to test it soon tho, im gonna go sleep anyway
yeah didnt work