Jump to content

Zemelua

Members
  • Posts

    190
  • Joined

  • Last visited

Everything posted by Zemelua

  1. I'm ashamed to say that I'm new to giyhub so I don't know if it's made, but it's a url. https://github.com/Zemelua/Depression-Mod
  2. sorry. I wrote it in various positions and tried it, so the first AbstractGui.GUI_ICONS_LOCATION is just a mistake. However, even if I turn it off, it still doesn't work properly.
  3. public class MentalOverlayHander { public static final ResourceLocation MENTALICON = new ResourceLocation("depressionmod:textures/gui/overlay.png"); private final Minecraft mc = Minecraft.getInstance(); @SubscribeEvent public void onPreRenderOverlay(RenderGameOverlayEvent.Post event) { if (event.getType() == ElementType.ALL && mc.playerController.gameIsSurvivalOrAdventure()) { int scaledWidth = this.mc.getMainWindow().getScaledWidth(); int scaledHeight = this.mc.getMainWindow().getScaledHeight(); int left_height = ForgeIngameGui.left_height; int left = scaledWidth / 2 - 91; int top = scaledHeight - left_height; int level = 9; //((PlayerMentalInterface) PlayerMentalCapabilityRegistry.PLAYER_MENTAL_CAPABILITY).getMental(); mc.getTextureManager().bindTexture(AbstractGui.GUI_ICONS_LOCATION); RenderSystem.enableBlend(); RenderSystem.enableAlphaTest(); RenderSystem.color4f(1F, 1F, 1F, 1F); mc.getTextureManager().bindTexture(MENTALICON); for (int i = 0; i < 10; ++i) { //iが10未満のとき繰り返す。iは繰り返しごとに1増える。 if (i < level) { //iがMPより小さいとき普通の薬を描画。 //mc.getTextureManager().bindTexture(MENTALICON); mc.ingameGUI.blit(left, top, 0, 0, 9, 9); } else if (i == level) { //iがMPと同じとき半分の薬を描画。 //mc.getTextureManager().bindTexture(MENTALICON); mc.ingameGUI.blit(left, top, 9, 0, 9, 9); } else if (i > level) { //iがMPより大きいとき黒の薬を描画。 //mc.getTextureManager().bindTexture(MENTALICON); mc.ingameGUI.blit(left, top, 18, 0, 9, 9); } left += 8; //アイコンを描画する位置を右に一つ分ずらす } RenderSystem.disableBlend(); mc.getTextureManager().bindTexture(AbstractGui.GUI_ICONS_LOCATION); } } }
  4. I rebinded the vanilla texture immediately after RenderSystem.disableBlend (); but it doesn't work. Is it wrong?
  5. public class MentalOverlayHander { public static final ResourceLocation MENTALICON = new ResourceLocation("depressionmod:textures/gui/overlay.png"); private final Minecraft mc = Minecraft.getInstance(); @SubscribeEvent public void onPreRenderOverlay(RenderGameOverlayEvent.Post event) { if (event.getType() == ElementType.ALL && mc.playerController.gameIsSurvivalOrAdventure()) { int scaledWidth = this.mc.getMainWindow().getScaledWidth(); int scaledHeight = this.mc.getMainWindow().getScaledHeight(); int left_height = ForgeIngameGui.left_height; int left = scaledWidth / 2 - 91; int top = scaledHeight - left_height; int level = 9; //((PlayerMentalInterface) PlayerMentalCapabilityRegistry.PLAYER_MENTAL_CAPABILITY).getMental(); RenderSystem.enableBlend(); RenderSystem.enableAlphaTest(); RenderSystem.color4f(1F, 1F, 1F, 1F); mc.getTextureManager().bindTexture(MENTALICON); for (int i = 0; i < 10; ++i) { //iが10未満のとき繰り返す。iは繰り返しごとに1増える。 if (i < level) { //iがMPより小さいとき普通の薬を描画。 //mc.getTextureManager().bindTexture(MENTALICON); mc.ingameGUI.blit(left, top, 0, 0, 9, 9); } else if (i == level) { //iがMPと同じとき半分の薬を描画。 //mc.getTextureManager().bindTexture(MENTALICON); mc.ingameGUI.blit(left, top, 9, 0, 9, 9); } else if (i > level) { //iがMPより大きいとき黒の薬を描画。 //mc.getTextureManager().bindTexture(MENTALICON); mc.ingameGUI.blit(left, top, 18, 0, 9, 9); } left += 8; //アイコンを描画する位置を右に一つ分ずらす mc.getTextureManager().bindTexture(AbstractGui.GUI_ICONS_LOCATION); } RenderSystem.disableBlend(); } } } I tried to fix the code but it doesn't work. Can you tell me specifically where and how to fix it?
  6. What does it mean to rebind a vanilla texture? I'm sorry for my poor understanding. Could you please show me the complete code to work with that as well?
  7. When I checked the entity type ALL, the white bar also disappeared. I'm not sure about AbstractGui.GUI_ICONS_LOCATION, so could you please write some sample code?
  8. I don't know why, but when I restarted the computer, even the white bar disappeared, so when I restarted with the element type set to ARMOR, this time it was displayed like this. The error log was not displayed.
  9. sorry. It's just a typo. The texture is neatly in the gui folder. Still it is not displayed correctly. Why?
  10. public class MentalOverlayHander { public static final ResourceLocation MENTALICON = new ResourceLocation("depressionmod:textures/gui/overlay.png"); private final Minecraft mc = Minecraft.getInstance(); //private final IngameGui iGUI = mc.ingameGUI; @SubscribeEvent public void onPreRenderOverlay(RenderGameOverlayEvent.Post event) { if (event.getType() == ElementType.AIR && mc.playerController.gameIsSurvivalOrAdventure()) { int scaledWidth = this.mc.getMainWindow().getScaledWidth(); int scaledHeight = this.mc.getMainWindow().getScaledHeight(); int left_height = ForgeIngameGui.left_height; int left = scaledWidth / 2 - 91; int top = scaledHeight - left_height; int level = 9; //((PlayerMentalInterface) PlayerMentalCapabilityRegistry.PLAYER_MENTAL_CAPABILITY).getMental(); RenderSystem.enableBlend(); mc.getTextureManager().bindTexture(MENTALICON); for (int i = 0; i < 10; ++i) { //iが10未満のとき繰り返す。iは繰り返しごとに1増える。 if (i < level) { //iがMPより小さいとき普通の薬を描画。 mc.ingameGUI.blit(left, top, 0, 0, 9, 9); } else if (i == level) { //iがMPと同じとき半分の薬を描画。 mc.ingameGUI.blit(left, top, 9, 0, 9, 9); } else if (i > level) { //iがMPより大きいとき黒の薬を描画。 mc.ingameGUI.blit(left, top, 18, 0, 9, 9); } left += 8; //アイコンを描画する位置を右に一つ分ずらす RenderSystem.disableBlend(); } } } } My English may be unnatural because I use a translator. sorry. When I apply the mod with the above code, it doesn't draw correctly like the image. Can anyone please tell me this solution? The position of the texture is src / main / resources / assets / depressionmod / textures / overlay.png, which is the second image.
  11. What is the difference between ForgeInGameGUI and InGameGUI of minecraft?
  12. Since I am writing using a translator, the text may be a little unnatural. sorry. I want to display my magic points in the same way as the health bar and food bar (the magic points capacity is already complete). After searching, I found that I could use RenderGameOverlayEvent, but it seems that there are various ways to actually draw. blit? buffer? Can you explain because I don't understand the difference between them? Also, it would be helpful if you could write the sample code as well.
×
×
  • Create New...

Important Information

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