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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Yes that’s the full log, I managed to get it working last night, the anvil fix mod is what was causing it to crash
    • Hey guys, i'm currently developping a mod with forge 1.12.2 2860 and i'm using optifine and gradle 4.9. The thing is i'm trying to figure out how to show the player's body in first person. So far everything's going well since i've try to use a shader. The player's body started to blink dark when using a shader. I've try a lot of shader like chocapic, zeus etc etc but still the same issue. So my question is : How should i apply the current shader to the body ? At the same time i'm also drawing a HUD so maybe it could be the problem?   Here is the issue :    And here is the code where i'm trying to display the body :    private static void renderFirstPersonBody(EntityPlayerSP player, float partialTicks) { Minecraft mc = Minecraft.getMinecraft(); GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); try { // Préparation OpenGL GlStateManager.enableDepth(); GlStateManager.depthMask(true); GlStateManager.enableAlpha(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // Éclairage correct pour shaders GlStateManager.enableLighting(); RenderHelper.enableStandardItemLighting(); GlStateManager.enableRescaleNormal(); // Active la lightmap pour les shaders mc.entityRenderer.enableLightmap(); // Position de rendu interpolée double px = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks; double py = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks; double pz = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks; GlStateManager.translate( px - mc.getRenderManager().viewerPosX, py - mc.getRenderManager().viewerPosY, pz - mc.getRenderManager().viewerPosZ ); // Rendu du joueur sans la tête Render<?> render = mc.getRenderManager().getEntityRenderObject(player); if (render instanceof RenderPlayer) { RenderPlayer renderPlayer = (RenderPlayer) render; boolean oldHeadHidden = renderPlayer.getMainModel().bipedHead.isHidden; boolean oldHeadwearHidden = renderPlayer.getMainModel().bipedHeadwear.isHidden; renderPlayer.getMainModel().bipedHead.isHidden = true; renderPlayer.getMainModel().bipedHeadwear.isHidden = true; setArmorHeadVisibility(renderPlayer, false); renderPlayer.doRender(player, 0, 0, 0, player.rotationYaw, partialTicks); renderPlayer.getMainModel().bipedHead.isHidden = oldHeadHidden; renderPlayer.getMainModel().bipedHeadwear.isHidden = oldHeadwearHidden; setArmorHeadVisibility(renderPlayer, !oldHeadwearHidden); } // Nettoyage post rendu mc.entityRenderer.disableLightmap(); GlStateManager.disableRescaleNormal(); } catch (Exception e) { // silent fail } finally { GlStateManager.popAttrib(); GlStateManager.popMatrix(); } }   Ty for your help. 
    • Item successfully registered, but there was a problem with the texture of the item, it did not insert and has just the wrong texture.     
    • Keep on using the original Launcher Run Vanilla 1.12.2 once and close the game Download Optifine and run optifine as installer (click on the optifine jar) Start the launcher and make sure the Optifine profile is selected - then test it again  
    • Hi everyone, I’m hoping to revisit an old version of Minecraft — specifically around Beta 1.7.3 — for nostalgia’s sake. I’ve heard you can do this through the official Minecraft Launcher, but I’m unsure how to do it safely without affecting my current installation or save files. Are there any compatibility issues I should watch out for when switching between versions? Would really appreciate any tips or advice from anyone who’s done this before! – Adam
  • Topics

×
×
  • Create New...

Important Information

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