Jump to content

Ernio

Forge Modder
  • Posts

    2638
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Ernio

  1. Ye sure, remind me what version are you on? Few hints: * Extend GuiScreen. * Open gui client side (unless you need container). * There are alredy few things implemented, outside IDE so mind naming, but they are there in vanilla/forge: GuiSlider and GuiTextField/Box. * You can replicate them / extend to your needs or maybe they are enough, as to GuiTextField/Box - you can track input and check if those are numbers and stuff. * For all inputs you will need to send packets to server (obviously). For a control system I'd make one key-value relation packet (in your case also dimension I guess). * As to stick - yup, there is GuiScreen#handleMouseInput() which should be a good place to track mouse movement. Hell you can even do that in drawScreen, etc. * Note: If you are planning to send mouse (stick) packets - do it from updateScreen() (I think) method (which is tick-based, not FPS) and send mouse every 3-5 ticks. Namings may be off a bit but that should put you on track (you are skilled). Props on mod
  2. Ye sure, remind me what version are you on? Few hints: * Extend GuiScreen. * Open gui client side (unless you need container). * There are alredy few things implemented, outside IDE so mind naming, but they are there in vanilla/forge: GuiSlider and GuiTextField/Box. * You can replicate them / extend to your needs or maybe they are enough, as to GuiTextField/Box - you can track input and check if those are numbers and stuff. * For all inputs you will need to send packets to server (obviously). For a control system I'd make one key-value relation packet (in your case also dimension I guess). * As to stick - yup, there is GuiScreen#handleMouseInput() which should be a good place to track mouse movement. Hell you can even do that in drawScreen, etc. * Note: If you are planning to send mouse (stick) packets - do it from updateScreen() (I think) method (which is tick-based, not FPS) and send mouse every 3-5 ticks. Namings may be off a bit but that should put you on track (you are skilled). Props on mod
  3. 1.6.4 is ancient (years), noone can help you. Update or look on your own. I alredy told you - look into Item.class and find method with name that sounds like it does what you want and @Override it.
  4. 1.6.4 is ancient (years), noone can help you. Update or look on your own. I alredy told you - look into Item.class and find method with name that sounds like it does what you want and @Override it.
  5. Dude, what are you doing? What are you doing with that WeakReference? Is needs to be saved INSIDE PLAYER. My prev post explains step by step what you should do.
  6. Dude, what are you doing? What are you doing with that WeakReference? Is needs to be saved INSIDE PLAYER. My prev post explains step by step what you should do.
  7. 1. Version? 2. What are those imports? AWT, really? 3. I don't think there is such method in superclass onItemUse(EntityPlayer entityplayer), you need to actually @Override something. Look into Item class or some Item tutorial. 4. I am almost certain you don't know Java - please learn something, basics at least.
  8. 1. Version? 2. What are those imports? AWT, really? 3. I don't think there is such method in superclass onItemUse(EntityPlayer entityplayer), you need to actually @Override something. Look into Item class or some Item tutorial. 4. I am almost certain you don't know Java - please learn something, basics at least.
  9. If you are calling clear on it, why bother filling it with super call? Super should be called if you want to preserve parent attribs and while you should (to preserve hierarchy) do what Choonster does, you can just make new Map. Simply don't call super and make new Multimap.
  10. If you are calling clear on it, why bother filling it with super call? Super should be called if you want to preserve parent attribs and while you should (to preserve hierarchy) do what Choonster does, you can just make new Map. Simply don't call super and make new Multimap.
  11. FMLCommonHandler.instance().getMinecraftServerInstance() Note this should be used by server threads. Returns: * SP: Client/Server = Integrated * MP/LAN: Client = null Dedic = Server Just in case: http://mcforge.readthedocs.io/en/latest/concepts/sides/ You can also get player per-world, look into World class (or maybe WorldServer), something like getPlayerEntities().
  12. FMLCommonHandler.instance().getMinecraftServerInstance() Note this should be used by server threads. Returns: * SP: Client/Server = Integrated * MP/LAN: Client = null Dedic = Server Just in case: http://mcforge.readthedocs.io/en/latest/concepts/sides/ You can also get player per-world, look into World class (or maybe WorldServer), something like getPlayerEntities().
  13. I am only here to say that you would be much better if you would work with official wiki. Not doing so will likely result in project being dead before end of the year. I am not taunting you, just saying that I saw MANY attempts on centralizing things with wikis, tutorials, samples, etc. and only ones standing always are official ones and those who have their own host (mostly popular hosted tutorial pages). As to writing wiki - without extensive knowledge of Forge like few people on this forum, you won't make anything that is not alredy there (and there is a lot). Again - don't get the wrong idea, I am just a mere opinion passing by. I could even give you damn lessons if you could write them down to be public on official forge wiki (I don't have time to write, but talking on e.g Skype is my speciality since I can do other things at the same time). Feel free to ask questions when you reach advanced modding (I am 1.9.4, but haven't setup a block since 1.7, meaning I didn't touch new Forge Registry API). What I can recommend as to current question (registration) is looking up source of 1.9.4 MDK. Everything is documented. Lol wut? Look (on this forum) to header. There is a "Wiki" button. EDIT This is also nice: http://mcforge.readthedocs.io
  14. I am only here to say that you would be much better if you would work with official wiki. Not doing so will likely result in project being dead before end of the year. I am not taunting you, just saying that I saw MANY attempts on centralizing things with wikis, tutorials, samples, etc. and only ones standing always are official ones and those who have their own host (mostly popular hosted tutorial pages). As to writing wiki - without extensive knowledge of Forge like few people on this forum, you won't make anything that is not alredy there (and there is a lot). Again - don't get the wrong idea, I am just a mere opinion passing by. I could even give you damn lessons if you could write them down to be public on official forge wiki (I don't have time to write, but talking on e.g Skype is my speciality since I can do other things at the same time). Feel free to ask questions when you reach advanced modding (I am 1.9.4, but haven't setup a block since 1.7, meaning I didn't touch new Forge Registry API). What I can recommend as to current question (registration) is looking up source of 1.9.4 MDK. Everything is documented. Lol wut? Look (on this forum) to header. There is a "Wiki" button. EDIT This is also nice: http://mcforge.readthedocs.io
  15. #JavaQuestion As of now I am using WeakLinkedHashMap with maximum capacity (uses removeEldestEntry) which is basically LinkedHashMap that uses WeakValues (when value is not used entry is removed). I had to do it myself since I couldn't find proper implementation. Since you probably have more knowledge here - is there something in MC libs that allows such map that: * Clears itself (values) when not used (values) * Has max size * Removes oldest entries when overloaded I was looking into MapMaker and some of caching classes but didn't find anything to this extent. In future I also want to improve mine with "waged values" since it (by logical analisys), when overloaded constantly will start recreating objects without caching them at all (since it is linked).
  16. #JavaQuestion As of now I am using WeakLinkedHashMap with maximum capacity (uses removeEldestEntry) which is basically LinkedHashMap that uses WeakValues (when value is not used entry is removed). I had to do it myself since I couldn't find proper implementation. Since you probably have more knowledge here - is there something in MC libs that allows such map that: * Clears itself (values) when not used (values) * Has max size * Removes oldest entries when overloaded I was looking into MapMaker and some of caching classes but didn't find anything to this extent. In future I also want to improve mine with "waged values" since it (by logical analisys), when overloaded constantly will start recreating objects without caching them at all (since it is linked).
  17. It means that you never picked it up on client? Proper way: Client: 1. Right click. 2. Ray trace for entity. 3. If entity was found and is in range (e.g 3 blocks), check if chicken. 4. Send packet containing ray traced chicken ID. Server: 1. Receive packet, PASS NEW RUNNABLE TO SERVER THREAD: (next steps in runnable) 2. Get EntityPlayerMP from Context, get EntityLivingBase from entityId received. 3. Safety recheck - test if found EntityLivingBase is in proper distance, then check if it is actually EntityChicken. 4. Found instance of EntityChicken save as WeakReference on server side @Capability or IEntityExtendedProperties assigned to player who sent packet. 5. Use EntityTracker to update all players tracking player who picked up chicken with packet. * Packet will containt entityId of: player who picked up chicken, chicken picked up. Client: (all receivers) 1. Receive packet, PASS NEW RUNNABLE TO CLIENT THREAD: (next steps in runnable) 2. Set client side @Capability or IEntityExtendedProperties of RECEIVED (from packet's player's entityId) EntityPlayer to have reference to EntityChicken from entityId chicken received. 3. Additionally - since it may happen that new EntityPlayer will come up to you while you are alredy holding chicken - you need to notify them: * Use PlayerEvent.StartTracking to update event.player about event.target (target is the EntityPlayer that would be holding chicken the moment someone else starts seeing him). Both: 1. Now - use PlayerTickEvent (START or END) to move chicken on BOTH SIDES in such way it always fits player's Y coord and rotation (this is pure math). This all will give you side-backed smooth movements of held Chicken on all clients seeing given player. Note: It is also possible to totally perform all chicken movements from server, but idk how well that will do with smoothness. In that case you can remove all blue steps. P.S: This is all theorycraft that will work (where I am not sure about blue part). I didn't have fun in field of moving entities for some time, so maybe server-only will work just as smooth as one could expect. Now when I think about it - it even should. For all I care yo ucould be even updating client side entities with RenderTickEvents lol (totally viable).
  18. It means that you never picked it up on client? Proper way: Client: 1. Right click. 2. Ray trace for entity. 3. If entity was found and is in range (e.g 3 blocks), check if chicken. 4. Send packet containing ray traced chicken ID. Server: 1. Receive packet, PASS NEW RUNNABLE TO SERVER THREAD: (next steps in runnable) 2. Get EntityPlayerMP from Context, get EntityLivingBase from entityId received. 3. Safety recheck - test if found EntityLivingBase is in proper distance, then check if it is actually EntityChicken. 4. Found instance of EntityChicken save as WeakReference on server side @Capability or IEntityExtendedProperties assigned to player who sent packet. 5. Use EntityTracker to update all players tracking player who picked up chicken with packet. * Packet will containt entityId of: player who picked up chicken, chicken picked up. Client: (all receivers) 1. Receive packet, PASS NEW RUNNABLE TO CLIENT THREAD: (next steps in runnable) 2. Set client side @Capability or IEntityExtendedProperties of RECEIVED (from packet's player's entityId) EntityPlayer to have reference to EntityChicken from entityId chicken received. 3. Additionally - since it may happen that new EntityPlayer will come up to you while you are alredy holding chicken - you need to notify them: * Use PlayerEvent.StartTracking to update event.player about event.target (target is the EntityPlayer that would be holding chicken the moment someone else starts seeing him). Both: 1. Now - use PlayerTickEvent (START or END) to move chicken on BOTH SIDES in such way it always fits player's Y coord and rotation (this is pure math). This all will give you side-backed smooth movements of held Chicken on all clients seeing given player. Note: It is also possible to totally perform all chicken movements from server, but idk how well that will do with smoothness. In that case you can remove all blue steps. P.S: This is all theorycraft that will work (where I am not sure about blue part). I didn't have fun in field of moving entities for some time, so maybe server-only will work just as smooth as one could expect. Now when I think about it - it even should. For all I care yo ucould be even updating client side entities with RenderTickEvents lol (totally viable).
  19. Simply check if (player != null) - what Choonster said.
  20. Simply check if (player != null) - what Choonster said.
  21. Depends "add slot" - to what? Player I guess, but you want to have additional slot inside player inv or maybe have additional inv? In any case - this is like clash of 4 biggest parts of intermidiate modding: * IExtendedEntityProperties * SimpleNetworkWrapper (packets) * Container+GUI+Slot * Events And few lesser parts of MC like: * NBT * PlayerInventory (IInventory) I doubt you will find (maybe) tutorial telling exatly what to do (there are many approaches), but you should be able to find enough on mentioned topics to make your own thingy. Success is directly dependent on how well you know Java. I can walk you through, but no code will be provided - now the question is - are you capable (if this would be 1st mod, it might be too hard)?
  22. Depends "add slot" - to what? Player I guess, but you want to have additional slot inside player inv or maybe have additional inv? In any case - this is like clash of 4 biggest parts of intermidiate modding: * IExtendedEntityProperties * SimpleNetworkWrapper (packets) * Container+GUI+Slot * Events And few lesser parts of MC like: * NBT * PlayerInventory (IInventory) I doubt you will find (maybe) tutorial telling exatly what to do (there are many approaches), but you should be able to find enough on mentioned topics to make your own thingy. Success is directly dependent on how well you know Java. I can walk you through, but no code will be provided - now the question is - are you capable (if this would be 1st mod, it might be too hard)?
  23. As to GUI - I don't see any attempt on your rendering multiline. You need to make custom TextBox (probably extend normal one) and draw contained string using FontRenderer#drawSplitString. Where is the problem? As to player - I told you to link relevant classes, I can't find shit, your code and packages are too messed up (also - centralize your events and separate client from server/common). Side note: You creates shitload of API systems that don't even apply to vanilla/forge design. I recommend learning how vanilla/forge works before writing tons of API interfaces. That is your decision tho.
  24. As to GUI - I don't see any attempt on your rendering multiline. You need to make custom TextBox (probably extend normal one) and draw contained string using FontRenderer#drawSplitString. Where is the problem? As to player - I told you to link relevant classes, I can't find shit, your code and packages are too messed up (also - centralize your events and separate client from server/common). Side note: You creates shitload of API systems that don't even apply to vanilla/forge design. I recommend learning how vanilla/forge works before writing tons of API interfaces. That is your decision tho.
  25. 1. Cleanup your code (what's with commenting out //@Override anyway?) 2. Link all relevant classes. 3. Restate all your issues. 4. Post errors if present and make sure that ALL code you've linked is being CALLED (make prints). P.S - Following up on threads that have few pages is just as time consuming as confusing.
×
×
  • Create New...

Important Information

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