Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tunity Starlight Support. #32

Open
EuanM199 opened this issue Jul 15, 2021 · 21 comments
Open

Tunity Starlight Support. #32

EuanM199 opened this issue Jul 15, 2021 · 21 comments

Comments

@EuanM199
Copy link

EuanM199 commented Jul 15, 2021

Since the popularity of starlight by being both in tuninity and its forks, could we get support for starlight?

here is the current issue I have found due to starlight + LightAPI

[20:56:19 WARN]: [InteractionVisualizer] Task #205 for InteractionVisualizer v1.16.2.3 generated an exception java.lang.ClassCastException: class ca.spottedleaf.starlight.light.StarLightInterface$2 cannot be cast to class net.minecraft.world.level.lighting.LightEngineBlock (ca.spottedleaf.starlight.light.StarLightInterface$2 and net.minecraft.world.level.lighting.LightEngineBlock are in unnamed module of loader 'app') at ru.beykerykt.lightapi.server.nms.craftbukkit.CraftBukkit_v1_17_R1$2.run(CraftBukkit_v1_17_R1.java:166) ~[?:?] at ru.beykerykt.lightapi.server.nms.craftbukkit.CraftBukkit_v1_17_R1.executeSync(CraftBukkit_v1_17_R1.java:242) ~[?:?] at ru.beykerykt.lightapi.server.nms.craftbukkit.CraftBukkit_v1_17_R1.recalculateLighting(CraftBukkit_v1_17_R1.java:159) ~[?:?] at ru.beykerykt.lightapi.server.nms.craftbukkit.CraftBukkit_v1_17_R1.deleteLight(CraftBukkit_v1_17_R1.java:103) ~[?:?] at ru.beykerykt.lightapi.LightAPI$2.run(LightAPI.java:375) ~[?:?] at ru.beykerykt.lightapi.LightAPI.deleteLight(LightAPI.java:386) ~[?:?] at ru.beykerykt.lightapi.LightAPI.deleteLight(LightAPI.java:349) ~[?:?] at com.loohp.interactionvisualizer.managers.LightManager.lambda$run$0(LightManager.java:133) ~[?:?] at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.run(CraftTask.java:100) ~[patched_1.17.1.jar:git-Purpur-1265] at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:468) ~[patched_1.17.1.jar:git-Purpur-1265] at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1565) ~[patched_1.17.1.jar:git-Purpur-1265] at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:492) ~[patched_1.17.1.jar:git-Purpur-1265] at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1480) ~[patched_1.17.1.jar:git-Purpur-1265] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1270) ~[patched_1.17.1.jar:git-Purpur-1265] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Purpur-1265]

@Qveshn
Copy link
Owner

Qveshn commented Jul 15, 2021

I did quick look at the source code here https://github.com/Tuinity/Starlight.
Yes, starlight has rewritten bukkit light engine. Therefore, ATM LightAPI is incompatible with starlight.
Additional research is required for this mod. Also, I am not very good with mods.
I need a brief description: how, where and what excatly to install to start the server with this mod (step by step).
Next, I will try to do research and, probably, the solution.

@EuanM199
Copy link
Author

EuanM199 commented Jul 15, 2021

Starlight is already built into Tuninity, Purpur, and airplane by default, it's not actually a mod,
See https://github.com/Tuinity/Tuinity and https://github.com/pl3xgaming/Purpur

its actually built into the forks by default and not a mod
you can use it by installing purpur, tuninity or airplane
no outside mod or plugin is required

@Qveshn
Copy link
Owner

Qveshn commented Jul 15, 2021

https://github.com/Tuinity/Tuinity -> https://ci.codemc.io/job/Spottedleaf/job/Tuinity/ -> tuinity-paperclip.jar #240
last version 1.16.5

will try purpur instead

@EuanM199
Copy link
Author

this is the correct CI for Tuninity 1.17 https://ci.codemc.io/job/Spottedleaf/job/Tuinity-1.17/

@Qveshn
Copy link
Owner

Qveshn commented Jul 15, 2021

