Skip to content

Commit 8c6b461

Browse files
committed
fix 1.12 problem?
1 parent 0c5c137 commit 8c6b461

File tree

3 files changed

+43
-2
lines changed

3 files changed

+43
-2
lines changed

19/src/main/java/mobi/omegacentauri/raspberryjammod/GuiFactory.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,9 @@ public RuntimeOptionGuiHandler getHandlerFor(
2727
RuntimeOptionCategoryElement element) {
2828
return null;
2929
}
30+
31+
public hasConfigGui() {
32+
return true;
33+
}
3034

3135
}

mcpipy/input.py

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from platform import system
99

1010
if system() == 'Windows':
11-
from ctypes import windll, Structure, c_ulong, byref
11+
from ctypes import windll, Structure, c_ulong, c_ushort, POINTER, Union, byref, c_int, sizeof, c_long
1212

1313
LBUTTON = 1
1414
RBUTTON = 2
@@ -168,6 +168,43 @@
168168
KEY_BACKSLASH = 0xDC
169169
KEY_CLOSE_BRACKET = 0xDD
170170
KEY_APOSTROPHE = 0xDE
171+
172+
KEYEVENT_KEYUP = 0x0002
173+
174+
class KeybdInputType(Structure):
175+
_fields_ = [('wVk', c_ushort),
176+
('wScan', c_ushort),
177+
('dwFlags', c_ulong),
178+
('time', c_ulong),
179+
('dwExtraInfo', POINTER(c_ulong))]
180+
181+
class HardwareInputType(Structure):
182+
_fields_ = (('uMsg', c_ulong),
183+
('wParamL', c_ushort),
184+
('wParamH', c_ushort))
185+
186+
class MouseInputType(Structure):
187+
_fields_ = (('dx', c_long),
188+
('dy', c_long),
189+
('mouseData', c_ulong),
190+
('dwFlags', c_ulong),
191+
('time', c_ulong),
192+
('dwExtraInfo', POINTER(c_ulong)))
193+
194+
class InputUnionType(Union):
195+
_fields_ = [('mi', MouseInputType), ('ki', KeybdInputType), ('hi', HardwareInputType)]
196+
197+
class InputType(Structure):
198+
_fields_ = [('type', c_ulong),
199+
('union', InputUnionType)]
200+
201+
def pressKey(key):
202+
data = (InputType*1)(InputType(1, InputUnionType(ki=KeybdInputType(key,key,0,0,None))))
203+
windll.user32.SendInput(1, data, c_int(sizeof(data)))
204+
205+
def releaseKey(key):
206+
data = (InputType*1)(InputType(1, InputUnionType(ki=KeybdInputType(key,key,KEYEVENT_KEYUP,0,None))))
207+
windll.user32.SendInput(1, data, c_int(sizeof(data)))
171208

172209
def getPressState(key):
173210
v = windll.user32.GetAsyncKeyState(int(key))
@@ -209,6 +246,6 @@ def getScreenSize():
209246
now,last = getPressState(ord(' '))
210247
if now or last:
211248
print(now, last)
212-
print(getMousePosition(), getScreenSize())
249+
# print(getMousePosition(), getScreenSize())
213250
sleep(0.01)
214251

mods.zip

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)