BeYkeRYkt / LightAPI

[ARCHIVED] Bukkit/Sponge library for create invisible light source
MIT License
56 stars 36 forks source link

Not working on papers latest builds #20

Closed Boy0000 closed 3 years ago

Boy0000 commented 3 years ago

Probably not unknown to you, but figured I would mention it.

Trying to set light does nothing, and whenever i getLightLevel it returns -11 image

It also returns -11 even when im not setting and just getting the lightlevel

Not sure if im the one doing it wrong or if its just not fully working for Papers Tuinity merge just yet

BeYkeRYkt commented 3 years ago

I'm not sure, but there are some comments:

  1. Do not call LightAPI.initialization(). It is intended for internal use.
  2. The lighting level may not change if the current lighting level is brighter than the required one.
  3. Use ResultCodes. The setLightLevel/getlightlevel methods can return the execution code from this list.
  4. I'm not sure, but it seems broadcastVal shows the value of "location.blockZ".

For example:

        int blockLight = LightAPI.get().getLightLevel(worldName, blockX, blockY, blockZ, LightFlag.BLOCK_LIGHTING);
        broadcastMessage("LightLevel: " + blockLight);
        int resultCode = LightAPI.get().setLightLevel(worldName, blockX, blockY, blockZ, lightLevel);
        switch (resultCode) {
            case ResultCode.SUCCESS:
                // The request was executed.
                break;
            case ResultCode.MOVED_TO_DEFERRED:
                // The request has been moved to the queue and will be executed after a while.
                break;
            default:
                broadcastMessage("Something is wrong. Result code:" + resultCode);
                break;
        }
Boy0000 commented 3 years ago

image image light where im standing is 0 sky 0 block its Kotlin btw hence when lol

BeYkeRYkt commented 3 years ago

Check the name of the world. Code -2 means that the world is unavailable.

Boy0000 commented 3 years ago

Yeah seems location.world.tostring was CraftWorld(name=world) so makes sense why it didnt work. Works after fixing this to be the actual worldname, though i had to hardcode it to the stringname, as world doesnt use Location but takes a string..

PatrickMSM commented 3 years ago

Please close this issue if your issue was fixed.