CloudWolfYT / ShaderSelectorV2

Creative Commons Zero v1.0 Universal
40 stars 1 forks source link

Issue with shake resourcepack on 1.20.6 #2

Open Nik0-0 opened 6 months ago

Nik0-0 commented 6 months ago

Hey! So even the latest version doesnt load up properly.

[20:38:45] [Render thread/INFO]: Caught error loading resourcepacks, removing all selected resourcepacks
java.util.concurrent.CompletionException: java.lang.RuntimeException: could not reload shaders
    at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) ~[?:?]
    at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) ~[?:?]
    at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:722) ~[?:?]
    at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?]
    at auv.a(SourceFile:69) ~[1.20.6.jar:?]
    at bpm.d(SourceFile:162) ~[1.20.6.jar:?]
    at bpq.d(SourceFile:23) ~[1.20.6.jar:?]
    at bpm.A(SourceFile:136) ~[1.20.6.jar:?]
    at bpm.bA(SourceFile:121) ~[1.20.6.jar:?]
    at ffh.c(SourceFile:1275) [1.20.6.jar:?]
    at ffh.f(SourceFile:888) [1.20.6.jar:?]
    at net.minecraft.client.main.Main.main(SourceFile:265) [1.20.6.jar:?]
Caused by: java.lang.RuntimeException: could not reload shaders
    at gdj.c(SourceFile:543) [1.20.6.jar:?]
    at gdj$1.a(SourceFile:421) ~[1.20.6.jar:?]
    at gdj$1.a(SourceFile:398) ~[1.20.6.jar:?]
    at auu.a(SourceFile:13) ~[1.20.6.jar:?]
    at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718) ~[?:?]
    ... 9 more
Caused by: ali: Invalid shaders/core/particle.json: Couldn't compile vertex program (file/Shader Selector (Advanced Screen Shake).zip, particle) : 0(51) : error C1102: incompatible type for parameter #1 ("pos.21")
0(51) : error C7623: implicit narrowing of type from "vec3" to "int"
0(51) : error C1104: too many parameters in function call
    at ali.a(SourceFile:48) ~[1.20.6.jar:?]
    at gee.<init>(SourceFile:176) ~[1.20.6.jar:?]
    at gdj.c(SourceFile:481) ~[1.20.6.jar:?]
    at gdj$1.a(SourceFile:421) ~[1.20.6.jar:?]
    at gdj$1.a(SourceFile:398) ~[1.20.6.jar:?]
    at auu.a(SourceFile:13) ~[1.20.6.jar:?]
    at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718) ~[?:?]
    ... 9 more
Caused by: java.io.IOException: Couldn't compile vertex program (file/Shader Selector (Advanced Screen Shake).zip, particle) : 0(51) : error C1102: incompatible type for parameter #1 ("pos.21")
0(51) : error C7623: implicit narrowing of type from "vec3" to "int"
0(51) : error C1104: too many parameters in function call
    at ezo.b(SourceFile:69) ~[1.20.6.jar:?]
    at ezo.a(SourceFile:51) ~[1.20.6.jar:?]
    at gee.a(SourceFile:214) ~[1.20.6.jar:?]
    at gee.<init>(SourceFile:161) ~[1.20.6.jar:?]
    at gdj.c(SourceFile:481) ~[1.20.6.jar:?]
    at gdj$1.a(SourceFile:421) ~[1.20.6.jar:?]
    at gdj$1.a(SourceFile:398) ~[1.20.6.jar:?]
    at auu.a(SourceFile:13) ~[1.20.6.jar:?]
    at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718) ~[?:?]
    ... 9 more
Pilvinen commented 6 months ago

Changing the line in YourResourcepack/assets/minecraft/shaders/core/particle.vsh from:

vertexDistance = fog_distance(ModelViewMat, Position, FogShape);

To:

vertexDistance = fog_distance(Position, FogShape);

Will fix the crash. Then you can watch your screen shake all day.

Pilvinen commented 6 months ago

The downside is that now the shake is on by default (which I'm assuming it's not supposed to be?) I don't understand the shader code well enough to figure out how to fix that.

But to stop the shake (ie. in MC 1.20.5+) you can run:

/particle minecraft:entity_effect{color: [0.9960784313725490196078431372549, 0.9921568627450980392156862745098, 0.003921568627451, 1.0]} ~ ~ ~ ~ ~ ~ 1 1 force

And to start it again you can run:

/particle minecraft:entity_effect{color: [0.9960784313725490196078431372549, 0.9921568627450980392156862745098, 1.0, 1.0]} ~ ~ ~ ~ ~ ~ 1 1 force

And to change the speed:

/particle minecraft:entity_effect{color: [0.9960784313725490196078431372549, 0.98823529411764705882352941176471, 0.01, 1.0]} ~ ~ ~ ~ ~ ~ 1 1 force @s

Or if you're doing things from Java plugin, here's an example how you could disable the shakes when a player logs in, until the author has time to fix this issue properly:

https://pastebin.com/XFSyR5RE

Nik0-0 commented 5 months ago

The downside is that now the shake is on by default (which I'm assuming it's not supposed to be?) I don't understand the shader code well enough to figure out how to fix that.

But to stop the shake (ie. in MC 1.20.5+) you can run:

/particle minecraft:entity_effect{color: [0.9960784313725490196078431372549, 0.9921568627450980392156862745098, 0.003921568627451, 1.0]} ~ ~ ~ ~ ~ ~ 1 1 force

And to start it again you can run:

/particle minecraft:entity_effect{color: [0.9960784313725490196078431372549, 0.9921568627450980392156862745098, 1.0, 1.0]} ~ ~ ~ ~ ~ ~ 1 1 force

And to change the speed:

/particle minecraft:entity_effect{color: [0.9960784313725490196078431372549, 0.98823529411764705882352941176471, 0.01, 1.0]} ~ ~ ~ ~ ~ ~ 1 1 force @s

Or if you're doing things from Java plugin, here's an example how you could disable the shakes when a player logs in, until the author has time to fix this issue properly:

https://pastebin.com/XFSyR5RE

Ye ye. I mean im using my own stuff to control that and kinda figured it out. 👀

Changing the line in YourResourcepack/assets/minecraft/shaders/core/particle.vsh from:

vertexDistance = fog_distance(ModelViewMat, Position, FogShape);

To:

vertexDistance = fog_distance(Position, FogShape);

Will fix the crash. Then you can watch your screen shake all day.

Alsoo doing that will keep it uh compatible with 1.20.4 or nope? Anyways thanks for response and help ✨

Pilvinen commented 5 months ago

Alsoo doing that will keep it uh compatible with 1.20.4 or nope? Anyways thanks for response and help ✨

It "works" in 1.20.6. It might not work in 1.20.4. But I don't know. I believe there were some changes to how shaders work in 1.20.5 (you can check the details here: https://feedback.minecraft.net/hc/en-us/articles/26136167989005-Minecraft-Java-Edition-1-20-5-Armored-Paws).

But the quick fix I did is not an ideal solution. If it works for you and you're going to use it, I should further note that moving between worlds will activate the shake, and you need to turn it off after a player transitions to Nether, End, etc.

There's also a slight almost imperceptible shake that you can see even when it's turned off if you pay attention. It might work better if you also set the other setting to a low value.

Pilvinen commented 5 months ago

Even more broken on 1.21. Mojang removed the "blend" block.

Not sure what to do about that.