diff --git a/build.gradle b/build.gradle index 94eafa1d..310fc5e3 100644 --- a/build.gradle +++ b/build.gradle @@ -105,6 +105,12 @@ dependencies { runtimeOnly fg.deobf("curse.maven:balm-531761:${balm_cf_file_id}") compileOnly fg.deobf("curse.maven:craftingtweaks-233071:${crafting_tweaks_cf_file_id}") runtimeOnly fg.deobf("curse.maven:craftingtweaks-233071:${crafting_tweaks_cf_file_id}") + compileOnly fg.deobf("curse.maven:chipped-456956:${chipped_cf_file_id}") + runtimeOnly fg.deobf("curse.maven:chipped-456956:${chipped_cf_file_id}") + compileOnly fg.deobf("curse.maven:athena-841890:${athena_cf_file_id}") + runtimeOnly fg.deobf("curse.maven:athena-841890:${athena_cf_file_id}") + compileOnly fg.deobf("curse.maven:resourcefullib-570073:${resourcefullib_cf_file_id}") + runtimeOnly fg.deobf("curse.maven:resourcefullib-570073:${resourcefullib_cf_file_id}") /* compileOnly fg.deobf("vazkii.botania:Botania:${botania_version}:api") runtimeOnly fg.deobf("vazkii.botania:Botania:${botania_version}") diff --git a/gradle.properties b/gradle.properties index 0304ebb0..eb8f0e6c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.daemon=false mod_id=sophisticatedbackpacks mod_group_id=sophisticatedbackpacks -mod_version=3.18.66 +mod_version=3.18.67 sonar_project_key=sophisticatedbackpacks:SophisticatedBackpacks github_package_url=https://maven.pkg.github.com/P3pp3rF1y/SophisticatedBackpacks @@ -22,5 +22,8 @@ botania_version=1.19.2-439-FORGE-SNAPSHOT patchouli_version=1.19.2-78-SNAPSHOT balm_cf_file_id=4597440 crafting_tweaks_cf_file_id=4596466 -sc_version=[1.20.1-0.5.99,1.21) +chipped_cf_file_id=4634856 +resourcefullib_cf_file_id=4851864 +athena_cf_file_id=4764357 +sc_version=[1.20.1-0.5.106,1.21) parchment_version=1.19.3-2023.03.12-1.20 \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/botanist_workbench_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/botanist_workbench_upgrade.json new file mode 100644 index 00000000..3a1240f3 --- /dev/null +++ b/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/botanist_workbench_upgrade.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "sophisticatedbackpacks:chipped/botanist_workbench_upgrade" + ] + }, + "criteria": { + "has_upgrade_base": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "items": [ + "sophisticatedbackpacks:upgrade_base" + ] + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "sophisticatedbackpacks:chipped/botanist_workbench_upgrade" + } + } + }, + "requirements": [ + [ + "has_upgrade_base", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/carpenter_workbench_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/carpenter_workbench_upgrade.json new file mode 100644 index 00000000..bbf764e1 --- /dev/null +++ b/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/carpenter_workbench_upgrade.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "sophisticatedbackpacks:chipped/carpenter_workbench_upgrade" + ] + }, + "criteria": { + "has_upgrade_base": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "items": [ + "sophisticatedbackpacks:upgrade_base" + ] + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "sophisticatedbackpacks:chipped/carpenter_workbench_upgrade" + } + } + }, + "requirements": [ + [ + "has_upgrade_base", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/glassblower_workbench_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/glassblower_workbench_upgrade.json new file mode 100644 index 00000000..c60504f4 --- /dev/null +++ b/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/glassblower_workbench_upgrade.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "sophisticatedbackpacks:chipped/glassblower_workbench_upgrade" + ] + }, + "criteria": { + "has_upgrade_base": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "items": [ + "sophisticatedbackpacks:upgrade_base" + ] + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "sophisticatedbackpacks:chipped/glassblower_workbench_upgrade" + } + } + }, + "requirements": [ + [ + "has_upgrade_base", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/mason_workbench_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/mason_workbench_upgrade.json new file mode 100644 index 00000000..8e62f903 --- /dev/null +++ b/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/mason_workbench_upgrade.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "sophisticatedbackpacks:chipped/mason_workbench_upgrade" + ] + }, + "criteria": { + "has_upgrade_base": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "items": [ + "sophisticatedbackpacks:upgrade_base" + ] + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "sophisticatedbackpacks:chipped/mason_workbench_upgrade" + } + } + }, + "requirements": [ + [ + "has_upgrade_base", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/philosopher_workbench_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/philosopher_workbench_upgrade.json new file mode 100644 index 00000000..7afa7187 --- /dev/null +++ b/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/philosopher_workbench_upgrade.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "sophisticatedbackpacks:chipped/philosopher_workbench_upgrade" + ] + }, + "criteria": { + "has_upgrade_base": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "items": [ + "sophisticatedbackpacks:upgrade_base" + ] + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "sophisticatedbackpacks:chipped/philosopher_workbench_upgrade" + } + } + }, + "requirements": [ + [ + "has_upgrade_base", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/shepherd_workbench_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/shepherd_workbench_upgrade.json new file mode 100644 index 00000000..32b04ce9 --- /dev/null +++ b/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/shepherd_workbench_upgrade.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "sophisticatedbackpacks:chipped/shepherd_workbench_upgrade" + ] + }, + "criteria": { + "has_upgrade_base": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "items": [ + "sophisticatedbackpacks:upgrade_base" + ] + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "sophisticatedbackpacks:chipped/shepherd_workbench_upgrade" + } + } + }, + "requirements": [ + [ + "has_upgrade_base", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/tinkerer_workbench_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/tinkerer_workbench_upgrade.json new file mode 100644 index 00000000..2ac690c1 --- /dev/null +++ b/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/sophisticatedbackpacks/chipped/tinkerer_workbench_upgrade.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "sophisticatedbackpacks:chipped/tinkerer_workbench_upgrade" + ] + }, + "criteria": { + "has_upgrade_base": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "items": [ + "sophisticatedbackpacks:upgrade_base" + ] + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "sophisticatedbackpacks:chipped/tinkerer_workbench_upgrade" + } + } + }, + "requirements": [ + [ + "has_upgrade_base", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/botanist_workbench_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/botanist_workbench_upgrade.json new file mode 100644 index 00000000..f945412f --- /dev/null +++ b/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/botanist_workbench_upgrade.json @@ -0,0 +1,35 @@ +{ + "type": "minecraft:crafting_shaped", + "conditions": [ + { + "modid": "chipped", + "type": "forge:mod_loaded" + }, + { + "itemRegistryName": "sophisticatedbackpacks:chipped/botanist_workbench_upgrade", + "type": "sophisticatedcore:item_enabled" + } + ], + "pattern": [ + " W ", + "IBI", + " R " + ], + "key": { + "B": { + "item": "sophisticatedbackpacks:upgrade_base" + }, + "R": { + "tag": "forge:dusts/redstone" + }, + "I": { + "tag": "forge:ingots/iron" + }, + "W": { + "item": "chipped:botanist_workbench" + } + }, + "result": { + "item": "sophisticatedbackpacks:chipped/botanist_workbench_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/carpenter_workbench_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/carpenter_workbench_upgrade.json new file mode 100644 index 00000000..a7bbe187 --- /dev/null +++ b/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/carpenter_workbench_upgrade.json @@ -0,0 +1,35 @@ +{ + "type": "minecraft:crafting_shaped", + "conditions": [ + { + "modid": "chipped", + "type": "forge:mod_loaded" + }, + { + "itemRegistryName": "sophisticatedbackpacks:chipped/carpenter_workbench_upgrade", + "type": "sophisticatedcore:item_enabled" + } + ], + "pattern": [ + " W ", + "IBI", + " R " + ], + "key": { + "B": { + "item": "sophisticatedbackpacks:upgrade_base" + }, + "R": { + "tag": "forge:dusts/redstone" + }, + "I": { + "tag": "forge:ingots/iron" + }, + "W": { + "item": "chipped:carpenters_table" + } + }, + "result": { + "item": "sophisticatedbackpacks:chipped/carpenter_workbench_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/glassblower_workbench_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/glassblower_workbench_upgrade.json new file mode 100644 index 00000000..d0556abf --- /dev/null +++ b/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/glassblower_workbench_upgrade.json @@ -0,0 +1,35 @@ +{ + "type": "minecraft:crafting_shaped", + "conditions": [ + { + "modid": "chipped", + "type": "forge:mod_loaded" + }, + { + "itemRegistryName": "sophisticatedbackpacks:chipped/glassblower_workbench_upgrade", + "type": "sophisticatedcore:item_enabled" + } + ], + "pattern": [ + " W ", + "IBI", + " R " + ], + "key": { + "B": { + "item": "sophisticatedbackpacks:upgrade_base" + }, + "R": { + "tag": "forge:dusts/redstone" + }, + "I": { + "tag": "forge:ingots/iron" + }, + "W": { + "item": "chipped:glassblower" + } + }, + "result": { + "item": "sophisticatedbackpacks:chipped/glassblower_workbench_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/mason_workbench_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/mason_workbench_upgrade.json new file mode 100644 index 00000000..e43c5f90 --- /dev/null +++ b/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/mason_workbench_upgrade.json @@ -0,0 +1,35 @@ +{ + "type": "minecraft:crafting_shaped", + "conditions": [ + { + "modid": "chipped", + "type": "forge:mod_loaded" + }, + { + "itemRegistryName": "sophisticatedbackpacks:chipped/mason_workbench_upgrade", + "type": "sophisticatedcore:item_enabled" + } + ], + "pattern": [ + " W ", + "IBI", + " R " + ], + "key": { + "B": { + "item": "sophisticatedbackpacks:upgrade_base" + }, + "R": { + "tag": "forge:dusts/redstone" + }, + "I": { + "tag": "forge:ingots/iron" + }, + "W": { + "item": "chipped:mason_table" + } + }, + "result": { + "item": "sophisticatedbackpacks:chipped/mason_workbench_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/philosopher_workbench_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/philosopher_workbench_upgrade.json new file mode 100644 index 00000000..cb157065 --- /dev/null +++ b/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/philosopher_workbench_upgrade.json @@ -0,0 +1,35 @@ +{ + "type": "minecraft:crafting_shaped", + "conditions": [ + { + "modid": "chipped", + "type": "forge:mod_loaded" + }, + { + "itemRegistryName": "sophisticatedbackpacks:chipped/philosopher_workbench_upgrade", + "type": "sophisticatedcore:item_enabled" + } + ], + "pattern": [ + " W ", + "IBI", + " R " + ], + "key": { + "B": { + "item": "sophisticatedbackpacks:upgrade_base" + }, + "R": { + "tag": "forge:dusts/redstone" + }, + "I": { + "tag": "forge:ingots/iron" + }, + "W": { + "item": "chipped:alchemy_bench" + } + }, + "result": { + "item": "sophisticatedbackpacks:chipped/philosopher_workbench_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/shepherd_workbench_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/shepherd_workbench_upgrade.json new file mode 100644 index 00000000..dcc74141 --- /dev/null +++ b/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/shepherd_workbench_upgrade.json @@ -0,0 +1,35 @@ +{ + "type": "minecraft:crafting_shaped", + "conditions": [ + { + "modid": "chipped", + "type": "forge:mod_loaded" + }, + { + "itemRegistryName": "sophisticatedbackpacks:chipped/shepherd_workbench_upgrade", + "type": "sophisticatedcore:item_enabled" + } + ], + "pattern": [ + " W ", + "IBI", + " R " + ], + "key": { + "B": { + "item": "sophisticatedbackpacks:upgrade_base" + }, + "R": { + "tag": "forge:dusts/redstone" + }, + "I": { + "tag": "forge:ingots/iron" + }, + "W": { + "item": "chipped:loom_table" + } + }, + "result": { + "item": "sophisticatedbackpacks:chipped/shepherd_workbench_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/tinkerer_workbench_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/tinkerer_workbench_upgrade.json new file mode 100644 index 00000000..56642561 --- /dev/null +++ b/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/tinkerer_workbench_upgrade.json @@ -0,0 +1,35 @@ +{ + "type": "minecraft:crafting_shaped", + "conditions": [ + { + "modid": "chipped", + "type": "forge:mod_loaded" + }, + { + "itemRegistryName": "sophisticatedbackpacks:chipped/tinkerer_workbench_upgrade", + "type": "sophisticatedcore:item_enabled" + } + ], + "pattern": [ + " W ", + "IBI", + " R " + ], + "key": { + "B": { + "item": "sophisticatedbackpacks:upgrade_base" + }, + "R": { + "tag": "forge:dusts/redstone" + }, + "I": { + "tag": "forge:ingots/iron" + }, + "W": { + "item": "chipped:mechanist_workbench" + } + }, + "result": { + "item": "sophisticatedbackpacks:chipped/tinkerer_workbench_upgrade" + } +} \ No newline at end of file diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/SophisticatedBackpacks.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/SophisticatedBackpacks.java index 2d4d4469..99c336c6 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/SophisticatedBackpacks.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/SophisticatedBackpacks.java @@ -41,6 +41,7 @@ public SophisticatedBackpacks() { ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, Config.SERVER_SPEC); ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.COMMON_SPEC); commonEventHandler.registerHandlers(); + ModCompat.initCompats(); IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus(); if (FMLEnvironment.dist == Dist.CLIENT) { ClientEventHandler.registerHandlers(); @@ -61,7 +62,7 @@ public SophisticatedBackpacks() { private static void setup(FMLCommonSetupEvent event) { SBPPacketHandler.INSTANCE.init(); - ModCompat.initCompats(); + ModCompat.compatsSetup(); event.enqueueWork(ModItems::registerDispenseBehavior); ModItems.registerCauldronInteractions(); } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/CompatModIds.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/CompatModIds.java index c7272284..9680eb86 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/CompatModIds.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/CompatModIds.java @@ -6,4 +6,5 @@ private CompatModIds() {} public static final String BOTANIA = "botania"; public static final String CURIOS = "curios"; public static final String QUARK = "quark"; + public static final String CHIPPED = "chipped"; } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/chipped/ChippedCompat.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/chipped/ChippedCompat.java new file mode 100644 index 00000000..ba4322ea --- /dev/null +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/chipped/ChippedCompat.java @@ -0,0 +1,74 @@ +package net.p3pp3rf1y.sophisticatedbackpacks.compat.chipped; + +import earth.terrarium.chipped.common.registry.ModRecipeTypes; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegisterEvent; +import net.minecraftforge.registries.RegistryObject; +import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; +import net.p3pp3rf1y.sophisticatedbackpacks.client.gui.SBPButtonDefinitions; +import net.p3pp3rf1y.sophisticatedbackpacks.init.ModItems; +import net.p3pp3rf1y.sophisticatedcore.client.gui.StorageScreenBase; +import net.p3pp3rf1y.sophisticatedcore.client.gui.UpgradeGuiManager; +import net.p3pp3rf1y.sophisticatedcore.client.gui.utils.Position; +import net.p3pp3rf1y.sophisticatedcore.common.gui.UpgradeContainerRegistry; +import net.p3pp3rf1y.sophisticatedcore.common.gui.UpgradeContainerType; +import net.p3pp3rf1y.sophisticatedcore.compat.ICompat; +import net.p3pp3rf1y.sophisticatedcore.compat.chipped.BlockTransformationUpgradeContainer; +import net.p3pp3rf1y.sophisticatedcore.compat.chipped.BlockTransformationUpgradeItem; +import net.p3pp3rf1y.sophisticatedcore.compat.chipped.BlockTransformationUpgradeTab; +import net.p3pp3rf1y.sophisticatedcore.compat.chipped.BlockTransformationUpgradeWrapper; + +public class ChippedCompat implements ICompat { + + public static final RegistryObject BOTANIST_WORKBENCH_UPGRADE = ModItems.ITEMS.register("chipped/botanist_workbench_upgrade", + () -> new BlockTransformationUpgradeItem(ModRecipeTypes.BOTANIST_WORKBENCH_TYPE)); + public static final RegistryObject GLASSBLOWER_WORKBENCH_UPGRADE = ModItems.ITEMS.register("chipped/glassblower_workbench_upgrade", + () -> new BlockTransformationUpgradeItem(ModRecipeTypes.GLASSBLOWER_TYPE)); + public static final RegistryObject CARPENTER_WORKBENCH_UPGRADE = ModItems.ITEMS.register("chipped/carpenter_workbench_upgrade", + () -> new BlockTransformationUpgradeItem(ModRecipeTypes.CARPENTERS_TABLE_TYPE)); + public static final RegistryObject SHEPHERD_WORKBENCH_UPGRADE = ModItems.ITEMS.register("chipped/shepherd_workbench_upgrade", + () -> new BlockTransformationUpgradeItem(ModRecipeTypes.LOOM_TABLE_TYPE)); + public static final RegistryObject MASON_WORKBENCH_UPGRADE = ModItems.ITEMS.register("chipped/mason_workbench_upgrade", + () -> new BlockTransformationUpgradeItem(ModRecipeTypes.MASON_TABLE_TYPE)); + public static final RegistryObject PHILOSOPHER_WORKBENCH_UPGRADE = ModItems.ITEMS.register("chipped/philosopher_workbench_upgrade", + () -> new BlockTransformationUpgradeItem(ModRecipeTypes.ALCHEMY_BENCH_TYPE)); + public static final RegistryObject TINKERER_WORKBENCH_UPGRADE = ModItems.ITEMS.register("chipped/tinkerer_workbench_upgrade", + () -> new BlockTransformationUpgradeItem(ModRecipeTypes.TINKERING_TABLE_TYPE)); + + @Override + public void init() { + IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus(); + modBus.addListener(this::registerContainers); + } + + public void registerContainers(RegisterEvent event) { + if (!event.getRegistryKey().equals(ForgeRegistries.Keys.MENU_TYPES)) { + return; + } + registerUpgradeContainer(BOTANIST_WORKBENCH_UPGRADE); + registerUpgradeContainer(GLASSBLOWER_WORKBENCH_UPGRADE); + registerUpgradeContainer(CARPENTER_WORKBENCH_UPGRADE); + registerUpgradeContainer(SHEPHERD_WORKBENCH_UPGRADE); + registerUpgradeContainer(MASON_WORKBENCH_UPGRADE); + registerUpgradeContainer(PHILOSOPHER_WORKBENCH_UPGRADE); + registerUpgradeContainer(TINKERER_WORKBENCH_UPGRADE); + } + + private void registerUpgradeContainer(RegistryObject item) { + UpgradeContainerType containerType = new UpgradeContainerType<>(BlockTransformationUpgradeContainer::new); + UpgradeContainerRegistry.register(item.getId(), containerType); + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> UpgradeGuiManager.registerTab(containerType, (BlockTransformationUpgradeContainer upgradeContainer, Position position, StorageScreenBase screen) -> { + String itemName = item.getId().getPath(); + return new BlockTransformationUpgradeTab(upgradeContainer, position, screen, SBPButtonDefinitions.SHIFT_CLICK_TARGET, itemName.replace('/', '_').substring(0, itemName.length() - "_upgrade".length())); + })); + } + + @Override + public void setup() { + //noop + } +} diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/curios/CuriosCompat.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/curios/CuriosCompat.java index 26528dac..b3c447d1 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/curios/CuriosCompat.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/curios/CuriosCompat.java @@ -40,18 +40,6 @@ public class CuriosCompat implements ICompat { public CuriosCompat() { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); modEventBus.addListener(this::sendImc); - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> { - CuriosRendererRegistry.register(ModItems.BACKPACK.get(), BackpackCurioRenderer::new); - CuriosRendererRegistry.register(ModItems.IRON_BACKPACK.get(), BackpackCurioRenderer::new); - CuriosRendererRegistry.register(ModItems.GOLD_BACKPACK.get(), BackpackCurioRenderer::new); - CuriosRendererRegistry.register(ModItems.DIAMOND_BACKPACK.get(), BackpackCurioRenderer::new); - CuriosRendererRegistry.register(ModItems.NETHERITE_BACKPACK.get(), BackpackCurioRenderer::new); - }); - - IEventBus eventBus = MinecraftForge.EVENT_BUS; - eventBus.addGenericListener(ItemStack.class, this::onAttachCapabilities); - - addPlayerInventoryHandlers(); } private void addPlayerInventoryHandlers() { @@ -100,6 +88,17 @@ public LazyOptional getCapability(Capability cap, @Nullable Direction @Override public void setup() { - //noop + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> { + CuriosRendererRegistry.register(ModItems.BACKPACK.get(), BackpackCurioRenderer::new); + CuriosRendererRegistry.register(ModItems.IRON_BACKPACK.get(), BackpackCurioRenderer::new); + CuriosRendererRegistry.register(ModItems.GOLD_BACKPACK.get(), BackpackCurioRenderer::new); + CuriosRendererRegistry.register(ModItems.DIAMOND_BACKPACK.get(), BackpackCurioRenderer::new); + CuriosRendererRegistry.register(ModItems.NETHERITE_BACKPACK.get(), BackpackCurioRenderer::new); + }); + + IEventBus eventBus = MinecraftForge.EVENT_BUS; + eventBus.addGenericListener(ItemStack.class, this::onAttachCapabilities); + + addPlayerInventoryHandlers(); } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBPRecipeProvider.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBPRecipeProvider.java index 907b2135..24a19361 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBPRecipeProvider.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBPRecipeProvider.java @@ -12,10 +12,15 @@ import net.minecraft.tags.ItemTags; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraftforge.common.Tags; +import net.minecraftforge.common.crafting.conditions.ModLoadedCondition; import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; +import net.p3pp3rf1y.sophisticatedbackpacks.compat.chipped.ChippedCompat; import net.p3pp3rf1y.sophisticatedbackpacks.init.ModItems; +import net.p3pp3rf1y.sophisticatedcore.compat.CompatModIds; +import net.p3pp3rf1y.sophisticatedcore.compat.chipped.BlockTransformationUpgradeItem; import net.p3pp3rf1y.sophisticatedcore.crafting.ShapeBasedRecipeBuilder; import net.p3pp3rf1y.sophisticatedcore.init.ModRecipes; import net.p3pp3rf1y.sophisticatedcore.util.RegistryHelper; @@ -573,6 +578,32 @@ protected void buildRecipes(Consumer consumer) { Ingredient.of(Items.NETHERITE_INGOT), RecipeCategory.MISC, ModItems.NETHERITE_BACKPACK.get()) .unlocks("has_diamond_backpack", has(ModItems.DIAMOND_BACKPACK.get())) .save(consumer, RegistryHelper.getItemKey(ModItems.NETHERITE_BACKPACK.get())); + + addChippedUpgradeRecipes(consumer); + } + + private static void addChippedUpgradeRecipes(Consumer consumer) { + addChippedUpgradeRecipe(consumer, ChippedCompat.BOTANIST_WORKBENCH_UPGRADE.get(), earth.terrarium.chipped.common.registry.ModBlocks.BOTANIST_WORKBENCH.get()); + addChippedUpgradeRecipe(consumer, ChippedCompat.GLASSBLOWER_WORKBENCH_UPGRADE.get(), earth.terrarium.chipped.common.registry.ModBlocks.GLASSBLOWER.get()); + addChippedUpgradeRecipe(consumer, ChippedCompat.CARPENTER_WORKBENCH_UPGRADE.get(), earth.terrarium.chipped.common.registry.ModBlocks.CARPENTERS_TABLE.get()); + addChippedUpgradeRecipe(consumer, ChippedCompat.SHEPHERD_WORKBENCH_UPGRADE.get(), earth.terrarium.chipped.common.registry.ModBlocks.LOOM_TABLE.get()); + addChippedUpgradeRecipe(consumer, ChippedCompat.MASON_WORKBENCH_UPGRADE.get(), earth.terrarium.chipped.common.registry.ModBlocks.MASON_TABLE.get()); + addChippedUpgradeRecipe(consumer, ChippedCompat.PHILOSOPHER_WORKBENCH_UPGRADE.get(), earth.terrarium.chipped.common.registry.ModBlocks.ALCHEMY_BENCH.get()); + addChippedUpgradeRecipe(consumer, ChippedCompat.TINKERER_WORKBENCH_UPGRADE.get(), earth.terrarium.chipped.common.registry.ModBlocks.TINKERING_TABLE.get()); + } + + private static void addChippedUpgradeRecipe(Consumer consumer, BlockTransformationUpgradeItem upgrade, Block workbench) { + ShapeBasedRecipeBuilder.shaped(upgrade) + .pattern(" W ") + .pattern("IBI") + .pattern(" R ") + .define('B', ModItems.UPGRADE_BASE.get()) + .define('R', Tags.Items.DUSTS_REDSTONE) + .define('I', Tags.Items.INGOTS_IRON) + .define('W', workbench) + .unlockedBy(HAS_UPGRADE_BASE, has(ModItems.UPGRADE_BASE.get())) + .condition(new ModLoadedCondition(CompatModIds.CHIPPED)) + .save(consumer); } private static InventoryChangeTrigger.TriggerInstance hasLeather() { diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModCompat.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModCompat.java index 9f4afe3c..4746b1b1 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModCompat.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModCompat.java @@ -3,6 +3,7 @@ import net.minecraftforge.fml.ModList; import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; import net.p3pp3rf1y.sophisticatedbackpacks.compat.CompatModIds; +import net.p3pp3rf1y.sophisticatedbackpacks.compat.chipped.ChippedCompat; import net.p3pp3rf1y.sophisticatedbackpacks.compat.curios.CuriosCompat; import net.p3pp3rf1y.sophisticatedcore.compat.ICompat; @@ -15,22 +16,30 @@ public class ModCompat { private ModCompat() {} private static final Map>> compatFactories = new HashMap<>(); + private static final Map loadedCompats = new HashMap<>(); static { compatFactories.put(CompatModIds.CURIOS, () -> CuriosCompat::new); - //compatFactories.put(CompatModIds.BOTANIA, () -> BotaniaCompat::new); //TODO readd Botania compat + //compatFactories.put(CompatModIds.BOTANIA, () -> BotaniaCompat::new); + compatFactories.put(CompatModIds.CHIPPED, () -> ChippedCompat::new); + } + + public static void compatsSetup() { + loadedCompats.values().forEach(ICompat::setup); } public static void initCompats() { for (Map.Entry>> entry : compatFactories.entrySet()) { if (ModList.get().isLoaded(entry.getKey())) { try { - entry.getValue().get().call().setup(); + loadedCompats.put(entry.getKey(), entry.getValue().get().call()); } catch (Exception e) { SophisticatedBackpacks.LOGGER.error("Error instantiating compatibility ", e); } } } + + loadedCompats.values().forEach(ICompat::init); } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModItems.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModItems.java index 53ee0eb8..9c1f825e 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModItems.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModItems.java @@ -158,7 +158,7 @@ public class ModItems { private ModItems() {} - private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, SophisticatedBackpacks.MOD_ID); + public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, SophisticatedBackpacks.MOD_ID); public static final DeferredRegister CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB.location(), SophisticatedBackpacks.MOD_ID); public static final DeferredRegister LOOT_FUNCTION_TYPES = DeferredRegister.create(Registries.LOOT_FUNCTION_TYPE.location(), SophisticatedBackpacks.MOD_ID); public static final DeferredRegister LOOT_CONDITION_TYPES = DeferredRegister.create(Registries.LOOT_CONDITION_TYPE.location(), SophisticatedBackpacks.MOD_ID); diff --git a/src/main/resources/assets/sophisticatedbackpacks/lang/en_us.json b/src/main/resources/assets/sophisticatedbackpacks/lang/en_us.json index 4823829c..53131035 100644 --- a/src/main/resources/assets/sophisticatedbackpacks/lang/en_us.json +++ b/src/main/resources/assets/sophisticatedbackpacks/lang/en_us.json @@ -91,6 +91,20 @@ "item.sophisticatedbackpacks.tool_swapper_upgrade.tooltip": "Automatically swaps item in player's hand for the one effective on the block/entity when these are left clicked.", "item.sophisticatedbackpacks.advanced_tool_swapper_upgrade": "Advanced Tool Swapper Upgrade", "item.sophisticatedbackpacks.advanced_tool_swapper_upgrade.tooltip": "Automatically swaps item in player's hand for the one effective on the block/entity when these are left clicked.\nHas filter options and enables swapping wrench like tools for block/entity player is looking at with %s", + "item.sophisticatedbackpacks.chipped.botanist_workbench_upgrade": "Chipped: Botanist's Workbench Upgrade", + "item.sophisticatedbackpacks.chipped.botanist_workbench_upgrade.tooltip": "Chipped Botanist's Workbench in an upgrade tab", + "item.sophisticatedbackpacks.chipped.glassblower_workbench_upgrade": "Chipped: Glassblower's Workbench Upgrade", + "item.sophisticatedbackpacks.chipped.glassblower_workbench_upgrade.tooltip": "Chipped Glassblower's Workbench in an upgrade tab", + "item.sophisticatedbackpacks.chipped.carpenter_workbench_upgrade": "Chipped: Carpenter's Workbench Upgrade", + "item.sophisticatedbackpacks.chipped.carpenter_workbench_upgrade.tooltip": "Chipped Carpenter's Workbench in an upgrade tab", + "item.sophisticatedbackpacks.chipped.mason_workbench_upgrade": "Chipped: Mason's Workbench Upgrade", + "item.sophisticatedbackpacks.chipped.mason_workbench_upgrade.tooltip": "Chipped Mason's Workbench in an upgrade tab", + "item.sophisticatedbackpacks.chipped.shepherd_workbench_upgrade": "Chipped: Shepherd's Workbench Upgrade", + "item.sophisticatedbackpacks.chipped.shepherd_workbench_upgrade.tooltip": "Chipped Shepherd's Workbench in an upgrade tab", + "item.sophisticatedbackpacks.chipped.philosopher_workbench_upgrade": "Chipped: Philosopher's Workbench Upgrade", + "item.sophisticatedbackpacks.chipped.philosopher_workbench_upgrade.tooltip": "Chipped Philosopher's Workbench in an upgrade tab", + "item.sophisticatedbackpacks.chipped.tinkerer_workbench_upgrade": "Chipped: Tinkerer's Workbench Upgrade", + "item.sophisticatedbackpacks.chipped.tinkerer_workbench_upgrade.tooltip": "Chipped Tinkerer's Workbench in an upgrade tab", "keybind.sophisticatedbackpacks.category": "Sophisticated Backpacks", "keybind.sophisticatedbackpacks.open_backpack": "Open Backpack", "keybind.sophisticatedbackpacks.inventory_interaction": "Run Inventory Interaction Upgrades", diff --git a/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/botanist_workbench_upgrade.json b/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/botanist_workbench_upgrade.json new file mode 100644 index 00000000..52f3b3a0 --- /dev/null +++ b/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/botanist_workbench_upgrade.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "sophisticatedbackpacks:item/chipped/botanist_workbench_upgrade" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/carpenter_workbench_upgrade.json b/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/carpenter_workbench_upgrade.json new file mode 100644 index 00000000..61f96b95 --- /dev/null +++ b/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/carpenter_workbench_upgrade.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "sophisticatedbackpacks:item/chipped/carpenter_workbench_upgrade" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/glassblower_workbench_upgrade.json b/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/glassblower_workbench_upgrade.json new file mode 100644 index 00000000..a47f219b --- /dev/null +++ b/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/glassblower_workbench_upgrade.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "sophisticatedbackpacks:item/chipped/glassblower_workbench_upgrade" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/mason_workbench_upgrade.json b/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/mason_workbench_upgrade.json new file mode 100644 index 00000000..954c481e --- /dev/null +++ b/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/mason_workbench_upgrade.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "sophisticatedbackpacks:item/chipped/mason_workbench_upgrade" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/philosopher_workbench_upgrade.json b/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/philosopher_workbench_upgrade.json new file mode 100644 index 00000000..ec99417d --- /dev/null +++ b/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/philosopher_workbench_upgrade.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "sophisticatedbackpacks:item/chipped/philosopher_workbench_upgrade" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/shepherd_workbench_upgrade.json b/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/shepherd_workbench_upgrade.json new file mode 100644 index 00000000..976230bd --- /dev/null +++ b/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/shepherd_workbench_upgrade.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "sophisticatedbackpacks:item/chipped/shepherd_workbench_upgrade" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/tinkerer_workbench_upgrade.json b/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/tinkerer_workbench_upgrade.json new file mode 100644 index 00000000..b9e898f2 --- /dev/null +++ b/src/main/resources/assets/sophisticatedbackpacks/models/item/chipped/tinkerer_workbench_upgrade.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "sophisticatedbackpacks:item/chipped/tinkerer_workbench_upgrade" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/botanist_workbench_upgrade.png b/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/botanist_workbench_upgrade.png new file mode 100644 index 00000000..5111b33a Binary files /dev/null and b/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/botanist_workbench_upgrade.png differ diff --git a/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/carpenter_workbench_upgrade.png b/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/carpenter_workbench_upgrade.png new file mode 100644 index 00000000..41c54736 Binary files /dev/null and b/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/carpenter_workbench_upgrade.png differ diff --git a/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/glassblower_workbench_upgrade.png b/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/glassblower_workbench_upgrade.png new file mode 100644 index 00000000..b1bcf947 Binary files /dev/null and b/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/glassblower_workbench_upgrade.png differ diff --git a/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/mason_workbench_upgrade.png b/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/mason_workbench_upgrade.png new file mode 100644 index 00000000..fb188dcd Binary files /dev/null and b/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/mason_workbench_upgrade.png differ diff --git a/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/philosopher_workbench_upgrade.png b/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/philosopher_workbench_upgrade.png new file mode 100644 index 00000000..5fecf84b Binary files /dev/null and b/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/philosopher_workbench_upgrade.png differ diff --git a/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/shepherd_workbench_upgrade.png b/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/shepherd_workbench_upgrade.png new file mode 100644 index 00000000..37c79a6e Binary files /dev/null and b/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/shepherd_workbench_upgrade.png differ diff --git a/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/tinkerer_workbench_upgrade.png b/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/tinkerer_workbench_upgrade.png new file mode 100644 index 00000000..6578a82e Binary files /dev/null and b/src/main/resources/assets/sophisticatedbackpacks/textures/item/chipped/tinkerer_workbench_upgrade.png differ