diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index e9fb17a..220b9c2 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -23,6 +23,7 @@ body: - Fabric - Forge - NeoForge + - Quilt validations: required: true - type: input diff --git a/.github/workflows/cicd-workflow.yml b/.github/workflows/cicd-workflow.yml index e8bb421..80fa150 100644 --- a/.github/workflows/cicd-workflow.yml +++ b/.github/workflows/cicd-workflow.yml @@ -112,3 +112,41 @@ jobs: secrets: github-token: ${{ secrets.GITHUB_TOKEN }} modrinth-token: ${{ secrets.MODRINTH_API_KEY }} + publish-fabric-on-curseforge: + needs: publish-github + if: startsWith(github.ref, 'refs/tags/') + name: Publish Fabric on Curseforge + uses: cech12/MinecraftModActions/.github/workflows/publish-curseforge.yml@main + with: + java-version: 17 + subproject: fabric + title-prefix: fabric- + curseforge-id: 363593 + game-versions: | + 1.20.4 + release-type: release + loaders: | + fabric + quilt + secrets: + github-token: ${{ secrets.GITHUB_TOKEN }} + curseforge-token: ${{ secrets.CURSEFORGE_API_KEY }} + publish-fabric-on-modrinth: + needs: publish-github + if: startsWith(github.ref, 'refs/tags/') + name: Publish Fabric on Modrinth + uses: cech12/MinecraftModActions/.github/workflows/publish-modrinth.yml@main + with: + java-version: 17 + subproject: fabric + title-prefix: fabric- + modrinth-id: yzHyAUSI + game-versions: | + 1.20.4 + release-type: release + loaders: | + fabric + quilt + secrets: + github-token: ${{ secrets.GITHUB_TOKEN }} + modrinth-token: ${{ secrets.MODRINTH_API_KEY }} diff --git a/CHANGELOG.md b/CHANGELOG.md index fc5d943..6067560 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Forge Recommended Versioning](https://mcforge.readthedocs.io/en/latest/conventions/versioning/). +## [1.20.4-3.1.0.0] - 2024-04-25 +### Added +- add Fabric (>=0.96.11+1.20.4) support (Fabric, Quilt) + ## [1.20.4-3.0.0.0] - 2024-04-06 ### Changed - updated to Minecraft 1.20.4 (Forge 49.0.38, Neoforge 20.4.218) diff --git a/README.md b/README.md index 91afb82..b5951f0 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,12 @@ [![License](https://img.shields.io/github/license/cech12/BrickFurnace)](http://opensource.org/licenses/MIT) [![](https://img.shields.io/discord/752506676719910963.svg?style=flat&color=informational&logo=discord&label=Discord)](https://discord.gg/gRUFH5t) -This **Minecraft Forge** mod adds **Brick Furnaces** to the game. +This Minecraft mod adds **Brick Furnaces** to the game. (Forge, NeoForge, Fabric, Quilt) + +The Fabric / Quilt version needs the following mods: + +- Fabric API ([Github](https://github.com/FabricMC/fabric), [Curseforge](https://www.curseforge.com/minecraft/mc-mods/fabric-api), [Modrinth](https://modrinth.com/mod/fabric-api)) +- Cloth Config API ([Github](https://github.com/shedaniel/cloth-config), [Curseforge](https://www.curseforge.com/minecraft/mc-mods/cloth-config), [Modrinth](https://modrinth.com/mod/cloth-config)) ![All Furnaces](material/all_furnaces.png) diff --git a/build.gradle b/build.gradle index 36e6754..8b95bf0 100644 --- a/build.gradle +++ b/build.gradle @@ -60,8 +60,10 @@ subprojects { "forge_version": forge_version, "forge_version_range": forge_version_range, "forge_loader_version_range": forge_loader_version_range, - //"fabric_version": fabric_version, - //"fabric_loader_version": fabric_loader_version, + "fabric_version": fabric_version, + "fabric_loader_version": fabric_loader_version, + "cloth_config_version": cloth_config_version, + "mod_menu_version": mod_menu_version, "neoforge_version": neoforge_version, "neoforge_version_range": neoforge_version_range, "neoforge_loader_version_range": neoforge_loader_version_range, diff --git a/common/src/main/java/de/cech12/brickfurnace/CommonLoader.java b/common/src/main/java/de/cech12/brickfurnace/CommonLoader.java index bab50d6..679d9f3 100644 --- a/common/src/main/java/de/cech12/brickfurnace/CommonLoader.java +++ b/common/src/main/java/de/cech12/brickfurnace/CommonLoader.java @@ -6,6 +6,7 @@ import de.cech12.brickfurnace.platform.Services; import net.minecraft.core.Holder; import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.ai.village.poi.PoiType; import net.minecraft.world.entity.ai.village.poi.PoiTypes; import net.minecraft.world.level.block.Block; @@ -27,6 +28,10 @@ public static void init() { Services.CONFIG.init(); } + public static ResourceLocation id(String name) { + return new ResourceLocation(Constants.MOD_ID, name); + } + /** * Initialize method that should be called by every loader mod when the mod blocks are registered. */ diff --git a/common/src/main/java/de/cech12/brickfurnace/blockentity/AbstractBrickFurnaceBlockEntity.java b/common/src/main/java/de/cech12/brickfurnace/blockentity/AbstractBrickFurnaceBlockEntity.java index b977312..52543c7 100644 --- a/common/src/main/java/de/cech12/brickfurnace/blockentity/AbstractBrickFurnaceBlockEntity.java +++ b/common/src/main/java/de/cech12/brickfurnace/blockentity/AbstractBrickFurnaceBlockEntity.java @@ -71,8 +71,9 @@ public static void tick(Level level, BlockPos pos, BlockState state, AbstractBri entity.dataAccess.set(RECIPES_USED, entity.dataAccess.get(BURN_TIME)); //changed because of private variable if (entity.isBurning()) { dirty = true; - if (Services.PLATFORM.hasCraftingRemainingItem(fuel)) entity.items.set(1, Services.PLATFORM.getCraftingRemainingItem(fuel)); - else if (!fuel.isEmpty()) { + if (Services.PLATFORM.hasCraftingRemainingItem(fuel)) { + entity.items.set(1, Services.PLATFORM.getCraftingRemainingItem(fuel)); + } else if (!fuel.isEmpty()) { fuel.shrink(1); if (fuel.isEmpty()) { entity.items.set(1, Services.PLATFORM.getCraftingRemainingItem(fuel)); diff --git a/common/src/main/resources/assets/brickfurnace/lang/de_de.json b/common/src/main/resources/assets/brickfurnace/lang/de_de.json index a9b66e9..03d9404 100644 --- a/common/src/main/resources/assets/brickfurnace/lang/de_de.json +++ b/common/src/main/resources/assets/brickfurnace/lang/de_de.json @@ -4,5 +4,27 @@ "block.brickfurnace.brick_smoker": "Ziegel-Räucherofen", "top.brickfurnace.fuel": "Fuel", - "top.brickfurnace.n_ticks": "%d ticks" + "top.brickfurnace.n_ticks": "%d ticks", + + "text.autoconfig.brickfurnace.title": "Brick Furnaces Settings", + + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED": "Vanilla Recipes enabled", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[0]": "§6§lVanilla Recipes enabled", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[1]": "If enabled, the vanilla blasting, smelting, and", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[2]": "smoking recipes are used by the brick furnaces.", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[3]": "§7§oDefault: true", + + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR": "Cook time factor", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[0]": "§6§lCook time factor", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[1]": "Cook time factor of all added brick furnaces in relation", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[2]": "to corresponding vanilla furnaces. (percent)", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time, 200 twice the time", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 100", + + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST": "Recipe blocked list", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[0]": "§6§lRecipe blocked list", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[1]": "A comma separated list of all vanilla recipes that", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[2]": "should not be used by the brick furnaces.", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[3]": "§7§oExample: baked_potato,baked_potato_from_smoking,othermod:other_baked_food", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[4]": "§7§oDefault: " } \ No newline at end of file diff --git a/common/src/main/resources/assets/brickfurnace/lang/en_us.json b/common/src/main/resources/assets/brickfurnace/lang/en_us.json index 218f30d..16ea968 100644 --- a/common/src/main/resources/assets/brickfurnace/lang/en_us.json +++ b/common/src/main/resources/assets/brickfurnace/lang/en_us.json @@ -4,5 +4,27 @@ "block.brickfurnace.brick_smoker": "Brick Smoker", "top.brickfurnace.fuel": "Fuel", - "top.brickfurnace.n_ticks": "%d ticks" + "top.brickfurnace.n_ticks": "%d ticks", + + "text.autoconfig.brickfurnace.title": "Brick Furnaces Settings", + + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED": "Vanilla Recipes enabled", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[0]": "§6§lVanilla Recipes enabled", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[1]": "If enabled, the vanilla blasting, smelting, and", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[2]": "smoking recipes are used by the brick furnaces.", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[3]": "§7§oDefault: true", + + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR": "Cook time factor", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[0]": "§6§lCook time factor", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[1]": "Cook time factor of all added brick furnaces in relation", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[2]": "to corresponding vanilla furnaces. (percent)", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time, 200 twice the time", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 100", + + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST": "Recipe blocked list", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[0]": "§6§lRecipe blocked list", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[1]": "A comma separated list of all vanilla recipes that", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[2]": "should not be used by the brick furnaces.", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[3]": "§7§oExample: baked_potato,baked_potato_from_smoking,othermod:other_baked_food", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[4]": "§7§oDefault: " } \ No newline at end of file diff --git a/common/src/main/resources/assets/brickfurnace/lang/es_es.json b/common/src/main/resources/assets/brickfurnace/lang/es_es.json index 5b72c7d..b1b656b 100644 --- a/common/src/main/resources/assets/brickfurnace/lang/es_es.json +++ b/common/src/main/resources/assets/brickfurnace/lang/es_es.json @@ -4,5 +4,27 @@ "block.brickfurnace.brick_smoker": "Ahumador de ladrillos", "top.brickfurnace.fuel": "Fuel", - "top.brickfurnace.n_ticks": "%d ticks" + "top.brickfurnace.n_ticks": "%d ticks", + + "text.autoconfig.brickfurnace.title": "Brick Furnaces Settings", + + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED": "Vanilla Recipes enabled", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[0]": "§6§lVanilla Recipes enabled", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[1]": "If enabled, the vanilla blasting, smelting, and", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[2]": "smoking recipes are used by the brick furnaces.", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[3]": "§7§oDefault: true", + + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR": "Cook time factor", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[0]": "§6§lCook time factor", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[1]": "Cook time factor of all added brick furnaces in relation", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[2]": "to corresponding vanilla furnaces. (percent)", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time, 200 twice the time", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 100", + + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST": "Recipe blocked list", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[0]": "§6§lRecipe blocked list", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[1]": "A comma separated list of all vanilla recipes that", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[2]": "should not be used by the brick furnaces.", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[3]": "§7§oExample: baked_potato,baked_potato_from_smoking,othermod:other_baked_food", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[4]": "§7§oDefault: " } \ No newline at end of file diff --git a/common/src/main/resources/assets/brickfurnace/lang/ko_kr.json b/common/src/main/resources/assets/brickfurnace/lang/ko_kr.json index cfb4903..ee6dca6 100644 --- a/common/src/main/resources/assets/brickfurnace/lang/ko_kr.json +++ b/common/src/main/resources/assets/brickfurnace/lang/ko_kr.json @@ -4,5 +4,27 @@ "block.brickfurnace.brick_smoker": "벽돌 훈연기", "top.brickfurnace.fuel": "Fuel", - "top.brickfurnace.n_ticks": "%d ticks" + "top.brickfurnace.n_ticks": "%d ticks", + + "text.autoconfig.brickfurnace.title": "Brick Furnaces Settings", + + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED": "Vanilla Recipes enabled", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[0]": "§6§lVanilla Recipes enabled", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[1]": "If enabled, the vanilla blasting, smelting, and", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[2]": "smoking recipes are used by the brick furnaces.", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[3]": "§7§oDefault: true", + + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR": "Cook time factor", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[0]": "§6§lCook time factor", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[1]": "Cook time factor of all added brick furnaces in relation", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[2]": "to corresponding vanilla furnaces. (percent)", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time, 200 twice the time", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 100", + + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST": "Recipe blocked list", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[0]": "§6§lRecipe blocked list", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[1]": "A comma separated list of all vanilla recipes that", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[2]": "should not be used by the brick furnaces.", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[3]": "§7§oExample: baked_potato,baked_potato_from_smoking,othermod:other_baked_food", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[4]": "§7§oDefault: " } \ No newline at end of file diff --git a/common/src/main/resources/assets/brickfurnace/lang/pt_br.json b/common/src/main/resources/assets/brickfurnace/lang/pt_br.json index 8965663..32bbec4 100644 --- a/common/src/main/resources/assets/brickfurnace/lang/pt_br.json +++ b/common/src/main/resources/assets/brickfurnace/lang/pt_br.json @@ -4,5 +4,27 @@ "block.brickfurnace.brick_smoker": "Defumador de Tijolos", "top.brickfurnace.fuel": "Combustível", - "top.brickfurnace.n_ticks": "%d ticks" + "top.brickfurnace.n_ticks": "%d ticks", + + "text.autoconfig.brickfurnace.title": "Brick Furnaces Settings", + + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED": "Vanilla Recipes enabled", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[0]": "§6§lVanilla Recipes enabled", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[1]": "If enabled, the vanilla blasting, smelting, and", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[2]": "smoking recipes are used by the brick furnaces.", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[3]": "§7§oDefault: true", + + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR": "Cook time factor", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[0]": "§6§lCook time factor", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[1]": "Cook time factor of all added brick furnaces in relation", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[2]": "to corresponding vanilla furnaces. (percent)", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time, 200 twice the time", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 100", + + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST": "Recipe blocked list", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[0]": "§6§lRecipe blocked list", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[1]": "A comma separated list of all vanilla recipes that", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[2]": "should not be used by the brick furnaces.", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[3]": "§7§oExample: baked_potato,baked_potato_from_smoking,othermod:other_baked_food", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[4]": "§7§oDefault: " } \ No newline at end of file diff --git a/common/src/main/resources/assets/brickfurnace/lang/pt_pt.json b/common/src/main/resources/assets/brickfurnace/lang/pt_pt.json index 8965663..32bbec4 100644 --- a/common/src/main/resources/assets/brickfurnace/lang/pt_pt.json +++ b/common/src/main/resources/assets/brickfurnace/lang/pt_pt.json @@ -4,5 +4,27 @@ "block.brickfurnace.brick_smoker": "Defumador de Tijolos", "top.brickfurnace.fuel": "Combustível", - "top.brickfurnace.n_ticks": "%d ticks" + "top.brickfurnace.n_ticks": "%d ticks", + + "text.autoconfig.brickfurnace.title": "Brick Furnaces Settings", + + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED": "Vanilla Recipes enabled", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[0]": "§6§lVanilla Recipes enabled", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[1]": "If enabled, the vanilla blasting, smelting, and", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[2]": "smoking recipes are used by the brick furnaces.", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[3]": "§7§oDefault: true", + + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR": "Cook time factor", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[0]": "§6§lCook time factor", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[1]": "Cook time factor of all added brick furnaces in relation", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[2]": "to corresponding vanilla furnaces. (percent)", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time, 200 twice the time", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 100", + + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST": "Recipe blocked list", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[0]": "§6§lRecipe blocked list", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[1]": "A comma separated list of all vanilla recipes that", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[2]": "should not be used by the brick furnaces.", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[3]": "§7§oExample: baked_potato,baked_potato_from_smoking,othermod:other_baked_food", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[4]": "§7§oDefault: " } \ No newline at end of file diff --git a/common/src/main/resources/assets/brickfurnace/lang/ru_ru.json b/common/src/main/resources/assets/brickfurnace/lang/ru_ru.json index 7a59133..d0914e3 100644 --- a/common/src/main/resources/assets/brickfurnace/lang/ru_ru.json +++ b/common/src/main/resources/assets/brickfurnace/lang/ru_ru.json @@ -4,5 +4,27 @@ "block.brickfurnace.brick_smoker": "Кирпичная коптильня", "top.brickfurnace.fuel": "Топливо", - "top.brickfurnace.n_ticks": "%d ticks" + "top.brickfurnace.n_ticks": "%d ticks", + + "text.autoconfig.brickfurnace.title": "Brick Furnaces Settings", + + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED": "Vanilla Recipes enabled", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[0]": "§6§lVanilla Recipes enabled", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[1]": "If enabled, the vanilla blasting, smelting, and", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[2]": "smoking recipes are used by the brick furnaces.", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[3]": "§7§oDefault: true", + + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR": "Cook time factor", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[0]": "§6§lCook time factor", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[1]": "Cook time factor of all added brick furnaces in relation", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[2]": "to corresponding vanilla furnaces. (percent)", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time, 200 twice the time", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 100", + + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST": "Recipe blocked list", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[0]": "§6§lRecipe blocked list", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[1]": "A comma separated list of all vanilla recipes that", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[2]": "should not be used by the brick furnaces.", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[3]": "§7§oExample: baked_potato,baked_potato_from_smoking,othermod:other_baked_food", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[4]": "§7§oDefault: " } diff --git a/common/src/main/resources/assets/brickfurnace/lang/zh_cn.json b/common/src/main/resources/assets/brickfurnace/lang/zh_cn.json index b69a9c6..fc2594e 100644 --- a/common/src/main/resources/assets/brickfurnace/lang/zh_cn.json +++ b/common/src/main/resources/assets/brickfurnace/lang/zh_cn.json @@ -4,5 +4,27 @@ "block.brickfurnace.brick_smoker": "砖烟熏炉", "top.brickfurnace.fuel": "Fuel", - "top.brickfurnace.n_ticks": "%d ticks" + "top.brickfurnace.n_ticks": "%d ticks", + + "text.autoconfig.brickfurnace.title": "Brick Furnaces Settings", + + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED": "Vanilla Recipes enabled", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[0]": "§6§lVanilla Recipes enabled", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[1]": "If enabled, the vanilla blasting, smelting, and", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[2]": "smoking recipes are used by the brick furnaces.", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[3]": "§7§oDefault: true", + + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR": "Cook time factor", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[0]": "§6§lCook time factor", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[1]": "Cook time factor of all added brick furnaces in relation", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[2]": "to corresponding vanilla furnaces. (percent)", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time, 200 twice the time", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 100", + + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST": "Recipe blocked list", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[0]": "§6§lRecipe blocked list", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[1]": "A comma separated list of all vanilla recipes that", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[2]": "should not be used by the brick furnaces.", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[3]": "§7§oExample: baked_potato,baked_potato_from_smoking,othermod:other_baked_food", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[4]": "§7§oDefault: " } \ No newline at end of file diff --git a/common/src/main/resources/assets/brickfurnace/lang/zh_tw.json b/common/src/main/resources/assets/brickfurnace/lang/zh_tw.json index a4b7397..0b85d15 100644 --- a/common/src/main/resources/assets/brickfurnace/lang/zh_tw.json +++ b/common/src/main/resources/assets/brickfurnace/lang/zh_tw.json @@ -4,5 +4,27 @@ "block.brickfurnace.brick_smoker": "磚煙熏爐", "top.brickfurnace.fuel": "Fuel", - "top.brickfurnace.n_ticks": "%d ticks" + "top.brickfurnace.n_ticks": "%d ticks", + + "text.autoconfig.brickfurnace.title": "Brick Furnaces Settings", + + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED": "Vanilla Recipes enabled", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[0]": "§6§lVanilla Recipes enabled", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[1]": "If enabled, the vanilla blasting, smelting, and", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[2]": "smoking recipes are used by the brick furnaces.", + "text.autoconfig.brickfurnace.option.VANILLA_RECIPES_ENABLED.@Tooltip[3]": "§7§oDefault: true", + + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR": "Cook time factor", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[0]": "§6§lCook time factor", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[1]": "Cook time factor of all added brick furnaces in relation", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[2]": "to corresponding vanilla furnaces. (percent)", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time, 200 twice the time", + "text.autoconfig.brickfurnace.option.COOK_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 100", + + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST": "Recipe blocked list", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[0]": "§6§lRecipe blocked list", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[1]": "A comma separated list of all vanilla recipes that", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[2]": "should not be used by the brick furnaces.", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[3]": "§7§oExample: baked_potato,baked_potato_from_smoking,othermod:other_baked_food", + "text.autoconfig.brickfurnace.option.RECIPE_BLOCKED_LIST.@Tooltip[4]": "§7§oDefault: " } \ No newline at end of file diff --git a/fabric/build.gradle b/fabric/build.gradle new file mode 100644 index 0000000..693bed1 --- /dev/null +++ b/fabric/build.gradle @@ -0,0 +1,72 @@ +plugins { + id 'java' + id 'idea' + id 'maven-publish' + id 'fabric-loom' version '[1.6.6,1.7)' +} +base { + archivesName = "${mod_id}-fabric" +} + +repositories { + maven { url "https://maven.shedaniel.me/" } + maven { url "https://maven.terraformersmc.com/releases/" } +} + +dependencies { + minecraft "com.mojang:minecraft:${minecraft_version}" + mappings loom.officialMojangMappings() + modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}" + modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}" + + modImplementation("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") { + exclude(group: "net.fabricmc.fabric-api") + } + modImplementation("com.terraformersmc:modmenu:${mod_menu_version}") + + modCompileOnlyApi("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}") + modCompileOnlyApi("mezz.jei:jei-${minecraft_version}-lib:${jei_version}") + modCompileOnlyApi("mezz.jei:jei-${minecraft_version}-fabric-api:${jei_version}") + // at runtime, use the full JEI jar for Fabric + modRuntimeOnly("mezz.jei:jei-${minecraft_version}-fabric:${jei_version}") + + implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1' + compileOnly project(":common") +} + +loom { + if (project(":common").file("src/main/resources/${mod_id}.accesswidener").exists()) { + accessWidenerPath.set(project(":common").file("src/main/resources/${mod_id}.accesswidener")) + } + mixin { + defaultRefmapName.set("${mod_id}.refmap.json") + } + runs { + client { + client() + setConfigName("Fabric Client") + ideConfigGenerated(true) + runDir("run") + } + server { + server() + setConfigName("Fabric Server") + ideConfigGenerated(true) + runDir("run") + } + } +} + +tasks.withType(JavaCompile).configureEach { + source(project(":common").sourceSets.main.allSource) +} +//tasks.withType(Javadoc).configureEach { +// source(project(":common").sourceSets.main.allJava) +//} +//tasks.named("sourcesJar", Jar) { +// from(project(":common").sourceSets.main.allSource) +//} + +processResources { + from project(":common").sourceSets.main.resources +} diff --git a/fabric/src/main/java/de/cech12/brickfurnace/BrickFurnaceMod.java b/fabric/src/main/java/de/cech12/brickfurnace/BrickFurnaceMod.java new file mode 100644 index 0000000..59b3376 --- /dev/null +++ b/fabric/src/main/java/de/cech12/brickfurnace/BrickFurnaceMod.java @@ -0,0 +1,31 @@ +package de.cech12.brickfurnace; + +import de.cech12.brickfurnace.init.ModBlockEntityTypes; +import de.cech12.brickfurnace.init.ModBlocks; +import de.cech12.brickfurnace.init.ModItems; +import de.cech12.brickfurnace.init.ModRecipeTypes; +import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.item.CreativeModeTabs; + +public class BrickFurnaceMod implements ModInitializer { + + @Override + public void onInitialize() { + ModBlocks.init(); + ModBlockEntityTypes.init(); + ModItems.init(); + ModRecipeTypes.init(); + CommonLoader.init(); + //init POI types + CommonLoader.initPoiStates(BuiltInRegistries.POINT_OF_INTEREST_TYPE::get, BuiltInRegistries.POINT_OF_INTEREST_TYPE::getHolderOrThrow); + //Register item in the creative tab. + ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.FUNCTIONAL_BLOCKS).register(content -> { + content.accept(Constants.BRICK_FURNACE_ITEM.get()); + content.accept(Constants.BRICK_BLAST_FURNACE_ITEM.get()); + content.accept(Constants.BRICK_SMOKER_ITEM.get()); + }); + } + +} diff --git a/fabric/src/main/java/de/cech12/brickfurnace/compat/ModMenuCompat.java b/fabric/src/main/java/de/cech12/brickfurnace/compat/ModMenuCompat.java new file mode 100644 index 0000000..5509ded --- /dev/null +++ b/fabric/src/main/java/de/cech12/brickfurnace/compat/ModMenuCompat.java @@ -0,0 +1,18 @@ +package de.cech12.brickfurnace.compat; + +import com.terraformersmc.modmenu.api.ConfigScreenFactory; +import com.terraformersmc.modmenu.api.ModMenuApi; +import de.cech12.brickfurnace.platform.FabricConfigHelper; +import me.shedaniel.autoconfig.AutoConfig; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +public class ModMenuCompat implements ModMenuApi { + + @Override + public ConfigScreenFactory getModConfigScreenFactory() { + return parent -> AutoConfig.getConfigScreen(FabricConfigHelper.class, parent).get(); + } + +} diff --git a/fabric/src/main/java/de/cech12/brickfurnace/init/ModBlockEntityTypes.java b/fabric/src/main/java/de/cech12/brickfurnace/init/ModBlockEntityTypes.java new file mode 100644 index 0000000..ca19cb0 --- /dev/null +++ b/fabric/src/main/java/de/cech12/brickfurnace/init/ModBlockEntityTypes.java @@ -0,0 +1,31 @@ +package de.cech12.brickfurnace.init; + +import de.cech12.brickfurnace.CommonLoader; +import de.cech12.brickfurnace.Constants; +import de.cech12.brickfurnace.blockentity.AbstractBrickFurnaceBlockEntity; +import de.cech12.brickfurnace.blockentity.BrickBlastFurnaceBlockEntity; +import de.cech12.brickfurnace.blockentity.BrickFurnaceBlockEntity; +import de.cech12.brickfurnace.blockentity.BrickSmokerBlockEntity; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.level.block.entity.BlockEntityType; + +public final class ModBlockEntityTypes { + + private static final BlockEntityType BRICK_FURNACE_BLOCK_ENTITY_TYPE = register(Constants.BRICK_FURNACE_NAME, BlockEntityType.Builder.of(BrickFurnaceBlockEntity::new, Constants.BRICK_FURNACE_BLOCK.get())); + private static final BlockEntityType BRICK_BLAST_FURNACE_BLOCK_ENTITY_TYPE = register(Constants.BRICK_BLAST_FURNACE_NAME, BlockEntityType.Builder.of(BrickBlastFurnaceBlockEntity::new, Constants.BRICK_BLAST_FURNACE_BLOCK.get())); + private static final BlockEntityType BRICK_SMOKER_BLOCK_ENTITY_TYPE = register(Constants.BRICK_SMOKER_NAME, BlockEntityType.Builder.of(BrickSmokerBlockEntity::new, Constants.BRICK_SMOKER_BLOCK.get())); + + static { + Constants.BRICK_FURNACE_BLOCK_ENTITY_TYPE = () -> BRICK_FURNACE_BLOCK_ENTITY_TYPE; + Constants.BRICK_BLAST_FURNACE_BLOCK_ENTITY_TYPE = () -> BRICK_BLAST_FURNACE_BLOCK_ENTITY_TYPE; + Constants.BRICK_SMOKER_BLOCK_ENTITY_TYPE = () -> BRICK_SMOKER_BLOCK_ENTITY_TYPE; + } + + public static void init() {} + + private static BlockEntityType register(String name, BlockEntityType.Builder blockEntityTypeBuilder) { + return Registry.register(BuiltInRegistries.BLOCK_ENTITY_TYPE, CommonLoader.id(name), blockEntityTypeBuilder.build(null)); + } + +} diff --git a/fabric/src/main/java/de/cech12/brickfurnace/init/ModBlocks.java b/fabric/src/main/java/de/cech12/brickfurnace/init/ModBlocks.java new file mode 100644 index 0000000..0e5f855 --- /dev/null +++ b/fabric/src/main/java/de/cech12/brickfurnace/init/ModBlocks.java @@ -0,0 +1,40 @@ +package de.cech12.brickfurnace.init; + +import de.cech12.brickfurnace.CommonLoader; +import de.cech12.brickfurnace.Constants; +import de.cech12.brickfurnace.block.BrickBlastFurnaceBlock; +import de.cech12.brickfurnace.block.BrickFurnaceBlock; +import de.cech12.brickfurnace.block.BrickSmokerBlock; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.MapColor; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; + +import java.util.function.ToIntFunction; + +public final class ModBlocks { + + private static final Block BRICK_FURNACE_BLOCK = register(Constants.BRICK_FURNACE_NAME, new BrickFurnaceBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).requiresCorrectToolForDrops().strength(2.0F, 6.0F).lightLevel(getLightLevelWhenLit(13)))); + private static final Block BRICK_BLAST_FURNACE_BLOCK = register(Constants.BRICK_BLAST_FURNACE_NAME, new BrickBlastFurnaceBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).requiresCorrectToolForDrops().strength(2.0F, 6.0F).lightLevel(getLightLevelWhenLit(13)))); + private static final Block BRICK_SMOKER_BLOCK = register(Constants.BRICK_SMOKER_NAME, new BrickSmokerBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).requiresCorrectToolForDrops().strength(2.0F, 6.0F).lightLevel(getLightLevelWhenLit(13)))); + + static { + Constants.BRICK_FURNACE_BLOCK = () -> BRICK_FURNACE_BLOCK; + Constants.BRICK_BLAST_FURNACE_BLOCK = () -> BRICK_BLAST_FURNACE_BLOCK; + Constants.BRICK_SMOKER_BLOCK = () -> BRICK_SMOKER_BLOCK; + } + + public static void init() {} + + private static Block register(String name, Block block) { + return Registry.register(BuiltInRegistries.BLOCK, CommonLoader.id(name), block); + } + + private static ToIntFunction getLightLevelWhenLit(final int lightLevel) { + return (blockState) -> blockState.getValue(BlockStateProperties.LIT) ? lightLevel : 0; + } + +} \ No newline at end of file diff --git a/fabric/src/main/java/de/cech12/brickfurnace/init/ModItems.java b/fabric/src/main/java/de/cech12/brickfurnace/init/ModItems.java new file mode 100644 index 0000000..8b4e860 --- /dev/null +++ b/fabric/src/main/java/de/cech12/brickfurnace/init/ModItems.java @@ -0,0 +1,31 @@ +package de.cech12.brickfurnace.init; + +import de.cech12.brickfurnace.CommonLoader; +import de.cech12.brickfurnace.Constants; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; + +import java.util.function.Supplier; + +public class ModItems { + + private static final Item BRICK_FURNACE_ITEM = register(Constants.BRICK_FURNACE_NAME, Constants.BRICK_FURNACE_BLOCK); + private static final Item BRICK_BLAST_FURNACE_ITEM = register(Constants.BRICK_BLAST_FURNACE_NAME, Constants.BRICK_BLAST_FURNACE_BLOCK); + private static final Item BRICK_SMOKER_ITEM = register(Constants.BRICK_SMOKER_NAME, Constants.BRICK_SMOKER_BLOCK); + + static { + Constants.BRICK_FURNACE_ITEM = () -> BRICK_FURNACE_ITEM; + Constants.BRICK_BLAST_FURNACE_ITEM = () -> BRICK_BLAST_FURNACE_ITEM; + Constants.BRICK_SMOKER_ITEM = () -> BRICK_SMOKER_ITEM; + } + + public static void init() {} + + private static Item register(String name, Supplier block) { + return Registry.register(BuiltInRegistries.ITEM, CommonLoader.id(name), new BlockItem(block.get(), new Item.Properties())); + } + +} diff --git a/fabric/src/main/java/de/cech12/brickfurnace/init/ModRecipeTypes.java b/fabric/src/main/java/de/cech12/brickfurnace/init/ModRecipeTypes.java new file mode 100644 index 0000000..6216d96 --- /dev/null +++ b/fabric/src/main/java/de/cech12/brickfurnace/init/ModRecipeTypes.java @@ -0,0 +1,40 @@ +package de.cech12.brickfurnace.init; + +import de.cech12.brickfurnace.CommonLoader; +import de.cech12.brickfurnace.Constants; +import de.cech12.brickfurnace.crafting.BrickBlastingRecipe; +import de.cech12.brickfurnace.crafting.BrickSmeltingRecipe; +import de.cech12.brickfurnace.crafting.BrickSmokingRecipe; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.item.crafting.AbstractCookingRecipe; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.RecipeType; + +public class ModRecipeTypes { + + private static final RecipeType BLASTING_RECIPE_TYPE = registerRecipe(Constants.BLASTING_NAME); + private static final RecipeType SMELTING_RECIPE_TYPE = registerRecipe(Constants.SMELTING_NAME); + private static final RecipeType SMOKING_RECIPE_TYPE = registerRecipe(Constants.SMOKING_NAME); + + private static final RecipeSerializer BLASTING_RECIPE_SERIALIZER = registerSerializer(Constants.BLASTING_NAME, BrickBlastingRecipe.SERIALIZER); + private static final RecipeSerializer SMELTING_RECIPE_SERIALIZER = registerSerializer(Constants.SMELTING_NAME, BrickSmeltingRecipe.SERIALIZER); + private static final RecipeSerializer SMOKING_RECIPE_SERIALIZER = registerSerializer(Constants.SMOKING_NAME, BrickSmokingRecipe.SERIALIZER); + + static { + Constants.BLASTING_RECIPE_TYPE = () -> (RecipeType) BLASTING_RECIPE_TYPE; + Constants.SMELTING_RECIPE_TYPE = () -> (RecipeType) SMELTING_RECIPE_TYPE; + Constants.SMOKING_RECIPE_TYPE = () -> (RecipeType) SMOKING_RECIPE_TYPE; + } + + public static void init() {} + + private static RecipeType registerRecipe(String name) { + return Registry.register(BuiltInRegistries.RECIPE_TYPE, CommonLoader.id(name), new RecipeType<>() {}); + } + + private static RecipeSerializer registerSerializer(String name, RecipeSerializer serializer) { + return Registry.register(BuiltInRegistries.RECIPE_SERIALIZER, CommonLoader.id(name), serializer); + } + +} diff --git a/fabric/src/main/java/de/cech12/brickfurnace/platform/FabricConfigHelper.java b/fabric/src/main/java/de/cech12/brickfurnace/platform/FabricConfigHelper.java new file mode 100644 index 0000000..68b7e0f --- /dev/null +++ b/fabric/src/main/java/de/cech12/brickfurnace/platform/FabricConfigHelper.java @@ -0,0 +1,51 @@ +package de.cech12.brickfurnace.platform; + +import de.cech12.brickfurnace.Constants; +import de.cech12.brickfurnace.platform.services.IConfigHelper; +import me.shedaniel.autoconfig.AutoConfig; +import me.shedaniel.autoconfig.ConfigData; +import me.shedaniel.autoconfig.annotation.Config; +import me.shedaniel.autoconfig.annotation.ConfigEntry; +import me.shedaniel.autoconfig.serializer.Toml4jConfigSerializer; + +/** + * The config service implementation for Fabric. + */ +@Config(name = Constants.MOD_ID) +public class FabricConfigHelper implements ConfigData, IConfigHelper { + + @ConfigEntry.Gui.Tooltip(count = 4) + public boolean VANILLA_RECIPES_ENABLED = VANILLA_RECIPES_ENABLED_DEFAULT; + + @ConfigEntry.Gui.Tooltip(count = 5) + @ConfigEntry.BoundedDiscrete(min = (long) (COOK_TIME_FACTOR_MIN * 100), max = (long) (COOK_TIME_FACTOR_MAX * 100)) + public long COOK_TIME_FACTOR = (long) (COOK_TIME_FACTOR_DEFAULT * 100); + + @ConfigEntry.Gui.Tooltip(count = 5) + public String RECIPE_BLOCKED_LIST = RECIPE_BLOCKED_LIST_DEFAULT; + + @Override + public void init() { + AutoConfig.register(FabricConfigHelper.class, Toml4jConfigSerializer::new); + } + + private FabricConfigHelper getConfig() { + return AutoConfig.getConfigHolder(FabricConfigHelper.class).getConfig(); + } + + @Override + public boolean areVanillaRecipesEnabled() { + return getConfig().VANILLA_RECIPES_ENABLED; + } + + @Override + public double getCookTimeFactor() { + return getConfig().COOK_TIME_FACTOR / 100D; + } + + @Override + public String getRecipeBlockedList() { + return getConfig().RECIPE_BLOCKED_LIST; + } + +} diff --git a/fabric/src/main/java/de/cech12/brickfurnace/platform/FabricPlatformHelper.java b/fabric/src/main/java/de/cech12/brickfurnace/platform/FabricPlatformHelper.java new file mode 100644 index 0000000..3afd505 --- /dev/null +++ b/fabric/src/main/java/de/cech12/brickfurnace/platform/FabricPlatformHelper.java @@ -0,0 +1,37 @@ +package de.cech12.brickfurnace.platform; + +import de.cech12.brickfurnace.platform.services.IPlatformHelper; +import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.world.item.ItemStack; + +/** + * The platform service implementation for Fabric. + */ +public class FabricPlatformHelper implements IPlatformHelper { + + @Override + public String getPlatformName() { + return "Fabric"; + } + + @Override + public boolean isModLoaded(String modId) { + return FabricLoader.getInstance().isModLoaded(modId); + } + + @Override + public boolean isDevelopmentEnvironment() { + return FabricLoader.getInstance().isDevelopmentEnvironment(); + } + + @Override + public boolean hasCraftingRemainingItem(ItemStack stack) { + return stack.getRecipeRemainder() != null && !stack.getRecipeRemainder().isEmpty(); + } + + @Override + public ItemStack getCraftingRemainingItem(ItemStack stack) { + return stack.getRecipeRemainder(); + } + +} diff --git a/fabric/src/main/resources/META-INF/services/de.cech12.brickfurnace.platform.services.IConfigHelper b/fabric/src/main/resources/META-INF/services/de.cech12.brickfurnace.platform.services.IConfigHelper new file mode 100644 index 0000000..c74f533 --- /dev/null +++ b/fabric/src/main/resources/META-INF/services/de.cech12.brickfurnace.platform.services.IConfigHelper @@ -0,0 +1 @@ +de.cech12.brickfurnace.platform.FabricConfigHelper \ No newline at end of file diff --git a/fabric/src/main/resources/META-INF/services/de.cech12.brickfurnace.platform.services.IPlatformHelper b/fabric/src/main/resources/META-INF/services/de.cech12.brickfurnace.platform.services.IPlatformHelper new file mode 100644 index 0000000..65e0da6 --- /dev/null +++ b/fabric/src/main/resources/META-INF/services/de.cech12.brickfurnace.platform.services.IPlatformHelper @@ -0,0 +1 @@ +de.cech12.brickfurnace.platform.FabricPlatformHelper \ No newline at end of file diff --git a/fabric/src/main/resources/data/brickfurnace/advancements/brick_furnace.json b/fabric/src/main/resources/data/brickfurnace/advancements/brick_furnace.json new file mode 100644 index 0000000..00084e2 --- /dev/null +++ b/fabric/src/main/resources/data/brickfurnace/advancements/brick_furnace.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "brickfurnace:brick_furnace" + ] + }, + "criteria": { + "has_brick": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "minecraft:brick" + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "brickfurnace:brick_furnace" + } + } + }, + "requirements": [ + [ + "has_brick", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/fabric/src/main/resources/data/brickfurnace/recipes/brick_blast_furnace.json b/fabric/src/main/resources/data/brickfurnace/recipes/brick_blast_furnace.json new file mode 100644 index 0000000..5cf2539 --- /dev/null +++ b/fabric/src/main/resources/data/brickfurnace/recipes/brick_blast_furnace.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "pattern": [ + "III", + "IXI", + "###" + ], + "key": { + "#": { + "item": "minecraft:brick" + }, + "X": { + "item": "brickfurnace:brick_furnace" + }, + "I": { + "tag": "c:iron_ingots" + } + }, + "result": { + "item": "brickfurnace:brick_blast_furnace" + } +} \ No newline at end of file diff --git a/fabric/src/main/resources/data/brickfurnace/recipes/brick_furnace.json b/fabric/src/main/resources/data/brickfurnace/recipes/brick_furnace.json new file mode 100644 index 0000000..8fd7ed8 --- /dev/null +++ b/fabric/src/main/resources/data/brickfurnace/recipes/brick_furnace.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "pattern": [ + "###", + "# #", + "###" + ], + "key": { + "#": { + "item": "minecraft:brick" + } + }, + "result": { + "item": "brickfurnace:brick_furnace" + } +} \ No newline at end of file diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..bba06c7 --- /dev/null +++ b/fabric/src/main/resources/fabric.mod.json @@ -0,0 +1,39 @@ +{ + "schemaVersion": 1, + "id": "${mod_id}", + "version": "${version}", + "name": "${mod_name}", + "description": "${mod_description}", + "authors": [ + "${mod_author}" + ], + "contact": { + "homepage": "${mod_url}", + "sources": "${mod_url}", + "issues": "${mod_issue_tracker}" + }, + "license": "${mod_license}", + "icon": "logo.png", + "environment": "*", + "entrypoints": { + "main": [ + "${group}.BrickFurnaceMod" + ], + "modmenu": [ + "${group}.compat.ModMenuCompat" + ] + }, + "mixins": [ + "${mod_id}.mixins.json" + ], + "depends": { + "java": ">=17", + "minecraft": ">=${minecraft_version}", + "fabricloader": ">=${fabric_loader_version}", + "fabric-api": ">=${fabric_version}", + "cloth-config": ">=${cloth_config_version}" + }, + "recommends": { + "modmenu": ">=${mod_menu_version}" + } +} diff --git a/common/src/main/resources/data/brickfurnace/advancements/recipes/decorations/brick_furnace.json b/forge/src/main/resources/data/brickfurnace/advancements/brick_furnace.json similarity index 100% rename from common/src/main/resources/data/brickfurnace/advancements/recipes/decorations/brick_furnace.json rename to forge/src/main/resources/data/brickfurnace/advancements/brick_furnace.json diff --git a/common/src/main/resources/data/brickfurnace/recipes/brick_blast_furnace.json b/forge/src/main/resources/data/brickfurnace/recipes/brick_blast_furnace.json similarity index 100% rename from common/src/main/resources/data/brickfurnace/recipes/brick_blast_furnace.json rename to forge/src/main/resources/data/brickfurnace/recipes/brick_blast_furnace.json diff --git a/common/src/main/resources/data/brickfurnace/recipes/brick_furnace.json b/forge/src/main/resources/data/brickfurnace/recipes/brick_furnace.json similarity index 100% rename from common/src/main/resources/data/brickfurnace/recipes/brick_furnace.json rename to forge/src/main/resources/data/brickfurnace/recipes/brick_furnace.json diff --git a/gradle.properties b/gradle.properties index dc46273..2ace4dc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ # Project group=de.cech12.brickfurnace -mod_version=3.0.0.0 +mod_version=3.1.0.0 mod_id=brickfurnace mod_name=Brick Furnace mod_author=Cech12 @@ -18,8 +18,10 @@ minecraft_version=1.20.4 minecraft_version_range=[1.20.4, 1.21) # Fabric -#fabric_version=0.91.0+1.20.2 -#fabric_loader_version=0.15.0 +fabric_version=0.96.11+1.20.4 +fabric_loader_version=0.15.7 +cloth_config_version=13.0.121 +mod_menu_version=9.0.0 # Forge forge_version=49.0.38 diff --git a/neoforge/src/main/resources/data/brickfurnace/advancements/brick_furnace.json b/neoforge/src/main/resources/data/brickfurnace/advancements/brick_furnace.json new file mode 100644 index 0000000..e32a69d --- /dev/null +++ b/neoforge/src/main/resources/data/brickfurnace/advancements/brick_furnace.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "brickfurnace:brick_furnace" + ] + }, + "criteria": { + "has_brick": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "tag": "forge:ingots/brick" + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "brickfurnace:brick_furnace" + } + } + }, + "requirements": [ + [ + "has_brick", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/neoforge/src/main/resources/data/brickfurnace/recipes/brick_blast_furnace.json b/neoforge/src/main/resources/data/brickfurnace/recipes/brick_blast_furnace.json new file mode 100644 index 0000000..bafc3ca --- /dev/null +++ b/neoforge/src/main/resources/data/brickfurnace/recipes/brick_blast_furnace.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "pattern": [ + "III", + "IXI", + "###" + ], + "key": { + "#": { + "tag": "forge:ingots/brick" + }, + "X": { + "item": "brickfurnace:brick_furnace" + }, + "I": { + "tag": "forge:ingots/iron" + } + }, + "result": { + "item": "brickfurnace:brick_blast_furnace" + } +} \ No newline at end of file diff --git a/neoforge/src/main/resources/data/brickfurnace/recipes/brick_furnace.json b/neoforge/src/main/resources/data/brickfurnace/recipes/brick_furnace.json new file mode 100644 index 0000000..44906dc --- /dev/null +++ b/neoforge/src/main/resources/data/brickfurnace/recipes/brick_furnace.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "pattern": [ + "###", + "# #", + "###" + ], + "key": { + "#": { + "tag": "forge:ingots/brick" + } + }, + "result": { + "item": "brickfurnace:brick_furnace" + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index b551a28..ce717a9 100644 --- a/settings.gradle +++ b/settings.gradle @@ -31,12 +31,12 @@ pluginManagement { } plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' } // This should match the folder name of the project, or else IDEA may complain (see https://youtrack.jetbrains.com/issue/IDEA-317606) rootProject.name = 'BrickFurnace' include("common") -//include("fabric") +include("fabric") include("forge") include("neoforge") \ No newline at end of file