
somewhatOfACoder
Members-
Content Count
10 -
Joined
-
Last visited
Community Reputation
0 NeutralAbout somewhatOfACoder
-
Rank
Tree Puncher
-
You used to be able to do DimensionManager#getWorld to get a world but DimensionManager disappeared in 1.16 How do I go about getting a world?
-
somewhatOfACoder started following Custom commands
-
If I can't make custom commands from scratch, then is there a method in a class somewhere to execute a command, so I can just have my custom command run a vanilla command? For example, /pm would just run /msg with the targets and the message.
-
I decided to make a custom command for fun, similar to the /msg command. The code for the command is below: public class PrivateMessageCommand { public static void register(CommandDispatcher<CommandSource> dispatcher) { dispatcher.register(Commands.literal("pm").requires((context) -> { return context.hasPermissionLevel(0); }).then(Commands.argument("targets", EntityArgument.players()) .then(Commands.argument("message", MessageArgument.message()).executes((context) -> { ITextComponent itextcomponent = MessageArgument.getMessage(context, "message"); int i =
-
Simulating keyboard and mouse input
somewhatOfACoder replied to somewhatOfACoder's topic in Modder Support
Unforntunately I haven't got it to work. I tried sending two presses as you said, one down then one up, but it didn't work. Do I need to have some sort of delay inbetween? And if so how do I do that -
Simulating keyboard and mouse input
somewhatOfACoder replied to somewhatOfACoder's topic in Modder Support
Ok I am now stumped. I read the input guide and made a callback method for the keyboard which allowed me to get the keycode, scancode, action and modifier of whatever key I typed. However after using these values as parameters for KeyboardListener#onKeyEvent, nothing happened. For example, the space bar has a keycode of 32, a scancode of 57, an action of 1 when pressed and no modifiers. When I put these values directly into KeyboardListener#onKeyEvent nothing happened. Help? -
Simulating keyboard and mouse input
somewhatOfACoder replied to somewhatOfACoder's topic in Modder Support
Ok so I changed the method I made to be the following: public static void jump() { Minecraft mc = Minecraft.getInstance(); int jumpKeyCode = mc.gameSettings.keyBindJump.getKey().getKeyCode(); int scanCode = jumpKeyCode; int action = 1; int modifiers = 0; mc.keyboardListener.onKeyEvent(mc.getMainWindow().getHandle(), jumpKeyCode, scanCode, action, modifiers); } However it still doesn't work. The keyCode is fine, but I am not sure about how to get the scanCode. I had a look at KeyboardListener#onKeyEvent and it seems that if the action is 1 then the key will be pressed. I am -
Simulating keyboard and mouse input
somewhatOfACoder replied to somewhatOfACoder's topic in Modder Support
Looking at both KeyboardListener#setupCallbacks and MouseHelper#registerCallbacks, I can see that I need to use the following: // for the keyboard this.onKeyEvent(windowPointer, key, scanCode, action, modifiers); // for the mouse this.mouseButtonCallback(handle1, button, action, modifiers); However I am unsure as to how to get the windowPointer and the handle1. From what I understand, InputMappings#setKeyCallbacks gives the necessary parameters, but calling this again would mean that I would need my own onKeyEvent and mouseButtonCallback methods to handle the input. Do I need to c -
I am trying to simulate keyboard and mouse input for a neural network but I can't figure out how to actually get the keys to be pressed. I put the following code into a separate class but when I call the jump method nothing happens. public static void jump() { Minecraft mc = Minecraft.getInstance(); KeyBinding.setKeyBindState(mc.gameSettings.keyBindJump.getKey(), true); KeyBinding.onTick(mc.gameSettings.keyBindJump.getKey()); } The method is indeed being called but the jump keybind isn't changing whatsoever. How do I go about simulating these inputs?
-
uhhhh about that. there isn't an error anymore, so I can't show u a screenshot. However, I remember clearly that the error said something along the lines of the following: Error: typetools-0.8.1.jar specified in the classpath does not exist C:\\blahblahblah\.gradle\caches\modules-2\files-2.1\net.jodah\type-tools\0.8.1\d12de898d333cb7eb0e39a35db03c1e09d92d595\typetools-0.8.1.jar it wasn't an error that was spit out by the game, but by eclipse itself when trying to run the runClient thing
-
somewhatOfACoder joined the community
-
So I was playing around with my mod, and something magical happened. I got an error saying that typetools-0.8.1 didn't exist. After reading the error more thoroughly, I navigated my way to the jar file for typetools, and surprise surprise, typetools-0.8.1 didn't exist. typetools-0.8.3 had taken its place. I tried running the setup commands again, doing gradlew genEclipseRuns first, then gradlew eclipse The commands executed successfully, but there was no overall change. I still couldn't run my mod in the testing environment. So I searched for the error on google, a