LightAPI
LightAPI copied to clipboard
not showing up LightType.SKY
hey looking forward for this API to grow! i wanna see also api doc!
i made an example of creating and deleting lights: and while LightType.BLOCK works perfect - LightType.SKY doesn't show up in any way - even when i get true from creating it.
the create light:
private void createLight(Location location, int level, boolean flag) { boolean isOk = LightAPI.createLight(location, LightType.SKY, level, flag); System.out.println("Create light: " + isOk); for(ChunkInfo info: LightAPI.collectChunks(location , LightType.SKY, level)){ LightAPI.updateChunk(info, LightType.SKY); } }
also, some ideas i have that you can implement to improve it:
- support for light on all the chunk - not per location.
- support for 2 location that create a line of light.
im using this api for example to highlight at night faction zones.
using paper.1.14.4 almost last version 226#
LightType.SKY means that the lighting is the same as if you were standing under the open sky.
Therefore, to see this lighting you must create it in the cave. The level of the LightType.SKY lighting depends both on "level" parameter you have passed to createLight finction and the time of the day
Try it please and tell me if something will be wrong
ho well that explain alot i used it at night on the open air, with a level of 55. is there way to create like drop of light (think like the light polls in from the sky between clouds: https://i.dailymail.co.uk/1s/2019/03/04/10/10548984-6768521-image-a-2_1551695118893.jpg)
i saw this post on the spigot section -> a custom armor stand that looks like it has this effect: https://proxy.spigotmc.org/b678a5323018c9ea334427da48a4f4f620579c0f?url=https%3A%2F%2Fi.gyazo.com%2F4112a782cff35caefeb805fe97bb5e27.jpg
other problem i found: for some reason if you try to create light above y 32 - it doesn't show up the block light effect.
Tel me please what server version and what code do you use
same code same version: using paper.1.14.4 version 226#
the code who calls it: createLight(location, 25, true);
when location y is higher then 32 it doesn't render the light
any updates?
- level must be 1-15
- position must have at least one trasnparent block around
- after creating light you should send notification to client to update affected chunks
- try to not use async mode while creating light
try the code like next (I wrote without ide, so it can cantain syntax mistakes):
// create light at location with level 15 (default LightType.BLOCK). using async=false
LightAPI.createLight(location, 15, false);
// check if light level has been applied
int checkLevel = location.getBlock().getLightFromBlocks();
if(checkLevel != 15){
// Something went wrong =(
}
// Now send notification to clients which chunks should be updated
// So, get list of chunks to update and send notification about them to clients
for(ChunkInfo info: LightAPI.collectChunks(location , 15)){
LightAPI.updateChunk(info); // after a few milliseconds, clients will be notified
}
Does it resolve your problem? If no, then send me url to download paper.1.14.4
Updated: Try to use https://github.com/Qveshn/ShinyItems to check LightAPI. Drag&Drop, restart server, get torch in hand and test lighting around you