CraftTweaker

CraftTweaker

151M Downloads

Question: Add the same description to many similarly named items

endumiuz opened this issue ยท 2 comments

commented

Is there a better way to do this? Can I use regex somehow (Something like ".*_shulker_box")?

import mods.jei.JEI;

mods.jei.JEI.addDescription(
  [<minecraft:white_shulker_box>,
  <minecraft:orange_shulker_box>,
  <minecraft:magenta_shulker_box>,
  <minecraft:light_blue_shulker_box>,
  <minecraft:yellow_shulker_box>,
  <minecraft:lime_shulker_box>,
  <minecraft:pink_shulker_box>,
  <minecraft:gray_shulker_box>,
  <minecraft:silver_shulker_box>,
  <minecraft:cyan_shulker_box>,
  <minecraft:purple_shulker_box>,
  <minecraft:blue_shulker_box>,
  <minecraft:brown_shulker_box>,
  <minecraft:green_shulker_box>,
  <minecraft:red_shulker_box>,
  <minecraft:black_shulker_box>],
  "While holding an item with your cursor, you can right click on top of a Shulker Box to add the item to it.");

Versions:

  • CT 1.12-4.1.20.586
  • Forge 14.23.5.2854
  • Minecraft 1.12.2
commented

You can get a list of items that match a regex using itemUtils
https://docs.blamejared.com/1.12/en/Vanilla/Utils/IItemUtils/

Thank you! This was exactly what I was looking for! It works perfectly =D

commented

Transfered here because this repository is for CraftTweaker, the other one is for documentation.

You can get a list of items that match a regex using itemUtils
https://docs.blamejared.com/1.12/en/Vanilla/Utils/IItemUtils/

Alternatively, you could iterate over the contents of an OreDictionaryEntry if one exists for them.