Jump to content

Ernio

Forge Modder
  • Posts

    2638
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by Ernio

  1. Note: I couldn't really place this thread in any sub-forum since it is not really off-topic, nor mc-general, and most certainly not support - "Suggestions" comes as close as it gets.

     

    I know I am not the only one "addicted" to at least Modding Support forum so maybe someone else would also find this handy (because if not, it would be kinda too far to make this feature for one person).

     

    I am just gonna describe it from experience:

    When I come back home (or rather forums) after long day or even few days there is just so much ongoing threads with "NEW" content that opening them all simply takes loads of time (I usually skim whole 1st page or more and open all threads in new tabs and only then proceed to reading/responding/helping). This pretty much allows one to be up-to-date (learn) with anything new and then possibly help others (so there is the reason of "addiction").

     

    Anyway - after considering (since I can't remember when) if it's not too lazy of me to request this, here it goes:

     

    BUTTON.png

    *dank memes*

     

    P.S: To not over-kill - it can open all "new" on currently viewed page in sub-forum and can be located next to mark read.

    Note: It is quite easy to make :P

     

    Thank you for consideration. 8)

     

  2. harvestBlock(...) - ALLOWS null player because harvesting can occur without player (e.g explosion).

    canHarvestBlock(...) - DOESN'T allow, because it is player-specific check. Why the hell would you even use this check if player is NOT harvesting given block? Just don't use it. If you really need some safety check - do it yourself, write helper method similar to canHarvestBlock. What is so difficult?

     

    And no - you don't fire the event, I just mentioned it as a docs reference.

  3. Elytra physics are hardcoded into entity. Look there.

    If "instanceof" is used - you could extend ElytraItem with custom ones, but if item singleton check is used - nothing much you can do.

     

    Other solution is subscribing to LivingUpdateEvent of PlayerTickEvent and simulating Elytra physics on your own, totally surpassing vanilla hardcode.

  4. I know that If if is increased too much the game will crash. I know if its not enough my entities don't get updated enough.

     

    Umm, if you are referring to updateFrequency that decides when to send positioning packets about given entity type then there is not any higher you can go than 1.

    Also - where did you pulled "game will crash" from? It won't...

     

    Lookup vanilla values for reference.

  5. What I can give you is a outline:

     

    1. @Subscribe to ChunkDataEvent.Load

    2. Check if event.getData()#hasKey("generated") - if not - this means that such tag was never assigned thus - chunk has been generated just now. In that case - assign such tag.

    The tag under key "generated" will be 3D ByteArray that will be saving mentioned x/y/z booleans.

    A little bit about compression:

    * Casuals would go ahead and make ByteArray with 16x16x256 = 65536 lenght, meaning it will be that many bytes.

    * Wannabe-cool people would apply 8 times better compression and make each byte (8 bits) hold data for 8 blocks, making it only 8192 in lenghs. Similar approach can be done with 256x64(longs) array. Anyway - this is better, but requires bitwise operations knowledge.

    So what next: If tag was not found assign it - you can do it however you want (as described above) and use some of NBT's methos such as setByteArray or setTagList (list of longs).

    3. Now every chunk in world has array of booleans - I am not sure if chunk data can be read outside above event (probably not), so:

    After all that above, no matter if the tag was there or chunk was just generated - you need to deserialize tag to some boolean[][][] x/y/z array. The array can be placed in some static x/y chunk map, so kinda like Chunk[][] of boolean[][][]. (#javaArraysComprehension).

    4. This data you can access and change from several events such as said BlockBreak.

    5. @Subscribe to ChunkDataEvent.Save and dump data from mentioned "Chunk[][] of boolean[][][]" into event.getData().

     

    Big note: As holding all loaded-from-startup chunks would be retarded you need to design some cleaning system that will remove no longer used chunk's booleans. While that is easy (nullify data on ChunkDataEvent.Save), you also need to take care of your arrays design - this can't be just "Chunk[][] of boolean[][][]" because it would kill RAM (5D array?), think of Objectifying it to some data structures and Lists/Maps.

  6. Well, he never directly asked for code, but "tips".

     

    So here you go:

     

    I'd recommend doing whole mod client-sided. Use ClientTickEvent to check Minecraft#thePlayer position and somehow decide that he is on edge of block.

    How to check edge? Block go from e.g 0.0-1.0, so logically - check if you are very close to full numbers and if the edge of block you are standing on is next to air block in given direction. Additionally check if you are not in air (jump) and stuff such as knock backs or running or being suffocating.

    Basically - all kinds of stuff to make it work "nice".

    Then when you finally pass all those checks you can simulate sneaking by sending packets to server saying you are sneaking (so basically simulate clicking sneak key) - on how to do that look at how vanilla inputs such stuff.

     

    Detailed help will not be provided because you are too outdated. Update.

  7. 1. Did you register event?

    2. I don't think MouseEvent is cancelable (read docs).

    3. MouseEvent (like any other input events) are client-sided. First of all they shouldn't be placed in common classes like Item. Second - you will need packets to do anything there (send packet to server from client when you want to do stuff).

  8. So I am making that JavaFX rewrite to MC which basically does whole gui and layout for you.

     

    Aside from basically everything - there is one big difference between JFX and MC:

    JFX recalculates layout when needed - and that is (aside from forced property changes) also when window is resized (so it changes while you are resizing)

    MC apparently freezes whole damn client whenever window is grabbed (which includes holding, moving, resizing).

     

    Now - as far as auto-layouting goes - it becomes kinda pointless to re-layout elements when they will be just freezed (not rendered) until you stop holding MC window.

     

    So now my choices are:

    1. Layout only on initGui() (so basically after you stop holding window) - which is VERY reasonable.

    2. Try to not-freeze whole client (server still works in background, so I don't see why we would need to freeze whole damn client).

     

    I will try to do 2nd (and if too hard, back to 1st), so question:

    * Where is the code responsible for it, because hell, can't find shit.

    * Is it whole client thread being freezed or just rendering (GL halt)?

     

    P.S: When you think about it, it would probably have to become coremod...

  9. 1. Version?

    2. Sided mod (present on server) or client-only?

    3. Should friend list be ever saved (quit/join world/server)?

    4. The logic you described:

     

    if(Player is hit)

    Friends.clear();

    Friends.add(Player's Display Name);

     

    ...will end up with List being of size == 0 or 1. Is this desired outcome? If yes - don't use List. Make direct reference to EntityPlayer (or null).

  10. 1.

    1.8.9 is the last version featuring IEEP. Update to new Capabilities: http://mcforge.readthedocs.io/en/latest/datastorage/capabilities/

    Some examples: https://github.com/MinecraftForge/MinecraftForge/tree/1.9/src/test/java/net/minecraftforge/test

    And google open source mods :)

     

    2.

    As of introduction of Capabilities (read 1st link)- it is HIGHLY recommended to dump all usage of vanilla interfaces and use IItemHandler (or other forge tools).

    Said that - if you want to do it professionally (like good modder would) - you want to expose implementation of your inventory via said capability system. So yeah - separate class exposed by capability assigned to Entity.

    This way you use full power of Forge inter-mod compatibility/design.

  11. He never fails to disappoint.

    64684615.jpg

     

    No, but seriously - this has triggered deep research as to what "Never fail to disappoint." actually means...

    While I know the phrase, I probably just never used it and to this point never really knew for sure.

    Apparently many people think it means "He always delivers." while logically approaching it means "He always disappoints."

    Said that - you gave me thank you so my guess you thought it was the 1st.

     

    width=480 height=360http://i1.ytimg.com/vi/GD6qtc2_AQA/hqdefault.jpg[/img]

     

    #topicGoneOfftopic

  12. A bit of design walk through:

     

    We have few things to cover:

     

    Entity

    IEEP or Capability

    IInventory or IItemHandler

     

    Before you can even start:

     

    1. What version are you on?

    * 1.7.10 will not get any further support.

    * 1.8.x should be immidiately updated to 1.9+, preferably 1.10+.

     

    2. Will the inventory in question be ONLY EVER assigned to one type of entity, or maybe it can also be assigned to other entities (like zombies or whatever)?

     

  13. Try removing the space in the Joiner.on(" ")

    Nope...

    Try removing the space in the Joiner.on(" ")

    Didn't work.

    Because it was correct. Read Guava docs.

     

    I already gave you solution in my 1st post.

    DO YOUR STATEMENTS LIKE I SHOWED AND DON'T USE "return"... (Joiner is never reached)

  14. if (status == true)
    do stuff;
    if (status == false)
    do otherStuff;
    

     

    *triggered*

     

    if (status)
    do stuff;
    else
    do otherStuff;
    

     

    ^ Hint: 2nd is better?

     

    As to "args problem" - build your string with StringBuilder or just with:

    String res = "";
    for (String s : strings)
    res += s + " ";
    

  15. I'd just like to add:

    * For players use PlayerTickEvent (tick events have phases meaning pick START or END).

    * Redesign your stuff:

    - You don't need prev/next (or last/current whatever you call it) variables.

    - Make setter method that will (if called on server) send packet whenever "valueToSet != current".

    - I'd also split "mana" and "maxMana" into separate packets (and apply tip above).

    - You seem to not store EntityPlayer inside Capability (assuming that since you are passing EntityPlayer to #updateClient method) - you could redesign it without passing such args.

×
×
  • Create New...

Important Information

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