Jump to content

superbas11

Members
  • Posts

    43
  • Joined

  • Last visited

Posts posted by superbas11

  1. code:

     

     

    public TestGui(){

     

    ...

     

    Image = new BufferedImage(600, 600, BufferedImage.TYPE_INT_ARGB);

     

    ...

     

    }

     

    @Override

    public void drawScreen(int mouseX, int mouseY, float par3) {

       

              ...

     

               

              this.mc.getTextureManager().bindTexture(Texturelocation);

              drawTexturedModalRect(150, 120, 0, 0, 600, 600);

               

               

              RenderHelper.enableGUIStandardItemLighting();RenderHelper.disableStandardItemLighting();

              super.drawScreen(mouseX, mouseY, par3);

              RenderHelper.enableStandardItemLighting();

    }

     

     

     

    Subscribed to the game tick with some checks to prevent executing when it's not needed:

     

     

            DrawGraph(Image);

            Dynamic = new DynamicTexture(Image);

            Texturelocation = this.mc.getTextureManager().getDynamicTextureLocation("ModControl.Graph",Dynamic);

     

     

  2. 600x600? Thats huge. Thats bigger than default texturemap...

     

    I'd suggest you calculate the image once per tick. Not every frame and reuse that image in rendering instead of recalculating it every frame.

    The image itself takes up roughly 1.3 mb in ram. Not to mention variables used in the calculation process. If you run this every frame your heap space gets full really fast.

     

    By calculation once per tick or several ticks you give the garbage collector time to catch up.

     

    thanks that worked!

     

    One last question:

    How to set the scale of the image?

     

    got this:

    this.mc.getTextureManager().bindTexture(Texturelocation);

    drawTexturedModalRect(150, 50, 0, 0, 600, 600);

     

    Now it renders the image small and multiple times on the screen but I want it to render on a big part of the screen, ones.

     

  3. this does not work:

     

    Dynamic.deleteGlTexture();

    Dynamic = null;

    Dynamic = new DynamicTexture(Image);

    Texturelocation = this.mc.getTextureManager().getDynamicTextureLocation("ModControl.Graph",Dynamic); 

     

    How should the texture be discarded?

  4. The image is 600 X 600 px. It crashes in about 10 seconds after the gui was opened.

     

    crash:

     

    java.lang.OutOfMemoryError: Java heap space

    at net.minecraft.client.renderer.texture.DynamicTexture.<init>(DynamicTexture.java:28)

    at net.minecraft.client.renderer.texture.DynamicTexture.<init>(DynamicTexture.java:19)

    at com.superbas11.modcontrol.client.Gui.TestGUI.drawScreen(GuiBasic.java:230)

    at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:427)

    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1078)

    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1048)

    at net.minecraft.client.Minecraft.run(Minecraft.java:345)

    at net.minecraft.client.main.Main.main(Main.java:117)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

    at GradleStart.main(Unknown Source)

     

     

  5. I want to deny a connection of a player. but I don't want the log in and log out message in de chat.

     

    code:

     

     

    @SubscribeEvent

    public void PlayerLoggedIn( ServerConnectionFromClientEvent event) {

     

    IChatComponent message = new ChatComponentText("opening ModControl gui...");

    //event.manager.getNetHandler().onDisconnect(message);

    //event.manager.sendPacket(new S00PacketDisconnect(message));

    //((NetHandlerPlayServer) event.handler).kickPlayerFromServer("reason");

                    //event.manager.closeChannel(message);

    }

     

     

     

    I tried some different methods but the log in message is still broadcasting in the chat.

  6. How do I render the orange part?

     

    sqh6jn.jpg

    Brown - rest of GUI

    White - visible part of list

    Orange - hidden part of list - a "cape"

    When element leaves visible part of list partially it' s being hidden behind "cape".

     

    constructor of the List:

     

        public ScrollList(TestGui parent, ArrayList Data, int listWidth, Boolean isPlayerList)

        {

            super(parent.getMinecraftInstance(),

                  listWidth,                                //width

                  parent.height,                    //height

                  32,                                          //top

                  parent.height - 66 + 4,          //bottom

                  10,                                          //left

                  35);                                        //slot height

     

          // System.out.println(parent.width+"-"+parent.height);

            this.parent=parent;

            this.Data=Data;

            this.isPlayerList = isPlayerList;

        }

     

  7. Problem 1 solved!

     

    used code in drawscreen():

     

                RenderHelper.disableStandardItemLighting();

                      super.drawScreen(mouseX, mouseY, par3);

                RenderHelper.enableStandardItemLighting();

     

     

×
×
  • Create New...

Important Information

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