• Recently Browsing

    No registered users viewing this page.

  • Posts

    • You need to use ObfuscationReflectionHelper with SRG names, otherwise your reflection code will not work outside of the development environment.
    • You call NetworkHooks.openGUI, like with any other GUI. Assuming you want this to happen on right click, the client will know which item to look at, so no special handling is necessary here.
    • I need to get debugFPS but it has private-access in class Mnecraft (net.minecraft.client.Minecraft), I'm try to using Reflection for that and It's give me an error:   java.lang.RuntimeException: No such field exception!     at com.thmc.mod.events.ItemDelayEventHandler.onPreInfoRender(ItemDelayEventHandler.java:130) ~[?:1.0] {re:classloading}     at net.minecraftforge.eventbus.ASMEventHandler_34_ItemDelayEventHandler_onPreInfoRender_Pre.invoke(.dynamic) ~[?:?] {}     at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-3.0.5-service.jar:?] {}     at net.minecraftforge.eventbus.EventBus.post(EventBus.java:297) ~[eventbus-3.0.5-service.jar:?] {}     at net.minecraftforge.client.gui.ForgeIngameGui.pre(ForgeIngameGui.java:828) ~[?:?] {re:classloading}     at net.minecraftforge.client.gui.ForgeIngameGui.func_238445_a_(ForgeIngameGui.java:121) ~[?:?] {re:classloading}     at net.minecraft.client.renderer.GameRenderer.func_195458_a(GameRenderer.java:765) ~[?:?] {re:classloading,pl:accesstransformer:B,xf:OptiFine:default}     at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:976) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:607) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.main.Main.main(Main.java:184) [?:?] {re:classloading,pl:runtimedistcleaner:A}     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] {}     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] {}     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] {}     at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] {}     at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51) [forge-1.16.4-35.0.17.jar:35.0] {}     at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$431/324579982.call(Unknown Source) [forge-1.16.4-35.0.17.jar:35.0] {}     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.6.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.6.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.6.jar:?] {}     at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.6.jar:?] {}     at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.6.jar:?] {}   then I'm try to try-catch Reflection and it's give me that error again? Can anyone help me for that?   Here is my code // throws NoSuchFieldException, IllegalAccessException try { Field fps = Minecraft.class.getDeclaredField("debugFPS"); if (Modifier.isPrivate(fps.getModifiers())) { fps.setAccessible(true); String text = ChatColor.WHITE + "FPS: " + RenderScreenGui.INSTANCE.translateFPSColor(fps.getInt(fps)); this.mc.fontRenderer.drawString(matrixStack, text, ((float)(event.getWindow().getScaledWidth() / 2) + 1.0625F - (float)(this.mc.fontRenderer.getStringWidth(text) / 2)) - ((float)((event.getWindow().getScaledWidth() / 2) - (this.mc.fontRenderer.getStringWidth(text) / 2 + 5) - 1.0625F)), ((float)(event.getWindow().getScaledHeight() / 2 - 24) + (float)(9 + 1)) - ((float)(event.getWindow().getScaledHeight() / 2 - 22)), 16777215); } } catch (NoSuchFieldException e) { throw new RuntimeException("No such field"); }  
    • I am trying to do something similar and ran into the same issue. Would you mind sharing your solution to change mouse position?
    • I am trying to do a similar thing on 1.16.2 but the  mc.currentScreen.mouseClicked() method doesn't seem to exist anymore.   Do you have any idea of what this was replaced with or an alternate solution?
  • Topics

  • Who's Online (See full list)