Malum

Malum

2M Downloads

[1.18.2] Runewood Sign Crashes the Client

LunafeyLazuli opened this issue ยท 7 comments

commented

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

commented

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.

commented

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

commented
commented

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.

commented

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)

commented

1.16.5/1.18.2/1.19.2 is no longer supported

commented

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);
    })
  }