stanhebben / MineTweaker3

Tweak your minecraft experience
66 stars 32 forks source link

[Suggestion] RegEx support for loot/recipe removal #190

Open Techokami opened 9 years ago

Techokami commented 9 years ago

So, my friend and I have been working on a modpack using MineTweaker3 to readjust crafting and loot to be more balanced and have a more fleshed-out progression. HOWEVER, one of the mods that adds loot, OpenComputers, handles its loot generation in a special way that can't be reconstructed (in an obvious manner to us) in MineTweaker3. So the easiest solution here would be to use a RegEx to match anything that does NOT contain the OpenComputers namespace, so its loot would be unaffected (and we feel it is fine as-is) but still remove everything else that we can rebuild on.

Except there's no RegEx support. Just specific items/blocks or the "everything" wildcard.

Would it be possible to add RegEx to removing loot and recipes?

Voidi commented 9 years ago

Not really related to your request, but what problems do you have with OC Loot? Because modifiy some of them too (add & remove) and it works for me

Techokami commented 9 years ago

Loot disks. They're special read-only Floppy Disks generated in a special way (using NBT data tags). You can look at the Scala code here.

The first problem is that there doesn't seem to be a way (to my limited knoledge) to write NBT data into an item in a MineTweaker script. The second problem is that, if a new loot disk was ever added (and they are) you would have to edit the script for each one, instead of OC's automagical system. It would feel safer to me to let OC handle its own loot and have a MineTweaker script handle the rest.

EDIT: Should also mention that there was something related to this that I had reported a year ago on OC's bug tracker, and you should look at Sangar's posting here. He uses a custom generator to generate the loot disks on demand, using a base item that has its NBT data changed upon generation, so there's only one entry in the loot table for as many disks as you want in the world and modpack itself.

Voidi commented 9 years ago

i use this script and it seems to work vanilla.loot.removeChestLoot("pyramidDesertyChest", <OpenComputers:item:47>.withTag({"oc:color": 2, "oc:lootPath": "OpenOS", "oc:data": {"oc:fs.label": "openos"}})); vanilla.loot.addChestLoot("strongholdLibrary", <OpenComputers:item:47>.withTag({"oc:color": 3, "oc:lootPath": "MazeGen", "oc:data": {"oc:fs.label": "maze"}}).weight(25), 1, 1); vanilla.loot.addChestLoot("pyramidDesertyChest", <OpenComputers:item:47>.withTag({"oc:color": 10, "oc:lootPath": "OPPM", "oc:data": {"oc:fs.label": "oppm"}}).weight(25), 1, 1); vanilla.loot.addChestLoot("pyramidJungleChest", <OpenComputers:item:47>.withTag({"oc:color": 10, "oc:lootPath": "OPPM", "oc:data": {"oc:fs.label": "oppm"}}).weight(25), 1, 1);

Techokami commented 9 years ago

Huh, so you CAN write NBT data tags in MineTweaker scripts. I did not see anything about that in the official documentation. However, I have 27 different loot disks in this mod pack, and having to sit down and write out all the data for all the disks is crazy, especially since it still breaks a feature in OC where you can add loot disks on a per-world basis, as you would have to write in every new disk you add, but if the world has a custom disk not seen anywhere else, you would not be generating the correct content anymore (either missing the disk, or generating a junk disk for every other world).

There's also another problem with this, and it is similar to a problem a friend of mine had with his mod Garden Collection. He has generated loot, in the form of pottery stamps to create decorative pots. These stamps can be customized with the addition/removal of more patterns, and the mod registered each stamp as a unique item in the loot table. They were set to be fairly rare, yet... we were drowning in stamps after exploring dungeons and ruins. The solution came in the form of a new item, the dirty pattern stamp, which transforms itself into a valid stamp when used with a filled cauldron. So now, the stamps appeared in loot chests at the correct frequency, rather than flooding out all other possible loot types due to sheer numbers.

This is something OpenComputers avoided entirely with its custom loot generation system. Rather than flooding the table with every single possible disk, it has a singular disk item in the table, but when it's generated, it becomes one of the n possible loot disks. But you can't seem to preserve this behavior with MineTweaker. The RNG is going to select the loot disks 27 times instead of once when generating loot, and flood the chest with loot disks and ignore the more interesting and useful loot items (like things from Xeno's Reliquary, whose recipes have been disabled in a separate MineTweaker script)!

That's why I feel that it would be safer to let OC handle loot generation on its own, and that would require an exclusion-based means of removing loot from the loot table, which is something that can be had with rudimentary support for regular expressions. If it's possible to remove loot based on the namespace alone and not specific namespace:item pairs, that could KIND OF work, but there's a shitload of mods in this pack and that's going to make for a very huge script...