Jump to content

[SOLVED BUT PARSING PROBLEM] [1.19.2] force client to toggle custom "post" shader when something happens on server


Recommended Posts

Posted (edited)

disclaimer: i am new to java. however i will not ask for implementation nuances (at least not much. any help is appreciated).

suppose we have a custom block. when we rightclick on it we send a custom package (i assume that because we want specific things to happen on a server). server handles the package (applies effects or whatever) and sends back the answer. client part handles the answer. how do i toggle/load a custom shader when handling the answer from the server? can't seem to find suitable method. do i need to write a mixin? and if so what should i "mixin into"?

i believe it's possible because there is an in-game nausea effect and "wobble" shader (which btw has uniform float Time in it in .fsh file so it's animated)

thanks for help in advance 

Edited by cocicocyn
PostChain#parseUniformNode is sus + problem is finally solved
  • cocicocyn changed the title to [1.19.2] force client to toggle custom "post" shader when something happens on server
Posted
  On 1/27/2023 at 4:40 AM, cocicocyn said:

how do i toggle/load a custom shader when handling the answer from the server?

Expand  

So, if you want to use the postchain method, you can load a given effect via GameRenderer#loadEffect, the rest would be creating the json, vsh, and fsh as necessary.

  On 1/27/2023 at 4:40 AM, cocicocyn said:

i believe it's possible because there is an in-game nausea effect and "wobble" shader (which btw has uniform float Time in it in .fsh file so it's animated)

Expand  

Nausea is rendered is highly hardcoded by manipulating the base posestack before everything else is rendered and the overlay is just a simple blit. As for the wobble shader, it's not really used anywhere afaik since it was probably part of the secret settings.

  On 1/27/2023 at 10:59 AM, cocicocyn said:

note for myself: research PostPass and PostChain classes in net.minecraft.client.renderer package (i guess the wiki provider is some third party warn me if this isn't supported) https://nekoyue.github.io/ForgeJavaDocs-NG/javadoc/1.19.3/net/minecraft/client/renderer/package-summary.html

Expand  

It's illegal for this to be hosted.

  • Thanks 1
Posted (edited)

am i the problem here? im not even reading anything from an array. 

net.minecraft.server.ChainedJsonException: Invalid shaders/post/tripeffect.json (Mod Resources) passes[0]->uniforms[0]->values[4]: Index 4 out of bounds for length 4
	at net.minecraft.server.ChainedJsonException.forException(ChainedJsonException.java:47) ~[forge-1.19.2-43.2.3_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading}
	at net.minecraft.client.renderer.PostChain.parseUniformNode(PostChain.java:245) ~[forge-1.19.2-43.2.3_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.PostChain.parsePassNode(PostChain.java:217) ~[forge-1.19.2-43.2.3_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.PostChain.load(PostChain.java:88) ~[forge-1.19.2-43.2.3_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.PostChain.<init>(PostChain.java:54) ~[forge-1.19.2-43.2.3_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.loadEffect(GameRenderer.java:321) ~[forge-1.19.2-43.2.3_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.guryavkin.drugsmodguryavkin.event.ClientEvents$ClientKeyEvents.onKeyInput(ClientEvents.java:38) ~[%23188!/:?] {re:classloading}
	at net.guryavkin.drugsmodguryavkin.event.__ClientKeyEvents_onKeyInput_Key.invoke(.dynamic) ~[%23188!/:?] {re:classloading,pl:eventbus:B}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.3.jar%23107!/:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.3.jar%23107!/:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.3.jar%23107!/:?] {}
	at net.minecraftforge.client.ForgeHooksClient.onKeyInput(ForgeHooksClient.java:753) ~[forge-1.19.2-43.2.3_mapped_official_1.19.2-recomp.jar%23182%23189!/:?] {re:classloading}
	at net.minecraft.client.KeyboardHandler.keyPress(KeyboardHandler.java:407) ~[forge-1.19.2-43.2.3_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.KeyboardHandler.lambda$setup$7(KeyboardHandler.java:442) ~[forge-1.19.2-43.2.3_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.19.2-43.2.3_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.KeyboardHandler.lambda$setup$8(KeyboardHandler.java:441) ~[forge-1.19.2-43.2.3_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:44) ~[lwjgl-glfw-3.3.1.jar%23162!/:build 7] {}
	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.3.1.jar%23168!/:build 7] {}
	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3403) ~[lwjgl-glfw-3.3.1.jar%23162!/:build 7] {}
	at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:164) ~[forge-1.19.2-43.2.3_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at com.mojang.blaze3d.platform.Window.updateDisplay(Window.java:337) ~[forge-1.19.2-43.2.3_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1143) ~[forge-1.19.2-43.2.3_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:700) ~[forge-1.19.2-43.2.3_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.run(Main.java:212) ~[forge-1.19.2-43.2.3_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:51) ~[forge-1.19.2-43.2.3_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
	at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:25) ~[fmlloader-1.19.2-43.2.3.jar%2395!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%23108!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%23108!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%23108!/:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%23108!/:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%23108!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%23108!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%23108!/:?] {}
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {}
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 4
	at net.minecraft.client.renderer.PostChain.parseUniformNode(PostChain.java:243) ~[forge-1.19.2-43.2.3_mapped_official_1.19.2-recomp.jar%23183!/:?] {re:classloading,pl:runtimedistcleaner:A}
	... 36 more
fuckety resource location bad, drugsmodguryavkin shaders/post/tripeffect.json
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 4

i can't make further progress anymore. managed to load a shader without shader compilation issues. this is what i get.
my "post" json:

  Reveal hidden contents

 my "program" json:

  Reveal hidden contents

my event handler where shader is loaded:

  Reveal hidden contents

my .fsh (if im using built-in uniforms wrong i will fix them later myself dont mind me):

  Reveal hidden contents

my .vsh (copied blit.vsh)

  Reveal hidden contents

what am i doing wrong

progress#1 branch in github https://github.com/lveeeeeeeeeee/guryavkin_drugs_mod_for_minecraft

Edited by cocicocyn
added github
Posted (edited)

YEESSSSSSSSSSSSS OH MY GOD devs please pay attention to PostChain#parseUniformNode method it seems to be broken (or i am just dumb) and finally i can change this to [SOLVED]

Edited by cocicocyn
grammar because i got too excited
  • cocicocyn changed the title to [SOLVED BUT PARSING PROBLEM] [1.19.2] force client to toggle custom "post" shader when something happens on server

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

  Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

  Your link has been automatically embedded.   Display as a link instead

  Your previous content has been restored.   Clear editor

  You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Create New...

Important Information

By using this site, you agree to our Terms of Use.