
Th1Minecraft
Members-
Content Count
5 -
Joined
-
Last visited
Community Reputation
0 NeutralAbout Th1Minecraft
-
Rank
Tree Puncher
-
I'm trying to create a new screen with TextFieldWidget but when I create render method TextFieldWidget can not typing anything, here is the code init method: public void init() { settingsPage = 0; assert this.minecraft != null; this.minecraft.keyboardListener.enableRepeatEvents(true); TextFieldWidget searchTextWidget = new TextFieldWidget(this.mc.fontRenderer, width / 2 - 100, height - 36, 200, 16, new StringTextComponent("")); searchTextWidget.setMaxStringLength(32767); searchTextWidget.changeFocus(true); searchTextWidget.setText(SettingsScreen.searchText); searchTextWidget.setCanLoseFocus(true); searchTextWidget.visible = true; this.searchTextField = searchTextWidget; this.buttons.add(this.searchTextField); this.addButton(searchTextWidget); render method: public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { super.render(matrixStack, mouseX, mouseY, partialTicks); }
-
Oh, I solved it. That's a bug from client side and it didn't send correctly because it needs to synchronize with other classes. But Thanks for helping a lot.
-
That's work! but idk why it's only work for an IDE runClient, the fps is showing. But when do I export the mod jar, run the game, and then the fps doesn't show.
-
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"); }