GrigLog/ThaumTweaks

[Suggestion] Pech Tweaks?

Closed this issue · 21 comments

Sort of small suggestion here - but I was wondering if this mod could include a configuration to modify the Pech Trades. (As an optional thing.)

It would ideally be a "item:metadata;weight" sort of table, and could potentially be used by modpack authors to give Pechs (Peches?) more stuff that's possible in trades. Maybe it could also allow for the removal of items as well, such as those Uncraftable Potions that they tend to trade in certain modpacks.

If this has to be moved over to it's own mod, purely because of it's usefulness, I can understand, and look forward to seeing such a project.

This should be simple. I will look into it in the next few days

Awesome!

The idea did get a bit more complex once I thought about it, however...

First thing is, Pechs (Peches?) also have professions, so it might have to be a "item:metadata,profession,weight;" table.
With the valid professions being Mage, Forager, and Stalker.
[Another possible option is having separate config options for each profession, but honestly, it's up to you however it's implemented.]

How would we define "removed"? Would we just add the respective item to the table, but with a weight of 0?

A final idea involves possibly showing all existing trades, with their weights, for reference. Some mods add items to the trade system (or at least Thaumic Additions: Reconstructed does), and it might be helpful to see the pre-config trade system via list or log which is created before the new trades are added.

I looked into the commit, that's awesome!

I look forward to when the update is ready, and thank you for including my suggestion.

Its not finished yet

Done. The file is on Curseforge. Check if it is what you asked for

And yes, it is applied before other mods do something with trades

Getting a crash after setting up the config:

---- Minecraft Crash Report ----
// Why did you do that?

Time: 2022-04-18 18:08:40 PDT
Description: Initializing game

java.lang.NullPointerException
at thaumcraft.common.config.ConfigEntities.handler$zfk000$initEntitiesHandler(ConfigEntities.java:589)
at thaumcraft.common.config.ConfigEntities.initEntities(ConfigEntities.java)
at thaumcraft.Registrar.registerEntities(Registrar.java:79)
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_126_Registrar_registerEntities_Register.invoke(.dynamic)
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:144)
at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182)
at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:857)
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:630)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:252)
at net.minecraft.client.Minecraft.init(Minecraft.java:467)
at net.minecraft.client.Minecraft.run(Minecraft.java:3931)
at net.minecraft.client.main.Main.main(SourceFile:123)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

Are you sure the items you specified are correct? NullPointerException may occur when the item was not found

I'm more than sure it's all correct - I'll include the configuration for reference.
thaumtweaks_pech_trades.txt

This is a Hastebin of the contents, if that's faster:

https://www.toptal.com/developers/hastebin/yahiwiliko.properties

Did you check the log? It should have written "item <>" not found" before throwing an error

Ive just launched the game with the mods mentioned in your file and jaopca:item_clusterzinc and jaopca:item_clusteraluminium are not present

I wonder if it has to do with when JAOPCA is initialized, as the items exist while in-game, but not when the trade file is searching for them.

I thought I would clarify on when I mentioned:

"A final idea involves possibly showing all existing trades, with their weights, for reference. Some mods add items to the trade system (or at least Thaumic Additions: Reconstructed does), and it might be helpful to see the pre-config trade system via list or log which is created before the new trades are added."

I was wondering if it's possible for the mod to make a log of everything Thaumcraft or any other mods add before this mod modifies the trades, not necessarily the default Thaumcraft trades. I don't know if the trades can be changed at another time of initialization, however. If it's possible to modify the trades at a later stage, though, then mods like JAOPCA won't throw up an error, hopefully.

I still seriously thank you for considering this suggestion in the first place, though. I don't think people have really thought about the Pech Trade System all that much, considering I haven't seen a single mod that allows for modifications of what they trade.

Please tell how did you get zinc and aluminum clusters in your game, I dont have them and cant test anything.
Creating a list of all trades is possible, but I dont really think it is neccessary because

  1. afaik TA:R is the only mod adding something to trades;
  2. you dont have to know what other mods add if your trades are the first ones initialized - everything else is added on top of that and there are no conflicts. Thats how it works now, I mixin into thaumcraft method and override it, its 100% guaranteed that nothing is changed before thaumtweaks.

About the loading stages - there is a strict order of registry initialization, so if items from thaumcraft and other mods are initialized, then jaopca items must be initialized as well. The problem is somewhere else.
I think I'll change the logic so that missing items are not throwing an error, only warning lines in the log.

You can just send your mod list

I had an issue where ThaumTweaks was throwing errors for all of the JAOPCA clusters, for all existing entries.

To get Zinc and Aluminum clusters, try installing Thermal Expansion and Metallurgy 4: Reforged.

I'm not joking around when I say the modlist for what I'm making has VERY likely too many mods (thus making a better idea to try to test with less mods).

NuclearCraft and Tech Reborn should cover the other clusters mentioned in the list.

I just realized that the comment I posted had a rather massive typo, apologies for that.

Sorry, completely forgot about that one

Now the approach is mixed:

  1. At the stage of pre-init, your trade list is parsed. If some items are missing, they are remembered for future.
  2. Init. If any mod wishes to add its own trades, it can do it here
  3. Post-init. The remembered entries are parsed again and added into the list if some of the items finally appeared. If no, ThaumTweaks just prints an error to the log.

Ive deleted the last file from curseforge and uploaded this

Thank you! I will be testing it momentarily.

Works like a charm!