Bugs in API 0.7.5.2

A new update is now available, introducing a lot of new content!
Latest hotfix: 0.7.5.2 (2024-09-10)
  • Maybe I mussed it but there doesn't seem to be a bug report thread by now.


    I'm gonna use this thread to report bugs (and things I consider to be bugs) in the API version 0.7.5.2.


    Issue 1)


    PlayerHitTerrainEvent

    Code
    ChunkPart chunkpart = net.risingworld.api.World.getChunkPart(evt.getChunkPositionX(), evt.getChunkPositionY(), evt.getChunkPositionZ());
    int terrainID = chunkpart.getTerrainID(evt.getBlockPositionX(), evt.getBlockPositionY(), evt.getBlockPositionZ());
    TerrainMaterialType materialtype = Plants.TerrainMaterialType.get(terrainID);


    I'd expect this code to return the materialtype of the terrain being hit yet it doesn't work as expected.

    e.g. if you hit grassland, gravel or sand terrains it's completely fine, yet if you hit bare soil it does return "water"

  • Unfortunately the Plants.TerrainMaterialType enum does not represent the terrain IDs - currently it is only used to determine the ground material types where plants can spawn, so it does not correlate with a particular terrain ID.


    In general, the "Plants" definitions only contain plant/vegetation related information.


    Currently the API does not expose an enum to represent terrain materials... but we can add this with the next update :)

  • Thanks for telling I was wondering if the two differrent terrain id's really are the same, now it's clear they are not. I'd appreciate to have a way to get some terrain type. It'd be great if for terrains there was something like for other things where you could obtain the expected result when breaking too.


    btw I guess I've found another bug


    Issue 2)

    PlayerPickupItemEvent

    If you catch a pickup event from a furnace and modify the furnace content using the lower code it seems to cause a crash when you do this a second time. No idea why it seems to work the first time.

    In my case I used this code to simulate some sort of material loss due to lack of skill.

    And to make it clear it not only throws an exception it completely crashes the game


    This is one of the crashdumps, doesn't look very helpfull to me but maybe you can see more in it than I am.

  • The next update will introduce a new Terrain enum, which represents the individual terrain ids ^^ Working with it could then look like this, for example:


    Java
    //Terrain ID
    int terrainID = chunkPart.getTerrainID(...);
    //Terrain type
    Terrain terrain = Terrain.get(terrainID);
    //Check terrain type
    if (terrain == Terrain.Hellstone) {
    //terrain is hellstone
    }



    btw I guess I've found another bug

    Thanks a lot for bringing this to my attention! This is indeed a bug :wat: The problem is that we do not clear the memory when creating the array for the getItems() method, we just fill it with the items in the furnace. But if one item is missing (i.e. one entry is null), the array index is not explicitly set to a null ptr - and in JNI, this array index will then just contain a random memory address (and accessing it results in a fatal error). We will fix that with the next update ;)

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!