Posts by Minotorious

A new update is now available, introducing a lot of new content!
Latest hotfix: 0.7.5.2 (2024-09-10)

    Das mit den Kleidern in die Hand nehmen brauch ich dennoch!

    ehm aber du kannst das gleiche wie Item.ObjectAttribute attribute = item.getAttribute(); mit Item.ClothingAttribute attribute = item.getAttribute(); machen. :/


    Beispiel aus der API:

    The PlayerKeyEvent and the java.util.Scanner are doing completely different things so they are not really comparable to use one in place of the other.


    The PlayerKeyEvent is called when a player presses a button on their keyboard and does something using that key.


    The java.util.Scanner requires a full text input, it reads that input and then does something with it i.e. like you do with the PlayerCommandEvent, getting the command as a whole and splitting it to identify what the player wants to do. The Scanner would do more or less what the String.split() method does in this case but in a more complex manner.


    But generally speaking you can use every Java method you want since the game is not limiting your coding to API methods only :)

    Dann kann ich dir eine zweite lösung anbieten:

    I had a look at the NPC class just now and there is no inventory related methods. NPC in general don't have an inventory, once they die they do drop some items but that "inventory" is not accessible through the API atm.


    on your other question, an NPC remains an NPC after death as there is a .isDead() method for the API to check for that state ;)

    sorry für die späte Antwort, für Objekte du kannst public static Definitions.ObjectDefinition getObjectDefinition(java.lang.String name) nutzen ;)


    dann du hast Methoden wie: .getID() und endlich kannst du:



    Hoffe es hilft :)

    Wenn ich aber eine Werkbank in der Hand halte und nach id frage, kommt da 800 raus statt 9!

    das ist kein fehler, die Werkbank ist eine Object d.h. objectkit Item im wenn im hand (vom Items Tabelle definitions.db datenbank ID: 800) und zum spawnen mit dem API du solltest die Object ID nutzen i.e 9 für die Werkbank aus dem Objects Tabelle im definitions.db ;)

    Just to add my cookie to the discussion, I would find it dangerous if a plugin could somehow access my filesystem when I connect to a server without my permission at least :/


    If I consent to it then it is my fault if something goes wrong :D


    Edit: I see on the Javadoc there is a Player.setOption(blabla) method so why not have a Player.getOption(blabla) method too to get such settings from the client?

    well it all comes down on how you import things, when you do import java.sql.PreparedStatement; that only imports the one Java class called PreparedStatement from the java.sql package. So it makes sense for you not to be able to use say the Connection class for example even though they are both in the same package.


    To be able to use all the classes of a package you need to import it as java.sql.* so that the import includes all the classes of the package and not just one.


    having said that though it is not good practice to import huge packages if you are only going to use 3-4 classes thereof ;)

    If positional coordinates are found int large numbers like 4658.49166.81 -1664.58. How does an area stored in small numbers relate If a size of a chunk is 20 x 20 blocks and 68 blocks high. Is this position 232 chunks away from the origin?

    My bad the chunk is 16x64x16 not 20x68x20 so this position is approximately 291 chunks away from the origin.


    ok let me try to clarify this further. The game has 2 coordinate systems, the global one and the chunk one.


    The Global coordinate system is using float values. The values in it are the number of blocks you are away from the origin (0,0) including decimals for when you are between block positions.


    The Chunk coordinate system is using int values. The values are the block position within the chunk and the chunk position within the world. e.g. in chunk 1 walking straight in the x-direction I can go from a block position of 0 to 15 at which point I will cross into chunk 2 and start walking again from the chunk 2's 0th to 15th block.



    @red51 I just noticed something in the Javadoc, in the Chunk information net.risingworld.api.utils.Chunk it says a chunk is 16x64x16 while in the same page under the blockData() and terrainData() methods it says they are 20x68x20 why the difference by 4 in each value?

    ooooh no then it is something completely different. The area protection database is storing areas based on the start and end point by using these four methods:

    • Vector3i getStartBlockPosition()
    • Vector3i getStartChunkPosition()
    • Vector3i getEndBlockPosition()
    • Vector3i getEndChunkPosition()

    Each of the Vector3i objects consist of 3 int values the X, Y, and Z positions. The database is storing these 12 values in total to be able to recreate the areas once the server restarts.


    Edit: These methods are under the Area class: net.risingworld.api.utils.Area

    I have another routine similar that needed the brackets to execute the look up task as a complete variable

    I am not sure there is any case in Java needing such weirdly placed brackets :/ the most complex bracket structure you can find in Java is either a lambda expression (i.e. how you specify the runnable task of a timer) or a casting structure i.e. int a = (int) myTimer.getTick()


    but glad you have managed to get it working in the end :)

    well socks are a "feet" tagged item and sandals are a "feet" tagged item too so similarly to you not being able to wear two pairs of boots one on top of the other you can't wear sandals on top of socks. This is not a bug for it to be fixed, it is the game's intended behaviour.


    Having said that idk if red will want to make an exception for sock-like items in the future.

    I don't think extra brackets can cause any problems unless you haven't closed them so that is why your code still works with them there. ;)


    Having said that Java is not Lisp thus it is not good practice to add extra unnecessary brackets of any kind be they round (), square [], or curly {}. Anyway I think most IDEs will underline (probably yellow or green but not red as they are not "in error") unnecessary brackets.