codetaylor / pyrotech-1.12

An early game mod with new primitive devices, combustion machines, smelting mechanics, storage options, tools, torches, advancements, and absolutely zero GUIs -- with exception to the substantially complete, mostly illustrated, and charred guidebook.
https://pyrotech.readthedocs.io/en/latest/
Other
52 stars 20 forks source link

Custom slag lang key not working properly #330

Closed brachy84 closed 3 years ago

brachy84 commented 3 years ago

Issue Description

  1. I can't get lang keys to work. In Custom Slag file:
{
        "registryName" : "brown_limonite",
        "langKey" : "material.brown_limonite",
        "color" : "944306"
    },

So I thought I use Custom Ore File which just crashes and I can't find the issue:

"oreBrownLimonite": {
      "slagColor": "944306",
      "langKey": [
        "material.brown_limonite"
      ],
      "output": [
        "minecraft:iron_nugget"
      ]
    },

What Happens

  1. Custom Slag: The Slag does only get named Slag

  2. Custom Ore crashes the game

What You Expect to Happen

I expected it to work?

Script

Crash Log

Crash from Custom ore https://pastebin.com/zKRhG8LW

Affected Versions

Do not use latest; please supply accurate version numbers.

codetaylor commented 3 years ago
  1. I don't know why the custom slag lang key is not working. I will have to look at it.

  2. The custom ore is crashing because it expects the lang key to have a mod id prefix such as minecraft:. Compare it to the file generated by Pyrotech:

"oredict": {
    "oreGold": {
      "slagColor": "fcee4b",
      "langKey": [
        "minecraft:tile.oreGold"
      ],
      "output": [
        "minecraft:gold_nugget:0"
      ]
    },
    "oreIron": {
      "slagColor": "d8af93",
      "langKey": [
        "minecraft:tile.oreIron"
      ],
      "output": [
        "minecraft:iron_nugget:0"
      ]
    }
  }
codetaylor commented 3 years ago

The mod id prefix has actually been made optional in the latest 1.5.0 release candidate which you can find on the Discord, discord.codetaylor.com, or you can wait a few days and it will be up on CurseForge.

brachy84 commented 3 years ago

Ok gregtech:material.brown_limonite does not crash, but it still does not get named correctly

codetaylor commented 3 years ago

This is because Pyrotech makes the assumption that lang keys will follow the naming convention set by Vanilla. The convention is that lang keys will have .name appended in the lang file yet the item will return the unlocalized name without the .name suffix.

GregTech does not follow this convention for material.brown_limonite as well as others.

This assumption has been discarded and the lang key handling has been changed to work with lang keys that do not follow convention.

Confirmed both slag file and ore file are working as expected in 1.12.2-1.5.0-RC8 using the two json objects given in the initial report.

image