https://github.com/pl3xgaming/Purpur -> https://purpur.pl3x.net/downloads/ -> purpur-1.17.1-1265.jar
downloaded

This server is running Purpur version git-Purpur-1265 (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT) (Git: 2824f64 on HEAD)

LightAPI do not work, but no exceptions...

Does I need to set any property in configs to turn on Tunity Starlight?

@EuanM199
Copy link
Author

its on by default, this error i found only started appearing when interaction visualizer was used,
https://www.spigotmc.org/resources/interactionvisualizer-visualize-function-blocks-entities-like-crafting-tables-with-animations.77050/

it seems to me like when interaction visualizer goes to call light API to delete light, that's when the error occurs

(ru.beykerykt.lightapi.LightAPI$2.run(LightAPI.java:375) ~[?:?] at ru.beykerykt.lightapi.LightAPI.deleteLight)

@EuanM199
Copy link
Author

EuanM199 commented Jul 15, 2021

i alerted Spottedleaf (Starlight Dev) to this thread and they said this

Spottedleaf
as of 1.17 I don't support custom light sources, as mojang has a custom light block

@Qveshn
Copy link
Owner

Qveshn commented Jul 15, 2021

We have to talk a little in discord serjproch#3585
What is your native language?

@EuanM199
Copy link
Author

Sent, im english

@Qveshn
Copy link
Owner

Qveshn commented Jul 15, 2021

Well, I can fix the bug, but I can not fix the problem yet 😟
The bug - is exception
The problem - is that LightAPI incompatible with Tuinity Starlight and, therefore, purpur, tuinity and other starlight-based minecraft servers, Starlight completely removed mechanics to set custom lights in blocks. 😟

@LOOHP
Copy link

LOOHP commented Jul 15, 2021

Is there no way to set light levels in starlight? I'm looking into their code as well rn.

@Qveshn
Copy link
Owner

Qveshn commented Jul 15, 2021

@LOOHP
They changed class LightEngineBlock and LightEngineSky to anonymous class from interface LayerLightEventListener.
In addition, in this interface, the mechanics of setting the light were cut out, as well as a stub was put in other necessary methods like throw new UnsupportedOperationException();. I do not find workarround yet, 😟

But InteractionVisualizer will work fine because since 1.16.3 armo stands are not darkened in the blocks
The exception was because:
LightAPI.deleteLight(location, LightType.BLOCK, false); is without if (LightAPI.isSupported(location.getWorld(), LightType.BLOCK))
https://github.com/LOOHP/InteractionVisualizer/blob/bb302978828be64b54024dc11c74e663f8d806b8/src/main/java/com/loohp/interactionvisualizer/managers/LightManager.java#L139
You can add this check in LightManager, but I will also need to add this check inside deleteLight because it is also my mistake.
Also, you can add configuration option like 'do-not-use-lightapi' and also softdepend in plugin.yml to LightAPI (instead hard depend)


Also I found error in InteractionVisualizer 1.16.2.6 with spigot 1.14.4:

java.lang.ClassCastException: org.bukkit.craftbukkit.v1_14_R1.block.impl.CraftCampfire cannot be cast to org.bukkit.block.data.Directional
	at com.loohp.interactionvisualizer.blocks.CampfireDisplay.spawnArmorStands(CampfireDisplay.java:381) ~[?:?]
	at com.loohp.interactionvisualizer.blocks.CampfireDisplay.lambda$run$2(CampfireDisplay.java:142) ~[?:?]
	at org.bukkit.craftbukkit.v1_14_R1.scheduler.CraftTask.run(CraftTask.java:81) ~[spigot-1.14.4.jar:git-Spigot-56f8471-56118c6]
	at org.bukkit.craftbukkit.v1_14_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:394) [spigot-1.14.4.jar:git-Spigot-56f8471-56118c6]
	at net.minecraft.server.v1_14_R1.MinecraftServer.b(MinecraftServer.java:1022) [spigot-1.14.4.jar:git-Spigot-56f8471-56118c6]
	at net.minecraft.server.v1_14_R1.DedicatedServer.b(DedicatedServer.java:393) [spigot-1.14.4.jar:git-Spigot-56f8471-56118c6]
	at net.minecraft.server.v1_14_R1.MinecraftServer.a(MinecraftServer.java:970) [spigot-1.14.4.jar:git-Spigot-56f8471-56118c6]
	at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:815) [spigot-1.14.4.jar:git-Spigot-56f8471-56118c6]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212] 

