use of net.minecraft.world.item.DyeColor in project MinecraftForge by MinecraftForge.
the class ForgeItemTagsProvider method addColored.
private void addColored(Consumer<Tag.Named<Item>> consumer, Tag.Named<Item> group, String pattern) {
String prefix = group.getName().getPath().toUpperCase(Locale.ENGLISH) + '_';
for (DyeColor color : DyeColor.values()) {
ResourceLocation key = new ResourceLocation("minecraft", pattern.replace("{color}", color.getName()));
Tag.Named<Item> tag = getForgeItemTag(prefix + color.getName());
Item item = ForgeRegistries.ITEMS.getValue(key);
if (item == null || item == Items.AIR)
throw new IllegalStateException("Unknown vanilla item: " + key.toString());
tag(tag).add(item);
consumer.accept(tag);
}
}
use of net.minecraft.world.item.DyeColor in project MinecraftForge by MinecraftForge.
the class ForgeItemTagsProvider method copyColored.
private void copyColored(Tag.Named<Block> blockGroup, Tag.Named<Item> itemGroup) {
String blockPre = blockGroup.getName().getPath().toUpperCase(Locale.ENGLISH) + '_';
String itemPre = itemGroup.getName().getPath().toUpperCase(Locale.ENGLISH) + '_';
for (DyeColor color : DyeColor.values()) {
Tag.Named<Block> from = getForgeBlockTag(blockPre + color.getName());
Tag.Named<Item> to = getForgeItemTag(itemPre + color.getName());
copy(from, to);
}
copy(getForgeBlockTag(blockPre + "colorless"), getForgeItemTag(itemPre + "colorless"));
}
use of net.minecraft.world.item.DyeColor in project MinecraftForge by MinecraftForge.
the class ForgeBlockTagsProvider method addColored.
private void addColored(Consumer<Block> consumer, Tag.Named<Block> group, String pattern) {
String prefix = group.getName().getPath().toUpperCase(Locale.ENGLISH) + '_';
for (DyeColor color : DyeColor.values()) {
ResourceLocation key = new ResourceLocation("minecraft", pattern.replace("{color}", color.getName()));
Tag.Named<Block> tag = getForgeTag(prefix + color.getName());
Block block = ForgeRegistries.BLOCKS.getValue(key);
if (block == null || block == Blocks.AIR)
throw new IllegalStateException("Unknown vanilla block: " + key.toString());
tag(tag).add(block);
consumer.accept(block);
}
}
Aggregations