Shinoow / AbyssalCraft-Integration

Integration module for AbyssalCraft
6 stars 6 forks source link

[Feature request] Make rituals match/ignore NBT data on an item-by-item basis? #27

Closed mrnos closed 5 years ago

mrnos commented 5 years ago

I'm trying to make monster spawners craftable through an infusion recipe, where some ingredients need to match NBT and some need to ignore NBT.

The recipe is as follows right now:

mods.abyssalcraft.InfusionRitual.addRitual("mob_spawner",
  2,
  -1,
  20000,
  false,
  <minecraft:mob_spawner>,
  <abyssalcraft:interdimensionalcage>.withTag({PotEnergy: 1000.0 as float}),
  [
    <botania:gravityrod>, 
    <minecraft:iron_bars>,
    <abyssalcraft:oc>,
    <minecraft:iron_bars>,
    <abyssalcraft:statue:*>,
    <minecraft:iron_bars>,
    <botania:floatingspecialflower>.withTag({type: "loonium"}),
    <minecraft:iron_bars>
  ],
  true)

This recipe will never work as is for the following reasons:

  1. I want to require the Interdimensional Cage to have 1,000 PE, and require the Botania flower to be a Loonium; both require matching by NBT (otherwise, ignoring NBT allows any interdimensional cage and any floating special flower work, which I don't want).
  2. But the Botania gravityrod, once crafted, changes its NBT data every tick, so for this recipe to work at all, the gravityrod needs to have its NBT data ignored.

Right now, my desired behavior appears impossible; NBT matching is all-or-nothing as configured by a single flag at the end.

Would something like CraftTweaker's onlyWithTag feature be feasible?

If this isn't practicable to solve, I can always make a different recipe for my pack. But this would be nice to have.

Shinoow commented 5 years ago

The NBT checking is currently done in the same fashion as onlyWithTag, except the case where the recipe Item doesn't have NBT but the input Item does isn't handled properly (since this should evaluate to true as under that circumstance the input Item NBT still "contains" the recipe Item NBT).

Shinoow commented 5 years ago

Fixed in https://github.com/Shinoow/AbyssalCraft/commit/c8c2dca73f600977b66c2f0b41a9abb83e3af1e5 and https://github.com/Shinoow/AbyssalCraft-Integration/commit/1baf328f2165215de829de9222fb70e53eea5667