Darkhax-Minecraft / ItemStages

Allows items to be put into stages.
GNU Lesser General Public License v2.1
7 stars 18 forks source link

Handle equipment separately from inventory. Add a system for exceptions when using broad conditions. #66

Closed Umbreona closed 3 years ago

Umbreona commented 3 years ago

i was wondering if you could add a feature where the player would be able to have armor in their inventory (say they found some diamond armour in a dungeon) but they cant equip it unless they have the right stage. then they can use it later on when they are a higher stage. was also wondering if there was a way to add all the items from a mod to a stage then clear select items under a tag like i can do with recipe stages

// mods.recipestages.Recipes.setRecipeStageByMod("dragonage", "iceandfire"); // mods.recipestages.Recipes.clearRecipeStage(); // mods.recipestages.Recipes.clearRecipeStage();

Darkhax commented 3 years ago

Splitting up inventory and equipment slots makes sense, I will add this to my TODO list for the next update.

was also wondering if there was a way to add all the items from a mod to a stage then clear select items under a tag like i can do with recipe stages

You can stage all items from a mod using this. There is no way to remove a specific entry from this, or create a restriction as the modid is checked on-demand rather than building a list of all possible items. The recommended way to do what you would like is to create a new item tag with all the items you specifically want and then stage that instead using this. This is fairly trivial with the tools CraftTweaker provides however I have had a lot of people ask about it so I am going to look into ways to make this even more simple.

Darkhax commented 3 years ago

As of https://github.com/Darkhax-Minecraft/ItemStages/commit/b3ee4cd3c36461180ab423e170a440c53d850526 you can now handle equipment separately from the inventory.

import mods.itemstages.ItemStages;

// Players can equip iron chestplates but not hold them in the inventory.
val one = ItemStages.restrict(<item:minecraft:iron_chestplate>, "one");
one.preventEquipment(false);

// Players can have iron helmets in their inventory but not their equipment.
val two = ItemStages.restrict(<item:minecraft:iron_helmet>, "two");
two.preventInventory(false);

As of https://github.com/Darkhax-Minecraft/ItemStages/commit/605565e3e0ece6df07143234cd347d6c08507b4d you can now create exclusion filters. If an item matches the exclusion filter it will NOT be stages.

// Stages all items from "minecraft" except for sticks.
ItemStages.createModRestriction("minecraft", s => <item:minecraft:stick>.matches(s), "one");