Comments (6)
Hi
Could you tell me what kind of plugin are you planning? What for lights will be created? And how often are you going to destroy/create lights?
from lightapi.
I am planning a plugin that will allow builders to place light sources from a server.
from lightapi.
permanently?
from lightapi.
This plugin was not designed for permanent light sources. Instead of this plugin, I propose to consider the capabilities of another VarLight plugin. It not only exposes the lights in the world, but saves them in a separate world map (files are like mca)
There are some limitations with creating lights in LightAPI plugin. This plugin only sets the light at the position of the block, but does not store information about the light source. Thus, standard minecraft mechanics can destroy the generated light during the update of the blocks. For example, if you put any block next to it, then the light in the adjacent block will be recalculated and the light will be destroyed, because there is no information that there was a light source in it.
Such loss of light must be checked separately from time to time and, if destroyed, re-created.
It's like putting an opened iron trapdoor somewhere, which will remain open until another block is placed next to it. After that, the neighboring blocks will be updated and the trapdoor will be closed.
There is also a problem when placing lights next to each other. In order for the light to spread over 15 blocks around, the plugin triggers the internal mechanics of minecraft to recount the six side blocks, which will cause the destruction of the light installed in them. In other words, the plugin does not allow the lights to be placed next to each other.
from lightapi.
For example, I can bring a code that allows you to expose the light in the desired block.
import ru.beykerykt.lightapi.LightType;
import ru.beykerykt.lightapi.LightAPI;
...
void setLight(Location location, int lightLevel, LightType lightType) {
Block block = location.getBlock();
int oldLightLevel = lightType == LightType.BLOCK ? block.getLightFromBlocks() : block.getLightFromSky();
if (oldLightLevel != lightLevel) {
if (lightLevel > 0) {
LightAPI.createLight(location, lightType, lightLevel, false);
} else {
LightAPI.deleteLight(location, lightType, false);
}
for (ChunkInfo chunkInfo : LightAPI.collectChunks(location, lightType, Math.max(lightLevel, oldLightLevel))) {
LightAPI.updateChunk(chunkInfo, lightType);
}
}
}
You can experiment with this code. Put the light somewhere and then check how it disappears if you put another block next to it.
from lightapi.
@Qveshn Thanks for your quick reply and for pointing out VarLight, I'll suggest that to the server team.
from lightapi.
Related Issues (20)
- Error when loading LightAPI on 1.15.2 Paper HOT 1
- How to implement LightAPI to a plugin? HOT 4
- Lights disappear on block update HOT 1
- Lighting only updates after a server restart HOT 2
- 1.17 HOT 3
- Error stopped chunks from loading HOT 10
- Tunity Starlight Support. HOT 21
- java.lang.ClassCastException: ca.spottedleaf.starlight.light.StarLightInterface$2 incompatible with net.minecraft.world.level.lighting.LightEngineBlock
- Can someone give plugin? HOT 2
- 1.17.1 Pupur Issue HOT 2
- don't see light HOT 13
- [WARN] LightAPIFork on paper 1.17.1-233 HOT 4
- No LightAPI implementations was found for Paper v1_17_R1 HOT 8
- [BUG] starlight.light.StarLightInterface HOT 1
- Error on StartUp
- Добавить поддержку starlight(в виде светлых блоков) для 1.17
- Update to support java 17 and mc 1.18
- Warn flood to console PufferFish core
- Classnotfoundexception on 1.18.2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lightapi.