Jump to content

Th1Minecraft

Members
  • Posts

    8
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Th1Minecraft's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Oh I just found out that is a method called ItemRenderer::renderItemOverlayIntoGUI. Thanks for your help. I solved it!
  2. This code is in MixinContainerScreen and I've tried for RenderGameOverlayEvent.Pre but it is just the same private final ContainerScreen that = (ContainerScreen) (Object) this; Method RenderExtraContainer: private void renderExtraContainer(MatrixStack matrixStack, Slot slot) throws CommandSyntaxException { if (!slot.getStack().isEmpty()) { RenderSystem.disableDepthTest(); RenderSystem.enableBlend(); RenderSystem.enableAlphaTest(); RenderUtils.bindTexture(EXTRA_CONTAINER); AbstractGui.blit(matrixStack, this.that.getGuiLeft() + this.that.getXSize() + 10, this.that.getGuiTop(), 0.0F, 0.0F, 176, 80, 176, 80); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.blendFunc(770, 771); GL11.glTexEnvi(8960, 8704, 3042); GL11.glTexEnvi(8960, 8704, 8448); RenderSystem.enableDepthTest(); RenderSystem.disableAlphaTest(); RenderSystem.enableRescaleNormal(); this.font.drawString(matrixStack, slot.getStack().getDisplayName().getString(), this.that.getGuiLeft() + this.that.getXSize() + 18, this.that.getGuiTop() + 6, FontColor.GRAY.getColorCodes()); ArrayList<ItemStack> listStack = this.getInventoryFromShulkerBoxItem(slot.getStack()); assert this.minecraft != null; ItemRenderer itemRenderer = this.minecraft.getItemRenderer(); int startPointX = this.that.getGuiLeft() + this.that.getXSize() + 18; int startPointY = this.that.getGuiTop() + 18; if (!listStack.isEmpty()) { for (int i = 0; i < 9; i++) { for (int j = 0; j < 3; j++) { if ((i + j * 9) <= listStack.size() - 1) { int count = listStack.get(i + (j * 9)).getCount(); matrixStack.push(); itemRenderer.renderItemAndEffectIntoGUI(listStack.get(i + (j * 9)), startPointX + (i * 18), startPointY + (j * 18)); matrixStack.pop(); if (count > 1) { this.font.drawStringWithShadow(matrixStack, String.valueOf(count), (float) (startPointX + (i * 18) + 16) - this.font.getStringWidth(String.valueOf(count)), (float) (startPointY + (j * 18) + 10), FontColor.WHITE.getColorCodes()); } } } } } } }
  3. I want to draw string over an itemStack, but string is rendering below an itemStack Here's my code: // i = index (0-9) // j = rows int count = listStack.get(i + (j * 9)).getCount(); Minecraft.getInstance().getItemRenderer().renderItemAndEffectIntoGUI(listStack.get(i + (j * 9)), startPointX + (i * 18), startPointY + (j * 18)); if (count > 1) { this.font.drawStringWithShadow(matrixStack, String.valueOf(count), (float) (startPointX + (i * 18) + 16) - this.font.getStringWidth(String.valueOf(count)), (float) (startPointY + (j * 18) + 10), FontColor.WHITE.getColorCodes()); }
  4. 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); }
  5. 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.
  6. 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.
  7. 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"); }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.