Skip to content

Commit

Permalink
feat: ✨ Add stonecutter and chipped upgrades as recipe catalysts so t…
Browse files Browse the repository at this point in the history
…hat they show up in JEI as ways to craft the given blocks
  • Loading branch information
P3pp3rF1y committed Nov 19, 2023
1 parent 48755f1 commit 7a0b602
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
org.gradle.daemon=false
minecraft_version=1.18.2
forge_version=40.1.30
mod_version=3.18.67
mod_version=3.18.68
jei_mc_version=1.18.2
jei_version=9.7.0+
curios_version=1.18.2-5.0.6.+
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package net.p3pp3rf1y.sophisticatedbackpacks.compat.chipped;

import earth.terrarium.chipped.Chipped;
import earth.terrarium.chipped.recipe.ChippedRecipe;
import earth.terrarium.chipped.registry.ModRecipeTypes;
import mezz.jei.api.recipe.RecipeType;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.IEventBus;
Expand All @@ -10,6 +15,7 @@
import net.minecraftforge.registries.RegistryObject;
import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks;
import net.p3pp3rf1y.sophisticatedbackpacks.client.gui.SBPButtonDefinitions;
import net.p3pp3rf1y.sophisticatedbackpacks.compat.jei.SBPPlugin;
import net.p3pp3rf1y.sophisticatedbackpacks.init.ModItems;
import net.p3pp3rf1y.sophisticatedcore.client.gui.StorageScreenBase;
import net.p3pp3rf1y.sophisticatedcore.client.gui.UpgradeGuiManager;
Expand Down Expand Up @@ -39,11 +45,20 @@ public class ChippedCompat implements ICompat {
public static final RegistryObject<BlockTransformationUpgradeItem> TINKERER_WORKBENCH_UPGRADE = ModItems.ITEMS.register("chipped/tinkerer_workbench_upgrade",
() -> new BlockTransformationUpgradeItem(SophisticatedBackpacks.ITEM_GROUP, ModRecipeTypes.MECHANIST_WORKBENCH_TYPE));


@Override
public void init() {
IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus();
modBus.addGenericListener(MenuType.class, this::registerContainers);

SBPPlugin.setAdditionalCatalystRegistrar(registration -> {
registration.addRecipeCatalyst(new ItemStack(BOTANIST_WORKBENCH_UPGRADE.get()), new RecipeType<>(new ResourceLocation(Chipped.MOD_ID, "botanist_workbench"), ChippedRecipe.class));
registration.addRecipeCatalyst(new ItemStack(GLASSBLOWER_WORKBENCH_UPGRADE.get()), new RecipeType<>(new ResourceLocation(Chipped.MOD_ID, "glassblower"), ChippedRecipe.class));
registration.addRecipeCatalyst(new ItemStack(CARPENTER_WORKBENCH_UPGRADE.get()), new RecipeType<>(new ResourceLocation(Chipped.MOD_ID, "carpenters_table"), ChippedRecipe.class));
registration.addRecipeCatalyst(new ItemStack(SHEPHERD_WORKBENCH_UPGRADE.get()), new RecipeType<>(new ResourceLocation(Chipped.MOD_ID, "loom_table"), ChippedRecipe.class));
registration.addRecipeCatalyst(new ItemStack(MASON_WORKBENCH_UPGRADE.get()), new RecipeType<>(new ResourceLocation(Chipped.MOD_ID, "mason_table"), ChippedRecipe.class));
registration.addRecipeCatalyst(new ItemStack(PHILOSOPHER_WORKBENCH_UPGRADE.get()), new RecipeType<>(new ResourceLocation(Chipped.MOD_ID, "alchemy_bench"), ChippedRecipe.class));
registration.addRecipeCatalyst(new ItemStack(TINKERER_WORKBENCH_UPGRADE.get()), new RecipeType<>(new ResourceLocation(Chipped.MOD_ID, "mechanist_workbench"), ChippedRecipe.class));
});
}

public void registerContainers(RegistryEvent.Register<MenuType<?>> evt) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Auto generated package-info by MCP

@ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault
package net.p3pp3rf1y.sophisticatedbackpacks.compat.chipped;

import net.minecraft.MethodsReturnNonnullByDefault;

import javax.annotation.ParametersAreNonnullByDefault;
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,16 @@

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;

@SuppressWarnings("unused")
@JeiPlugin
public class SBPPlugin implements IModPlugin {
private static Consumer<IRecipeCatalystRegistration> additionalCatalystRegistrar = registration -> {};
public static void setAdditionalCatalystRegistrar(Consumer<IRecipeCatalystRegistration> additionalCatalystRegistrar) {
SBPPlugin.additionalCatalystRegistrar = additionalCatalystRegistrar;
}

@Override
public ResourceLocation getPluginUid() {
return new ResourceLocation(SophisticatedBackpacks.MOD_ID, "default");
Expand Down Expand Up @@ -93,6 +99,8 @@ private UpgradeRecipe copyUpgradeRecipe(UpgradeRecipe recipe) {
@Override
public void registerRecipeCatalysts(IRecipeCatalystRegistration registration) {
registration.addRecipeCatalyst(new ItemStack(ModItems.CRAFTING_UPGRADE.get()), RecipeTypes.CRAFTING);
registration.addRecipeCatalyst(new ItemStack(ModItems.STONECUTTER_UPGRADE.get()), RecipeTypes.STONECUTTING);
additionalCatalystRegistrar.accept(registration);
}

@Override
Expand Down

0 comments on commit 7a0b602

Please sign in to comment.