Jump to content

Mew

Members
  • Posts

    567
  • Joined

  • Last visited

Everything posted by Mew

  1. Also, with your example, you are working with a null pointer, i.e. rand. You never give rand a value, you might want to change that
  2. 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
  3. I am pretty sure that the username is stored in the current session. I believe a new session is created when you log in.
  4. 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 )
  5. 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. *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 ( except for the moderators etc. and the Forge team )
  6. 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
  7. 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
  8. 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...
  9. GotoLink is ABSOLUTELY RIGHT! Even if it is a core mod that edits base files, it is still a MOD so it goes in the MODS FOLDER. It should then be able to iterate as you are wanting to do. ( Notice I said SHOULD... )
  10. A slightly better, and less resource/time consuming way to do this would be to implement to of the earlier said ways. You would first do a check to see if the player has the item in their inventory, THEN run the for loop to get what slot it is in, and from there, get the itemstack. If the player doesn't have the item... Just do nothing.
  11. 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".
  12. 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 >.>
  13. That will probably be because you are not in the view that you specified in your render code if you told it to only render the model in third person, it will only render in third person. If you tell it to only render the model in first person, it will only render in first person.
  14. 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 )
  15. My question for that, is how would I do that exactly? 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 } }
  16. 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 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)
  17. Also, if you want to look at a working implementation of the "bars", I have a mana bar that I drew in one of my mods, feel free to take a look at it: https://github.com/ModderPenguin/MinePG/blob/master/source/minepg/rpg_common/rpg/client/gui/GuiManaBar.java
  18. Well first thing first, you have done this slightly wrong. You need to override the method initGui() and move your buttonList call to that method. That should clear it up If it doesn't... Just post again
  19. 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
  20. 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 )
  21. 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
  22. I believe that that is set in the actual entity file itself. You could always just go through all the fire blocks within a certain radius around the player and clear the them every time you click... But that is a bit inefficient. So I am not to sure on this...
  23. Read the code that Draco18s has posted... What he forgot to tell you was to do the null check.
  24. * 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.