From ed31c4bb1654b6249daebd02f17e7d18a537124f Mon Sep 17 00:00:00 2001 From: cech12 Date: Sat, 27 Apr 2024 08:52:06 +0200 Subject: [PATCH] add Fabric & Quilt support --- .github/ISSUE_TEMPLATE/bug.yml | 1 + .github/workflows/cicd-workflow.yml | 38 +++++++++ CHANGELOG.md | 4 + README.md | 7 +- build.gradle | 6 +- .../de/cech12/solarcooker/CommonLoader.java | 5 ++ .../java/de/cech12/solarcooker/Constants.java | 8 +- .../block/AbstractSolarCookerBlock.java | 12 +-- .../solarcooker/block/SolarCookerBlock.java | 8 +- ...ntity.java => SolarCookerBlockEntity.java} | 22 +++--- .../SolarCookerBlockEntityRenderer.java | 6 +- .../inventory/SolarCookerContainer.java | 10 +-- .../inventory/SolarCookerResultSlot.java | 6 +- .../platform/services/IConfigHelper.java | 2 +- .../platform/services/IRegistryHelper.java | 4 +- .../assets/solarcooker/lang/de_de.json | 37 ++++++++- .../assets/solarcooker/lang/en_us.json | 37 ++++++++- .../assets/solarcooker/lang/pt_br.json | 37 ++++++++- .../assets/solarcooker/lang/ru_ru.json | 37 ++++++++- .../assets/solarcooker/lang/uk_ua.json | 37 ++++++++- .../assets/solarcooker/lang/zh_cn.json | 37 ++++++++- fabric/build.gradle | 71 +++++++++++++++++ .../solarcooker/FabricSolarCookerMod.java | 31 ++++++++ .../block/FabricSolarCookerBlock.java | 50 ++++++++++++ .../client/FabricSolarCookerClientMod.java | 37 +++++++++ .../solarcooker/compat/ModMenuCompat.java | 18 +++++ .../solarcooker/init/ModBlockEntityTypes.java | 24 ++++++ .../de/cech12/solarcooker/init/ModBlocks.java | 33 ++++++++ .../de/cech12/solarcooker/init/ModItems.java | 31 ++++++++ .../cech12/solarcooker/init/ModMenuTypes.java | 26 +++++++ .../solarcooker/init/ModRecipeTypes.java | 31 ++++++++ .../platform/FabricConfigHelper.java | 77 +++++++++++++++++++ .../platform/FabricPlatformHelper.java | 26 +++++++ .../platform/FabricRegistryHelper.java | 17 ++++ ...olarcooker.platform.services.IConfigHelper | 1 + ...arcooker.platform.services.IPlatformHelper | 1 + ...arcooker.platform.services.IRegistryHelper | 1 + .../data/c/tags/items/wooden_chests.json | 6 ++ .../shining_diamond_block.json | 32 ++++++++ .../recipes/decorations/solar_cooker.json | 32 ++++++++ .../data/solarcooker/recipes/reflector.json | 23 ++++++ .../recipes/shining_diamond_block.json | 10 +++ .../solarcooker/recipes/solar_cooker.json | 23 ++++++ fabric/src/main/resources/fabric.mod.json | 43 +++++++++++ .../ForgeSolarCookerBlockEntity.java | 2 +- .../platform/ForgeRegistryHelper.java | 4 +- .../shining_diamond_block.json | 0 .../recipes/decorations/solar_cooker.json | 0 .../data/solarcooker/recipes/reflector.json | 0 .../recipes/shining_diamond_block.json | 0 .../solarcooker/recipes/solar_cooker.json | 0 gradle.properties | 8 +- .../NeoForgeSolarCookerBlockEntity.java | 12 --- .../cech12/solarcooker/compat/TOPCompat.java | 4 +- .../solarcooker/init/ModBlockEntityTypes.java | 4 +- .../de/cech12/solarcooker/init/ModItems.java | 7 +- .../platform/NeoForgeRegistryHelper.java | 7 +- .../shining_diamond_block.json | 32 ++++++++ .../recipes/decorations/solar_cooker.json | 32 ++++++++ .../data/solarcooker/recipes/reflector.json | 23 ++++++ .../recipes/shining_diamond_block.json | 10 +++ .../solarcooker/recipes/solar_cooker.json | 23 ++++++ settings.gradle | 4 +- 63 files changed, 1097 insertions(+), 80 deletions(-) rename common/src/main/java/de/cech12/solarcooker/blockentity/{AbstractSolarCookerBlockEntity.java => SolarCookerBlockEntity.java} (95%) create mode 100644 fabric/build.gradle create mode 100644 fabric/src/main/java/de/cech12/solarcooker/FabricSolarCookerMod.java create mode 100644 fabric/src/main/java/de/cech12/solarcooker/block/FabricSolarCookerBlock.java create mode 100644 fabric/src/main/java/de/cech12/solarcooker/client/FabricSolarCookerClientMod.java create mode 100644 fabric/src/main/java/de/cech12/solarcooker/compat/ModMenuCompat.java create mode 100644 fabric/src/main/java/de/cech12/solarcooker/init/ModBlockEntityTypes.java create mode 100644 fabric/src/main/java/de/cech12/solarcooker/init/ModBlocks.java create mode 100644 fabric/src/main/java/de/cech12/solarcooker/init/ModItems.java create mode 100644 fabric/src/main/java/de/cech12/solarcooker/init/ModMenuTypes.java create mode 100644 fabric/src/main/java/de/cech12/solarcooker/init/ModRecipeTypes.java create mode 100644 fabric/src/main/java/de/cech12/solarcooker/platform/FabricConfigHelper.java create mode 100644 fabric/src/main/java/de/cech12/solarcooker/platform/FabricPlatformHelper.java create mode 100644 fabric/src/main/java/de/cech12/solarcooker/platform/FabricRegistryHelper.java create mode 100644 fabric/src/main/resources/META-INF/services/de.cech12.solarcooker.platform.services.IConfigHelper create mode 100644 fabric/src/main/resources/META-INF/services/de.cech12.solarcooker.platform.services.IPlatformHelper create mode 100644 fabric/src/main/resources/META-INF/services/de.cech12.solarcooker.platform.services.IRegistryHelper create mode 100644 fabric/src/main/resources/data/c/tags/items/wooden_chests.json create mode 100644 fabric/src/main/resources/data/solarcooker/advancements/recipes/building_blocks/shining_diamond_block.json create mode 100644 fabric/src/main/resources/data/solarcooker/advancements/recipes/decorations/solar_cooker.json create mode 100644 fabric/src/main/resources/data/solarcooker/recipes/reflector.json create mode 100644 fabric/src/main/resources/data/solarcooker/recipes/shining_diamond_block.json create mode 100644 fabric/src/main/resources/data/solarcooker/recipes/solar_cooker.json create mode 100644 fabric/src/main/resources/fabric.mod.json rename {common => forge}/src/main/resources/data/solarcooker/advancements/recipes/building_blocks/shining_diamond_block.json (100%) rename {common => forge}/src/main/resources/data/solarcooker/advancements/recipes/decorations/solar_cooker.json (100%) rename {common => forge}/src/main/resources/data/solarcooker/recipes/reflector.json (100%) rename {common => forge}/src/main/resources/data/solarcooker/recipes/shining_diamond_block.json (100%) rename {common => forge}/src/main/resources/data/solarcooker/recipes/solar_cooker.json (100%) delete mode 100644 neoforge/src/main/java/de/cech12/solarcooker/blockentity/NeoForgeSolarCookerBlockEntity.java create mode 100644 neoforge/src/main/resources/data/solarcooker/advancements/recipes/building_blocks/shining_diamond_block.json create mode 100644 neoforge/src/main/resources/data/solarcooker/advancements/recipes/decorations/solar_cooker.json create mode 100644 neoforge/src/main/resources/data/solarcooker/recipes/reflector.json create mode 100644 neoforge/src/main/resources/data/solarcooker/recipes/shining_diamond_block.json create mode 100644 neoforge/src/main/resources/data/solarcooker/recipes/solar_cooker.json 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 7b50259..9431fa4 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: 436874 + 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: IsSapAeq + 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 e41d8dc..61b08c5 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-27 +### Added +- add Fabric (>=0.96.11+1.20.4) support (Fabric, Quilt) + ## [1.20.4-3.0.0.0] - 2024-04-08 ### Changed - updated to Minecraft 1.20.4 (Forge 49.0.38, Neoforge 20.4.225) diff --git a/README.md b/README.md index 62098b6..1e7b628 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,12 @@ [![License](https://img.shields.io/github/license/cech12/SolarCooker)](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 is a **Minecraft Forge** mod and adds a **Solar Cooker** to the game. +This is a Minecraft mod that adds a **Solar Cooker** 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/logo.png) diff --git a/build.gradle b/build.gradle index 99f0ef6..6ab26fb 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/solarcooker/CommonLoader.java b/common/src/main/java/de/cech12/solarcooker/CommonLoader.java index e47e4a6..eb578ce 100644 --- a/common/src/main/java/de/cech12/solarcooker/CommonLoader.java +++ b/common/src/main/java/de/cech12/solarcooker/CommonLoader.java @@ -1,6 +1,7 @@ package de.cech12.solarcooker; import de.cech12.solarcooker.platform.Services; +import net.minecraft.resources.ResourceLocation; /** * A static class for all loaders which initializes everything which is used by all loaders. @@ -14,6 +15,10 @@ public static void init() { Services.CONFIG.init(); } + public static ResourceLocation id(String name) { + return new ResourceLocation(Constants.MOD_ID, name); + } + private CommonLoader() {} } diff --git a/common/src/main/java/de/cech12/solarcooker/Constants.java b/common/src/main/java/de/cech12/solarcooker/Constants.java index b68f933..6c70f11 100644 --- a/common/src/main/java/de/cech12/solarcooker/Constants.java +++ b/common/src/main/java/de/cech12/solarcooker/Constants.java @@ -1,8 +1,8 @@ package de.cech12.solarcooker; -import de.cech12.solarcooker.blockentity.AbstractSolarCookerBlockEntity; +import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity; import de.cech12.solarcooker.crafting.SolarCookingRecipe; -import net.minecraft.world.inventory.AbstractContainerMenu; +import de.cech12.solarcooker.inventory.SolarCookerContainer; import net.minecraft.world.inventory.MenuType; import net.minecraft.world.item.Item; import net.minecraft.world.item.crafting.RecipeType; @@ -37,7 +37,7 @@ public class Constants { public static Supplier REFLECTOR_BLOCK; public static Supplier SHINING_DIAMOND_BLOCK_BLOCK; - public static Supplier> SOLAR_COOKER_ENTITY_TYPE; + public static Supplier> SOLAR_COOKER_ENTITY_TYPE; public static Supplier SOLAR_COOKER_ITEM; public static Supplier REFLECTOR_ITEM; @@ -45,7 +45,7 @@ public class Constants { public static Supplier> SOLAR_COOKING_RECIPE_TYPE; - public static Supplier> SOLAR_COOKER_MENU_TYPE; + public static Supplier> SOLAR_COOKER_MENU_TYPE; private Constants() {} diff --git a/common/src/main/java/de/cech12/solarcooker/block/AbstractSolarCookerBlock.java b/common/src/main/java/de/cech12/solarcooker/block/AbstractSolarCookerBlock.java index 2a10133..9e89b69 100644 --- a/common/src/main/java/de/cech12/solarcooker/block/AbstractSolarCookerBlock.java +++ b/common/src/main/java/de/cech12/solarcooker/block/AbstractSolarCookerBlock.java @@ -1,6 +1,6 @@ package de.cech12.solarcooker.block; -import de.cech12.solarcooker.blockentity.AbstractSolarCookerBlockEntity; +import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.RenderShape; @@ -73,8 +73,8 @@ public BlockState getStateForPlacement(BlockPlaceContext context) { public void setPlacedBy(@Nonnull Level worldIn, @Nonnull BlockPos pos, @Nonnull BlockState state, LivingEntity placer, ItemStack stack) { if (stack.hasCustomHoverName()) { BlockEntity tileentity = worldIn.getBlockEntity(pos); - if (tileentity instanceof AbstractSolarCookerBlockEntity) { - ((AbstractSolarCookerBlockEntity)tileentity).setCustomName(stack.getHoverName()); + if (tileentity instanceof SolarCookerBlockEntity) { + ((SolarCookerBlockEntity)tileentity).setCustomName(stack.getHoverName()); } } @@ -85,9 +85,9 @@ public void setPlacedBy(@Nonnull Level worldIn, @Nonnull BlockPos pos, @Nonnull public void onRemove(BlockState state, @Nonnull Level worldIn, @Nonnull BlockPos pos, BlockState newState, boolean isMoving) { if (!state.is(newState.getBlock())) { BlockEntity tileentity = worldIn.getBlockEntity(pos); - if (tileentity instanceof AbstractSolarCookerBlockEntity) { - Containers.dropContents(worldIn, pos, (AbstractSolarCookerBlockEntity)tileentity); - ((AbstractSolarCookerBlockEntity)tileentity).getRecipesToAwardAndPopExperience(worldIn, Vec3.atLowerCornerOf(pos)); + if (tileentity instanceof SolarCookerBlockEntity) { + Containers.dropContents(worldIn, pos, (SolarCookerBlockEntity)tileentity); + ((SolarCookerBlockEntity)tileentity).getRecipesToAwardAndPopExperience(worldIn, Vec3.atLowerCornerOf(pos)); worldIn.updateNeighbourForOutputSignal(pos, this); } diff --git a/common/src/main/java/de/cech12/solarcooker/block/SolarCookerBlock.java b/common/src/main/java/de/cech12/solarcooker/block/SolarCookerBlock.java index ebaac82..d21a51b 100644 --- a/common/src/main/java/de/cech12/solarcooker/block/SolarCookerBlock.java +++ b/common/src/main/java/de/cech12/solarcooker/block/SolarCookerBlock.java @@ -2,7 +2,7 @@ import com.mojang.serialization.MapCodec; import de.cech12.solarcooker.Constants; -import de.cech12.solarcooker.blockentity.AbstractSolarCookerBlockEntity; +import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity; import de.cech12.solarcooker.platform.Services; import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.BaseEntityBlock; @@ -46,7 +46,7 @@ public BlockEntity newBlockEntity(@Nonnull BlockPos pos, @Nonnull BlockState sta @Override @Nullable public BlockEntityTicker getTicker(@Nonnull Level level, @Nonnull BlockState state, @Nonnull BlockEntityType entityType) { - return createTickerHelper(entityType, Constants.SOLAR_COOKER_ENTITY_TYPE.get(), AbstractSolarCookerBlockEntity::tick); + return createTickerHelper(entityType, Constants.SOLAR_COOKER_ENTITY_TYPE.get(), SolarCookerBlockEntity::tick); } /** @@ -56,8 +56,8 @@ public BlockEntityTicker getTicker(@Nonnull Level lev @Override protected void interactWith(Level worldIn, @Nonnull BlockPos pos, @Nonnull Player player) { BlockEntity blockEntity = worldIn.getBlockEntity(pos); - if (blockEntity instanceof AbstractSolarCookerBlockEntity && player instanceof ServerPlayer) { - player.openMenu((AbstractSolarCookerBlockEntity) blockEntity); + if (blockEntity instanceof SolarCookerBlockEntity && player instanceof ServerPlayer) { + player.openMenu((SolarCookerBlockEntity) blockEntity); } } diff --git a/common/src/main/java/de/cech12/solarcooker/blockentity/AbstractSolarCookerBlockEntity.java b/common/src/main/java/de/cech12/solarcooker/blockentity/SolarCookerBlockEntity.java similarity index 95% rename from common/src/main/java/de/cech12/solarcooker/blockentity/AbstractSolarCookerBlockEntity.java rename to common/src/main/java/de/cech12/solarcooker/blockentity/SolarCookerBlockEntity.java index 45586ef..290a8e2 100644 --- a/common/src/main/java/de/cech12/solarcooker/blockentity/AbstractSolarCookerBlockEntity.java +++ b/common/src/main/java/de/cech12/solarcooker/blockentity/SolarCookerBlockEntity.java @@ -49,7 +49,7 @@ import javax.annotation.Nullable; import java.util.List; -public abstract class AbstractSolarCookerBlockEntity extends BaseContainerBlockEntity implements WorldlyContainer, RecipeCraftingHolder, StackedContentsCompatible, LidBlockEntity { +public class SolarCookerBlockEntity extends BaseContainerBlockEntity implements WorldlyContainer, RecipeCraftingHolder, StackedContentsCompatible, LidBlockEntity { public static final int CONTAINER_IS_SUNLIT = 0; public static final int CONTAINER_COOK_TIME = 1; @@ -77,13 +77,13 @@ public abstract class AbstractSolarCookerBlockEntity extends BaseContainerBlockE protected final RecipeType specificRecipeType; private final Object2IntOpenHashMap usedRecipes = new Object2IntOpenHashMap<>(); - public AbstractSolarCookerBlockEntity(BlockEntityType tileTypeIn, BlockPos pos, BlockState state, - RecipeType specificRecipeTypeIn) { + public SolarCookerBlockEntity(BlockEntityType tileTypeIn, BlockPos pos, BlockState state, + RecipeType specificRecipeTypeIn) { super(tileTypeIn, pos, state); this.specificRecipeType = specificRecipeTypeIn; } - public AbstractSolarCookerBlockEntity(BlockPos pos, BlockState state) { + public SolarCookerBlockEntity(BlockPos pos, BlockState state) { this(Constants.SOLAR_COOKER_ENTITY_TYPE.get(), pos, state, Constants.SOLAR_COOKING_RECIPE_TYPE.get()); } @@ -93,9 +93,9 @@ public AbstractSolarCookerBlockEntity(BlockPos pos, BlockState state) { protected final ContainerData dataAccess = new ContainerData() { public int get(int index) { return switch (index) { - case CONTAINER_IS_SUNLIT -> AbstractSolarCookerBlockEntity.this.isSunlit() ? 1 : 0; - case CONTAINER_COOK_TIME -> AbstractSolarCookerBlockEntity.this.cookTime; - case CONTAINER_COOK_TIME_TOTAL -> AbstractSolarCookerBlockEntity.this.cookTimeTotal; + case CONTAINER_IS_SUNLIT -> SolarCookerBlockEntity.this.isSunlit() ? 1 : 0; + case CONTAINER_COOK_TIME -> SolarCookerBlockEntity.this.cookTime; + case CONTAINER_COOK_TIME_TOTAL -> SolarCookerBlockEntity.this.cookTimeTotal; default -> 0; }; } @@ -104,10 +104,10 @@ public void set(int index, int value) { switch (index) { //case CONTAINER_IS_SUNLIT: break; //do nothing case CONTAINER_COOK_TIME: - AbstractSolarCookerBlockEntity.this.cookTime = value; + SolarCookerBlockEntity.this.cookTime = value; break; case CONTAINER_COOK_TIME_TOTAL: - AbstractSolarCookerBlockEntity.this.cookTimeTotal = value; + SolarCookerBlockEntity.this.cookTimeTotal = value; } } @@ -157,7 +157,7 @@ public boolean isSunlit() { && this.level.canSeeSky(this.worldPosition.above())); } else { //world.isDaytime() returns always true on client side - return AbstractSolarCookerBlockEntity.this.getBlockState().getValue(SolarCookerBlock.SUNLIT); + return SolarCookerBlockEntity.this.getBlockState().getValue(SolarCookerBlock.SUNLIT); } } return false; @@ -205,7 +205,7 @@ public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt) { this.load(pkt.getTag()); } - public static void tick(Level level, BlockPos pos, BlockState state, AbstractSolarCookerBlockEntity entity) { + public static void tick(Level level, BlockPos pos, BlockState state, SolarCookerBlockEntity entity) { if (level != null) { boolean dirty = false; entity.calculateLidAngle(); diff --git a/common/src/main/java/de/cech12/solarcooker/client/SolarCookerBlockEntityRenderer.java b/common/src/main/java/de/cech12/solarcooker/client/SolarCookerBlockEntityRenderer.java index a37a667..734b1ec 100644 --- a/common/src/main/java/de/cech12/solarcooker/client/SolarCookerBlockEntityRenderer.java +++ b/common/src/main/java/de/cech12/solarcooker/client/SolarCookerBlockEntityRenderer.java @@ -2,7 +2,7 @@ import de.cech12.solarcooker.Constants; import de.cech12.solarcooker.block.AbstractSolarCookerBlock; -import de.cech12.solarcooker.blockentity.AbstractSolarCookerBlockEntity; +import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.math.Axis; @@ -29,7 +29,7 @@ import javax.annotation.Nonnull; -public class SolarCookerBlockEntityRenderer implements BlockEntityRenderer { +public class SolarCookerBlockEntityRenderer implements BlockEntityRenderer { public static final ResourceLocation TEXTURE = new ResourceLocation(Constants.MOD_ID, "textures/entity/solar_cooker.png"); @@ -56,7 +56,7 @@ public SolarCookerBlockEntityRenderer(BlockEntityRendererProvider.Context render } @Override - public void render(AbstractSolarCookerBlockEntity blockEntity, float partialTicks, @Nonnull PoseStack matrixStackIn, @Nonnull MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { + public void render(SolarCookerBlockEntity blockEntity, float partialTicks, @Nonnull PoseStack matrixStackIn, @Nonnull MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) { Level world = blockEntity.getLevel(); boolean isInWorld = world != null; BlockState blockstate = isInWorld ? blockEntity.getBlockState() : Constants.SOLAR_COOKER_BLOCK.get().defaultBlockState().setValue(ChestBlock.FACING, Direction.SOUTH); diff --git a/common/src/main/java/de/cech12/solarcooker/inventory/SolarCookerContainer.java b/common/src/main/java/de/cech12/solarcooker/inventory/SolarCookerContainer.java index 6de80a9..3be0353 100644 --- a/common/src/main/java/de/cech12/solarcooker/inventory/SolarCookerContainer.java +++ b/common/src/main/java/de/cech12/solarcooker/inventory/SolarCookerContainer.java @@ -1,7 +1,7 @@ package de.cech12.solarcooker.inventory; import de.cech12.solarcooker.Constants; -import de.cech12.solarcooker.blockentity.AbstractSolarCookerBlockEntity; +import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity; import de.cech12.solarcooker.platform.Services; import net.minecraft.world.Container; import net.minecraft.world.entity.player.Player; @@ -134,16 +134,16 @@ public void removed(@Nonnull Player playerIn) { } public int getCookProgressionScaled() { - int i = this.data.get(AbstractSolarCookerBlockEntity.CONTAINER_COOK_TIME); - int j = this.data.get(AbstractSolarCookerBlockEntity.CONTAINER_COOK_TIME_TOTAL); + int i = this.data.get(SolarCookerBlockEntity.CONTAINER_COOK_TIME); + int j = this.data.get(SolarCookerBlockEntity.CONTAINER_COOK_TIME_TOTAL); return j != 0 && i != 0 ? i * 24 / j : 0; } public boolean isBurning() { - return this.data.get(AbstractSolarCookerBlockEntity.CONTAINER_COOK_TIME) > 0; + return this.data.get(SolarCookerBlockEntity.CONTAINER_COOK_TIME) > 0; } public boolean isSunlit() { - return this.data.get(AbstractSolarCookerBlockEntity.CONTAINER_IS_SUNLIT) > 0; + return this.data.get(SolarCookerBlockEntity.CONTAINER_IS_SUNLIT) > 0; } } diff --git a/common/src/main/java/de/cech12/solarcooker/inventory/SolarCookerResultSlot.java b/common/src/main/java/de/cech12/solarcooker/inventory/SolarCookerResultSlot.java index 0b6ebae..6c11264 100644 --- a/common/src/main/java/de/cech12/solarcooker/inventory/SolarCookerResultSlot.java +++ b/common/src/main/java/de/cech12/solarcooker/inventory/SolarCookerResultSlot.java @@ -1,6 +1,6 @@ package de.cech12.solarcooker.inventory; -import de.cech12.solarcooker.blockentity.AbstractSolarCookerBlockEntity; +import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.Container; import net.minecraft.world.inventory.FurnaceResultSlot; @@ -19,8 +19,8 @@ public SolarCookerResultSlot(Player player, Container inventoryIn, int slotIndex @Override protected void checkTakeAchievements(@Nonnull ItemStack stack) { super.checkTakeAchievements(stack); - if (!this.player.level().isClientSide && this.container instanceof AbstractSolarCookerBlockEntity) { - ((AbstractSolarCookerBlockEntity)this.container).awardUsedRecipesAndPopExperience(this.player); + if (!this.player.level().isClientSide && this.container instanceof SolarCookerBlockEntity) { + ((SolarCookerBlockEntity)this.container).awardUsedRecipesAndPopExperience(this.player); } } } diff --git a/common/src/main/java/de/cech12/solarcooker/platform/services/IConfigHelper.java b/common/src/main/java/de/cech12/solarcooker/platform/services/IConfigHelper.java index 21fd733..45d9518 100644 --- a/common/src/main/java/de/cech12/solarcooker/platform/services/IConfigHelper.java +++ b/common/src/main/java/de/cech12/solarcooker/platform/services/IConfigHelper.java @@ -40,7 +40,7 @@ public interface IConfigHelper { /** Default value of the recipe blocked list option */ String RECIPE_BLOCKED_LIST_DEFAULT = ""; /** Config description of the recipe blocked list option */ - String RECIPE_BLOCKED_LIST_DESCRIPTION = "A comma separated list of all vanilla recipes that should not be used by the brick furnaces. Example: \"baked_potato,baked_potato_from_smoking,othermod:other_baked_food\""; + String RECIPE_BLOCKED_LIST_DESCRIPTION = "A comma separated list of all vanilla recipes that should not be used by the solar cooker. Example: \"baked_potato,baked_potato_from_smoking,othermod:other_baked_food\""; /** * Initialization method for the Service implementations. diff --git a/common/src/main/java/de/cech12/solarcooker/platform/services/IRegistryHelper.java b/common/src/main/java/de/cech12/solarcooker/platform/services/IRegistryHelper.java index 9ab34fe..28ac8eb 100644 --- a/common/src/main/java/de/cech12/solarcooker/platform/services/IRegistryHelper.java +++ b/common/src/main/java/de/cech12/solarcooker/platform/services/IRegistryHelper.java @@ -1,6 +1,6 @@ package de.cech12.solarcooker.platform.services; -import de.cech12.solarcooker.blockentity.AbstractSolarCookerBlockEntity; +import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity; import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.state.BlockState; @@ -11,6 +11,6 @@ */ public interface IRegistryHelper { - AbstractSolarCookerBlockEntity getNewBlockEntity(@Nonnull BlockPos pos, @Nonnull BlockState state); + SolarCookerBlockEntity getNewBlockEntity(@Nonnull BlockPos pos, @Nonnull BlockState state); } 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 2957194..d6c3ade 100644 --- a/common/src/main/resources/assets/solarcooker/lang/de_de.json +++ b/common/src/main/resources/assets/solarcooker/lang/de_de.json @@ -4,5 +4,40 @@ "block.solarcooker.shining_diamond_block": "Strahlender Diamantblock", "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." + "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/en_us.json b/common/src/main/resources/assets/solarcooker/lang/en_us.json index 98890d0..1cfd8e1 100644 --- a/common/src/main/resources/assets/solarcooker/lang/en_us.json +++ b/common/src/main/resources/assets/solarcooker/lang/en_us.json @@ -4,5 +4,40 @@ "block.solarcooker.shining_diamond_block": "Shining Block of Diamond", "item.solarcooker.reflector.description": "Up to four Reflectors can be placed to the left and right side of a Solar Cooker to improve the incidence of light and reduce cooking time.", - "item.solarcooker.shining_diamond_block.description": "Shine bright! Can be placed above a Solar Cooker to use it independently of the sun." + "item.solarcooker.shining_diamond_block.description": "Shine bright! Can be placed above a Solar Cooker to use it independently of the sun.", + + "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 2fad183..d21783f 100644 --- a/common/src/main/resources/assets/solarcooker/lang/pt_br.json +++ b/common/src/main/resources/assets/solarcooker/lang/pt_br.json @@ -4,5 +4,40 @@ "block.solarcooker.shining_diamond_block": "Bloco brilhante de diamante", "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." + "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 d44c0ef..7ed1900 100644 --- a/common/src/main/resources/assets/solarcooker/lang/ru_ru.json +++ b/common/src/main/resources/assets/solarcooker/lang/ru_ru.json @@ -4,5 +4,40 @@ "block.solarcooker.shining_diamond_block": "Сияющий алмазный блок", "item.solarcooker.reflector.description": "Для увеличения падения света и сокращения времени готовки, по левому и правому бокам солнечной плиты можно установить до четырёх светоотражателей.", - "item.solarcooker.shining_diamond_block.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 dce8308..2f1387f 100644 --- a/common/src/main/resources/assets/solarcooker/lang/uk_ua.json +++ b/common/src/main/resources/assets/solarcooker/lang/uk_ua.json @@ -4,5 +4,40 @@ "block.solarcooker.shining_diamond_block": "Сяючий алмазний блок", "item.solarcooker.reflector.description": "Заради збільшення падіння світла та скорочення часу приготування, по лівому та правому боках сонячної плити можна встановити до чотирьох світловідбивачів.", - "item.solarcooker.shining_diamond_block.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 d5b850f..297374c 100644 --- a/common/src/main/resources/assets/solarcooker/lang/zh_cn.json +++ b/common/src/main/resources/assets/solarcooker/lang/zh_cn.json @@ -4,5 +4,40 @@ "block.solarcooker.shining_diamond_block": "闪耀的钻石块", "item.solarcooker.reflector.description": "在太阳灶的左右两侧最多可以放置四个反射板来改善光线的入射以及减少烹饪时间。", - "item.solarcooker.shining_diamond_block.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 new file mode 100644 index 0000000..6c27322 --- /dev/null +++ b/fabric/build.gradle @@ -0,0 +1,71 @@ +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}") + // 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/solarcooker/FabricSolarCookerMod.java b/fabric/src/main/java/de/cech12/solarcooker/FabricSolarCookerMod.java new file mode 100644 index 0000000..4673e54 --- /dev/null +++ b/fabric/src/main/java/de/cech12/solarcooker/FabricSolarCookerMod.java @@ -0,0 +1,31 @@ +package de.cech12.solarcooker; + +import de.cech12.solarcooker.init.ModBlockEntityTypes; +import de.cech12.solarcooker.init.ModBlocks; +import de.cech12.solarcooker.init.ModItems; +import de.cech12.solarcooker.init.ModMenuTypes; +import de.cech12.solarcooker.init.ModRecipeTypes; +import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; +import net.minecraft.world.item.CreativeModeTabs; + +public class FabricSolarCookerMod implements ModInitializer { + + @Override + public void onInitialize() { + ModBlocks.init(); + ModBlockEntityTypes.init(); + ModItems.init(); + ModRecipeTypes.init(); + ModMenuTypes.init(); + //Config + CommonLoader.init(); + //Register items in the creative tab. + ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.FUNCTIONAL_BLOCKS).register(content -> { + content.accept(Constants.SOLAR_COOKER_ITEM.get()); + content.accept(Constants.REFLECTOR_ITEM.get()); + content.accept(Constants.SHINING_DIAMOND_BLOCK_ITEM.get()); + }); + } + +} diff --git a/fabric/src/main/java/de/cech12/solarcooker/block/FabricSolarCookerBlock.java b/fabric/src/main/java/de/cech12/solarcooker/block/FabricSolarCookerBlock.java new file mode 100644 index 0000000..73a0041 --- /dev/null +++ b/fabric/src/main/java/de/cech12/solarcooker/block/FabricSolarCookerBlock.java @@ -0,0 +1,50 @@ +package de.cech12.solarcooker.block; + +import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity; +import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; +import net.minecraft.core.BlockPos; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.stats.Stats; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import org.jetbrains.annotations.NotNull; + +import javax.annotation.Nonnull; + +public class FabricSolarCookerBlock extends SolarCookerBlock { + + public FabricSolarCookerBlock(Properties builder) { + super(builder); + } + + @Override + protected void interactWith(Level worldIn, @NotNull BlockPos pos, @NotNull Player player) { + BlockEntity blockEntity = worldIn.getBlockEntity(pos); + if (blockEntity instanceof SolarCookerBlockEntity container) { + player.openMenu(new ExtendedScreenHandlerFactory() { + @Override + public void writeScreenOpeningData(ServerPlayer player, FriendlyByteBuf data) { + //do nothing + } + + @Nonnull + @Override + public Component getDisplayName(){ + return container.getDisplayName(); + } + + @Override + public AbstractContainerMenu createMenu(int windowId, @Nonnull Inventory inventory, @Nonnull Player player) { + return container.createMenu(windowId, inventory, player); + } + }); + player.awardStat(Stats.INSPECT_HOPPER); + } + } + +} diff --git a/fabric/src/main/java/de/cech12/solarcooker/client/FabricSolarCookerClientMod.java b/fabric/src/main/java/de/cech12/solarcooker/client/FabricSolarCookerClientMod.java new file mode 100644 index 0000000..27b1f84 --- /dev/null +++ b/fabric/src/main/java/de/cech12/solarcooker/client/FabricSolarCookerClientMod.java @@ -0,0 +1,37 @@ +package de.cech12.solarcooker.client; + +import com.mojang.blaze3d.vertex.PoseStack; +import de.cech12.solarcooker.Constants; +import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity; +import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.MenuScreens; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; +import net.minecraft.core.BlockPos; +import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; + +public class FabricSolarCookerClientMod implements ClientModInitializer { + + @Override + public void onInitializeClient() { + MenuScreens.register(Constants.SOLAR_COOKER_MENU_TYPE.get(), SolarCookerScreen::new); + + BlockEntityRenderers.register(Constants.SOLAR_COOKER_ENTITY_TYPE.get(), SolarCookerBlockEntityRenderer::new); + + BuiltinItemRendererRegistry.INSTANCE.register(Constants.SOLAR_COOKER_ITEM.get(), new BuiltinItemRendererRegistry.DynamicItemRenderer() { + private SolarCookerBlockEntity blockEntity; + + @Override + public void render(ItemStack stack, ItemDisplayContext mode, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay) { + if (blockEntity == null) { + blockEntity = new SolarCookerBlockEntity(BlockPos.ZERO, Constants.SOLAR_COOKER_BLOCK.get().defaultBlockState()); + } + Minecraft.getInstance().getBlockEntityRenderDispatcher().renderItem(blockEntity, matrices, vertexConsumers, light, overlay); + } + }); + } + +} diff --git a/fabric/src/main/java/de/cech12/solarcooker/compat/ModMenuCompat.java b/fabric/src/main/java/de/cech12/solarcooker/compat/ModMenuCompat.java new file mode 100644 index 0000000..de04739 --- /dev/null +++ b/fabric/src/main/java/de/cech12/solarcooker/compat/ModMenuCompat.java @@ -0,0 +1,18 @@ +package de.cech12.solarcooker.compat; + +import com.terraformersmc.modmenu.api.ConfigScreenFactory; +import com.terraformersmc.modmenu.api.ModMenuApi; +import de.cech12.solarcooker.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/solarcooker/init/ModBlockEntityTypes.java b/fabric/src/main/java/de/cech12/solarcooker/init/ModBlockEntityTypes.java new file mode 100644 index 0000000..2ae3050 --- /dev/null +++ b/fabric/src/main/java/de/cech12/solarcooker/init/ModBlockEntityTypes.java @@ -0,0 +1,24 @@ +package de.cech12.solarcooker.init; + +import de.cech12.solarcooker.CommonLoader; +import de.cech12.solarcooker.Constants; +import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity; +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 SOLAR_COOKER_ENTITY_TYPE = register(Constants.SOLAR_COOKER_NAME, BlockEntityType.Builder.of(SolarCookerBlockEntity::new, Constants.SOLAR_COOKER_BLOCK.get())); + + static { + Constants.SOLAR_COOKER_ENTITY_TYPE = () -> SOLAR_COOKER_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/solarcooker/init/ModBlocks.java b/fabric/src/main/java/de/cech12/solarcooker/init/ModBlocks.java new file mode 100644 index 0000000..5ade5b7 --- /dev/null +++ b/fabric/src/main/java/de/cech12/solarcooker/init/ModBlocks.java @@ -0,0 +1,33 @@ +package de.cech12.solarcooker.init; + +import de.cech12.solarcooker.CommonLoader; +import de.cech12.solarcooker.Constants; +import de.cech12.solarcooker.block.FabricSolarCookerBlock; +import de.cech12.solarcooker.block.ReflectorBlock; +import de.cech12.solarcooker.block.ShiningDiamondBlock; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.material.MapColor; + +public final class ModBlocks { + + private static final Block SOLAR_COOKER_BLOCK = register(Constants.SOLAR_COOKER_NAME, new FabricSolarCookerBlock(BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).strength(2.5F, 3.5F).sound(SoundType.WOOD))); + private static final Block REFLECTOR_BLOCK = register(Constants.REFLECTOR_NAME, new ReflectorBlock(BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).strength(2.0F).sound(SoundType.WOOD))); + private static final Block SHINING_DIAMOND_BLOCK_BLOCK = register(Constants.SHINING_DIAMOND_BLOCK_NAME, new ShiningDiamondBlock(BlockBehaviour.Properties.of().mapColor(MapColor.DIAMOND).requiresCorrectToolForDrops().strength(5.0F, 6.0F).sound(SoundType.METAL).lightLevel(state -> 15))); + + static { + Constants.SOLAR_COOKER_BLOCK = () -> SOLAR_COOKER_BLOCK; + Constants.REFLECTOR_BLOCK = () -> REFLECTOR_BLOCK; + Constants.SHINING_DIAMOND_BLOCK_BLOCK = () -> SHINING_DIAMOND_BLOCK_BLOCK; + } + + public static void init() {} + + private static Block register(String name, Block block) { + return Registry.register(BuiltInRegistries.BLOCK, CommonLoader.id(name), block); + } + +} \ No newline at end of file diff --git a/fabric/src/main/java/de/cech12/solarcooker/init/ModItems.java b/fabric/src/main/java/de/cech12/solarcooker/init/ModItems.java new file mode 100644 index 0000000..5d6c30e --- /dev/null +++ b/fabric/src/main/java/de/cech12/solarcooker/init/ModItems.java @@ -0,0 +1,31 @@ +package de.cech12.solarcooker.init; + +import de.cech12.solarcooker.CommonLoader; +import de.cech12.solarcooker.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 SOLAR_COOKER_ITEM = register(Constants.SOLAR_COOKER_NAME, Constants.SOLAR_COOKER_BLOCK); + private static final Item REFLECTOR_ITEM = register(Constants.REFLECTOR_NAME, Constants.REFLECTOR_BLOCK); + private static final Item SHINING_DIAMOND_BLOCK_ITEM = register(Constants.SHINING_DIAMOND_BLOCK_NAME, Constants.SHINING_DIAMOND_BLOCK_BLOCK); + + static { + Constants.SOLAR_COOKER_ITEM = () -> SOLAR_COOKER_ITEM; + Constants.REFLECTOR_ITEM = () -> REFLECTOR_ITEM; + Constants.SHINING_DIAMOND_BLOCK_ITEM = () -> SHINING_DIAMOND_BLOCK_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/solarcooker/init/ModMenuTypes.java b/fabric/src/main/java/de/cech12/solarcooker/init/ModMenuTypes.java new file mode 100644 index 0000000..6b13a8b --- /dev/null +++ b/fabric/src/main/java/de/cech12/solarcooker/init/ModMenuTypes.java @@ -0,0 +1,26 @@ +package de.cech12.solarcooker.init; + +import de.cech12.solarcooker.CommonLoader; +import de.cech12.solarcooker.Constants; +import de.cech12.solarcooker.inventory.SolarCookerContainer; +import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerType; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; + +public class ModMenuTypes { + + private static final MenuType SOLAR_COOKER_MENU_TYPE = register(Constants.SOLAR_COOKER_MENU_NAME, new ExtendedScreenHandlerType<>((pWindowID, pInventory, pData) -> new SolarCookerContainer(Constants.SOLAR_COOKING_RECIPE_TYPE.get(), pWindowID, pInventory))); + + static { + Constants.SOLAR_COOKER_MENU_TYPE = () -> SOLAR_COOKER_MENU_TYPE; + } + + public static void init() {} + + private static MenuType register(String name, ExtendedScreenHandlerType screenHandlerType) { + return Registry.register(BuiltInRegistries.MENU, CommonLoader.id(name), screenHandlerType); + } + +} diff --git a/fabric/src/main/java/de/cech12/solarcooker/init/ModRecipeTypes.java b/fabric/src/main/java/de/cech12/solarcooker/init/ModRecipeTypes.java new file mode 100644 index 0000000..52d0544 --- /dev/null +++ b/fabric/src/main/java/de/cech12/solarcooker/init/ModRecipeTypes.java @@ -0,0 +1,31 @@ +package de.cech12.solarcooker.init; + +import de.cech12.solarcooker.CommonLoader; +import de.cech12.solarcooker.Constants; +import de.cech12.solarcooker.crafting.SolarCookingRecipe; +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 SOLAR_COOKING_RECIPE_TYPE = registerRecipe(Constants.SOLAR_COOKING_NAME); + + private static final RecipeSerializer SOLAR_COOKING_SERIALIZER = registerSerializer(Constants.SOLAR_COOKING_NAME, SolarCookingRecipe.SERIALIZER); + + static { + Constants.SOLAR_COOKING_RECIPE_TYPE = () -> SOLAR_COOKING_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/solarcooker/platform/FabricConfigHelper.java b/fabric/src/main/java/de/cech12/solarcooker/platform/FabricConfigHelper.java new file mode 100644 index 0000000..63ebc03 --- /dev/null +++ b/fabric/src/main/java/de/cech12/solarcooker/platform/FabricConfigHelper.java @@ -0,0 +1,77 @@ +package de.cech12.solarcooker.platform; + +import de.cech12.solarcooker.Constants; +import de.cech12.solarcooker.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; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.item.crafting.AbstractCookingRecipe; +import net.minecraft.world.item.crafting.RecipeType; + +/** + * 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 = 4) + public String VANILLA_RECIPE_TYPE = BuiltInRegistries.RECIPE_TYPE.getKey(VANILLA_RECIPE_TYPE_DEFAULT).getPath(); + + @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) + @ConfigEntry.BoundedDiscrete(min = (long) (MAX_REFLECTOR_TIME_FACTOR_MIN * 100), max = (long) (MAX_REFLECTOR_TIME_FACTOR_MAX * 100)) + public long MAX_REFLECTOR_TIME_FACTOR = (long) (MAX_REFLECTOR_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 RecipeType getRecipeType() { + return switch (getConfig().VANILLA_RECIPE_TYPE) { + case "smoking" -> RecipeType.SMOKING; + case "smelting" -> RecipeType.SMELTING; + case "campfire_cooking" -> RecipeType.CAMPFIRE_COOKING; + case "blasting" -> RecipeType.BLASTING; + default -> VANILLA_RECIPE_TYPE_DEFAULT; + }; + } + + @Override + public double getCookTimeFactor() { + return getConfig().COOK_TIME_FACTOR / 100D; + } + + @Override + public double getMaxReflectorTimeFactor() { + return getConfig().MAX_REFLECTOR_TIME_FACTOR / 100D; + } + + @Override + public String getRecipeBlockedList() { + return getConfig().RECIPE_BLOCKED_LIST; + } + +} diff --git a/fabric/src/main/java/de/cech12/solarcooker/platform/FabricPlatformHelper.java b/fabric/src/main/java/de/cech12/solarcooker/platform/FabricPlatformHelper.java new file mode 100644 index 0000000..139aa8a --- /dev/null +++ b/fabric/src/main/java/de/cech12/solarcooker/platform/FabricPlatformHelper.java @@ -0,0 +1,26 @@ +package de.cech12.solarcooker.platform; + +import de.cech12.solarcooker.platform.services.IPlatformHelper; +import net.fabricmc.loader.api.FabricLoader; + +/** + * 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(); + } + +} diff --git a/fabric/src/main/java/de/cech12/solarcooker/platform/FabricRegistryHelper.java b/fabric/src/main/java/de/cech12/solarcooker/platform/FabricRegistryHelper.java new file mode 100644 index 0000000..f00c612 --- /dev/null +++ b/fabric/src/main/java/de/cech12/solarcooker/platform/FabricRegistryHelper.java @@ -0,0 +1,17 @@ +package de.cech12.solarcooker.platform; + +import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity; +import de.cech12.solarcooker.platform.services.IRegistryHelper; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.state.BlockState; + +import javax.annotation.Nonnull; + +public class FabricRegistryHelper implements IRegistryHelper { + + @Override + public SolarCookerBlockEntity getNewBlockEntity(@Nonnull BlockPos pos, @Nonnull BlockState state) { + return new SolarCookerBlockEntity(pos, state); + } + +} diff --git a/fabric/src/main/resources/META-INF/services/de.cech12.solarcooker.platform.services.IConfigHelper b/fabric/src/main/resources/META-INF/services/de.cech12.solarcooker.platform.services.IConfigHelper new file mode 100644 index 0000000..1056533 --- /dev/null +++ b/fabric/src/main/resources/META-INF/services/de.cech12.solarcooker.platform.services.IConfigHelper @@ -0,0 +1 @@ +de.cech12.solarcooker.platform.FabricConfigHelper \ No newline at end of file diff --git a/fabric/src/main/resources/META-INF/services/de.cech12.solarcooker.platform.services.IPlatformHelper b/fabric/src/main/resources/META-INF/services/de.cech12.solarcooker.platform.services.IPlatformHelper new file mode 100644 index 0000000..52a8e82 --- /dev/null +++ b/fabric/src/main/resources/META-INF/services/de.cech12.solarcooker.platform.services.IPlatformHelper @@ -0,0 +1 @@ +de.cech12.solarcooker.platform.FabricPlatformHelper \ No newline at end of file diff --git a/fabric/src/main/resources/META-INF/services/de.cech12.solarcooker.platform.services.IRegistryHelper b/fabric/src/main/resources/META-INF/services/de.cech12.solarcooker.platform.services.IRegistryHelper new file mode 100644 index 0000000..f99b6f3 --- /dev/null +++ b/fabric/src/main/resources/META-INF/services/de.cech12.solarcooker.platform.services.IRegistryHelper @@ -0,0 +1 @@ +de.cech12.solarcooker.platform.FabricRegistryHelper \ No newline at end of file diff --git a/fabric/src/main/resources/data/c/tags/items/wooden_chests.json b/fabric/src/main/resources/data/c/tags/items/wooden_chests.json new file mode 100644 index 0000000..86533f9 --- /dev/null +++ b/fabric/src/main/resources/data/c/tags/items/wooden_chests.json @@ -0,0 +1,6 @@ +{ + "values": [ + "minecraft:chest", + "minecraft:trapped_chest" + ] +} \ No newline at end of file diff --git a/fabric/src/main/resources/data/solarcooker/advancements/recipes/building_blocks/shining_diamond_block.json b/fabric/src/main/resources/data/solarcooker/advancements/recipes/building_blocks/shining_diamond_block.json new file mode 100644 index 0000000..831b85c --- /dev/null +++ b/fabric/src/main/resources/data/solarcooker/advancements/recipes/building_blocks/shining_diamond_block.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "solarcooker:shining_diamond_block" + ] + }, + "criteria": { + "has_diamond_block": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "minecraft:diamond_block" + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "solarcooker:shining_diamond_block" + } + } + }, + "requirements": [ + [ + "has_diamond_block", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/fabric/src/main/resources/data/solarcooker/advancements/recipes/decorations/solar_cooker.json b/fabric/src/main/resources/data/solarcooker/advancements/recipes/decorations/solar_cooker.json new file mode 100644 index 0000000..d44cdd2 --- /dev/null +++ b/fabric/src/main/resources/data/solarcooker/advancements/recipes/decorations/solar_cooker.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "solarcooker:solar_cooker" + ] + }, + "criteria": { + "has_chest": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "tag": "c:wooden_chests" + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "solarcooker:solar_cooker" + } + } + }, + "requirements": [ + [ + "has_chest", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/fabric/src/main/resources/data/solarcooker/recipes/reflector.json b/fabric/src/main/resources/data/solarcooker/recipes/reflector.json new file mode 100644 index 0000000..69e86c1 --- /dev/null +++ b/fabric/src/main/resources/data/solarcooker/recipes/reflector.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "pattern": [ + "GIS", + "GIS", + "GIS" + ], + "key": { + "G": { + "tag": "c:glass_panes" + }, + "I": { + "tag": "c:iron_ingots" + }, + "S": { + "tag": "minecraft:wooden_slabs" + } + }, + "result": { + "item": "solarcooker:reflector" + } +} \ No newline at end of file diff --git a/fabric/src/main/resources/data/solarcooker/recipes/shining_diamond_block.json b/fabric/src/main/resources/data/solarcooker/recipes/shining_diamond_block.json new file mode 100644 index 0000000..773535f --- /dev/null +++ b/fabric/src/main/resources/data/solarcooker/recipes/shining_diamond_block.json @@ -0,0 +1,10 @@ +{ + "type": "solarcooker:solarcooking", + "category": "misc", + "ingredient": { + "item": "minecraft:diamond_block" + }, + "result": "solarcooker:shining_diamond_block", + "experience": 0.3, + "cookingtime": 3000 +} \ No newline at end of file diff --git a/fabric/src/main/resources/data/solarcooker/recipes/solar_cooker.json b/fabric/src/main/resources/data/solarcooker/recipes/solar_cooker.json new file mode 100644 index 0000000..55eb3bd --- /dev/null +++ b/fabric/src/main/resources/data/solarcooker/recipes/solar_cooker.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "pattern": [ + "IGI", + "GCG", + "IGI" + ], + "key": { + "G": { + "tag": "c:glass_panes" + }, + "I": { + "tag": "c:iron_ingots" + }, + "C": { + "tag": "c:wooden_chests" + } + }, + "result": { + "item": "solarcooker:solar_cooker" + } +} \ 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..9db200e --- /dev/null +++ b/fabric/src/main/resources/fabric.mod.json @@ -0,0 +1,43 @@ +{ + "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}.FabricSolarCookerMod" + ], + "client": [ + "${group}.client.FabricSolarCookerClientMod" + ], + "modmenu": [ + "${group}.compat.ModMenuCompat" + ], + "jei_mod_plugin": [ + "${group}.jei.SolarCookerJEIPlugin" + ] + }, + "depends": { + "java": ">=17", + "minecraft": ">=${minecraft_version}", + "fabricloader": ">=${fabric_loader_version}", + "fabric-api": ">=${fabric_version}", + "cloth-config": ">=${cloth_config_version}" + }, + "recommends": { + "modmenu": ">=${mod_menu_version}", + "jei": ">=${jei_version}" + } +} diff --git a/forge/src/main/java/de/cech12/solarcooker/blockentity/ForgeSolarCookerBlockEntity.java b/forge/src/main/java/de/cech12/solarcooker/blockentity/ForgeSolarCookerBlockEntity.java index a8eb30d..f068040 100644 --- a/forge/src/main/java/de/cech12/solarcooker/blockentity/ForgeSolarCookerBlockEntity.java +++ b/forge/src/main/java/de/cech12/solarcooker/blockentity/ForgeSolarCookerBlockEntity.java @@ -12,7 +12,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class ForgeSolarCookerBlockEntity extends AbstractSolarCookerBlockEntity { +public class ForgeSolarCookerBlockEntity extends SolarCookerBlockEntity { public ForgeSolarCookerBlockEntity(BlockPos pos, BlockState state) { super(pos, state); diff --git a/forge/src/main/java/de/cech12/solarcooker/platform/ForgeRegistryHelper.java b/forge/src/main/java/de/cech12/solarcooker/platform/ForgeRegistryHelper.java index ed3b106..5b4e368 100644 --- a/forge/src/main/java/de/cech12/solarcooker/platform/ForgeRegistryHelper.java +++ b/forge/src/main/java/de/cech12/solarcooker/platform/ForgeRegistryHelper.java @@ -1,6 +1,6 @@ package de.cech12.solarcooker.platform; -import de.cech12.solarcooker.blockentity.AbstractSolarCookerBlockEntity; +import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity; import de.cech12.solarcooker.blockentity.ForgeSolarCookerBlockEntity; import de.cech12.solarcooker.platform.services.IRegistryHelper; import net.minecraft.core.BlockPos; @@ -11,7 +11,7 @@ public class ForgeRegistryHelper implements IRegistryHelper { @Override - public AbstractSolarCookerBlockEntity getNewBlockEntity(@Nonnull BlockPos pos, @Nonnull BlockState state) { + public SolarCookerBlockEntity getNewBlockEntity(@Nonnull BlockPos pos, @Nonnull BlockState state) { return new ForgeSolarCookerBlockEntity(pos, state); } diff --git a/common/src/main/resources/data/solarcooker/advancements/recipes/building_blocks/shining_diamond_block.json b/forge/src/main/resources/data/solarcooker/advancements/recipes/building_blocks/shining_diamond_block.json similarity index 100% rename from common/src/main/resources/data/solarcooker/advancements/recipes/building_blocks/shining_diamond_block.json rename to forge/src/main/resources/data/solarcooker/advancements/recipes/building_blocks/shining_diamond_block.json diff --git a/common/src/main/resources/data/solarcooker/advancements/recipes/decorations/solar_cooker.json b/forge/src/main/resources/data/solarcooker/advancements/recipes/decorations/solar_cooker.json similarity index 100% rename from common/src/main/resources/data/solarcooker/advancements/recipes/decorations/solar_cooker.json rename to forge/src/main/resources/data/solarcooker/advancements/recipes/decorations/solar_cooker.json diff --git a/common/src/main/resources/data/solarcooker/recipes/reflector.json b/forge/src/main/resources/data/solarcooker/recipes/reflector.json similarity index 100% rename from common/src/main/resources/data/solarcooker/recipes/reflector.json rename to forge/src/main/resources/data/solarcooker/recipes/reflector.json diff --git a/common/src/main/resources/data/solarcooker/recipes/shining_diamond_block.json b/forge/src/main/resources/data/solarcooker/recipes/shining_diamond_block.json similarity index 100% rename from common/src/main/resources/data/solarcooker/recipes/shining_diamond_block.json rename to forge/src/main/resources/data/solarcooker/recipes/shining_diamond_block.json diff --git a/common/src/main/resources/data/solarcooker/recipes/solar_cooker.json b/forge/src/main/resources/data/solarcooker/recipes/solar_cooker.json similarity index 100% rename from common/src/main/resources/data/solarcooker/recipes/solar_cooker.json rename to forge/src/main/resources/data/solarcooker/recipes/solar_cooker.json diff --git a/gradle.properties b/gradle.properties index 876480b..7f97aa5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ # Project group=de.cech12.solarcooker -mod_version=3.0.0.0 +mod_version=3.1.0.0 mod_id=solarcooker mod_name=Solar Cooker 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/java/de/cech12/solarcooker/blockentity/NeoForgeSolarCookerBlockEntity.java b/neoforge/src/main/java/de/cech12/solarcooker/blockentity/NeoForgeSolarCookerBlockEntity.java deleted file mode 100644 index db0ba8b..0000000 --- a/neoforge/src/main/java/de/cech12/solarcooker/blockentity/NeoForgeSolarCookerBlockEntity.java +++ /dev/null @@ -1,12 +0,0 @@ -package de.cech12.solarcooker.blockentity; - -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.block.state.BlockState; - -public class NeoForgeSolarCookerBlockEntity extends AbstractSolarCookerBlockEntity { - - public NeoForgeSolarCookerBlockEntity(BlockPos pos, BlockState state) { - super(pos, state); - } - -} diff --git a/neoforge/src/main/java/de/cech12/solarcooker/compat/TOPCompat.java b/neoforge/src/main/java/de/cech12/solarcooker/compat/TOPCompat.java index a94423a..019ba57 100644 --- a/neoforge/src/main/java/de/cech12/solarcooker/compat/TOPCompat.java +++ b/neoforge/src/main/java/de/cech12/solarcooker/compat/TOPCompat.java @@ -1,7 +1,7 @@ package de.cech12.solarcooker.compat; import de.cech12.solarcooker.Constants; -import de.cech12.solarcooker.blockentity.AbstractSolarCookerBlockEntity; +import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity; import mcjty.theoneprobe.api.ElementAlignment; import mcjty.theoneprobe.api.IProbeHitData; import mcjty.theoneprobe.api.IProbeInfo; @@ -39,7 +39,7 @@ public ResourceLocation getID() { @Override public void addProbeInfo(ProbeMode probeMode, IProbeInfo iProbeInfo, Player player, Level level, BlockState blockState, IProbeHitData iProbeHitData) { BlockEntity blockEntity = level.getBlockEntity(iProbeHitData.getPos()); - if (!(blockEntity instanceof AbstractSolarCookerBlockEntity)) { + if (!(blockEntity instanceof SolarCookerBlockEntity)) { return; } CompoundTag nbt = blockEntity.getUpdateTag(); diff --git a/neoforge/src/main/java/de/cech12/solarcooker/init/ModBlockEntityTypes.java b/neoforge/src/main/java/de/cech12/solarcooker/init/ModBlockEntityTypes.java index 9a52684..7e917aa 100644 --- a/neoforge/src/main/java/de/cech12/solarcooker/init/ModBlockEntityTypes.java +++ b/neoforge/src/main/java/de/cech12/solarcooker/init/ModBlockEntityTypes.java @@ -1,7 +1,7 @@ package de.cech12.solarcooker.init; import de.cech12.solarcooker.Constants; -import de.cech12.solarcooker.blockentity.NeoForgeSolarCookerBlockEntity; +import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.level.block.entity.BlockEntityType; import net.neoforged.neoforge.registries.DeferredRegister; @@ -11,7 +11,7 @@ public final class ModBlockEntityTypes { public static DeferredRegister> BLOCK_ENTITY_TYPES = DeferredRegister.create(BuiltInRegistries.BLOCK_ENTITY_TYPE, Constants.MOD_ID); static { - Constants.SOLAR_COOKER_ENTITY_TYPE = BLOCK_ENTITY_TYPES.register(Constants.SOLAR_COOKER_NAME, () -> BlockEntityType.Builder.of(NeoForgeSolarCookerBlockEntity::new, Constants.SOLAR_COOKER_BLOCK.get()).build(null)); + Constants.SOLAR_COOKER_ENTITY_TYPE = BLOCK_ENTITY_TYPES.register(Constants.SOLAR_COOKER_NAME, () -> BlockEntityType.Builder.of(SolarCookerBlockEntity::new, Constants.SOLAR_COOKER_BLOCK.get()).build(null)); } } diff --git a/neoforge/src/main/java/de/cech12/solarcooker/init/ModItems.java b/neoforge/src/main/java/de/cech12/solarcooker/init/ModItems.java index 0324726..507dec5 100644 --- a/neoforge/src/main/java/de/cech12/solarcooker/init/ModItems.java +++ b/neoforge/src/main/java/de/cech12/solarcooker/init/ModItems.java @@ -2,12 +2,11 @@ import de.cech12.solarcooker.Constants; import com.mojang.blaze3d.vertex.PoseStack; -import de.cech12.solarcooker.blockentity.NeoForgeSolarCookerBlockEntity; +import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.core.BlockPos; -import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemDisplayContext; @@ -41,12 +40,12 @@ private static DeferredHolder solarCookerItem() { public void initializeClient(@Nonnull Consumer consumer) { consumer.accept(new IClientItemExtensions() { final BlockEntityWithoutLevelRenderer myRenderer = new BlockEntityWithoutLevelRenderer(Minecraft.getInstance().getBlockEntityRenderDispatcher(), Minecraft.getInstance().getEntityModels()) { - private NeoForgeSolarCookerBlockEntity blockEntity; + private SolarCookerBlockEntity blockEntity; @Override public void renderByItem(@Nonnull ItemStack stack, @Nonnull ItemDisplayContext displayContext, @Nonnull PoseStack matrix, @Nonnull MultiBufferSource buffer, int x, int y) { if (blockEntity == null) { - blockEntity = new NeoForgeSolarCookerBlockEntity(BlockPos.ZERO, Constants.SOLAR_COOKER_BLOCK.get().defaultBlockState()); + blockEntity = new SolarCookerBlockEntity(BlockPos.ZERO, Constants.SOLAR_COOKER_BLOCK.get().defaultBlockState()); } Minecraft.getInstance().getBlockEntityRenderDispatcher().renderItem(blockEntity, matrix, buffer, x, y); } diff --git a/neoforge/src/main/java/de/cech12/solarcooker/platform/NeoForgeRegistryHelper.java b/neoforge/src/main/java/de/cech12/solarcooker/platform/NeoForgeRegistryHelper.java index 6e6e529..e9e231d 100644 --- a/neoforge/src/main/java/de/cech12/solarcooker/platform/NeoForgeRegistryHelper.java +++ b/neoforge/src/main/java/de/cech12/solarcooker/platform/NeoForgeRegistryHelper.java @@ -1,7 +1,6 @@ package de.cech12.solarcooker.platform; -import de.cech12.solarcooker.blockentity.AbstractSolarCookerBlockEntity; -import de.cech12.solarcooker.blockentity.NeoForgeSolarCookerBlockEntity; +import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity; import de.cech12.solarcooker.platform.services.IRegistryHelper; import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.state.BlockState; @@ -11,8 +10,8 @@ public class NeoForgeRegistryHelper implements IRegistryHelper { @Override - public AbstractSolarCookerBlockEntity getNewBlockEntity(@Nonnull BlockPos pos, @Nonnull BlockState state) { - return new NeoForgeSolarCookerBlockEntity(pos, state); + public SolarCookerBlockEntity getNewBlockEntity(@Nonnull BlockPos pos, @Nonnull BlockState state) { + return new SolarCookerBlockEntity(pos, state); } } diff --git a/neoforge/src/main/resources/data/solarcooker/advancements/recipes/building_blocks/shining_diamond_block.json b/neoforge/src/main/resources/data/solarcooker/advancements/recipes/building_blocks/shining_diamond_block.json new file mode 100644 index 0000000..74b6a6a --- /dev/null +++ b/neoforge/src/main/resources/data/solarcooker/advancements/recipes/building_blocks/shining_diamond_block.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "solarcooker:shining_diamond_block" + ] + }, + "criteria": { + "has_diamond_block": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "tag": "forge:storage_blocks/diamond" + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "solarcooker:shining_diamond_block" + } + } + }, + "requirements": [ + [ + "has_diamond_block", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/neoforge/src/main/resources/data/solarcooker/advancements/recipes/decorations/solar_cooker.json b/neoforge/src/main/resources/data/solarcooker/advancements/recipes/decorations/solar_cooker.json new file mode 100644 index 0000000..2655bad --- /dev/null +++ b/neoforge/src/main/resources/data/solarcooker/advancements/recipes/decorations/solar_cooker.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "solarcooker:solar_cooker" + ] + }, + "criteria": { + "has_chest": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "tag": "forge:chests/wooden" + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "solarcooker:solar_cooker" + } + } + }, + "requirements": [ + [ + "has_chest", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/neoforge/src/main/resources/data/solarcooker/recipes/reflector.json b/neoforge/src/main/resources/data/solarcooker/recipes/reflector.json new file mode 100644 index 0000000..b238591 --- /dev/null +++ b/neoforge/src/main/resources/data/solarcooker/recipes/reflector.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "pattern": [ + "GIS", + "GIS", + "GIS" + ], + "key": { + "G": { + "tag": "forge:glass_panes" + }, + "I": { + "tag": "forge:ingots/iron" + }, + "S": { + "tag": "minecraft:wooden_slabs" + } + }, + "result": { + "item": "solarcooker:reflector" + } +} \ No newline at end of file diff --git a/neoforge/src/main/resources/data/solarcooker/recipes/shining_diamond_block.json b/neoforge/src/main/resources/data/solarcooker/recipes/shining_diamond_block.json new file mode 100644 index 0000000..398f5a9 --- /dev/null +++ b/neoforge/src/main/resources/data/solarcooker/recipes/shining_diamond_block.json @@ -0,0 +1,10 @@ +{ + "type": "solarcooker:solarcooking", + "category": "misc", + "ingredient": { + "tag": "forge:storage_blocks/diamond" + }, + "result": "solarcooker:shining_diamond_block", + "experience": 0.3, + "cookingtime": 3000 +} \ No newline at end of file diff --git a/neoforge/src/main/resources/data/solarcooker/recipes/solar_cooker.json b/neoforge/src/main/resources/data/solarcooker/recipes/solar_cooker.json new file mode 100644 index 0000000..95ab5b7 --- /dev/null +++ b/neoforge/src/main/resources/data/solarcooker/recipes/solar_cooker.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "pattern": [ + "IGI", + "GCG", + "IGI" + ], + "key": { + "G": { + "tag": "forge:glass_panes" + }, + "I": { + "tag": "forge:ingots/iron" + }, + "C": { + "tag": "forge:chests/wooden" + } + }, + "result": { + "item": "solarcooker:solar_cooker" + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 05ba501..b43d318 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 = 'SolarCooker' include("common") -//include("fabric") +include("fabric") include("forge") include("neoforge") \ No newline at end of file