#Askii code for mousewheel

33 messages · Page 1 of 1 (latest)

languid sinew
#

Is there an askii code for scrolling up and down with the mouse wheel? Or some other way to test for the mouse wheel scroll on client?

signal pollenBOT
#

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

languid sinew
#

Uhm, I just tried, Is this event not on 1.19.2? Because Client.getScrollDelta() does nothing and I tried this, also doesn't work

const $ClientMouseWheel = Java.loadClass('net.minecraftforge.client.event.InputEvent.MouseScrollingEvent')
ClientEvents.tick(e => {
    console.log($ClientMouseWheel.getScrollDelta())
})```
steep star
#

what on earth did you just try wtf

languid sinew
#

Importing that class?

#

Idk I never worked with that stuff and never understood how it works

steep star
#

it is an Event, Forge Event

#

you have to listen to it

#

on startup script

languid sinew
#

Like this?

#
ForgeEvents.onEvent('net.minecraftforge.client.event.InputEvent.MouseScrollingEvent', e => {
    
})```
steep star
#

ForgeEvents.onEvent("net.minecraftforge.client.event.InputEvent.MouseScrollingEvent", event => {
  // for when no screen
})

ForgeEvents.onEvent("net.minecraftforge.client.event.ScreenEvent.MouseScrolled$Pre", event => {
  // inside a screen before the screen handles scroll
})

ForgeEvents.onEvent("net.minecraftforge.client.event.ScreenEvent.MouseScrolled$Post", event => {
  // inside a screen after the screen handles scroll, if none took action about it
})

you have those options, you will need to see what you need

languid sinew
#

Ok, thanks

#

Is this reloadable with /kubejs reload startup_scripts?

#

For easy testing

steep star
#

if you do the global trick, yes

languid sinew
#

A... what?

#

How would I do that?

steep star
#

sec

languid sinew
#

Also, from startup scripts, can I send a package to the server? Or how would I execute stuff on the server from a startup script?

steep star
#
ForgeEvents.onEvent("net.minecraftforge.client.event.InputEvent.MouseScrollingEvent", event => {
  global.scrollWhenNoScreen(event)
})

ForgeEvents.onEvent("net.minecraftforge.client.event.ScreenEvent.MouseScrolled$Pre", event => {
  global.scrollBeforeScreen(event)
})

ForgeEvents.onEvent("net.minecraftforge.client.event.ScreenEvent.MouseScrolled$Post", event => {
  global.scrollAfterScreen(event)
})

global.scrollWhenNoScreen = (event) => {
  // for when no screen
}

global.scrollBeforeScreen = (event) => {
  // inside a screen before the screen handles scroll
}

global.scrollAfterScreen = (event) => {
  // inside a screen after the screen handles scroll, if none took action about it
}

add your code inside global function

languid sinew
#

Stuff with painter as always

steep star
#

painter requires server?

languid sinew
#

I want to test if the player has a specific item, then interact with server persistant data, then paint stuff and then run a command

steep star
#

and what scroll has to do with all this?

languid sinew
#

Basicly I want to make a debug menu, where you click and hold your mouse, then a menu pops up and you can quick run a command

#

Like /kube reload server_scripts and other commands I use all the time

#

And with scrolling you change the command that will be run when you release the mouse

languid sinew
lofty nexusBOT
#

Paste version of startup.log from @languid sinew

languid sinew
#
StartupEvents.registry('item', event => {
    event.create("debug_menu").texture('kubejs:item/debug').displayName('Degub menu').maxStackSize(1).tooltip("Used for debugging (Dev only)")
})

ForgeEvents.onEvent('net.minecraftforge.client.event.InputEvent.MouseScrollingEvent', e => {
    global.MouseScrollingEvent(e)
})
ForgeEvents.onEvent('net.minecraftforge.client.event.ScreenEvent.MouseButtonPressed.Pre', e => {
    global.MousePressedEvent(e)
})
ForgeEvents.onEvent('net.minecraftforge.client.event.ScreenEvent.MouseButtonReleased.Pre', e => {
    global.MouseReleasedEvent(e)
})

global.MouseScrollingEvent = (e) => {
    let delta = e.getScrollDelta()
    console.log(delta)
    Client.player.sendData('DebugKey', { name: e.player.username,key:'scroll' })
  }
global.MousePressedEvent = (e) => {
    let button = e.getButton()
    let screen = e.getScreen()
    console.log('pressed',button,screen)
  }
global.MouseReleasedEvent = (e) => {
    let button = e.getButton()
    let screen = e.getScreen()
    console.log('released',button,screen)
  }```