SammySemicolon / Malum-Mod

A minecraft mod about dark magic.
83 stars 32 forks source link

[1.18.2] Runewood Sign Crashes the Client #153

Closed LunafeyLazuli closed 3 months ago

LunafeyLazuli commented 1 year ago

Basically, when on a server, if you place a runewood sign, your game crashes but not the server https://pastebin.com/s8pecZcC

SammySemicolon commented 1 year ago

That's odd. I am aware of the issue but have no idea what causes it, what's odd though, is the fact that the signs shouldn't render as of now to combat this issue. I'll try and get a fix out soon.

LunafeyLazuli commented 1 year ago

Yeah no worries! What was funny was that when I joined the server again the sign was invisible, but placing it still crashed me XD

ChiefArug commented 9 months ago

To me it looks like the cause might be this line in lodestone being commented out: https://github.com/LodestarMC/Lodestone/blob/main/src/main/java/team/lodestar/lodestone/setup/LodestoneBlockEntityRegistry.java#L57-L59

ChiefArug commented 9 months ago

Scratch that, turned out to be caused by not registering the sign material for the wood type. KubeJS startup script that fixes this on 1.19.2:

if (Platform.isClientEnvironment()) {
  ClientEvents.init(event => {
    const $WoodTypeRegistry = Java.loadClass('com.sammy.malum.registry.common.block.WoodTypeRegistry')
    const $ModelMaterial = Java.loadClass('net.minecraft.client.resources.model.Material')
    const $Sheets = Java.loadClass('net.minecraft.client.renderer.Sheets')

    runeSignMaterial = new $ModelMaterial($Sheets.SIGN_SHEET, "malum:entity/signs/runewood")
    soulSignMaterial = new $ModelMaterial($Sheets.SIGN_SHEET, "malum:entity/signs/soulwood")
    $Sheets.SIGN_MATERIALS.put($WoodTypeRegistry.RUNEWOOD, runeSignMaterial)
    $Sheets.SIGN_MATERIALS.put($WoodTypeRegistry.SOULWOOD, soulSignMaterial)
  })
}

As for fixing this in the mod I think forge has the TextureStitchEvent.Pre event for this, although I am not entirely sure about that.

MsVella commented 9 months ago

Can confirm that i'm having this issue too on my server, as mentioned and documented in the report above to the aether guys, For some reason it seems to work fine otherwise (although i suspect now it may be the cause of some random crashes we've had), but it makes a hard incompatibility with the aether mod for some reason. (I've been trying to add it to the server but it keeps crashing in dev environments, let me know if you want a copy of our multiplayer save)

SammySemicolon commented 3 months ago

1.16.5/1.18.2/1.19.2 is no longer supported

V972 commented 2 weeks ago

Scratch that, turned out to be caused by not registering the sign material for the wood type. KubeJS startup script that fixes this on 1.19.2:

if (Platform.isClientEnvironment()) {
  ClientEvents.init(event => {
    const $WoodTypeRegistry = Java.loadClass('com.sammy.malum.registry.common.block.WoodTypeRegistry')
    const $ModelMaterial = Java.loadClass('net.minecraft.client.resources.model.Material')
    const $Sheets = Java.loadClass('net.minecraft.client.renderer.Sheets')

    runeSignMaterial = new $ModelMaterial($Sheets.SIGN_SHEET, "malum:entity/signs/runewood")
    soulSignMaterial = new $ModelMaterial($Sheets.SIGN_SHEET, "malum:entity/signs/soulwood")
    $Sheets.SIGN_MATERIALS.put($WoodTypeRegistry.RUNEWOOD, runeSignMaterial)
    $Sheets.SIGN_MATERIALS.put($WoodTypeRegistry.SOULWOOD, soulSignMaterial)
  })
}

As for fixing this in the mod I think forge has the TextureStitchEvent.Pre event for this, although I am not entirely sure about that.

Here's working 1.18.2 version. The signs themselves don't render in the world, but not crashing the bloody game and not bricking my save is enough for me.

If someone would look at this and find out how to fix rendering -- be my guest.

if (Platform.isClientEnvironment()) {
    onEvent('client.init', event => {
      const $WoodTypeRegistry = java('com.sammy.malum.registry.common.block.WoodTypeRegistry');
      const $ModelMaterial = java('net.minecraft.client.resources.model.Material');
      const $Sheets = java('net.minecraft.client.renderer.Sheets');

      let runeSignMaterial = new $ModelMaterial($Sheets.SIGN_SHEET, "malum:entity/signs/runewood");
      let soulSignMaterial = new $ModelMaterial($Sheets.SIGN_SHEET, "malum:entity/signs/soulwood");
      $Sheets.SIGN_MATERIALS.put($WoodTypeRegistry.RUNEWOOD, runeSignMaterial);
      $Sheets.SIGN_MATERIALS.put($WoodTypeRegistry.SOULWOOD, soulSignMaterial);
    })
  }