Astral Sorcery

Astral Sorcery

63M Downloads

Rock Crystals in CraftTweaker scripts match too strictly

codewarrior0 opened this issue ยท 5 comments

commented

CraftTweaker scripts that specify <astralsorcery:itemrockcrystalsimple> as an ingredient will only match the plain rock crystal, and reject crystals that are celestial, attuned, or both. In contrast, stock AS recipes such as the Lightwell and Linking Tool accept any such crystal.

One solution would be to create an oredict key that matches any rock or celestial crystal and another key that just matches celestial crystals. Another solution (that would retroactively fix any existing scripts) would be to special-case the CT handling of the rock crystal and celestial crystal items to automatically generify them as is done in ItemHandle.getCrystalVariant.

commented

I've been told that using an oredict key for crystals in CT scripts fails due to the NBT data on the crystals. The special-case handling might be the best solution.

commented

It works if the items are added to the oredict like so:

# Astral Sorcery Rock Crystals

    <ore:crystalAstralRockAny>.add(<astralsorcery:itemrockcrystalsimple>.withEmptyTag());
    <ore:crystalAstralRockAny>.add(<astralsorcery:itemtunedrockcrystal>.withEmptyTag());
    <ore:crystalAstralRockAny>.add(<astralsorcery:itemcelestialcrystal>.withEmptyTag());
    <ore:crystalAstralRockAny>.add(<astralsorcery:itemtunedcelestialcrystal>.withEmptyTag());
commented

Indeed, oredict does not care about nbt tags. You can also omit the .withEmptyTag() part and it should still work.

commented

withEmptyTag() was needed. Without it, recipes using the oredict did not work in the Vanilla crafting table.

commented

Next update adds a utility class which includes a ZenMethod which does the same as ItemHandle.getCrystalVariant:

mods.astralsorcery.Utils.getCrystalORIngredient(boolean hasToBeCelestial, boolean hasToBeAttuned)

Does exactly was ItemHandle.getCrystalVariant does and returns an IIngredientOR which matches against any crystal that fits according to the 2 boolean parameters.

Edit: can now be found at: https://github.com/HellFirePvP/AstralSorcery/blob/master/src/main/java/hellfirepvp/astralsorcery/common/integrations/mods/crafttweaker/tweaks/Utils.java#L34