Jump to content

Mew

Members
  • Posts

    567
  • Joined

  • Last visited

Posts posted by Mew

  1. There are two variables in every GUI class. They are width and height. As you may or may not assume, these are the width and height of the screen.

     

    If you wanted to have the TOP LEFT of the image for the HUD drawn in the very center of the screen, you would draw it at x location width / 2, and y location height / 2.

     

    I hope that helps :)

  2. Lol, maybe. It seems as if he has minor respect for everyone with a descent question, and those that answer correctly and know what they are doing, and then no respect for anyone else xD ( except for the moderators etc. and the Forge team )

     

    More like "no respect for anyone asking what appears to be an uninformed question" regardless of how informed that person actually is.

     

    True.. Even though you can be entirely informed, if you phrase something wrong, the question then takes a completely new path. And that in turn can lead to something that you had not entirely wanted to be informed on. Thus resulting in yourself seeming uninformed.

     

    :/ The joys of misdirection in its fullest. ( and no the magician kind xD )

  3. Glad to see your back from your hiatus Draco :D

     

    It's what happens when you tear your hair out trying to do something that should be simple, only to find that Forge didn't unfinalize something* and get dragged back into the help forum. :P

     

    *Lex told me that there's no reason it should be unfinalized, three days later a pull request is made, acted on, and merged with the main trunk.  I think Lex just hates me.

     

    Lol, maybe. It seems as if he has minor respect for everyone with a descent question, and those that answer correctly and know what they are doing, and then no respect for anyone else xD ( except for the moderators etc. and the Forge team )

  4. Seems a bit... Sketchy.

     

    But anyway. What I would do is make a TickHandler for client ( or is it server in this instance? :/ ) that would take a Boolean from the item that is called, something like: isThisItemLeftClickingOrNot. Then do a check in the handler to see if it is, and then add 1 onto a counter. Then, if the counter is over 20 ticks ( I believe that is one second ) wait, or keep adding, until the variable is false again. Then in the else statement, do another check to see if the counter is greater than 20 ( or however many ticks a second is ).

     

    Example:

    // TickHandler stuff...
    // in whatever method it is
    if ( player.getHeldItem ().getItem ().itemId == YourMod.YourItem.itemId ) {
        if ( YourMod.YourItem.getIsThisItemLeftClickingOrNot )
            counter++;
        else {
            if ( counter >= 20 ) {
                // RELEASE THE ENTITY! Maybe... This should be server side  Ignore the client side above 
            }
        }
    }
    // More TickHandler stuff..
    

     

    So yeah.. Something along those lines. You could also make the tickhandler set a Boolean in the item and check it using the left click function to release the entity... I am not sure which is cleaner. I would assume doing it from the TickHandler would be a bit quicker.

     

    Hope this helps :D

  5. Thanks but now it returns the error "A mod tried to open a gui without being a NetworkMod"

     

    Good thing you solved it, as that error is woefully inadequate, as there are something like FIVE different problems that will generate that error.  I had the misfortune of having the most uncommon one when I was doing my gui container.

     

    Glad to see your back from your hiatus Draco :D

  6. I'll put this in a spoiler so we can all move on:

     

     

    dep·re·cate  (dpr-kt)

    tr.v. de·pre·cat·ed, de·pre·cat·ing, de·pre·cates

    1. To express disapproval of; deplore.

    2. To belittle; depreciate.

    3. Computer Science To mark (a component of a software standard) as obsolete to warn against its use in the future so that it may be phased out.

     

    su·per·sede  (spr-sd)

    tr.v. su·per·sed·ed, su·per·sed·ing, su·per·sedes

    1. To take the place of; replace.

    2. To cause to be set aside, especially to displace as inferior or antiquated. See Synonyms at replace.

     

    Since Common/ClientProxy still work and will continue to work for the foreseeable future as one of several methods to accomplish the same things, it's not really correct to say they've been replaced with something 'new' unless they were absolutely required in earlier versions, but now are optional and planned on being discarded at some point in the future. From what I understand, they were always optional, as they are just user-defined classes, and you can use them or not as Mazetar pointed out. It's all a matter of personal preference.

     

     

     

    Thank you for that... :D

  7. So I guess it's settled then as is the question of GUI tutorials ? :D

     

    Well not really. I still haven't found a GUI tutorial that deals with a simple GUI that itsn't a container. Basically all I want to have is a textbox where the player enters a number and a checkbox. These values get written to the TileEntity as "lightValue" and "isLit", respectively.

     

    So far the tutorials I've seen extend GuiContainer. I'm pretty sure I all I need is GuiScreen but still looking into it.

     

    PS:

     

    Not to beat a dead horse but I posted a definition of deprecated so I don't see how you could say it lacked actual definition. So far it seems nobody subscribes to that definition: the method of coding with proxies has been superceded by the method of coding without them. That is a valid application of the word deprecated.

     

    Even the 1.5.2 examples in the wiki don't use them anymore.

     

    I am sorry if I didn't fully explain myself. I was meaning it in a literal sense. The fact that the Common/Client proxy classes are made by the user means that they CANNOT be actually deprecated...

  8. Herpdy Derp!! Thanks, probs never would have realized that... lol I feel like the kind of person that thinks they lost their sunglasses and then realizes they were wearing them the whole time right about now...

     

     

    Also btw the tutorial that told me to register my entities in my clientproxy is a forge tutorial, its the making of a space marine mod or something like that, it was quite comprehensive....

     

    Haha, thanks for the laugh mate! Sounds a bit like my Grandma... "Have you seen my glasses?", * I point to my eye *, * she puts her hand to her face and finds the glasses sitting on her nose * "Thank you dear".

  9. Well, I see nothing wrong with the code... So I am not sure what the problem is. It is probably something to do with your positioning of the slots...

     

    Anyway, I hope this is solved fairly quickly. I hate small problems like this that take forever to be solved >.>

  10. Can I see the Container class as well please? Also, try not to use xSize and ySize, they aren't actual variables for getting the size of the screen. That is the width/height variables. So use those instead. xSize/ySize are used for the TEXTURE size. ( just a hint :P )

  11. For the first thing, what I would do is have a text field that can't be edited that displays all the numbers that you have put in so far. Then have some sort of "enter" key. Then, when the "enter" button has been clicked, you take the string from the text field and then check to see if it matches the correct pin code. Nice and simple xD

     

    My question for that, is how would I do that exactly? :P

    Do I need to use a text field for it? Ideally I'd like to keep it part of the theme of the GUI, I've never used a text field but I assume it's like a button and is a fixed texture?

     

    The text field is what the title says, it is a field, for text. I believe its called GuiTextField (the class). And no, its not EXACTLY like a button. You still have to click it to use it, but that is all it does on click. It focuses on the text field. And you most certainly wouldn't need a text field, but I would use it. ( But you don't have to, that is just me. And am I right in assuming this is for your currency mod? ) You could instead just use a string and add to the string the number that was pushed in string format.

     

    So for something of an example... :

    String enteredPin = "";
    
    @Override
    public/protected void actionPerformed ( GuiButton button ) {
        switch ( button.id ) [
            case ID_OF_A_BUTTON:
                enteredPin = enteredPin + "0";
                this.isPinLongEnough ( enteredPin );
        }
    }
    
    private void isPinLongEnough ( String pin ) {
        if ( pin.length() == 4 )
            this.authenticatePin ( pin );
    }
    
    private void authenticatePing ( String pin ) {
        if ( pin.equals ( "0101" ) {
            // Execute code to do whatever it is that you were intending to do
        } else {
            // Do some sort of error code, just some graphics or something. This is where the text field would be helpful in my opinion
        }
    }
    

  12. If you want to see real code implementation of a mana system, feel free to browse my MinePG mod source code. I no longer work on that mod so I don't care what you do with the source xD

     

    Here are the relevant classes:

    Drawing the Bar: https://github.com/ModderPenguin/MinePG/blob/master/source/minepg/rpg_common/rpg/client/gui/GuiManaBar.java

    The Mana variables: https://github.com/ModderPenguin/MinePG/blob/master/source/minepg/rpg_common/rpg/playerinfo/PlayerInformation.java

    Regenerating mana: https://github.com/ModderPenguin/MinePG/blob/master/source/minepg/rpg_common/rpg/handlers/events/GenericEventHandler.java (Look at the method, regenerateMana)

  13. Well what is "necessary" is usually a subjective definition :P

     

    I certainly never needed to have a common and client proxy, not in 1.6 and not in 1.3 but hey they made my code become so much cleaner and simpler so for me they where "necessary" ;)

     

    In any case, they can be used and there's no reason to avoid using them nor do you have to use them and therefore they aren't deprecated.

     

    So I guess it's settled then as is the question of GUI tutorials ? :D

     

    I always use my CommonProxy class as my GuiHandler... I am not entirely sure why though. Oh well...

     

    Everyone has their own coding style, this is even shown in simple things like whether or not they use the proxies. I learnt modding with proxies, so I am sticking with just because that is the way I know how to do it, and it is the way I do it. Everyone is different like I above stated. And yes Mazetar, the way the OP described deprecated was a bit... Lacking in actual definition. And as you pointed out, it cannot actually be deprecated. Thanks for clearing that, it was making me worried xD

  14. You have GOT to be joking... Since when did CommonProxy / ClientProxy become depracted?!?!?!?!?!!?!?!?!?

     

    I believe you MAY have read my tutorial.. Probably not though. I don't get into any of the interesting GUI stuff, but it gets a basic GUI working.

     

    I can give you some pointers if you want, just PM me or ask via this thread. ( I can't be bothered to type it all out if you don't want it xD )

  15. For the first thing, what I would do is have a text field that can't be edited that displays all the numbers that you have put in so far. Then have some sort of "enter" key. Then, when the "enter" button has been clicked, you take the string from the text field and then check to see if it matches the correct pin code. Nice and simple xD

  16. * chuckles *

     

    Nice try, but not quite mate. I actually have NO IDEA how to ENTIRELY go about this, but I do know what it would require.

     

    I have never made my own annotation files, but I would suggest looking at the Mod annotation class. I would then also look at what Lycanus Darkbinder suggested, the cpw.mods.fml.common.discovery package.

     

    BUT!!! Before you do ANY of that, go learn a far bit of java. This problem/question seems quite advanced, though I have no idea how hard as I have never tried it, but it is always good to be prepared.

×
×
  • Create New...

Important Information

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