1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
|
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.text.DecimalFormat;
import java.util.*;
import java.util.stream.Stream;
public class EMC {
private record SimplifiedRecipe(ItemStack output, List<ItemStack> remainder, List<Ingredient> 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<ItemStack> 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, Double> ITEM_COMMON_MAP = new HashMap<>();
private static final Map<TagKey<Item>, Double> ITEM_TAG_COMMON_MAP = new HashMap<>();
private static final Map<TagKey<Block>, Double> BLOCK_TAG_COMMON_MAP = new HashMap<>();
private static final List<SimplifiedRecipe> FAKE_RECIPES = new ArrayList<>();
private static final EMC defaultInstance = new EMC(null);
private static final Map<Level, EMC> instances = Collections.synchronizedMap(new WeakHashMap<>());
private static final DecimalFormat formatter = new DecimalFormat("0");
static {
formatter.setMaximumFractionDigits(1);
}
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;
}
public static String formatEmc(double value) {
return formatter.format(value);
}
private final Map<Item, Double> 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("Calculating EMC values...");
var recipes = getRecipes(world);
var configured = new HashSet<>(data.keySet());
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(ItemStack stack) {
if (stack.isEmpty()) {
return OptionalDouble.empty();
}
var item = stack.getItem();
var value = data.get(item);
if (value == null || value <= 0) {
return OptionalDouble.empty();
}
EmcStorage storage = null;
if (item instanceof EmcStorage emcStorage) {
storage = emcStorage;
} else if (item instanceof BlockItem blockItem) {
if (blockItem.getBlock() instanceof EmcStorage emcStorage) {
storage = emcStorage;
}
}
if (storage != null) {
value += storage.getStoredEmc(stack);
}
return OptionalDouble.of(value);
}
private List<SimplifiedRecipe> getRecipes(@Nullable Level world) {
Stream<SimplifiedRecipe> 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<SimplifiedRecipe> recipes, Set<Item> configured, Item item) {
var res = get(item.getDefaultInstance());
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<SimplifiedRecipe> recipes,
Set<Item> 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<SimplifiedRecipe> recipes,
Set<Item> 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.<Item, Double>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.BUNDLE, -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)
));
// 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))
));
}
}
}
|