quat1024 / BotaniaTweaks

small tweaks to botania, such as nerfable mana fluxfields and automatable ender air
Mozilla Public License 2.0
6 stars 7 forks source link

partial nbt comparison issue #42

Open Yoghurt4C opened 5 years ago

Yoghurt4C commented 5 years ago

aka bee problems image image

quat1024 commented 5 years ago

and the nbt on the item you are throwing onto the plate is...?

Yoghurt4C commented 5 years ago

image

Yoghurt4C commented 5 years ago

image

quat1024 commented 5 years ago

ok so obviously the reason why this happens is because the whole "input item must have a superset of nbt tags" thing doesn't extend properly to nested nbt tags lol

trying to find out a better way of comparing the tags

quat1024 commented 5 years ago

alright:

Yoghurt4C commented 5 years ago

still having issues with this, tried a bunch of nested nbt variations (like snipping the whole species chromosome: <forestry:bee_princess_ge>.withTag({Genome: {Chromosomes: [{UID1: "gendustry.bee.Manasteel", UID0: "gendustry.bee.Manasteel", Slot: 0 as byte}]}})), but it doesn't want to work image

quat1024 commented 5 years ago

I tested a bunch of cases with this smh, I think i have to assume you're not telling zs the NBT tag you think you're telling it

Yoghurt4C commented 5 years ago

how am I supposed to present the tag to ct?

quat1024 commented 5 years ago

I was thinking you might have the wrong type somewhere (zen is super loose on types i think).

But actually, come to think of it, probably the array is fucking it up

codewarrior0 commented 5 years ago

Your fix doesn't seem to do a superset comparison on list tags.

codewarrior0 commented 5 years ago

Oh! Your old solution using NBTTagCompound#merge doesn't do a superset comparison on list tags either.

This is kind of a weird edge case because to properly do the comparison on ordered lists, you'd need to specify the list indices for the subset of elements you want to match in addition to the elements themselves.

quat1024 commented 5 years ago

I think a good compromise would be to just assume that all arrays are unordered (just treat them the same as a tag compound). Arrays don't turn up too often on items, and when they do, they usually specify an index somewhere in the tag compound anyways (chests, bees apparently, ...) so you can match on that

quat1024 commented 5 years ago

...but then matching becomes really fun (match every pair of elements??)

codewarrior0 commented 5 years ago

I thought about treating them as unordered but immediately trashed that idea when I remembered how some swedish weirdos use lists to store coordinate triples.

quat1024 commented 5 years ago

But why would you want to create a recipe that only works with, like, something bound to a specific coordinate lol

codewarrior0 commented 5 years ago

Maybe I'm asking for a tool with a wooden handle and an unobtainium large plate and I don't want shrewd players giving me an unobtainium handle with a wooden large plate?

codewarrior0 commented 5 years ago

Oh, I just noticed you're iterating over the tags for the input item and then ignoring them if they aren't in the recipe, which means an input item will match a recipe if it has at least as many tags as the recipe but the tag names are all completely different.

quat1024 commented 5 years ago

Ah, I used to have a counter that tracked how many tags matched, but didn't think I needed it, didn't think of that case