diff --git a/src/main/java/me/ramidzkh/mekae2/integration/jei/AE2JeiIntegrationHelper.java b/src/main/java/me/ramidzkh/mekae2/integration/jei/AE2JeiIntegrationHelper.java index a1370d5..f598be7 100644 --- a/src/main/java/me/ramidzkh/mekae2/integration/jei/AE2JeiIntegrationHelper.java +++ b/src/main/java/me/ramidzkh/mekae2/integration/jei/AE2JeiIntegrationHelper.java @@ -3,7 +3,7 @@ import tamaized.ae2jeiintegration.api.integrations.jei.IngredientConverters; public class AE2JeiIntegrationHelper { - public static void register() { - IngredientConverters.register(new ChemicalIngredientConverter()); - } + public static void register() { + IngredientConverters.register(new ChemicalIngredientConverter()); + } } diff --git a/src/main/java/me/ramidzkh/mekae2/integration/jei/AMJeiPlugin.java b/src/main/java/me/ramidzkh/mekae2/integration/jei/AMJeiPlugin.java index 98f0994..5ec1bbb 100644 --- a/src/main/java/me/ramidzkh/mekae2/integration/jei/AMJeiPlugin.java +++ b/src/main/java/me/ramidzkh/mekae2/integration/jei/AMJeiPlugin.java @@ -1,30 +1,31 @@ package me.ramidzkh.mekae2.integration.jei; -import me.ramidzkh.mekae2.AppliedMekanistics; -import mezz.jei.api.IModPlugin; -import mezz.jei.api.JeiPlugin; import net.minecraft.resources.ResourceLocation; import net.neoforged.fml.ModList; import net.neoforged.fml.loading.LoadingModList; import net.neoforged.fml.loading.moddiscovery.ModInfo; +import me.ramidzkh.mekae2.AppliedMekanistics; +import mezz.jei.api.IModPlugin; +import mezz.jei.api.JeiPlugin; + @JeiPlugin public class AMJeiPlugin implements IModPlugin { - @Override - public ResourceLocation getPluginUid() { - return ResourceLocation.fromNamespaceAndPath(AppliedMekanistics.ID, "jei_plugin"); - } + @Override + public ResourceLocation getPluginUid() { + return ResourceLocation.fromNamespaceAndPath(AppliedMekanistics.ID, "jei_plugin"); + } - public AMJeiPlugin() { - if (isModLoaded("ae2jeiintegration")) { - AE2JeiIntegrationHelper.register(); - } - } + public AMJeiPlugin() { + if (isModLoaded("ae2jeiintegration")) { + AE2JeiIntegrationHelper.register(); + } + } - private static boolean isModLoaded(String modId) { - if (ModList.get() == null) { - return LoadingModList.get().getMods().stream().map(ModInfo::getModId).anyMatch(modId::equals); - } - return ModList.get().isLoaded(modId); - } + private static boolean isModLoaded(String modId) { + if (ModList.get() == null) { + return LoadingModList.get().getMods().stream().map(ModInfo::getModId).anyMatch(modId::equals); + } + return ModList.get().isLoaded(modId); + } } diff --git a/src/main/java/me/ramidzkh/mekae2/integration/jei/ChemicalIngredientConverter.java b/src/main/java/me/ramidzkh/mekae2/integration/jei/ChemicalIngredientConverter.java index 4423d18..8885140 100644 --- a/src/main/java/me/ramidzkh/mekae2/integration/jei/ChemicalIngredientConverter.java +++ b/src/main/java/me/ramidzkh/mekae2/integration/jei/ChemicalIngredientConverter.java @@ -1,43 +1,45 @@ package me.ramidzkh.mekae2.integration.jei; -import appeng.api.stacks.GenericStack; +import org.jetbrains.annotations.Nullable; + import me.ramidzkh.mekae2.ae2.MekanismKey; import mekanism.api.IMekanismAccess; import mekanism.api.chemical.ChemicalStack; import mekanism.api.integration.jei.IMekanismJEIHelper; import mezz.jei.api.ingredients.IIngredientHelper; import mezz.jei.api.ingredients.IIngredientType; -import org.jetbrains.annotations.Nullable; import tamaized.ae2jeiintegration.api.integrations.jei.IngredientConverter; +import appeng.api.stacks.GenericStack; + public class ChemicalIngredientConverter implements IngredientConverter { - private final IIngredientType ingredientType; - - public ChemicalIngredientConverter() { - IMekanismJEIHelper mekJeiHelper = IMekanismAccess.INSTANCE.jeiHelper(); - IIngredientHelper chemicalStackHelper = mekJeiHelper.getChemicalStackHelper(); - this.ingredientType = chemicalStackHelper.getIngredientType(); - } - - @Override - public IIngredientType getIngredientType() { - return ingredientType; - } - - @Override - public @Nullable ChemicalStack getIngredientFromStack(GenericStack genericStack) { - if (genericStack.what() instanceof MekanismKey key) { - return key.withAmount(genericStack.amount()); - } - return null; - } - - @Override - public @Nullable GenericStack getStackFromIngredient(ChemicalStack chemicalStack) { - var what = MekanismKey.of(chemicalStack); - if (what == null) { - return null; - } - return new GenericStack(what, chemicalStack.getAmount()); - } + private final IIngredientType ingredientType; + + public ChemicalIngredientConverter() { + IMekanismJEIHelper mekJeiHelper = IMekanismAccess.INSTANCE.jeiHelper(); + IIngredientHelper chemicalStackHelper = mekJeiHelper.getChemicalStackHelper(); + this.ingredientType = chemicalStackHelper.getIngredientType(); + } + + @Override + public IIngredientType getIngredientType() { + return ingredientType; + } + + @Override + public @Nullable ChemicalStack getIngredientFromStack(GenericStack genericStack) { + if (genericStack.what() instanceof MekanismKey key) { + return key.withAmount(genericStack.amount()); + } + return null; + } + + @Override + public @Nullable GenericStack getStackFromIngredient(ChemicalStack chemicalStack) { + var what = MekanismKey.of(chemicalStack); + if (what == null) { + return null; + } + return new GenericStack(what, chemicalStack.getAmount()); + } } diff --git a/src/main/java/me/ramidzkh/mekae2/integration/jei/package-info.java b/src/main/java/me/ramidzkh/mekae2/integration/jei/package-info.java index 3ca6fa7..3242e34 100644 --- a/src/main/java/me/ramidzkh/mekae2/integration/jei/package-info.java +++ b/src/main/java/me/ramidzkh/mekae2/integration/jei/package-info.java @@ -2,6 +2,6 @@ @MethodsReturnNonnullByDefault package me.ramidzkh.mekae2.integration.jei; -import net.minecraft.MethodsReturnNonnullByDefault; - import javax.annotation.ParametersAreNonnullByDefault; + +import net.minecraft.MethodsReturnNonnullByDefault;