|
1 | | -//package dev.compactmods.machines.compat.jei; |
2 | | -// |
3 | | -//import dev.compactmods.machines.CompactMachinesCommon; |
4 | | -//import dev.compactmods.machines.api.CompactMachines; |
5 | | -//import dev.compactmods.machines.api.component.CMDataComponents; |
6 | | -//import dev.compactmods.machines.api.machine.MachineConstants; |
7 | | -//import dev.compactmods.machines.api.room.template.RoomTemplateHelper; |
8 | | -//import dev.compactmods.machines.machine.Machines; |
9 | | -//import dev.compactmods.machines.shrinking.Shrinking; |
10 | | -//import mezz.jei.api.IModPlugin; |
11 | | -//import mezz.jei.api.JeiPlugin; |
12 | | -//import mezz.jei.api.constants.VanillaTypes; |
13 | | -//import mezz.jei.api.ingredients.IIngredientType; |
14 | | -//import mezz.jei.api.ingredients.subtypes.ISubtypeInterpreter; |
15 | | -//import mezz.jei.api.ingredients.subtypes.UidContext; |
16 | | -//import mezz.jei.api.registration.IRecipeRegistration; |
17 | | -//import mezz.jei.api.registration.ISubtypeRegistration; |
18 | | -//import net.minecraft.network.chat.Component; |
19 | | -//import net.minecraft.resources.ResourceLocation; |
20 | | -//import net.minecraft.tags.TagKey; |
21 | | -//import net.minecraft.world.item.Item; |
22 | | -//import net.minecraft.world.item.ItemStack; |
23 | | -//import net.minecraft.world.item.crafting.Ingredient; |
24 | | -//import net.neoforged.neoforge.server.ServerLifecycleHooks; |
25 | | -//import org.jetbrains.annotations.NotNull; |
26 | | -//import org.jetbrains.annotations.Nullable; |
27 | | -// |
28 | | -//import javax.annotation.ParametersAreNonnullByDefault; |
29 | | -//import javax.annotation.ParametersAreNullableByDefault; |
30 | | -// |
31 | | -//@JeiPlugin |
32 | | -//public class CompactMachinesJeiPlugin implements IModPlugin { |
33 | | -// @Override |
34 | | -// public ResourceLocation getPluginUid() { |
35 | | -// return CompactMachines.modRL("main"); |
36 | | -// } |
37 | | -// |
38 | | -// @Override |
39 | | -// public void registerRecipes(IRecipeRegistration registration) { |
40 | | -// registration.addIngredientInfo( |
41 | | -// Machines.Items.unboundColored(CompactMachinesCommon.BRAND_MACHINE_COLOR), |
42 | | -// VanillaTypes.ITEM_STACK, |
43 | | -// Component.translatable("jei.compactmachines.machines")); |
44 | | -// |
45 | | -// // Add all known template JEI infos |
46 | | -// RoomTemplateHelper.getTemplateHolders(ServerLifecycleHooks.getCurrentServer().registryAccess()) |
47 | | -// .map(Machines.Items::forNewRoom) |
48 | | -// .forEach(t -> registration.addIngredientInfo(t, VanillaTypes.ITEM_STACK, |
49 | | -// Component.translatable("jei.compactmachines.machines"))); |
50 | | -// |
51 | | -// registration.addIngredientInfo( |
52 | | -// new ItemStack(Shrinking.PERSONAL_SHRINKING_DEVICE.get()), |
53 | | -// VanillaTypes.ITEM_STACK, |
54 | | -// Component.translatable("jei.compactmachines.shrinking_device")); |
55 | | -// } |
56 | | -// |
57 | | -// @Override |
58 | | -// @ParametersAreNonnullByDefault |
59 | | -// public void registerItemSubtypes(ISubtypeRegistration registration) { |
60 | | -// registration.registerSubtypeInterpreter(VanillaTypes.ITEM_STACK, Machines.Items.UNBOUND_MACHINE.get(), |
61 | | -// new ISubtypeInterpreter<>() { |
62 | | -// @Override |
63 | | -// public @Nullable Object getSubtypeData(ItemStack ingredient, UidContext context) { |
64 | | -// return ingredient.get(CMDataComponents.ROOM_TEMPLATE_ID); |
65 | | -// } |
66 | | -// |
67 | | -// @Override |
68 | | -// public @NotNull String getLegacyStringSubtypeInfo(ItemStack ingredient, UidContext context) { |
69 | | -// return ""; |
70 | | -// } |
71 | | -// }); |
72 | | -// } |
73 | | -//} |
| 1 | +package dev.compactmods.machines.compat.jei; |
| 2 | + |
| 3 | +import dev.compactmods.machines.CompactMachinesCommon; |
| 4 | +import dev.compactmods.machines.api.CompactMachines; |
| 5 | +import dev.compactmods.machines.api.component.CMDataComponents; |
| 6 | +import dev.compactmods.machines.api.room.template.RoomTemplateHelper; |
| 7 | +import dev.compactmods.machines.machine.Machines; |
| 8 | +import dev.compactmods.machines.shrinking.Shrinking; |
| 9 | +import mezz.jei.api.IModPlugin; |
| 10 | +import mezz.jei.api.JeiPlugin; |
| 11 | +import mezz.jei.api.constants.VanillaTypes; |
| 12 | +import mezz.jei.api.ingredients.subtypes.ISubtypeInterpreter; |
| 13 | +import mezz.jei.api.ingredients.subtypes.UidContext; |
| 14 | +import mezz.jei.api.registration.IRecipeRegistration; |
| 15 | +import mezz.jei.api.registration.ISubtypeRegistration; |
| 16 | +import net.minecraft.network.chat.Component; |
| 17 | +import net.minecraft.resources.ResourceLocation; |
| 18 | +import net.minecraft.world.item.ItemStack; |
| 19 | +import net.neoforged.neoforge.server.ServerLifecycleHooks; |
| 20 | +import org.jetbrains.annotations.NotNull; |
| 21 | +import org.jetbrains.annotations.Nullable; |
| 22 | + |
| 23 | +import javax.annotation.ParametersAreNonnullByDefault; |
| 24 | + |
| 25 | +@JeiPlugin |
| 26 | +public class CompactMachinesJeiPlugin implements IModPlugin { |
| 27 | + @Override |
| 28 | + public @NotNull ResourceLocation getPluginUid() { |
| 29 | + return CompactMachines.modRL("main"); |
| 30 | + } |
| 31 | + |
| 32 | + @Override |
| 33 | + public void registerRecipes(IRecipeRegistration registration) { |
| 34 | + registration.addIngredientInfo( |
| 35 | + Machines.Items.unboundColored(CompactMachinesCommon.BRAND_MACHINE_COLOR), |
| 36 | + VanillaTypes.ITEM_STACK, |
| 37 | + Component.translatable("jei.compactmachines.machines")); |
| 38 | + |
| 39 | + // Add all known template JEI infos |
| 40 | + RoomTemplateHelper.getTemplateHolders(ServerLifecycleHooks.getCurrentServer().registryAccess()) |
| 41 | + .map(Machines.Items::forNewRoom) |
| 42 | + .forEach(t -> registration.addIngredientInfo(t, VanillaTypes.ITEM_STACK, |
| 43 | + Component.translatable("jei.compactmachines.machines"))); |
| 44 | + |
| 45 | + registration.addIngredientInfo( |
| 46 | + new ItemStack(Shrinking.PERSONAL_SHRINKING_DEVICE.get()), |
| 47 | + VanillaTypes.ITEM_STACK, |
| 48 | + Component.translatable("jei.compactmachines.shrinking_device")); |
| 49 | + } |
| 50 | + |
| 51 | + @Override |
| 52 | + @ParametersAreNonnullByDefault |
| 53 | + public void registerItemSubtypes(ISubtypeRegistration registration) { |
| 54 | + registration.registerSubtypeInterpreter(VanillaTypes.ITEM_STACK, Machines.Items.UNBOUND_MACHINE.get(), |
| 55 | + (ingredient, context) -> ingredient.get(CMDataComponents.ROOM_TEMPLATE_ID)); |
| 56 | + } |
| 57 | +} |
0 commit comments