Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Frontear

Members
  • Posts

    54
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Frontear

  1. The documentation isn't clear about how to implement them. It's only telling me the format, the maven support, and some other stuff about modifying the Manifest INF. How exactly am I supposed to accept this? Am I supposed to modify files outside of the build.gradle?

  2. I've already modified the build.gradle to compile org.reflections, which can be found here. The problem is while the dev environment can build it, it will not work after using `gradle build`. I've tried running `gradle buildDependents` as well, and nothing will solve the issue. How can I correctly compile an external library into my mod?

     

    Edit: What I mean to say is that the official Minecraft Client will not run the mod, throwing a NoClassDefFound, meaning org.reflections isn't compiling with my mod. How can I make it so?

  3. 2 minutes ago, V0idWa1k3r said:

    It will neither be sent to the server nor appear in the client's local chat. These are different things. When the client hits enter to send a message it first gets added to it's local client's chat - it is not yet visible to any other player on the server but is visible to the client who is sending it. It then gets sent to the server which sends it to every other player for them to see if needed. I don't know whether you want the client who typed the message to see it, which is why I've included an explanation as to how to add it to the local client's chat. Again, you can add anything you want to that chat and only the client that you are doing it with will see those messages, not anyone else. 

    Just checked for such an event. It does not exist.

     

    Probably should've mentioned im using 1.10 Forge, but I dont see any ClientChatEvent at all. What would be an alternative plan?

  4. 2 minutes ago, V0idWa1k3r said:

    So do you want to detect when the client player types a message, respond to it and stop it from reaching the server? Forge has an event for that - ClientChatEvent. You can cancel it and then it won't be sent. It however won't add it to the chat either so you would have to do that yourself with GuiNewChat#addToSentMessages. You can get the GuiNewChat instance from GuiIngame#getChatGUI and you can get a GuiIngame instance with Minecraft.ingameGUI.

    "You can cancel it and then it won't be sent". I assume you mean the text message the player sends won't be added to chat, correct? If so, great.

  5. Example: If I type `Ping`, I want the mod to respond with `Pong`.

     

    I've already figured I can use `ClientChatRecievedEvent` to be able to see when the user sends a message, but this doesn't exactly return favourable results. `event.message` doesn't have the option to simply return just the text, effectively, instead of returning "Ping", it'll return either "<PlayerName> Ping" or "<> Ping". I want only "Ping", and another problem arises. Servers often format text messages to display a users rank. That will change the expected format of `event.message.getFormatted (or unformatted whatever)` text and would require a different method of handling. Additionally, I don't want the users message to make it to the server. Basically, it needs to be a client side message with a client side response.

     

    tl;dr is there any way I can get a message typed by the player in chat, make sure it doesn't get published to server or public chat, and issue a client sided response?

     

  6. 8 hours ago, diesieben07 said:

    Still a bad time. Use Forge's built in method.

    What about in other cases? Sure, I can ping a server for an updated mod file now, but what about in cases where'd I'd like to perform some final changes. Maybe perhaps a fancy closing animation. 

  7. 5 hours ago, Cadiboo said:

    Why would you do this on exit. Hey, the game just fatally crashed - seems like a good time to send a request over the internet and wait for a response...

    No no, not on a crash. Check when the user is manually exiting the game, through 'exit game' 

  8. 16 minutes ago, Cadiboo said:

    Try stepping through execution with the debugger and/or making your own EventSubscriber to see if the event is fired

     

     

    Alright, so I've tried doing some janky stuff, and here are my results.

     

    First, I completely made a new class, and had the event binded to `EVENT_BUS.post()` a MouseEvent. This worked, as the reximian9k mod fired. Now here are the issues:

     

    The Event will stop posting if any other keys are pressed and the Event itself won't always fire.

     

    Edit: It'll stop firing if you change your mouse coordinates, so move it across the screen

  9. Just now, diesieben07 said:

    Correct.

    I've tried that, and it still doesn't seem to update the cps counter on reximian9k's mod. I'm certain he uses MouseEvent as well, as it's part of his code.

     

    import net.minecraftforge.client.event.MouseEvent;
    //...
    @SubscribeEvent
    public void onClick(MouseEvent e) {
      dx = e.dx;
      dy = e.dy;
      mX = e.x;
      mX = e.y;
      if(e.buttonstate && e.button == Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode() + 100) {
        this.addClick();
        Mainframe.onClick();
      }
      lastEvent = System.currentTimeMillis();
    }

     

  10. 1 hour ago, diesieben07 said:

    You can call EventBus#post to fire an event. However, there is not just MouseEvent, there is also MouseInputEvent, which is designed to accept the direct LWJGL mouse inputs. I am not sure there is a way to fake those.

    Effectively, `MinecraftForge.EVENT_BUS.post(new MouseEvent());`?

  11. I've created a mod that automatically clicks/uses the item in hand, for people like me who suffer from RSI. The problem here is that I want it to fire a MouseEvent (the forge one) every time it clicks. The reason for this is that another mod, coded by reximian9k, called KeyMod, relies on MouseEvent to update it's cps counter, and I'd like my mod to work correctly with it. Is there a way to manually trigger the MouseEvent, so that any SubscribedMethods will automatically run their code correctly when I use this mod of mine?

  12. Thank you for your response, however the hunger bar continues to be artifacted with Post. I'll try Pre and reupdate this comment. If I use Pre, everything will once again be artifacted, as you said, since it uses a different texture. Post will also artifact the hunger bar still.

     

    Edit: I've solved the issue by checking `event.getType()`. Thank you!

     

  13. I have isolated the issue in the following line of code:

    Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(etc)

     

    I'm extremely confused as to why it's artifacting the xp bar, health bar, food bar and armour bar. Here's a portion of my code:

    // the main code
    public void postInit(FMLPostInitializationEvent event) {
        MinecraftForge.EVENT_BUS.register(new MyMod());
    }
    
    // MyMod class
    public uiCreator;
    public MyMod() {
        uiCreator = new UICreator();
    }
    
    @SubscribeEvent
    public void onGui(RenderGameOverlayEvent event) {
        uiCreator.Create();
    }
    
    // UICreator class
    public void Create() {
        Minecraft.getMinecraft().fontRenderer.drawStringWithShadow("MyMod", 2, 2, 0xffffff);
    }

     

    Effectively, the line which is causing the artifacting is `Minecraft.getMinecraft().fontRenderer.drawStringWithShadow("MyMod", 2, 2, 0xffffff);`. I don't understand why. I'm certain it's this line, as removing/commenting out any other portions of code do not fix the artifacting until I comment this line out. I'm extremely confused as to why this is occuring. If anyone has any form of insight, I'd greatly appreciate it

    Image of the Artifacting bar

  14. To preface, this is my code:

     

    // the main class:
    
    @EventHandler
    public void postInit(FMLPostInitialization event) {
    	MinecraftForge.EVENT_BUS.register(new SomeClass());
    }
    
    // the 'SomeClass':
    
    @SubscribeEvent
    public void onGui(RenderGameOverlayEvent event) {
    	someUI.Draw("Hello There");
    	for (int i = 0; i < arrayList.size(); i++) {
    		arrayList.get(i).guiRender(i);
    	}
    }
    
    // the someUI.Draw():
    
    public void Draw(String text) {
    	Minecraft.fontRendererObj.drawString(text, 2, 2, 0xffffff);
    }
    
    // the arrayList:
    
    public ArrayList<thisClass> arrayList = new ArrayList<thisClass>();
    //...
    arrayList.add(thisClass); // and other classes which extend thisClass
    
    // thisClass:
    
    public class thisClass {
    	public void guiRender(int offset) {
    		Minecraft.getMinecraft().fontRendererObj.drawString("Test", 2, 12 + (offset * 10), 0xffffff);
        }
    }

    The problem here is while someUI.Draw() will correctly create the text in the top right (2, 2), arrayList.get(i).guiRender(i) will not create anything. I've tried many things, from directly calling it (`new thisClass().guiRender(1)`) to merging it with someUI.Draw(). Nothing solves this problem. I'm extremely confused why it isn't creating anything, considering it should be properly creating text. I'd appreciate any help possible.

  15. So, I've tried to make an autoclicker in Minecraft. It's worked, for the most part. Here is the code:

     

    private void MouseClick() {
    		if (minecraft.gameSettings.keyBindAttack.isKeyDown()) { // if 'mouse 1' is being pressed down
    			minecraft.thePlayer.swingItem(); // just the visual part
    			switch (minecraft.objectMouseOver.typeOfHit) {
    				case ENTITY: // attack the entity internally
    					minecraft.playerController.attackEntity(minecraft.thePlayer, minecraft.objectMouseOver.entityHit);
    					break;
    				case BLOCK: // don't spam attack the block, break it instead
    					minecraft.playerController.clickBlock(minecraft.objectMouseOver.getBlockPos(), minecraft.objectMouseOver.sideHit);
    					break;
    			}
    		}
    	}

    My problem stems from compatibility with other mods, specifically Reximian9k's KeyMod. I want my mod to be able to update the counter, but it's not going to. Why? Simple:

    // Reximian9k's KeyMod code
    @SubscribeEvent
       public void onClick(MouseEvent e) {
          if(e.buttonstate && e.button == Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode() + 100) {
             this.addClick();
             Mainframe.onClick();
          }
       }

    The problem is that his code will check if the mouse button is pressed, not if an attack is being called. Due to the way my mod implements the autoclicker, where it allows the user to hold down the key and spam attack/breaking, reximian's code will check for the mouse being pressed. KeyMod won't be able to update with the current AutoClicker code.

     

    My question is, would it somehow be possible for me to implement a internal click mechanism which will still trigger MouseEvent, allowing for KeyMod to properly update when my autoclicker is in effect?

  16. I've tried to import the forge project in IntelliJ. I've followed the README accurately (running Manjaro), and it has not generated a proper configuration. Normally I would just make one, but I'm not even sure which class is the main starting class, so I can't generate any configuration. If anyone can point me in a direction, I'd really appreciate it.

     

    Edit: Trying to rebuild it again, at the part where I use `./gradlew genIntelliJRuns`, this exception is thrown:

     

    This mapping 'stable_20' was designed for MC 1.8.8! Use at your own peril.
    #################################################
             ForgeGradle 2.1-SNAPSHOT-eed8c6b        
      https://github.com/MinecraftForge/ForgeGradle  
    #################################################
                   Powered by MCP unknown               
                 http://modcoderpack.com             
             by: Searge, ProfMobius, Fesh0r,         
             R4wk, ZeuX, IngisKahn, bspkrs           
    #################################################
    :genIntellijRunsjava.lang.NullPointerException
            at net.minecraftforge.gradle.common.Constants.addXml(Constants.java:290)
            at net.minecraftforge.gradle.user.UserBasePlugin.injectIntellijRuns(UserBasePlugin.java:1272)
            at net.minecraftforge.gradle.user.UserBasePlugin$16.execute(UserBasePlugin.java:1180)
            at net.minecraftforge.gradle.user.UserBasePlugin$16.execute(UserBasePlugin.java:1143)
            at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:585)
            at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:568)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
            at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
            at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
            at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
            at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
            at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
            at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
            at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
            at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
            at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
            at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:62)
            at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
            at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
            at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
            at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
            at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
            at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
            at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
            at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
            at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
            at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
            at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:155)
            at org.gradle.internal.Factories$1.create(Factories.java:22)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
            at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:152)
            at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:33)
            at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:100)
            at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:94)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
            at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:94)
            at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83)
            at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
            at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
            at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
            at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
            at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
            at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:77)
            at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:47)
            at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
            at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
            at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
            at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
            at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
            at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
            at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
            at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
            at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
            at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
            at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
            at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
            at org.gradle.launcher.Main.doAction(Main.java:33)
            at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
            at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
            at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
            at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
            at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
    

     

    Edit 2: I've fixed the issue. Rather than using the shell terminal, I used IntelliJ directly and it fixed my issue completely. For future reference, import the `build.gradle` into IntelliJ, press the "Gradle" sidebar located on the right-side, find the 'setupDecompWorkspace' (or whatever type of workspace you want), run it, then run the 'genIntelliJRuns' and it'll work. If you get an error at the Workspace part, press the wrench icon inside the gradle panel, and in 'Gradle VM Options', type in '-Xmx4G' where 4G represents 4 GB of RAM. You can reduce that if you don't have that much, but it won't need more than that.

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.