package lv.enes.mc.eris_alchemy; import jakarta.annotation.Nullable; import lv.enes.mc.eris_alchemy.utils.*; import lv.enes.mc.eris_alchemy.utils.ItemUtils; import net.minecraft.core.RegistryAccess; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.*; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import vazkii.patchouli.common.item.PatchouliItems; import java.util.*; import java.util.stream.Stream; public class EMC { private record SimplifiedRecipe(ItemStack output, List remainder, List inputs) { public SimplifiedRecipe(ItemLike output, Ingredient... inputs) { this(new ItemStack(output), List.of(), List.of(inputs)); } public SimplifiedRecipe(ItemLike output, ItemLike... inputs) { this(new ItemStack(output), List.of(), Arrays.stream(inputs).map(Ingredient::of).toList()); } public SimplifiedRecipe(ItemLike output, ItemStack... inputs) { this(new ItemStack(output), List.of(), Arrays.stream(inputs).map(Ingredient::of).toList()); } public SimplifiedRecipe(ItemLike output, List remainder, ItemLike... inputs) { this(new ItemStack(output), remainder, Arrays.stream(inputs).map(Ingredient::of).toList()); } public SimplifiedRecipe(ItemStack output, ItemLike... inputs) { this(output, List.of(), Arrays.stream(inputs).map(Ingredient::of).toList()); } public SimplifiedRecipe(ItemStack output, ItemStack... inputs) { this(output, List.of(), Arrays.stream(inputs).map(Ingredient::of).toList()); } public SimplifiedRecipe(Recipe recipe, RegistryAccess registryAccess) { this( RecipeUtils.getOutput(recipe, registryAccess), List.of(), // TODO: RecipeUtils.getIngredients(recipe).stream().filter(ingredient -> !ingredient.isEmpty()).toList() ); } } private static final Map ITEM_COMMON_MAP = new HashMap<>(); private static final Map, Double> ITEM_TAG_COMMON_MAP = new HashMap<>(); private static final Map, Double> BLOCK_TAG_COMMON_MAP = new HashMap<>(); private static final List FAKE_RECIPES = new ArrayList<>(); private static final EMC defaultInstance = new EMC(null); private static final Map instances = Collections.synchronizedMap(new WeakHashMap<>()); public static EMC getInstance(Level world) { if (world == null) { return defaultInstance; } if (instances.containsKey(world)) { return instances.get(world); } var instance = new EMC(world); instances.put(world, instance); return instance; } private final Map data; private EMC(@Nullable Level world) { data = Collections.synchronizedMap(new HashMap<>(ITEM_COMMON_MAP)); ITEM_TAG_COMMON_MAP.forEach( (tag, emcValue) -> BuiltInRegistries.ITEM .getTagOrEmpty(tag) .forEach(holder -> data.putIfAbsent(holder.value(), emcValue)) ); BLOCK_TAG_COMMON_MAP.forEach( (tag, emcValue) -> BuiltInRegistries.BLOCK .getTagOrEmpty(tag) .forEach(holder -> data.putIfAbsent(holder.value().asItem(), emcValue)) ); ErisAlchemy.LOGGER.info("Getting recipes..."); var recipes = getRecipes(world); var configured = new HashSet<>(data.keySet()); ErisAlchemy.LOGGER.info("Calculating EMC values..."); BuiltInRegistries.ITEM.forEach(item -> { configEmc(recipes, configured, item); if (world != null && !data.containsKey(item)) { ErisAlchemy.LOGGER.warn("No EMC value for '{}' known", item); } }); } public OptionalDouble get(Item item) { var value = data.get(item); if (value == null || value <= 0) { return OptionalDouble.empty(); } return OptionalDouble.of(value); } private List getRecipes(@Nullable Level world) { Stream recipes = Stream.concat( FAKE_RECIPES.stream(), AxeUtils.getStrippables() .entrySet() .stream() .map(entry -> new SimplifiedRecipe(entry.getValue(), Ingredient.of(entry.getKey()))) ); if (world != null) { recipes = Stream.concat( recipes, world.getRecipeManager() .getRecipes() .stream() .map(recipe -> new SimplifiedRecipe(recipe, world.registryAccess())) ); } return recipes.toList(); } private OptionalDouble configEmc(List recipes, Set configured, Item item) { var res = get(item); if (res.isPresent() || configured.contains(item)) { return res; } configured.add(item); res = recipes.stream() .filter(recipe -> recipe.output.is(item)) .map(recipe -> calculateEmcForRecipe(recipes, configured, recipe)) .filter(OptionalDouble::isPresent) .mapToDouble(OptionalDouble::getAsDouble) .average(); res.ifPresent(emc -> data.put(item, emc)); if (res.isPresent() && res.getAsDouble() <= 0) { res = OptionalDouble.empty(); } return res; } private OptionalDouble calculateEmcForRecipe( List recipes, Set configured, SimplifiedRecipe recipe ) { try { if (recipe.inputs.isEmpty()) { return OptionalDouble.empty(); } var inputEmc = recipe.inputs .stream() .map(ingredient -> calculateEmcForIngredient(recipes, configured, ingredient)) .mapToDouble(OptionalDouble::orElseThrow) .sum(); if (inputEmc <= 0) { return OptionalDouble.empty(); } var remainderEmc = recipe.remainder .stream() .map(remainder -> configEmc(recipes, configured, remainder.getItem())) .mapToDouble(OptionalDouble::orElseThrow) .sum(); if (remainderEmc > inputEmc) { ErisAlchemy.LOGGER.warn("Recipe generating {} creates too much EMC out of thin air!", recipe.output); return OptionalDouble.empty(); } else if (remainderEmc < 0) { return OptionalDouble.empty(); } var outputDivisor = (double) recipe.output.getCount(); return OptionalDouble.of((inputEmc - remainderEmc) / outputDivisor); } catch (NoSuchElementException e) { return OptionalDouble.empty(); } } private OptionalDouble calculateEmcForIngredient( List recipes, Set configured, Ingredient ingredient ) { return Arrays.stream(ingredient.getItems()) .map(stack -> configEmc(recipes, configured, stack.getItem()).stream() .map(x -> x * stack.getCount()) .findFirst()) .filter(OptionalDouble::isPresent) .mapToDouble(OptionalDouble::getAsDouble) .filter(x -> x > 0) .average(); } static { ITEM_COMMON_MAP.putAll(Map.ofEntries( Map.entry(Items.AIR, -1.0), Map.entry(Items.AMETHYST_CLUSTER, -1.0), Map.entry(Items.AMETHYST_SHARD, 1024.0), Map.entry(Items.ANCIENT_DEBRIS, -1.0), Map.entry(Items.APPLE, 128.0), Map.entry(Items.BAMBOO, 2.0), Map.entry(Items.BARRIER, -1.0), Map.entry(Items.BEDROCK, -1.0), Map.entry(Items.BEEF, 64.0), Map.entry(Items.BEETROOT, 24.0), Map.entry(Items.BEETROOT_SEEDS, 16.0), Map.entry(Items.BIG_DRIPLEAF, 1.0), Map.entry(Items.BLAZE_ROD, 1536.0), Map.entry(Items.BONE, 96.0), Map.entry(Items.BROWN_MUSHROOM, 32.0), Map.entry(Items.BROWN_MUSHROOM_BLOCK, -1.0), Map.entry(Items.BUDDING_AMETHYST, -1.0), Map.entry(Items.CACTUS, 8.0), Map.entry(Items.CARROT, 24.0), Map.entry(Items.CALCITE, 1.0), Map.entry(Items.CHAIN_COMMAND_BLOCK, -1.0), Map.entry(Items.CHICKEN, 64.0), Map.entry(Items.CHORUS_FLOWER, 32.0), Map.entry(Items.CHORUS_FRUIT, 32.0), Map.entry(Items.CHORUS_PLANT, 24.0), Map.entry(Items.CLAY_BALL, 64.0), Map.entry(Items.COAL, 128.0), Map.entry(Items.COBWEB, 12.0), Map.entry(Items.COBBLESTONE, 1.0), Map.entry(Items.COBBLED_DEEPSLATE, 1.0), Map.entry(Items.COCOA_BEANS, 8.0), Map.entry(Items.COMMAND_BLOCK, -1.0), Map.entry(Items.COMMAND_BLOCK_MINECART, -1.0), Map.entry(Items.COPPER_INGOT, 85.0), Map.entry(Items.CREEPER_HEAD, 34816.0), Map.entry(Items.CRIMSON_FUNGUS, 24.0), Map.entry(Items.CRIMSON_ROOTS, 1.0), Map.entry(Items.CRYING_OBSIDIAN, 64.0), Map.entry(Items.DEAD_BUSH, 1.0), Map.entry(Items.DEBUG_STICK, -1.0), Map.entry(Items.DIAMOND, 8192.0), Map.entry(Items.DIRT_PATH, 1.0), Map.entry(Items.DRAGON_BREATH, 34816.0), Map.entry(Items.DRAGON_EGG, 139264.0), Map.entry(Items.DRAGON_HEAD, 34816.0), Map.entry(Items.ECHO_SHARD, 128.0), Map.entry(Items.EGG, 32.0), Map.entry(Items.ELYTRA, 8196.0), Map.entry(Items.EMERALD, 1024.0), Map.entry(Items.ENCHANTED_BOOK, -1.0), Map.entry(Items.END_PORTAL_FRAME, -1.0), Map.entry(Items.END_STONE, 1.0), Map.entry(Items.ENDER_PEARL, 1024.0), Map.entry(Items.EXPERIENCE_BOTTLE, -1.0), Map.entry(Items.FARMLAND, -1.0), Map.entry(Items.FEATHER, 48.0), Map.entry(Items.FERN, 1.0), Map.entry(Items.FIREWORK_STAR, -1.0), Map.entry(Items.FLINT, 4.0), Map.entry(Items.FROGSPAWN, -1.0), Map.entry(Items.GHAST_TEAR, 4096.0), Map.entry(Items.GLOW_BERRIES, 8.0), Map.entry(Items.GLOW_LICHEN, 8.0), Map.entry(Items.GLOWSTONE_DUST, 384.0), Map.entry(Items.GOAT_HORN, 32.0), Map.entry(Items.GOLD_INGOT, 2048.0), Map.entry(Items.GOLD_NUGGET, 2048.0/9), Map.entry(Items.GRASS, 1.0), Map.entry(Items.GRAVEL, 4.0), Map.entry(Items.GUNPOWDER, 192.0), Map.entry(Items.HANGING_ROOTS, 1.0), Map.entry(Items.HEART_OF_THE_SEA, 4096.0), Map.entry(Items.HONEYCOMB, 24.0), Map.entry(Items.ICE, 1.0), Map.entry(Items.INFESTED_CHISELED_STONE_BRICKS, -1.0), Map.entry(Items.INFESTED_COBBLESTONE, -1.0), Map.entry(Items.INFESTED_CRACKED_STONE_BRICKS, -1.0), Map.entry(Items.INFESTED_DEEPSLATE, -1.0), Map.entry(Items.INFESTED_MOSSY_STONE_BRICKS, -1.0), Map.entry(Items.INFESTED_STONE, -1.0), Map.entry(Items.INFESTED_STONE_BRICKS, -1.0), Map.entry(Items.IRON_INGOT, 256.0), Map.entry(Items.IRON_NUGGET, 256.0/9), Map.entry(Items.JIGSAW, -1.0), Map.entry(Items.KELP, 32.0), Map.entry(Items.KNOWLEDGE_BOOK, -1.0), Map.entry(Items.LAPIS_LAZULI, 864.0), Map.entry(Items.LARGE_AMETHYST_BUD, -1.0), Map.entry(Items.LARGE_FERN, 1.0), Map.entry(Items.LEATHER, 64.0), Map.entry(Items.LIGHT, -1.0), Map.entry(Items.LILY_PAD, 16.0), Map.entry(Items.LINGERING_POTION, -1.0), Map.entry(Items.MANGROVE_ROOTS, 1.0), Map.entry(Items.MEDIUM_AMETHYST_BUD, -1.0), Map.entry(Items.MELON_SLICE, 144.0), Map.entry(Items.MUD, 1.0), Map.entry(Items.MUSHROOM_STEM, -1.0), Map.entry(Items.MUTTON, 64.0), Map.entry(Items.NAME_TAG, -1.0), Map.entry(Items.NAUTILUS_SHELL, 64.0), Map.entry(Items.NETHER_QUARTZ_ORE, -1.0), Map.entry(Items.NETHER_SPROUTS, 1.0), Map.entry(Items.NETHER_STAR, 139264.0), Map.entry(Items.NETHER_WART, 24.0), Map.entry(Items.NETHERITE_SCRAP, 16384.0), Map.entry(Items.OBSIDIAN, 64.0), Map.entry(Items.PHANTOM_MEMBRANE, 96.0), Map.entry(Items.PIGLIN_HEAD, 34816.0), Map.entry(Items.PITCHER_POD, 8.0), Map.entry(Items.PLAYER_HEAD, 34816.0), Map.entry(Items.POINTED_DRIPSTONE, 0.25), Map.entry(Items.PORKCHOP, 64.0), Map.entry(Items.POTATO, 24.0), Map.entry(Items.POTION, -1.0), Map.entry(Items.PRISMARINE_CRYSTALS, 384.0), Map.entry(Items.PRISMARINE_SHARD, 0.25), Map.entry(Items.PUMPKIN, 144.0), Map.entry(Items.QUARTZ, 64.0), Map.entry(Items.RABBIT, 64.0), Map.entry(Items.RABBIT_HIDE, 64.0), Map.entry(Items.RAW_COPPER, -1.0), Map.entry(Items.RAW_COPPER_BLOCK, -1.0), Map.entry(Items.RAW_GOLD, -1.0), Map.entry(Items.RAW_GOLD_BLOCK, -1.0), Map.entry(Items.RAW_IRON, -1.0), Map.entry(Items.RAW_IRON_BLOCK, -1.0), Map.entry(Items.RED_MUSHROOM, 32.0), Map.entry(Items.RED_MUSHROOM_BLOCK, -1.0), Map.entry(Items.REDSTONE, 64.0), Map.entry(Items.REINFORCED_DEEPSLATE, -1.0), Map.entry(Items.REPEATING_COMMAND_BLOCK, -1.0), Map.entry(Items.ROTTEN_FLESH, 24.0), Map.entry(Items.SADDLE, 192.0), Map.entry(Items.SCULK, 1.0), Map.entry(Items.SCULK_CATALYST, 16.0), Map.entry(Items.SCULK_SENSOR, 32.0), Map.entry(Items.SCULK_SHRIEKER, 16.0), Map.entry(Items.SCULK_VEIN, 1.0), Map.entry(Items.SCUTE, 32.0), Map.entry(Items.SEA_PICKLE, 1.0), Map.entry(Items.SEAGRASS, 1.0), Map.entry(Items.SHULKER_SHELL, 256.0), Map.entry(Items.SKELETON_SKULL, 34816.0), Map.entry(Items.SLIME_BALL, 24.0), Map.entry(Items.SMALL_AMETHYST_BUD, -1.0), Map.entry(Items.SMALL_DRIPLEAF, 1.0), Map.entry(Items.SNIFFER_EGG, 32.0), Map.entry(Items.SNOWBALL, 1.0), Map.entry(Items.SOUL_SAND, 49.0), Map.entry(Items.SOUL_SOIL, 49.0), Map.entry(Items.SPAWNER, -1.0), Map.entry(Items.SPIDER_EYE, 128.0), Map.entry(Items.SPLASH_POTION, -1.0), Map.entry(Items.SPONGE, 48.0), Map.entry(Items.SPORE_BLOSSOM, 1.0), Map.entry(Items.STICK, 4.0), Map.entry(Items.STRING, 12.0), Map.entry(Items.STRUCTURE_BLOCK, -1.0), Map.entry(Items.STRUCTURE_VOID, -1.0), Map.entry(Items.SUGAR_CANE, 32.0), Map.entry(Items.SUSPICIOUS_GRAVEL, 4.0), Map.entry(Items.SWEET_BERRIES, 8.0), Map.entry(Items.TALL_GRASS, 1.0), Map.entry(Items.TIPPED_ARROW, -1.0), Map.entry(Items.TORCHFLOWER_SEEDS, 8.0), Map.entry(Items.TOTEM_OF_UNDYING, 4096.0), Map.entry(Items.TURTLE_EGG, 32.0), Map.entry(Items.TWISTING_VINES, 8.0), Map.entry(Items.VINE, 8.0), Map.entry(Items.WARPED_FUNGUS, 24.0), Map.entry(Items.WARPED_ROOTS, 1.0), Map.entry(Items.WARPED_WART_BLOCK, 1.0), Map.entry(Items.WEEPING_VINES, 8.0), Map.entry(Items.WET_SPONGE, 48.0), Map.entry(Items.WHEAT, 24.0), Map.entry(Items.WHEAT_SEEDS, 16.0), Map.entry(Items.WITHER_SKELETON_SKULL, 34816.0), Map.entry(Items.WRITTEN_BOOK, -1.0), Map.entry(Items.ZOMBIE_HEAD, 34816.0), Map.entry(PatchouliItems.BOOK, -1.0) )); SpawnEggItem.eggs().forEach(spawnEgg -> ITEM_COMMON_MAP.put(spawnEgg, -1.0)); CoralUtils.streamAllCoralBlocks().forEach(block -> ITEM_COMMON_MAP.put(block.asItem(), 1.0)); CoralUtils.streamAllDeadCoralBlocks().forEach(block -> ITEM_COMMON_MAP.put(block.asItem(), 1.0)); CoralUtils.streamAllCorals().forEach(block -> ITEM_COMMON_MAP.put(block.asItem(), 1.0)); CoralUtils.streamAllDeadCorals().forEach(block -> ITEM_COMMON_MAP.put(block.asItem(), 1.0)); BLOCK_TAG_COMMON_MAP.putAll(Map.ofEntries( Map.entry(BlockTags.BASE_STONE_NETHER, 1.0), Map.entry(BlockTags.BASE_STONE_OVERWORLD, 1.0), Map.entry(BlockTags.NYLIUM, 1.0) )); ITEM_TAG_COMMON_MAP.putAll(Map.ofEntries( Map.entry(ItemTags.COAL_ORES, -1.0), Map.entry(ItemTags.COPPER_ORES, -1.0), Map.entry(ItemTags.DIAMOND_ORES, -1.0), Map.entry(ItemTags.DIRT, 1.0), Map.entry(ItemTags.MUSIC_DISCS, 4096.0), Map.entry(ItemTags.EMERALD_ORES, -1.0), Map.entry(ItemTags.FISHES, 64.0), Map.entry(ItemTags.FLOWERS, 16.0), Map.entry(ItemTags.GOLD_ORES, -1.0), Map.entry(ItemTags.IRON_ORES, -1.0), Map.entry(ItemTags.LAPIS_ORES, -1.0), Map.entry(ItemTags.LEAVES, 1.0), Map.entry(ItemTags.LOGS, 32.0), Map.entry(ItemTags.REDSTONE_ORES, -1.0), Map.entry(ItemTags.SAND, 1.0), Map.entry(ItemTags.SAPLINGS, 32.0), Map.entry(ItemTags.WOOL, 48.0) )); FAKE_RECIPES.addAll(List.of( // more oxidised coppers are worth less new SimplifiedRecipe(new ItemStack(Items.EXPOSED_COPPER, 4), new ItemStack(Items.COPPER_BLOCK, 3)), new SimplifiedRecipe(new ItemStack(Items.WEATHERED_COPPER, 4), new ItemStack(Items.COPPER_BLOCK, 2)), new SimplifiedRecipe(new ItemStack(Items.OXIDIZED_COPPER, 4), new ItemStack(Items.COPPER_BLOCK, 1)), new SimplifiedRecipe(new ItemStack(Items.WAXED_EXPOSED_COPPER, 4), new ItemStack(Items.WAXED_COPPER_BLOCK, 3)), new SimplifiedRecipe(new ItemStack(Items.WAXED_WEATHERED_COPPER, 4), new ItemStack(Items.WAXED_COPPER_BLOCK, 2)), new SimplifiedRecipe(new ItemStack(Items.WAXED_OXIDIZED_COPPER, 4), new ItemStack(Items.WAXED_COPPER_BLOCK, 1)), // more damaged anvils are worth less new SimplifiedRecipe(new ItemStack(Items.CHIPPED_ANVIL, 3), new ItemStack(Items.ANVIL, 2)), new SimplifiedRecipe(new ItemStack(Items.DAMAGED_ANVIL, 3), new ItemStack(Items.ANVIL, 1)), // old oak slabs are the same value as modern ones new SimplifiedRecipe(Items.PETRIFIED_OAK_SLAB, Items.OAK_SLAB), // chainmail armour is worth the same as normal iron armor new SimplifiedRecipe(Items.CHAINMAIL_HELMET, Items.IRON_HELMET), new SimplifiedRecipe(Items.CHAINMAIL_CHESTPLATE, Items.IRON_CHESTPLATE), new SimplifiedRecipe(Items.CHAINMAIL_LEGGINGS, Items.IRON_LEGGINGS), new SimplifiedRecipe(Items.CHAINMAIL_BOOTS, Items.IRON_BOOTS), // enchanted golden apple is worth uhh 16 times the non-enchanted one :3 new SimplifiedRecipe(Items.ENCHANTED_GOLDEN_APPLE, new ItemStack(Items.GOLDEN_APPLE, 16)), // carving a pumpkin with shears new SimplifiedRecipe(Items.CARVED_PUMPKIN, List.of(new ItemStack(Items.PUMPKIN_SEEDS, 4)), Items.PUMPKIN), // gathering honey new SimplifiedRecipe(Items.HONEY_BOTTLE, Items.HONEYCOMB, Items.GLASS_BOTTLE), // smithing template duplicating recipes but -1 templates on both sides new SimplifiedRecipe(Items.COAST_ARMOR_TRIM_SMITHING_TEMPLATE, new ItemStack(Items.DIAMOND, 7), new ItemStack(Items.COBBLESTONE)), new SimplifiedRecipe(Items.DUNE_ARMOR_TRIM_SMITHING_TEMPLATE, new ItemStack(Items.DIAMOND, 7), new ItemStack(Items.SANDSTONE)), new SimplifiedRecipe(Items.EYE_ARMOR_TRIM_SMITHING_TEMPLATE, new ItemStack(Items.DIAMOND, 7), new ItemStack(Items.END_STONE)), new SimplifiedRecipe(Items.HOST_ARMOR_TRIM_SMITHING_TEMPLATE, new ItemStack(Items.DIAMOND, 7), new ItemStack(Items.TERRACOTTA)), new SimplifiedRecipe(Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE, new ItemStack(Items.DIAMOND, 7), new ItemStack(Items.NETHERRACK)), new SimplifiedRecipe(Items.RAISER_ARMOR_TRIM_SMITHING_TEMPLATE, new ItemStack(Items.DIAMOND, 7), new ItemStack(Items.TERRACOTTA)), new SimplifiedRecipe(Items.RIB_ARMOR_TRIM_SMITHING_TEMPLATE, new ItemStack(Items.DIAMOND, 7), new ItemStack(Items.NETHERRACK)), new SimplifiedRecipe(Items.SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE, new ItemStack(Items.DIAMOND, 7), new ItemStack(Items.COBBLESTONE)), new SimplifiedRecipe(Items.SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE, new ItemStack(Items.DIAMOND, 7), new ItemStack(Items.TERRACOTTA)), new SimplifiedRecipe(Items.SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE, new ItemStack(Items.DIAMOND, 7), new ItemStack(Items.COBBLED_DEEPSLATE)), new SimplifiedRecipe(Items.SNOUT_ARMOR_TRIM_SMITHING_TEMPLATE, new ItemStack(Items.DIAMOND, 7), new ItemStack(Items.BLACKSTONE)), new SimplifiedRecipe(Items.SPIRE_ARMOR_TRIM_SMITHING_TEMPLATE, new ItemStack(Items.DIAMOND, 7), new ItemStack(Items.PURPUR_BLOCK)), new SimplifiedRecipe(Items.TIDE_ARMOR_TRIM_SMITHING_TEMPLATE, new ItemStack(Items.DIAMOND, 7), new ItemStack(Items.PRISMARINE)), new SimplifiedRecipe(Items.VEX_ARMOR_TRIM_SMITHING_TEMPLATE, new ItemStack(Items.DIAMOND, 7), new ItemStack(Items.COBBLESTONE)), new SimplifiedRecipe(Items.WARD_ARMOR_TRIM_SMITHING_TEMPLATE, new ItemStack(Items.DIAMOND, 7), new ItemStack(Items.COBBLED_DEEPSLATE)), new SimplifiedRecipe(Items.WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE, new ItemStack(Items.DIAMOND, 7), new ItemStack(Items.TERRACOTTA)), new SimplifiedRecipe(Items.WILD_ARMOR_TRIM_SMITHING_TEMPLATE, new ItemStack(Items.DIAMOND, 7), new ItemStack(Items.MOSSY_COBBLESTONE)), // water bucket = bucket + water, water assumed to be same value as cobblestone new SimplifiedRecipe(Items.WATER_BUCKET, Items.BUCKET, Items.COBBLESTONE), // lava bucket = bucket + lava, lava assumed to be same value as obsidian new SimplifiedRecipe(Items.LAVA_BUCKET, Items.BUCKET, Items.OBSIDIAN), // powder snow bucket = bucket + snow new SimplifiedRecipe(Items.POWDER_SNOW_BUCKET, Items.BUCKET, Items.SNOW_BLOCK), // milk bucket = bucket + milk, milk assumed to be same value as wheat new SimplifiedRecipe(Items.MILK_BUCKET, Items.BUCKET, Items.WHEAT), // [fish] bucket = bucket + [fish] new SimplifiedRecipe(Items.COD_BUCKET, Items.BUCKET, Items.COD), new SimplifiedRecipe(Items.PUFFERFISH_BUCKET, Items.BUCKET, Items.PUFFERFISH), new SimplifiedRecipe(Items.SALMON_BUCKET, Items.BUCKET, Items.SALMON), new SimplifiedRecipe(Items.TROPICAL_FISH_BUCKET, Items.BUCKET, Items.TROPICAL_FISH), // yep new SimplifiedRecipe(Items.AXOLOTL_BUCKET, Items.TROPICAL_FISH_BUCKET), new SimplifiedRecipe(Items.TADPOLE_BUCKET, Items.AXOLOTL_BUCKET), // dye value is the canon new SimplifiedRecipe(Items.INK_SAC, Items.BLACK_DYE), // disc value is the canon new SimplifiedRecipe(new ItemStack(Items.DISC_FRAGMENT_5, 9), Items.MUSIC_DISC_5), // glowing ink sac is more expensive than an ink sac new SimplifiedRecipe(Items.GLOW_INK_SAC, new ItemStack(Items.INK_SAC, 4)), // activated maps cost the same as unactivated ones new SimplifiedRecipe(Items.FILLED_MAP, Items.MAP), // poisonous potato costs less than a normal one new SimplifiedRecipe(new ItemStack(Items.POISONOUS_POTATO, 2), Items.POTATO), // rabbits foot costs more than rabbit meat new SimplifiedRecipe(Items.RABBIT_FOOT, new ItemStack(Items.RABBIT, 8)), // [X] horse armor == [X] leggings // wtf, why? see how much leather is used by leather horse armor new SimplifiedRecipe(Items.IRON_HORSE_ARMOR, Items.IRON_LEGGINGS), new SimplifiedRecipe(Items.GOLDEN_HORSE_ARMOR, Items.GOLDEN_LEGGINGS), new SimplifiedRecipe(Items.DIAMOND_HORSE_ARMOR, Items.DIAMOND_LEGGINGS), // Trident = 1.5 * iron sword new SimplifiedRecipe(new ItemStack(Items.TRIDENT, 2), new ItemStack(Items.IRON_SWORD, 3)), // an actual recipe but it's special, minecraft:crafting_special_suspiciousstew new SimplifiedRecipe(Items.SUSPICIOUS_STEW, Items.BOWL, Items.BROWN_MUSHROOM, Items.RED_MUSHROOM, Items.POPPY), // obvious new SimplifiedRecipe(Items.GLOBE_BANNER_PATTERN, Items.CREEPER_BANNER_PATTERN), new SimplifiedRecipe(Items.PIGLIN_BANNER_PATTERN, Items.CREEPER_BANNER_PATTERN), // the vibes fit new SimplifiedRecipe(Items.BELL, Items.SPYGLASS), // light sources, shroomlight has no crafting uses but is brighter new SimplifiedRecipe(Items.SHROOMLIGHT, Items.GLOWSTONE), // bee nest = honeycomb block new SimplifiedRecipe(Items.BEE_NEST, new ItemStack(Items.HONEYCOMB, 9)), // gilded blackstone = blackstone with gold nuggets new SimplifiedRecipe(Items.GILDED_BLACKSTONE, new ItemStack(Items.BLACKSTONE), new ItemStack(Items.GOLD_NUGGET, 4)), // froglight = eaten magma cube new SimplifiedRecipe(Items.OCHRE_FROGLIGHT, Items.MAGMA_CREAM), new SimplifiedRecipe(Items.PEARLESCENT_FROGLIGHT, Items.MAGMA_CREAM), new SimplifiedRecipe(Items.VERDANT_FROGLIGHT, Items.MAGMA_CREAM), // UPGRADE[1.20.1]: currently experimental stuff new SimplifiedRecipe(Items.BUNDLE, new ItemStack(Items.RABBIT_HIDE, 6), new ItemStack(Items.STRING, 2)) )); // pot sherds can be replaced with bricks when making decorated pots ItemUtils.streamTag(ItemTags.DECORATED_POT_SHERDS).forEach(sherd -> FAKE_RECIPES.add(new SimplifiedRecipe(sherd, Items.BRICK))); for (var color : DyeColor.values()) { ITEM_COMMON_MAP.put(DyeUtils.getDye(color), 8.0); FAKE_RECIPES.addAll(List.of( // putting concrete powder in water new SimplifiedRecipe(DyeUtils.getConcrete(color), DyeUtils.getConcretePowder(color)), // an actual recipe but it's special, minecraft:crafting_special_shulkerboxcoloring new SimplifiedRecipe(DyeUtils.getShulkerBox(color), Items.SHULKER_BOX, DyeUtils.getDye(color)) )); } } }