diff --git a/CHANGELOG.md b/CHANGELOG.md index 8095d6e..25b08ff 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.2.0] - 2024-06-04 +### Added +- added Roughly Enough Items (REI) support (version 14.1.727) (all loaders) + ## [1.20.4-3.1.1.0] - 2024-05-11 ### Added - registering ItemHandlers to be more compatible with other mods (NeoForge) diff --git a/build.gradle b/build.gradle index 6ab26fb..d4e483a 100644 --- a/build.gradle +++ b/build.gradle @@ -44,6 +44,9 @@ subprojects { name = 'BlameJared Maven (JEI / CraftTweaker / Bookshelf)' url = 'https://maven.blamejared.com' } + //REI + maven { url "https://maven.shedaniel.me/" } + maven { url "https://maven.architectury.dev/" } } tasks.withType(JavaCompile).configureEach { @@ -76,6 +79,8 @@ subprojects { "mod_description": project.description, "jei_version": jei_version, "jei_version_range": jei_version_range, + "rei_version": rei_version, + "rei_version_range": rei_version_range, "top_version": top_version, "top_version_range": top_version_range ] diff --git a/common/src/main/resources/assets/solarcooker/lang/de_de.json b/common/src/main/resources/assets/solarcooker/lang/de_de.json index d6c3ade..a43e075 100644 --- a/common/src/main/resources/assets/solarcooker/lang/de_de.json +++ b/common/src/main/resources/assets/solarcooker/lang/de_de.json @@ -5,39 +5,4 @@ "item.solarcooker.reflector.description": "Links und rechts neben einem Solarkocher können bis zu vier Reflektoren platziert werden, um den Lichteinfall zu verbessern und die Kochzeit zu reduzieren.", "item.solarcooker.shining_diamond_block.description": "Shine bright! Kann über einem Solarkocher platziert werden, um ihn unabhängig von der Sonne zu nutzen.", - - "text.autoconfig.solarcooker.title": "Solar Cooker Settings", - - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED": "Vanilla Recipes enabled", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[0]": "§6§lVanilla Recipes enabled", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[1]": "If enabled, the vanilla blasting, smelting, or", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[2]": "smoking recipes are used by the solar cooker.", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[3]": "§7§oDefault: true", - - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE": "Vanilla Recipe Type", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[0]": "§6§lVanilla Recipe Type", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[1]": "Defines which vanilla recipes the solar cooker can use.", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[2]": "§7§oPossible values: smoking, smelting, blasting, campfire_cooking", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[3]": "§7§oDefault: smoking", - - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR": "Cook time factor", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[0]": "§6§lCook time factor", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[1]": "Cook time factor of the solar cooker in relation", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[2]": "to corresponding vanilla furnace. (percent)", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time, 200 twice the time", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 400", - - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR": "Max Reflector time factor", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[0]": "§6§lMax Reflector time factor", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[1]": "Speed factor when all 4 reflectors are placed", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[2]": "next to the solar cooker. (percent)", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 25", - - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST": "Recipe blocked list", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[0]": "§6§lRecipe blocked list", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[1]": "A comma separated list of all vanilla recipes that", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[2]": "should not be used by the solar cooker.", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[3]": "§7§oExample: baked_potato,baked_potato_from_smoking,othermod:other_baked_food", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[4]": "§7§oDefault: " } \ No newline at end of file diff --git a/common/src/main/resources/assets/solarcooker/lang/pt_br.json b/common/src/main/resources/assets/solarcooker/lang/pt_br.json index d21783f..e0f9228 100644 --- a/common/src/main/resources/assets/solarcooker/lang/pt_br.json +++ b/common/src/main/resources/assets/solarcooker/lang/pt_br.json @@ -5,39 +5,4 @@ "item.solarcooker.reflector.description": "Até quatro Refletores podem ser colocados à esquerda e à direita de um Fogão Solar para melhorar a incidência de luz e reduzir o tempo de cozimento.", "item.solarcooker.shining_diamond_block.description": "Brilhar! Pode ser colocado por cima de um Fogão Solar para o utilizar independentemente do sol.", - - "text.autoconfig.solarcooker.title": "Solar Cooker Settings", - - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED": "Vanilla Recipes enabled", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[0]": "§6§lVanilla Recipes enabled", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[1]": "If enabled, the vanilla blasting, smelting, or", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[2]": "smoking recipes are used by the solar cooker.", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[3]": "§7§oDefault: true", - - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE": "Vanilla Recipe Type", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[0]": "§6§lVanilla Recipe Type", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[1]": "Defines which vanilla recipes the solar cooker can use.", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[2]": "§7§oPossible values: smoking, smelting, blasting, campfire_cooking", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[3]": "§7§oDefault: smoking", - - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR": "Cook time factor", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[0]": "§6§lCook time factor", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[1]": "Cook time factor of the solar cooker in relation", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[2]": "to corresponding vanilla furnace. (percent)", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time, 200 twice the time", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 400", - - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR": "Max Reflector time factor", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[0]": "§6§lMax Reflector time factor", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[1]": "Speed factor when all 4 reflectors are placed", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[2]": "next to the solar cooker. (percent)", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 25", - - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST": "Recipe blocked list", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[0]": "§6§lRecipe blocked list", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[1]": "A comma separated list of all vanilla recipes that", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[2]": "should not be used by the solar cooker.", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[3]": "§7§oExample: baked_potato,baked_potato_from_smoking,othermod:other_baked_food", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[4]": "§7§oDefault: " } \ No newline at end of file diff --git a/common/src/main/resources/assets/solarcooker/lang/ru_ru.json b/common/src/main/resources/assets/solarcooker/lang/ru_ru.json index 7ed1900..2d7892e 100644 --- a/common/src/main/resources/assets/solarcooker/lang/ru_ru.json +++ b/common/src/main/resources/assets/solarcooker/lang/ru_ru.json @@ -5,39 +5,4 @@ "item.solarcooker.reflector.description": "Для увеличения падения света и сокращения времени готовки, по левому и правому бокам солнечной плиты можно установить до четырёх светоотражателей.", "item.solarcooker.shining_diamond_block.description": "Блестит ярко! Может быть поставлен над солнечной плитой для её использования независимо от солнца.", - - "text.autoconfig.solarcooker.title": "Solar Cooker Settings", - - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED": "Vanilla Recipes enabled", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[0]": "§6§lVanilla Recipes enabled", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[1]": "If enabled, the vanilla blasting, smelting, or", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[2]": "smoking recipes are used by the solar cooker.", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[3]": "§7§oDefault: true", - - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE": "Vanilla Recipe Type", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[0]": "§6§lVanilla Recipe Type", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[1]": "Defines which vanilla recipes the solar cooker can use.", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[2]": "§7§oPossible values: smoking, smelting, blasting, campfire_cooking", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[3]": "§7§oDefault: smoking", - - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR": "Cook time factor", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[0]": "§6§lCook time factor", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[1]": "Cook time factor of the solar cooker in relation", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[2]": "to corresponding vanilla furnace. (percent)", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time, 200 twice the time", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 400", - - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR": "Max Reflector time factor", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[0]": "§6§lMax Reflector time factor", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[1]": "Speed factor when all 4 reflectors are placed", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[2]": "next to the solar cooker. (percent)", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 25", - - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST": "Recipe blocked list", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[0]": "§6§lRecipe blocked list", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[1]": "A comma separated list of all vanilla recipes that", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[2]": "should not be used by the solar cooker.", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[3]": "§7§oExample: baked_potato,baked_potato_from_smoking,othermod:other_baked_food", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[4]": "§7§oDefault: " } \ No newline at end of file diff --git a/common/src/main/resources/assets/solarcooker/lang/uk_ua.json b/common/src/main/resources/assets/solarcooker/lang/uk_ua.json index 2f1387f..609bb2d 100644 --- a/common/src/main/resources/assets/solarcooker/lang/uk_ua.json +++ b/common/src/main/resources/assets/solarcooker/lang/uk_ua.json @@ -5,39 +5,4 @@ "item.solarcooker.reflector.description": "Заради збільшення падіння світла та скорочення часу приготування, по лівому та правому боках сонячної плити можна встановити до чотирьох світловідбивачів.", "item.solarcooker.shining_diamond_block.description": "Блищить яскраво! Може бути встановлений над сонячною плитою заради її використання незалежно від сонця.", - - "text.autoconfig.solarcooker.title": "Solar Cooker Settings", - - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED": "Vanilla Recipes enabled", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[0]": "§6§lVanilla Recipes enabled", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[1]": "If enabled, the vanilla blasting, smelting, or", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[2]": "smoking recipes are used by the solar cooker.", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[3]": "§7§oDefault: true", - - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE": "Vanilla Recipe Type", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[0]": "§6§lVanilla Recipe Type", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[1]": "Defines which vanilla recipes the solar cooker can use.", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[2]": "§7§oPossible values: smoking, smelting, blasting, campfire_cooking", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[3]": "§7§oDefault: smoking", - - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR": "Cook time factor", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[0]": "§6§lCook time factor", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[1]": "Cook time factor of the solar cooker in relation", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[2]": "to corresponding vanilla furnace. (percent)", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time, 200 twice the time", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 400", - - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR": "Max Reflector time factor", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[0]": "§6§lMax Reflector time factor", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[1]": "Speed factor when all 4 reflectors are placed", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[2]": "next to the solar cooker. (percent)", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 25", - - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST": "Recipe blocked list", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[0]": "§6§lRecipe blocked list", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[1]": "A comma separated list of all vanilla recipes that", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[2]": "should not be used by the solar cooker.", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[3]": "§7§oExample: baked_potato,baked_potato_from_smoking,othermod:other_baked_food", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[4]": "§7§oDefault: " } \ No newline at end of file diff --git a/common/src/main/resources/assets/solarcooker/lang/zh_cn.json b/common/src/main/resources/assets/solarcooker/lang/zh_cn.json index 297374c..6df06c8 100644 --- a/common/src/main/resources/assets/solarcooker/lang/zh_cn.json +++ b/common/src/main/resources/assets/solarcooker/lang/zh_cn.json @@ -5,39 +5,4 @@ "item.solarcooker.reflector.description": "在太阳灶的左右两侧最多可以放置四个反射板来改善光线的入射以及减少烹饪时间。", "item.solarcooker.shining_diamond_block.description": "闪闪放光芒!可以放置在一个太阳灶上方,独立于太阳使用。", - - "text.autoconfig.solarcooker.title": "Solar Cooker Settings", - - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED": "Vanilla Recipes enabled", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[0]": "§6§lVanilla Recipes enabled", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[1]": "If enabled, the vanilla blasting, smelting, or", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[2]": "smoking recipes are used by the solar cooker.", - "text.autoconfig.solarcooker.option.VANILLA_RECIPES_ENABLED.@Tooltip[3]": "§7§oDefault: true", - - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE": "Vanilla Recipe Type", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[0]": "§6§lVanilla Recipe Type", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[1]": "Defines which vanilla recipes the solar cooker can use.", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[2]": "§7§oPossible values: smoking, smelting, blasting, campfire_cooking", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[3]": "§7§oDefault: smoking", - - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR": "Cook time factor", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[0]": "§6§lCook time factor", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[1]": "Cook time factor of the solar cooker in relation", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[2]": "to corresponding vanilla furnace. (percent)", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time, 200 twice the time", - "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 400", - - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR": "Max Reflector time factor", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[0]": "§6§lMax Reflector time factor", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[1]": "Speed factor when all 4 reflectors are placed", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[2]": "next to the solar cooker. (percent)", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 25", - - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST": "Recipe blocked list", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[0]": "§6§lRecipe blocked list", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[1]": "A comma separated list of all vanilla recipes that", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[2]": "should not be used by the solar cooker.", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[3]": "§7§oExample: baked_potato,baked_potato_from_smoking,othermod:other_baked_food", - "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[4]": "§7§oDefault: " } \ No newline at end of file diff --git a/fabric/build.gradle b/fabric/build.gradle index 6c27322..9760d92 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -27,7 +27,11 @@ dependencies { modCompileOnlyApi("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}") modCompileOnlyApi("mezz.jei:jei-${minecraft_version}-lib:${jei_version}") // at runtime, use the full JEI jar for Fabric - modRuntimeOnly("mezz.jei:jei-${minecraft_version}-fabric:${jei_version}") + //modRuntimeOnly("mezz.jei:jei-${minecraft_version}-fabric:${jei_version}") + + modCompileOnlyApi("me.shedaniel:RoughlyEnoughItems-api-fabric:$rei_version") + modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-fabric:$rei_version" + modImplementation "dev.architectury:architectury-forge:$architectury_version" implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1' compileOnly project(":common") diff --git a/fabric/src/main/java/de/cech12/solarcooker/rei/SolarCookerReiClientPlugin.java b/fabric/src/main/java/de/cech12/solarcooker/rei/SolarCookerReiClientPlugin.java new file mode 100644 index 0000000..0d618e3 --- /dev/null +++ b/fabric/src/main/java/de/cech12/solarcooker/rei/SolarCookerReiClientPlugin.java @@ -0,0 +1,38 @@ +package de.cech12.solarcooker.rei; + +import de.cech12.solarcooker.Constants; +import de.cech12.solarcooker.crafting.SolarCookingRecipe; +import de.cech12.solarcooker.platform.Services; +import me.shedaniel.rei.api.client.plugins.REIClientPlugin; +import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; +import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; +import me.shedaniel.rei.api.common.display.DisplaySerializerRegistry; +import me.shedaniel.rei.api.common.util.EntryStacks; +import net.minecraft.world.item.crafting.AbstractCookingRecipe; + +import java.util.Objects; + +@SuppressWarnings("unused") +public class SolarCookerReiClientPlugin implements REIClientPlugin { + + @Override + public void registerCategories(CategoryRegistry registry) { + registry.add(new SolarCookingReiDisplayCategory()); + registry.addWorkstations(SolarCookingReiDisplayCategory.ID, EntryStacks.of(Constants.SOLAR_COOKER_BLOCK.get())); + } + + @Override + public void registerDisplaySerializer(DisplaySerializerRegistry registry) { + registry.register(SolarCookingReiDisplayCategory.ID, SolarCookingReiDisplay.getSerializer()); + } + + @Override + public void registerDisplays(DisplayRegistry registry) { + registry.registerRecipeFiller(SolarCookingRecipe.class, Constants.SOLAR_COOKING_RECIPE_TYPE.get(), SolarCookingReiDisplay::new); + if (Services.CONFIG.areVanillaRecipesEnabled()) { + registry.registerRecipeFiller(AbstractCookingRecipe.class, type -> Objects.equals(Services.CONFIG.getRecipeType(), type), + recipeHolder -> Services.CONFIG.isRecipeAllowed(recipeHolder.id()), SolarCookingReiDisplay::new); + } + } + +} diff --git a/fabric/src/main/java/de/cech12/solarcooker/rei/SolarCookingReiDisplay.java b/fabric/src/main/java/de/cech12/solarcooker/rei/SolarCookingReiDisplay.java new file mode 100644 index 0000000..96134b2 --- /dev/null +++ b/fabric/src/main/java/de/cech12/solarcooker/rei/SolarCookingReiDisplay.java @@ -0,0 +1,62 @@ +package de.cech12.solarcooker.rei; + +import de.cech12.solarcooker.crafting.SolarCookingRecipe; +import de.cech12.solarcooker.platform.Services; +import me.shedaniel.rei.api.common.category.CategoryIdentifier; +import me.shedaniel.rei.api.common.display.basic.BasicDisplay; +import me.shedaniel.rei.api.common.entry.EntryIngredient; +import me.shedaniel.rei.api.common.registry.RecipeManagerContext; +import me.shedaniel.rei.api.common.util.EntryIngredients; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.item.crafting.AbstractCookingRecipe; +import net.minecraft.world.item.crafting.RecipeHolder; + +import java.util.Collections; +import java.util.List; +import java.util.Optional; + +public class SolarCookingReiDisplay extends BasicDisplay { + + private final float xp; + private final double cookTime; + + public SolarCookingReiDisplay(RecipeHolder recipe) { + this(EntryIngredients.ofIngredients( + recipe.value().getIngredients()), + Collections.singletonList(EntryIngredients.of(recipe.value().getResultItem(null))), + recipe, + recipe.value().getExperience(), + recipe.value() instanceof SolarCookingRecipe ? recipe.value().getCookingTime() : (recipe.value().getCookingTime() * Services.CONFIG.getCookTimeFactor())); + } + + public SolarCookingReiDisplay(List input, List output, CompoundTag tag) { + this(input, output, RecipeManagerContext.getInstance().byId(tag, "location"), + tag.getFloat("xp"), tag.getDouble("cookTime")); + } + + public SolarCookingReiDisplay(List input, List output, RecipeHolder recipe, float xp, double cookTime) { + super(input, output, Optional.ofNullable(recipe).map(RecipeHolder::id)); + this.xp = xp; + this.cookTime = cookTime; + } + + public static Serializer getSerializer() { + return Serializer.ofRecipeLess(SolarCookingReiDisplay::new, (display, tag) -> { + tag.putFloat("xp", display.xp); + tag.putDouble("cookTime", display.cookTime); + }); + } + + @Override + public CategoryIdentifier getCategoryIdentifier() { + return SolarCookingReiDisplayCategory.ID; + } + + public double getCookTime() { + return cookTime; + } + + public float getXp() { + return xp; + } +} diff --git a/fabric/src/main/java/de/cech12/solarcooker/rei/SolarCookingReiDisplayCategory.java b/fabric/src/main/java/de/cech12/solarcooker/rei/SolarCookingReiDisplayCategory.java new file mode 100644 index 0000000..2d878e8 --- /dev/null +++ b/fabric/src/main/java/de/cech12/solarcooker/rei/SolarCookingReiDisplayCategory.java @@ -0,0 +1,68 @@ +package de.cech12.solarcooker.rei; + +import com.google.common.collect.Lists; +import de.cech12.solarcooker.Constants; +import me.shedaniel.math.Point; +import me.shedaniel.math.Rectangle; +import me.shedaniel.rei.api.client.gui.DisplayRenderer; +import me.shedaniel.rei.api.client.gui.Renderer; +import me.shedaniel.rei.api.client.gui.SimpleDisplayRenderer; +import me.shedaniel.rei.api.client.gui.widgets.Widget; +import me.shedaniel.rei.api.client.gui.widgets.Widgets; +import me.shedaniel.rei.api.client.registry.display.DisplayCategory; +import me.shedaniel.rei.api.common.category.CategoryIdentifier; +import me.shedaniel.rei.api.common.entry.EntryStack; +import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; + +import java.text.DecimalFormat; +import java.util.Collections; +import java.util.List; + +public class SolarCookingReiDisplayCategory implements DisplayCategory { + + public static final CategoryIdentifier ID = CategoryIdentifier.of(Constants.MOD_ID, Constants.SOLAR_COOKING_NAME); + + @Override + public CategoryIdentifier getCategoryIdentifier() { + return ID; + } + + @Override + public Component getTitle() { + return Component.translatable("block.solarcooker.solar_cooker"); + } + + @Override + public Renderer getIcon() { + return EntryStack.of(VanillaEntryTypes.ITEM, new ItemStack(Constants.SOLAR_COOKER_ITEM.get())); + } + + @Override + public int getDisplayHeight() { + return 49; + } + + @Override + public DisplayRenderer getDisplayRenderer(SolarCookingReiDisplay display) { + return SimpleDisplayRenderer.from(Collections.singletonList(display.getInputEntries().get(0)), display.getOutputEntries()); + } + + @Override + public List setupDisplay(SolarCookingReiDisplay display, Rectangle bounds) { + Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10); + double cookingTime = display.getCookTime(); + DecimalFormat df = new DecimalFormat("###.##"); + List widgets = Lists.newArrayList(); + widgets.add(Widgets.createRecipeBase(bounds)); + widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 9))); + widgets.add(Widgets.createBurningFire(new Point(startPoint.x + 1, startPoint.y + 20)).animationDurationMS(10000.0)); + widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + 5), Component.translatable("category.rei.cooking.time&xp", df.format(display.getXp()), df.format(cookingTime / 20.0))).noShadow().rightAligned().color(-12566464, -4473925)); + widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 8)).animationDurationTicks(cookingTime)); + widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 9)).entries(display.getOutputEntries().get(0)).disableBackground().markOutput()); + widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entries(display.getInputEntries().get(0)).markInput()); + return widgets; + } + +} diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 9db200e..862e590 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -17,16 +17,19 @@ "environment": "*", "entrypoints": { "main": [ - "${group}.FabricSolarCookerMod" + "de.cech12.solarcooker.FabricSolarCookerMod" ], "client": [ - "${group}.client.FabricSolarCookerClientMod" + "de.cech12.solarcooker.client.FabricSolarCookerClientMod" ], "modmenu": [ - "${group}.compat.ModMenuCompat" + "de.cech12.solarcooker.compat.ModMenuCompat" ], "jei_mod_plugin": [ - "${group}.jei.SolarCookerJEIPlugin" + "de.cech12.solarcooker.jei.SolarCookerJEIPlugin" + ], + "rei_client": [ + "de.cech12.solarcooker.rei.SolarCookerReiClientPlugin" ] }, "depends": { diff --git a/forge/build.gradle b/forge/build.gradle index cea4952..37269cb 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -68,7 +68,12 @@ dependencies { testCompileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}")) compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-lib:${jei_version}")) testCompileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-lib:${jei_version}")) - runtimeOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}")) + //runtimeOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}")) + + compileOnly fg.deobf("me.shedaniel:RoughlyEnoughItems-api-forge:$rei_version") + runtimeOnly fg.deobf("me.shedaniel:RoughlyEnoughItems-forge:$rei_version") + implementation fg.deobf("me.shedaniel.cloth:cloth-config-forge:${cloth_config_version}") + implementation fg.deobf("dev.architectury:architectury-forge:${architectury_version}") } tasks.withType(JavaCompile).configureEach { diff --git a/forge/src/main/java/de/cech12/solarcooker/rei/SolarCookerReiClientPlugin.java b/forge/src/main/java/de/cech12/solarcooker/rei/SolarCookerReiClientPlugin.java new file mode 100644 index 0000000..46f10f9 --- /dev/null +++ b/forge/src/main/java/de/cech12/solarcooker/rei/SolarCookerReiClientPlugin.java @@ -0,0 +1,40 @@ +package de.cech12.solarcooker.rei; + +import de.cech12.solarcooker.Constants; +import de.cech12.solarcooker.crafting.SolarCookingRecipe; +import de.cech12.solarcooker.platform.Services; +import me.shedaniel.rei.api.client.plugins.REIClientPlugin; +import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; +import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; +import me.shedaniel.rei.api.common.display.DisplaySerializerRegistry; +import me.shedaniel.rei.api.common.util.EntryStacks; +import me.shedaniel.rei.forge.REIPluginClient; +import net.minecraft.world.item.crafting.AbstractCookingRecipe; + +import java.util.Objects; + +@SuppressWarnings("unused") +@REIPluginClient +public class SolarCookerReiClientPlugin implements REIClientPlugin { + + @Override + public void registerCategories(CategoryRegistry registry) { + registry.add(new SolarCookingReiDisplayCategory()); + registry.addWorkstations(SolarCookingReiDisplayCategory.ID, EntryStacks.of(Constants.SOLAR_COOKER_BLOCK.get())); + } + + @Override + public void registerDisplaySerializer(DisplaySerializerRegistry registry) { + registry.register(SolarCookingReiDisplayCategory.ID, SolarCookingReiDisplay.getSerializer()); + } + + @Override + public void registerDisplays(DisplayRegistry registry) { + registry.registerRecipeFiller(SolarCookingRecipe.class, Constants.SOLAR_COOKING_RECIPE_TYPE.get(), SolarCookingReiDisplay::new); + if (Services.CONFIG.areVanillaRecipesEnabled()) { + registry.registerRecipeFiller(AbstractCookingRecipe.class, type -> Objects.equals(Services.CONFIG.getRecipeType(), type), + recipeHolder -> Services.CONFIG.isRecipeAllowed(recipeHolder.id()), SolarCookingReiDisplay::new); + } + } + +} diff --git a/forge/src/main/java/de/cech12/solarcooker/rei/SolarCookingReiDisplay.java b/forge/src/main/java/de/cech12/solarcooker/rei/SolarCookingReiDisplay.java new file mode 100644 index 0000000..4cb0f96 --- /dev/null +++ b/forge/src/main/java/de/cech12/solarcooker/rei/SolarCookingReiDisplay.java @@ -0,0 +1,62 @@ +package de.cech12.solarcooker.rei; + +import de.cech12.solarcooker.crafting.SolarCookingRecipe; +import de.cech12.solarcooker.platform.Services; +import me.shedaniel.rei.api.common.category.CategoryIdentifier; +import me.shedaniel.rei.api.common.display.basic.BasicDisplay; +import me.shedaniel.rei.api.common.entry.EntryIngredient; +import me.shedaniel.rei.api.common.registry.RecipeManagerContext; +import me.shedaniel.rei.api.common.util.EntryIngredients; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.item.crafting.AbstractCookingRecipe; +import net.minecraft.world.item.crafting.RecipeHolder; + +import java.util.Collections; +import java.util.List; +import java.util.Optional; + +public class SolarCookingReiDisplay extends BasicDisplay { + + private final float xp; + private final double cookTime; + + public SolarCookingReiDisplay(RecipeHolder recipe) { + this(EntryIngredients.ofIngredients( + recipe.value().getIngredients()), + Collections.singletonList(EntryIngredients.of(recipe.value().getResultItem(null))), + recipe, + recipe.value().getExperience(), + recipe.value() instanceof SolarCookingRecipe ? recipe.value().getCookingTime() : (recipe.value().getCookingTime() * Services.CONFIG.getCookTimeFactor())); + } + + public SolarCookingReiDisplay(List input, List output, CompoundTag tag) { + this(input, output, RecipeManagerContext.getInstance().byId(tag, "location"), + tag.getFloat("xp"), tag.getDouble("cookTime")); + } + + public SolarCookingReiDisplay(List input, List output, RecipeHolder recipe, float xp, double cookTime) { + super(input, output, Optional.ofNullable(recipe).map(RecipeHolder::id)); + this.xp = xp; + this.cookTime = cookTime; + } + + public static Serializer getSerializer() { + return BasicDisplay.Serializer.ofRecipeLess(SolarCookingReiDisplay::new, (display, tag) -> { + tag.putFloat("xp", display.xp); + tag.putDouble("cookTime", display.cookTime); + }); + } + + @Override + public CategoryIdentifier getCategoryIdentifier() { + return SolarCookingReiDisplayCategory.ID; + } + + public double getCookTime() { + return cookTime; + } + + public float getXp() { + return xp; + } +} diff --git a/forge/src/main/java/de/cech12/solarcooker/rei/SolarCookingReiDisplayCategory.java b/forge/src/main/java/de/cech12/solarcooker/rei/SolarCookingReiDisplayCategory.java new file mode 100644 index 0000000..2754092 --- /dev/null +++ b/forge/src/main/java/de/cech12/solarcooker/rei/SolarCookingReiDisplayCategory.java @@ -0,0 +1,68 @@ +package de.cech12.solarcooker.rei; + +import com.google.common.collect.Lists; +import de.cech12.solarcooker.Constants; +import me.shedaniel.math.Point; +import me.shedaniel.math.Rectangle; +import me.shedaniel.rei.api.client.gui.DisplayRenderer; +import me.shedaniel.rei.api.client.gui.Renderer; +import me.shedaniel.rei.api.client.gui.SimpleDisplayRenderer; +import me.shedaniel.rei.api.client.gui.widgets.Widget; +import me.shedaniel.rei.api.client.gui.widgets.Widgets; +import me.shedaniel.rei.api.client.registry.display.DisplayCategory; +import me.shedaniel.rei.api.common.category.CategoryIdentifier; +import me.shedaniel.rei.api.common.entry.EntryStack; +import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; + +import java.text.DecimalFormat; +import java.util.Collections; +import java.util.List; + +public class SolarCookingReiDisplayCategory implements DisplayCategory { + + public static final CategoryIdentifier ID = CategoryIdentifier.of(Constants.MOD_ID, Constants.SOLAR_COOKING_NAME); + + @Override + public CategoryIdentifier getCategoryIdentifier() { + return ID; + } + + @Override + public Component getTitle() { + return Component.translatable("block.solarcooker.solar_cooker"); + } + + @Override + public Renderer getIcon() { + return EntryStack.of(VanillaEntryTypes.ITEM, new ItemStack(Constants.SOLAR_COOKER_ITEM.get())); + } + + @Override + public int getDisplayHeight() { + return 49; + } + + @Override + public DisplayRenderer getDisplayRenderer(SolarCookingReiDisplay display) { + return SimpleDisplayRenderer.from(Collections.singletonList(display.getInputEntries().get(0)), display.getOutputEntries()); + } + + @Override + public List setupDisplay(SolarCookingReiDisplay display, Rectangle bounds) { + Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10); + double cookingTime = display.getCookTime(); + DecimalFormat df = new DecimalFormat("###.##"); + List widgets = Lists.newArrayList(); + widgets.add(Widgets.createRecipeBase(bounds)); + widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 9))); + widgets.add(Widgets.createBurningFire(new Point(startPoint.x + 1, startPoint.y + 20)).animationDurationMS(10000.0)); + widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + 5), Component.translatable("category.rei.cooking.time&xp", new Object[]{df.format(display.getXp()), df.format(cookingTime / 20.0)})).noShadow().rightAligned().color(-12566464, -4473925)); + widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 8)).animationDurationTicks(cookingTime)); + widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 9)).entries(display.getOutputEntries().get(0)).disableBackground().markOutput()); + widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entries(display.getInputEntries().get(0)).markInput()); + return widgets; + } + +} diff --git a/gradle.properties b/gradle.properties index 4961210..691a2fc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ # Project group=de.cech12.solarcooker -mod_version=3.1.1.0 +mod_version=3.1.2.0 mod_id=solarcooker mod_name=Solar Cooker mod_author=Cech12 @@ -37,6 +37,11 @@ neoforge_loader_version_range=[1,) jei_version=17.3.0.49 jei_version_range=[17.3.0.49,) +# rei +rei_version=14.1.727 +rei_version_range=[14.1.727,) +architectury_version=11.1.17 + #the one probe top_version=1.20.4_neo-11.0.2-3 top_version_range=[1.20.4_neo-11.0.2,) diff --git a/neoforge/build.gradle b/neoforge/build.gradle index 2cc82da..7e8154c 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -54,7 +54,12 @@ dependencies { testCompileOnly("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}") compileOnly("mezz.jei:jei-${minecraft_version}-lib:${jei_version}") testCompileOnly("mezz.jei:jei-${minecraft_version}-lib:${jei_version}") - runtimeOnly("mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}") + //runtimeOnly("mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}") + + compileOnly("me.shedaniel:RoughlyEnoughItems-api-neoforge:$rei_version") + runtimeOnly("me.shedaniel:RoughlyEnoughItems-neoforge:$rei_version") + implementation("me.shedaniel.cloth:cloth-config-neoforge:$cloth_config_version") + implementation("dev.architectury:architectury-neoforge:$architectury_version") implementation("mcjty.theoneprobe:theoneprobe:$top_version") {transitive = false} } diff --git a/neoforge/src/main/java/de/cech12/solarcooker/rei/SolarCookerReiClientPlugin.java b/neoforge/src/main/java/de/cech12/solarcooker/rei/SolarCookerReiClientPlugin.java new file mode 100644 index 0000000..46f10f9 --- /dev/null +++ b/neoforge/src/main/java/de/cech12/solarcooker/rei/SolarCookerReiClientPlugin.java @@ -0,0 +1,40 @@ +package de.cech12.solarcooker.rei; + +import de.cech12.solarcooker.Constants; +import de.cech12.solarcooker.crafting.SolarCookingRecipe; +import de.cech12.solarcooker.platform.Services; +import me.shedaniel.rei.api.client.plugins.REIClientPlugin; +import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; +import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; +import me.shedaniel.rei.api.common.display.DisplaySerializerRegistry; +import me.shedaniel.rei.api.common.util.EntryStacks; +import me.shedaniel.rei.forge.REIPluginClient; +import net.minecraft.world.item.crafting.AbstractCookingRecipe; + +import java.util.Objects; + +@SuppressWarnings("unused") +@REIPluginClient +public class SolarCookerReiClientPlugin implements REIClientPlugin { + + @Override + public void registerCategories(CategoryRegistry registry) { + registry.add(new SolarCookingReiDisplayCategory()); + registry.addWorkstations(SolarCookingReiDisplayCategory.ID, EntryStacks.of(Constants.SOLAR_COOKER_BLOCK.get())); + } + + @Override + public void registerDisplaySerializer(DisplaySerializerRegistry registry) { + registry.register(SolarCookingReiDisplayCategory.ID, SolarCookingReiDisplay.getSerializer()); + } + + @Override + public void registerDisplays(DisplayRegistry registry) { + registry.registerRecipeFiller(SolarCookingRecipe.class, Constants.SOLAR_COOKING_RECIPE_TYPE.get(), SolarCookingReiDisplay::new); + if (Services.CONFIG.areVanillaRecipesEnabled()) { + registry.registerRecipeFiller(AbstractCookingRecipe.class, type -> Objects.equals(Services.CONFIG.getRecipeType(), type), + recipeHolder -> Services.CONFIG.isRecipeAllowed(recipeHolder.id()), SolarCookingReiDisplay::new); + } + } + +} diff --git a/neoforge/src/main/java/de/cech12/solarcooker/rei/SolarCookingReiDisplay.java b/neoforge/src/main/java/de/cech12/solarcooker/rei/SolarCookingReiDisplay.java new file mode 100644 index 0000000..96134b2 --- /dev/null +++ b/neoforge/src/main/java/de/cech12/solarcooker/rei/SolarCookingReiDisplay.java @@ -0,0 +1,62 @@ +package de.cech12.solarcooker.rei; + +import de.cech12.solarcooker.crafting.SolarCookingRecipe; +import de.cech12.solarcooker.platform.Services; +import me.shedaniel.rei.api.common.category.CategoryIdentifier; +import me.shedaniel.rei.api.common.display.basic.BasicDisplay; +import me.shedaniel.rei.api.common.entry.EntryIngredient; +import me.shedaniel.rei.api.common.registry.RecipeManagerContext; +import me.shedaniel.rei.api.common.util.EntryIngredients; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.item.crafting.AbstractCookingRecipe; +import net.minecraft.world.item.crafting.RecipeHolder; + +import java.util.Collections; +import java.util.List; +import java.util.Optional; + +public class SolarCookingReiDisplay extends BasicDisplay { + + private final float xp; + private final double cookTime; + + public SolarCookingReiDisplay(RecipeHolder recipe) { + this(EntryIngredients.ofIngredients( + recipe.value().getIngredients()), + Collections.singletonList(EntryIngredients.of(recipe.value().getResultItem(null))), + recipe, + recipe.value().getExperience(), + recipe.value() instanceof SolarCookingRecipe ? recipe.value().getCookingTime() : (recipe.value().getCookingTime() * Services.CONFIG.getCookTimeFactor())); + } + + public SolarCookingReiDisplay(List input, List output, CompoundTag tag) { + this(input, output, RecipeManagerContext.getInstance().byId(tag, "location"), + tag.getFloat("xp"), tag.getDouble("cookTime")); + } + + public SolarCookingReiDisplay(List input, List output, RecipeHolder recipe, float xp, double cookTime) { + super(input, output, Optional.ofNullable(recipe).map(RecipeHolder::id)); + this.xp = xp; + this.cookTime = cookTime; + } + + public static Serializer getSerializer() { + return Serializer.ofRecipeLess(SolarCookingReiDisplay::new, (display, tag) -> { + tag.putFloat("xp", display.xp); + tag.putDouble("cookTime", display.cookTime); + }); + } + + @Override + public CategoryIdentifier getCategoryIdentifier() { + return SolarCookingReiDisplayCategory.ID; + } + + public double getCookTime() { + return cookTime; + } + + public float getXp() { + return xp; + } +} diff --git a/neoforge/src/main/java/de/cech12/solarcooker/rei/SolarCookingReiDisplayCategory.java b/neoforge/src/main/java/de/cech12/solarcooker/rei/SolarCookingReiDisplayCategory.java new file mode 100644 index 0000000..2d878e8 --- /dev/null +++ b/neoforge/src/main/java/de/cech12/solarcooker/rei/SolarCookingReiDisplayCategory.java @@ -0,0 +1,68 @@ +package de.cech12.solarcooker.rei; + +import com.google.common.collect.Lists; +import de.cech12.solarcooker.Constants; +import me.shedaniel.math.Point; +import me.shedaniel.math.Rectangle; +import me.shedaniel.rei.api.client.gui.DisplayRenderer; +import me.shedaniel.rei.api.client.gui.Renderer; +import me.shedaniel.rei.api.client.gui.SimpleDisplayRenderer; +import me.shedaniel.rei.api.client.gui.widgets.Widget; +import me.shedaniel.rei.api.client.gui.widgets.Widgets; +import me.shedaniel.rei.api.client.registry.display.DisplayCategory; +import me.shedaniel.rei.api.common.category.CategoryIdentifier; +import me.shedaniel.rei.api.common.entry.EntryStack; +import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; + +import java.text.DecimalFormat; +import java.util.Collections; +import java.util.List; + +public class SolarCookingReiDisplayCategory implements DisplayCategory { + + public static final CategoryIdentifier ID = CategoryIdentifier.of(Constants.MOD_ID, Constants.SOLAR_COOKING_NAME); + + @Override + public CategoryIdentifier getCategoryIdentifier() { + return ID; + } + + @Override + public Component getTitle() { + return Component.translatable("block.solarcooker.solar_cooker"); + } + + @Override + public Renderer getIcon() { + return EntryStack.of(VanillaEntryTypes.ITEM, new ItemStack(Constants.SOLAR_COOKER_ITEM.get())); + } + + @Override + public int getDisplayHeight() { + return 49; + } + + @Override + public DisplayRenderer getDisplayRenderer(SolarCookingReiDisplay display) { + return SimpleDisplayRenderer.from(Collections.singletonList(display.getInputEntries().get(0)), display.getOutputEntries()); + } + + @Override + public List setupDisplay(SolarCookingReiDisplay display, Rectangle bounds) { + Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10); + double cookingTime = display.getCookTime(); + DecimalFormat df = new DecimalFormat("###.##"); + List widgets = Lists.newArrayList(); + widgets.add(Widgets.createRecipeBase(bounds)); + widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 9))); + widgets.add(Widgets.createBurningFire(new Point(startPoint.x + 1, startPoint.y + 20)).animationDurationMS(10000.0)); + widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + 5), Component.translatable("category.rei.cooking.time&xp", df.format(display.getXp()), df.format(cookingTime / 20.0))).noShadow().rightAligned().color(-12566464, -4473925)); + widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 8)).animationDurationTicks(cookingTime)); + widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 9)).entries(display.getOutputEntries().get(0)).disableBackground().markOutput()); + widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entries(display.getInputEntries().get(0)).markInput()); + return widgets; + } + +}