• 0

    posted a message on Custom Crafting Gui Wont open

    Without looking in depth into your code, are you adding the right amount of slots? otherwise there will be an out of bounds error

    Posted in: Modification Development
  • 1

    posted a message on I want to learn java for mods (FOR FREE)

    There's plenty of free sources out there to learn how to code even if you have 0 knowledge or no help.


    When I started I did the same thing as Sgt_SuiZ. I went word for word and slowly developed an idea of what everything meant (with some studying of the language to help myself learn what is possible).


    It took months before I could really get something out there with countless hours spent getting frustrated working through problems, but it was free and taught me.


    So just be prepared to spend a lot of time learning how to code and how minecraft works before being able to pump something out

    Posted in: Modification Development
  • 0

    posted a message on [Solved] GUI buttons love to render on top of everything
    Quote from Sgt_SuiZ»

    Assuming that this.buttonList is a list of the super class, if I were you I would make a replica of buttonList with a slighly different name and at every drawScreen loop through that list and call drawButton on each element. Because if buttonList belongs to the inherited class it's not surprising that it's doing whatever it wants to with it.


    Great idea! :D Thanks for the help. It works perfectly now. :Diamond: :Diamond: :Diamond:

    Posted in: Modification Development
  • 0

    posted a message on [Solved] GUI buttons love to render on top of everything
    Quote from Sgt_SuiZ»

    but, do you know when drawButton is being called?


    I would assume right as the buttons are initialized. I'll try messing around with it and see if I can fix it


    Edit: changing the functions proved to ruin it.

    And when testing the order drawScreen is run before either drawButtons are; so it makes sense why the buttons

    are on top. I just need to figure out how to change that

    Posted in: Modification Development
  • 0

    posted a message on [Solved] GUI buttons love to render on top of everything
    Quote from Sgt_SuiZ»

    So, where are you actually rendering the buttons?


    Oh right. It's reached by

    [/p]
    [p]private GUI_Crafting_Inventory.NewTab buttonNewTab;
     private GUI_Crafting_Inventory.NewTab buttonNewTab2;
     private GUI_Crafting_Inventory.NewTab buttonNewTab3;
     private GUI_Crafting_Inventory.Craft buttonCraft;[/p]
    [p]


    [/p]
    [p]@SideOnly(Side.CLIENT)
     static class NewTab extends GuiButton
     {
     private static final String __OBFID = "CL_00000745";
     private int tabNumber;[/p]
    [p]public NewTab(int par1, int par2, int par3, int par4)
     {
     super(par1, par2, par3, 65, 20, "");
     tabNumber = par4;
     }[/p]
    [p]/**
     * Draws this button to the screen.
     */
     public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_)
     {
     if (this.visible)
     {
     boolean flag = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition && p_146112_2_ < this.xPosition + 65 && p_146112_3_ < this.yPosition + 20;
     GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
     p_146112_1_.getTextureManager().bindTexture(GUI_Crafting_Inventory.cover);
     int k = 6;
     int l = 185;[/p]
    [p]if (flag)
     {
     l += 22;
     }
     
     //l += 1*tabNumber;[/p]
    [p]this.drawTexturedModalRect(this.xPosition, this.yPosition, k, l, 65, 20);[/p]
    [p]}[/p]
    [p]}
    }[/p]
    [p]

    Just one of the buttons used. This and the other buttons are below everything within the class file but that shouldn't change the layering.

    I'm thinking I need to have this moved into drawScreen in order to have it work. In which case it'll have to be done differently.

    (This method was taken from mc's book gui many weeks ago when I created a diff type of book and liked the button system)

    Posted in: Modification Development
  • 0

    posted a message on [Solved] GUI buttons love to render on top of everything
    [/p]
    [p]public void initGui()
     {
     this.buttonList.clear();
     Keyboard.enableRepeatEvents(true);[/p]
    [p]int k = (this.width - this.craftingImageWidth) / 2;
     int l = (this.height - 159) / 2;
     int l2 = (this.height - 130) / 2;
     
     this.buttonList.add(this.buttonNewTab = new GUI_Crafting_Inventory.NewTab(0, k + 7, l + 7, 1));
     this.buttonList.add(this.buttonNewTab2 = new GUI_Crafting_Inventory.NewTab(1, k + 73, l + 7, 2));
     this.buttonList.add(this.buttonNewTab3 = new GUI_Crafting_Inventory.NewTab(2, k + 139, l + 7, 3));
     this.buttonList.add(new GuiSlider(3, k + 64, l2 + 6));
     //this.buttonList.add(new GuiSliderHorizontal(3, k + 10, l + 10));
     this.buttonList.add(this.buttonCraft = new GUI_Crafting_Inventory.Craft(4, k + 120, l2 + 110));
    
     this.updateButtons();
     }[/p]
    [p]
    is how im adding my buttons (I removed the gl code)
    and then a snippet from my drawScreen is
    [/p]
    [p]public void drawScreen(int par1, int par2, float par3)
     {
     GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);[/p]
    [p]this.drawTexturedModalRect(k + 129, l + 8, 0, 175, 17, 17);
     if (itemstack1 != null) {
     this.drawTexturedModalRect(k + 81, l + 40, 0, 175, 17, 17);
     }
     if (itemstack2 != null) {
     this.drawTexturedModalRect(k + 113, l + 40, 0, 175, 17, 17);
     }[/p]
    [p]GL11.glPushMatrix();
     RenderHelper.enableGUIStandardItemLighting();
     GL11.glDisable(GL11.GL_LIGHTING);
     GL11.glEnable(GL12.GL_RESCALE_NORMAL);
     GL11.glEnable(GL11.GL_COLOR_MATERIAL);
     GL11.glEnable(GL11.GL_LIGHTING);
     itemRender.zLevel = 100.0F;[/p]
    [p]//Ingredient 8
     if (itemstack8 != null) {
     itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), itemstack8, k + 178, l + 68);
     itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), itemstack8, k + 178, l + 68);
     if (itemstack8M > 0) {
    etc code
     for (int i = 0; i < 36; ++i) {
     ItemStack stack = invPlayer.getStackInSlot(i);
     if (stack != null && (stack.getItem() == itemstack1.getItem())) {
    etc code
     }
     }
     String i0 = (quantityHeld >= itemstack8M ? EnumChatFormatting.BLUE : EnumChatFormatting.RED) + "" + quantityHeld + "/" + itemstack8M;
    etc code
     int i1 = this.fontRendererObj.getStringWidth(i0);
     this.fontRendererObj.drawString(i0, k + 186 - (i1 / 2), l + 86, 0);
     }
     }[/p]
    [p]itemRender.zLevel = 0.0F;
     GL11.glDisable(GL11.GL_LIGHTING);[/p]
    [p]if (this.func_146978_c(129, 8, 16, 16, par1, par2) && itemstack != null)
     {
     this.renderToolTip(itemstack, par1, par2);
     }
    GL11.glPopMatrix();[/p]
    [p]

    The 2nd code is very very fragmented from the large function, but I'm not sure what to mark as the culprit of this so I tried to include what I thought would be helpful. And ironically from messing around now the dimming when I render tooltips is permanent. I'll mess around with that in the morning
    Posted in: Modification Development
  • 0

    posted a message on [Solved] GUI buttons love to render on top of everything
    Quote from Sgt_SuiZ»

    Well about moving item tool tips and stuff getting dim, you need to set glColor to white before drawing something with a texture, but maybe you're already doing that and I don't know what I'm talking about.


    Edit: actually you're probably using some automated functions to draw the textured rect. In, that case everything should be sorted out for you.


    It still doesn't help with the layering though sadly

    Posted in: Modification Development
  • 0

    posted a message on [Solved] GUI buttons love to render on top of everything
    Quote from master801»

    Render your buttons first, then your other components last.

    That will make it so buttons are behind your other components. Or so I think.


    If that doesn't work, I think using glPushMatrix and glPopMatrix on the buttons, it will make them "group" together.


    When I grouped buttons together it didnt change the fact that it's rendered on top and when I view item tooltips the buttons all dim.


    So everyone is recommending rendering my buttons first which is the obvious move to make and something I tried, but how can I do it if they are in two separate functions.

    Posted in: Modification Development
  • 0

    posted a message on [Solved] GUI buttons love to render on top of everything
    Quote from Leviathan143»

    I believe GUI elements rendering depends on where they are in the code. So if you render your buttons after your text, the buttons will be in front of the text. If you render your text after your buttons, the text will be in front.


    I have everything within drawScreen layered in order from bg to fore front so that shouldn't be the problem.

    Buttons are created in initGui though so it's a different function entirely.

    Quote from Sgt_SuiZ»

    What do you mean by 'parts that are beneath the image'?


    Like if the text starts to the left and is long enough that it intersects with the button then it is covered by the button.

    Posted in: Modification Development
  • 0

    posted a message on [Solved] GUI buttons love to render on top of everything
    Quote from Sgt_SuiZ»

    Try rendering the text and stuff in a different position than the buttons.


    I have but it covers the parts that are beneath the image.


    I'm close to resorting to having invisible buttons and updating the background based on the hover state of a button's position.

    It adds on extra work though and makes the code sloppier.

    Posted in: Modification Development
  • 0

    posted a message on [Solved] GUI buttons love to render on top of everything

    I'm not sure how to render the buttons in a different way so that they aren't always on top of everything.

    In my GUI O'm working on, the text and item tooltips and etc are all covered by buttons (scrollbars included).


    I've tried messing around with it to no avail, and I know it has to be possible but I'm not sure how.

    And I can't find any materials on it online or a specific difference in vanilla code


    Any help is greatly appreciated :)

    Posted in: Modification Development
  • 0

    posted a message on How do I change my custom block texture onRightClick?

    As long as the block works fine as it is the only thing you should have to change to make this work is the block file.


    You can either use a variable within the file or use NBTs and save that to the tile entity and then change the value with the activated function. If you do anything other than NBTs then it will reset when the game is closed, but using NBTs will require more work to accomplish if you don't know how to do it

    Posted in: Modification Development
  • 0

    posted a message on Non Cube Models (Techne)

    The texture when it's rounded is much different in behavior and on a side note so is the way to add it in game. You can't use the same method that you would use to add a "cube" model as you call it :P. I tried once before a year ago

    Posted in: Modification Development
  • 0

    posted a message on Naming system that supports a vast amount of possibilities
    Quote from tim4242»

    How about another way to make the name base larger, just adding "last names" to the other ones, those can be randomly generated by a pronounceable word generator of sorts, then they get put in a list so there are no duplicates.


    Hm. True. If I add a list of both then I can generate first and last separately I can easily create over 100,000 possibilities. I think that's actually the way I'll go. It's more similar to the real notebook's functionality

    Posted in: Requests / Ideas For Mods
  • 0

    posted a message on Naming system that supports a vast amount of possibilities
    Quote from wakkytabbakky»

    is it possible to split players and all other entities up ? so players have a huge number of set names but other entities have numbers etc in the name also that way it wont be as bad


    so like if livingentity = player

    give human name

    else

    gives entity1 entity2 etc ( or something like that)


    just thinking as if you do make this SMP some poor fellow might get killed because someone left a number off :P


    otherwise i think the underscore with numbers is good or just google a name generator and add 1000 names to the list :P


    Oh. haha. I could give players the original list of names then give entities the numbered version of it.

    I have been using an a-z male/female list of names to add some but some of them are ridiculous and I have to have type each name so I don't want too many names in it XD. But yeah I think that settles it. players get the originals and all other entities get 0-9. With 500-750 different possible player names I think it's safe to say guessing names you know are on the list won't do you much good :P Especially since you may get yourself


    For the sake of SMP or large worlds I may make it two digits that follow living entities' names just to secure a large amount of names. And only one death note is born into existence and it is spawned into a chest within a certain number of blocks of the first player to load the world. I should probably add a minimum distance too since I've loaded enough worlds to where I've had it spawn next to me

    Posted in: Requests / Ideas For Mods
  • To post a comment, please or register a new account.