jaredlll08 / ModTweaker

ModTweaker is an addon for CraftTweaker, which provides Integration for an amount of mods.
MIT License
68 stars 63 forks source link

Crash on attempting to set Thaumcraft aspects #638

Closed ejektaflex closed 6 years ago

ejektaflex commented 6 years ago

Issue Description:

Trying out the new Thaumcraft Aspects functions causes an error, even though syntax is correct.

What happens:

I get a bad type on the operand stack.

What you expected to happen:

I'm attempting to remove the Metallum aspect from all harvestcraft items.

Script used (Please Pastebin or gist your script, posting an unpasted or ungist'd script will automatically close this issue):

https://gist.github.com/ejektaflex/820af4a929e71295fea92e8fa8aa471b

Minetweaker.log file (Please Pastebin or gist your file, posting an unpasted or ungist'd file will automatically close this issue):

https://gist.github.com/ejektaflex/ffd05087859b78f7b7426527902e6a6e


Affected Versions (Do not use "latest"):

Your most recent log file where the issue was present:

https://gist.github.com/ejektaflex/345f0cd029baf9a272326a48cfc8b556

kindlich commented 6 years ago

You might want to import thaumcraft.aspect.CTAspect if you are referring to it that way.

Geethebluesky commented 6 years ago

I can't get this script to work either, even after importing thaumcraft.aspect.CTAspect and thaumcraft.aspect.CTAspectStack. Tried all sorts of permutations and keep getting errors either like the above, or "identifier not expected", etc. but the error messages are not helping.

Can we have an example script to just loop over an item's aspects (the actual CTAspect objects)?

jaredlll08 commented 6 years ago

okay so, this was an oversight by me, but thaumcraft adds aspects after scripts are loaded, so technically, at run time, there are no aspects on any items, so I'll be removing that in the next version.

Saying that however, I will be adding a new method called "removeAspect()", that will remove the aspect from the item, at a later time in the load cycle. If the item doesn't have that specific aspect, then it will do nothing, but if it does, then it will be removed, and the others will be left as they were (I.E, you can loop over all HC items and remove Metallum from them without knowing if they even have Metallum to start with)

Geethebluesky commented 6 years ago

Oh that sounds great. Thanks :)

The other methods will also be able handle nonexistent aspects gracefully, right? (meaning getAspects() doesn't go nuts if it's called on an item without aspects) Just want to be clear.

jaredlll08 commented 6 years ago

There is no longer a way to loop over aspects, because aspects are only added after scripts are ran, you can use

<thaumcraft:thaumonomicon>.removeAspects(<aspect:aqua>); instead