#open inventories when right click

78 messages · Page 1 of 1 (latest)

warm ore
#

guys is there any way that when i right click my item it opens my inventory?

pearl ermineBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

hushed carbon
#

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)
}

hushed carbon
#

if you want to open another screen, replace the $InventoryScreen constructor with the constructor of another class

warm ore
#

ok

warm ore
#

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)

}
})

hushed carbon
#

whats the error

storm duneBOT
#

Never say 'it crashed', 'it errored', or 'it didn't work' without providing the full crash report, log, and scripts!

warm ore
storm duneBOT
#

Paste version of client.txt from @warm ore

warm ore
#

it just doesnt work

#

it doesnt open my inv

hushed carbon
#
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
warm ore
#

yeah still not doing nothing i want to open my inv when i right click while holding the dirt block

hushed carbon
#

how are you reloading this

#

where is the script

warm ore
#

client_scripts

hushed carbon
#

it should be in server

warm ore
#

oh

hushed carbon
#

then do /reload

#

to reload the script

warm ore
#

i didnt know sorry

hushed carbon
#

np its fine

warm ore
#

doesnt work as well

hushed carbon
#

did you reload?

warm ore
#

yrah

#

i restarted my game

hushed carbon
#

hmm

#

oh

storm duneBOT
#

This is a list of all the events. Choose your version.

hushed carbon
#

oh theres no player.right_click event

#

do item.right_click

warm ore
storm duneBOT
#

Paste version of server.txt from @warm ore

hushed carbon
#

ok wait

hushed carbon
#

i edited the message

#

wait

#

ok its good now @warm ore

warm ore
storm duneBOT
#

Paste version of server.txt from @warm ore

warm ore
#

on the log

hushed carbon
#

trying to fix

#

sorry if this is taking a while, my computer is slow

warm ore
#

np

#

your helping me so i gotta thank you

hushed carbon
#

done

#

still edited message

warm ore
storm duneBOT
#

Paste version of server.txt from @warm ore

warm ore
#

bro

hushed carbon
#

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

warm ore
#

i know

storm duneBOT
#

Paste version of server.txt from @warm ore

warm ore
#

it says its the class

hushed carbon
#

ok

#

oh god my keyboard

#

it should work fr this time

#

wait lemme check again

#

yeah everything looks fine to me

warm ore
#

still doesnt work and now the logs doesnt say nothing

storm duneBOT
#

Paste version of server.txt from @warm ore

warm ore
#

Idk bro it looks like its all right

hushed carbon
#

wtf this is so odd

hushed carbon
#
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

warm ore
#

yeah didnt work