Do I need to create issue?

@LOOHP
Copy link

LOOHP commented Jul 16, 2021

Also I found error in InteractionVisualizer 1.16.2.6 with spigot 1.14.4:

You could create an issue for that as I'm pretty sure org.bukkit.craftbukkit.block.impl.CraftCampfire implements org.bukkit.block.data.Directional. Are you using the last build of spigot 1.14.4?

https://helpch.at/docs/1.14.4/org/bukkit/block/data/type/Campfire.html

From the source created by buildtools:

package org.bukkit.craftbukkit.block.impl;

public final class CraftCampfire extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Campfire, org.bukkit.block.data.Directional, org.bukkit.block.data.Lightable, org.bukkit.block.data.Waterlogged {...}

@Qveshn
Copy link
Owner

Qveshn commented Jul 16, 2021

@LOOHP sorry, it really wasn't the last build. Works fine with the latest build 2502-b.

@LOOHP
Copy link

LOOHP commented Jul 16, 2021

@LOOHP sorry, it really wasn't the last build. Works fine with the latest build 2502-b.

No problem :)

They changed class LightEngineBlock and LightEngineSky to anonymous class from interface LayerLightEventListener.
In addition, in this interface, the mechanics of setting the light were cut out, as well as a stub was put in other necessary methods like throw new UnsupportedOperationException();. I do not find workarround yet, 😟

Maybe discussing with the devs of starlight would make things easier?

@Qveshn
Copy link
Owner

Qveshn commented Jul 16, 2021

Maybe discussing with the devs of starlight would make things easier?

I will try. But I do not know what to say...
"hI, I did what is forbidden to do: picked out the undocumented functions and private fields of the light engine in craftbukkit and used them to set lights, and now Starlight rewrote this engine and its implementation does not coincide with the Bukkit. What should I do now?" 😄
In addition, the developer in discord has already said "as of 1.17 I don't support custom light sources, as mojang has a custom light block" (although in 1.16 LightAPI plugin also quietly did not work with Starlight 😄).

But nevertheless, I will try ...
My main arguments are:

  1. LIGHT BLOCK can be set only in the air (it is an independent block) while custom lights could be placed inside other blocks
  2. LIGHT BLOCK can emmit light only of LightType.BLOCK, while cutom lights can be set both for BLOCK and SKY types
  3. LIGHT BLOCK can be set only from min to max world height, while custom light can be set also in one section below and above world. This will allow to illuminate structures from the outside of the world.

@EchocallingEarth
Copy link

EchocallingEarth commented Sep 8, 2021

This issue is actually going to become pain in the rear to LightAPI now that Tunity is part of Paper which will now be using starlight. Or so I have heard (unconfirmed rumor). Since it seems the blame is pushed solely to starlight.

That is unless I have read something wrongly in the above and other opened/closed issues. Sadly closed means NOT FIXED.

@LoneDev6
Copy link

@Andre601
Copy link

Andre601 commented Nov 7, 2021

Someone pointed out that upstream received a v5 release which seems to include Starlight support amongst other features.
However, the release also mentions that the API has been rewritten, so this could be breaking...

The actual release: https://github.com/BeYkeRYkt/LightAPI/releases/tag/5.0.0-Bukkit

@LoneDev6
Copy link

LoneDev6 commented Nov 9, 2021

Someone pointed out that upstream received a v5 release which seems to include Starlight support amongst other features. However, the release also mentions that the API has been rewritten, so this could be breaking...

The actual release: https://github.com/BeYkeRYkt/LightAPI/releases/tag/5.0.0-Bukkit

I think it's better to wait some time due to the fact that there is no docs for the new API and I suspect it will be rewritten again.

@Andre601
Copy link

Andre601 commented Nov 9, 2021

I already gave my concerns on upstream in an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants