Skip to content

Commit

Permalink
updated to Minecraft 1.21 (Fabric 0.100.3+1.21, Neoforge 21.0.42-beta…
Browse files Browse the repository at this point in the history
…, Forge 51.0.18)

- updated Cloth Config support (15.0.127) (Fabric/Quilt)
- updated ModMenu support (11.0.1) (Fabric/Quilt)
- updated JEI support (19.0.0.11) (Forge & NeoForge)
- updated REI support (16.0.729) (Fabric/Quilt & NeoForge)
- updated The One Probe support (1.21_neo-12.0.0) (NeoForge)
  • Loading branch information
cech12 committed Jun 30, 2024
1 parent b71581e commit 65efe2f
Show file tree
Hide file tree
Showing 38 changed files with 88 additions and 67 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/cicd-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
workflow_dispatch:
push:
branches: [ "*" ]
tags: ["1.20*"]
tags: ["1.21*"]
pull_request:
branches: [ "*" ]

Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
title-prefix: forge-
curseforge-id: 436874
game-versions: |
1.20.6
1.21
release-type: release
loaders: |
forge
Expand All @@ -69,7 +69,7 @@ jobs:
title-prefix: forge-
modrinth-id: IsSapAeq
game-versions: |
1.20.6
1.21
release-type: release
loaders: |
forge
Expand All @@ -87,7 +87,7 @@ jobs:
title-prefix: neoforge-
curseforge-id: 436874
game-versions: |
1.20.6
1.21
release-type: release
loaders: |
neoforge
Expand All @@ -105,7 +105,7 @@ jobs:
title-prefix: neoforge-
modrinth-id: IsSapAeq
game-versions: |
1.20.6
1.21
release-type: release
loaders: |
neoforge
Expand All @@ -123,7 +123,7 @@ jobs:
title-prefix: fabric-
curseforge-id: 436874
game-versions: |
1.20.6
1.21
release-type: release
loaders: |
fabric
Expand All @@ -142,7 +142,7 @@ jobs:
title-prefix: fabric-
modrinth-id: IsSapAeq
game-versions: |
1.20.6
1.21
release-type: release
loaders: |
fabric
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ 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.21-4.0.0.0] - 2024-06-30
### Changed
- updated to Minecraft 1.21 (Fabric 0.100.3+1.21, Neoforge 21.0.42-beta, Forge 51.0.18)
- updated Cloth Config support (15.0.127) (Fabric/Quilt)
- updated ModMenu support (11.0.1) (Fabric/Quilt)
- updated JEI support (19.0.0.11) (Forge & NeoForge)
- updated REI support (16.0.729) (Fabric/Quilt & NeoForge)
- updated The One Probe support (1.21_neo-12.0.0) (NeoForge)

## [1.20.6-3.2.0.0] - 2024-06-30
### Changed
- updated to Minecraft 1.20.6 (Fabric 0.98.0+1.20.6, NeoForge 20.6.119, Forge 50.1.9)
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/de/cech12/solarcooker/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class Constants {
private Constants() {}

public static ResourceLocation id(String name) {
return new ResourceLocation(MOD_ID, name);
return ResourceLocation.fromNamespaceAndPath(MOD_ID, name);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.minecraft.core.Direction;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.NonNullList;
import net.minecraft.core.RegistryAccess;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.Connection;
import net.minecraft.network.chat.Component;
Expand All @@ -35,9 +36,9 @@
import net.minecraft.world.inventory.StackedContentsCompatible;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.item.crafting.RecipeHolder;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.item.crafting.SingleRecipeInput;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BaseContainerBlockEntity;
Expand Down Expand Up @@ -213,13 +214,13 @@ public static void tick(Level level, BlockPos pos, BlockState state, SolarCooker
boolean isSunlit = entity.isSunlit();
if (isSunlit && !entity.items.get(INPUT).isEmpty()) {
RecipeHolder<? extends AbstractCookingRecipe> recipe = entity.getRecipe();
if (entity.canSmelt(recipe)) {
if (entity.canSmelt(level.registryAccess(), recipe)) {
entity.cookTime++;
if (entity.cookTime == entity.cookTimeTotal) {
entity.cookTime = 0;
entity.cookTimeTotal = entity.getRecipeCookTime();
if (!level.isClientSide) {
entity.smeltItem(recipe);
entity.smeltItem(level.registryAccess(), recipe);
dirty = true;
}
}
Expand All @@ -246,7 +247,7 @@ public static void tick(Level level, BlockPos pos, BlockState state, SolarCooker
}

public boolean shouldLidBeOpen() {
return this.numPlayersUsing > 0 || (this.canSmelt(getRecipe()) && this.isSunlit());
return this.numPlayersUsing > 0 || (this.canSmelt(this.getLevel().registryAccess(), getRecipe()) && this.isSunlit());
}

private void calculateLidAngle() {
Expand Down Expand Up @@ -329,9 +330,9 @@ private void playSound(SoundEvent soundIn) {
}
}

protected boolean canSmelt(@Nullable RecipeHolder<?> recipe) {
protected boolean canSmelt(RegistryAccess registryAccess, @Nullable RecipeHolder<?> recipe) {
if (!this.items.get(INPUT).isEmpty() && recipe != null) {
ItemStack recipeOutput = ((Recipe<WorldlyContainer>) recipe.value()).assemble(this, this.getLevel().registryAccess());
ItemStack recipeOutput = recipe.value().getResultItem(registryAccess);
if (!recipeOutput.isEmpty()) {
ItemStack output = this.items.get(OUTPUT);
if (output.isEmpty()) return true;
Expand All @@ -342,10 +343,10 @@ protected boolean canSmelt(@Nullable RecipeHolder<?> recipe) {
return false;
}

private void smeltItem(@Nullable RecipeHolder<?> recipe) {
if (recipe != null && this.canSmelt(recipe)) {
private void smeltItem(RegistryAccess registryAccess, @Nullable RecipeHolder<?> recipe) {
if (recipe != null && this.canSmelt(registryAccess, recipe)) {
ItemStack itemstack = this.items.get(INPUT);
ItemStack itemstack1 = ((Recipe<WorldlyContainer>) recipe.value()).assemble(this, this.getLevel().registryAccess());
ItemStack itemstack1 = recipe.value().getResultItem(registryAccess);
ItemStack itemstack2 = this.items.get(OUTPUT);
if (itemstack2.isEmpty()) {
this.items.set(1, itemstack1.copy());
Expand Down Expand Up @@ -380,14 +381,15 @@ protected RecipeHolder<? extends AbstractCookingRecipe> getRecipe() {
if (input.isEmpty() || input == failedMatch) {
return null;
}
if (this.level != null && curRecipe != null && curRecipe.value().matches(this, level)) {
SingleRecipeInput recipeInput = new SingleRecipeInput(input);
if (this.level != null && curRecipe != null && curRecipe.value().matches(recipeInput, level)) {
return curRecipe;
} else {
RecipeHolder<? extends AbstractCookingRecipe> rec = null;
if (this.level != null) {
rec = this.level.getRecipeManager().getRecipeFor((RecipeType<AbstractCookingRecipe>) this.specificRecipeType, this, this.level).orElse(null);
rec = this.level.getRecipeManager().getRecipeFor((RecipeType<AbstractCookingRecipe>) this.specificRecipeType, recipeInput, this.level).orElse(null);
if (rec == null && Services.CONFIG.areVanillaRecipesEnabled()) {
rec = this.level.getRecipeManager().getRecipesFor((RecipeType<AbstractCookingRecipe>) Services.CONFIG.getRecipeType(), this, this.level)
rec = this.level.getRecipeManager().getRecipesFor((RecipeType<AbstractCookingRecipe>) Services.CONFIG.getRecipeType(), recipeInput, this.level)
.stream().filter(abstractCookingRecipe -> Services.CONFIG.isRecipeAllowed(abstractCookingRecipe.id())).findFirst().orElse(null);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
package de.cech12.solarcooker.client;

import de.cech12.solarcooker.Constants;
import de.cech12.solarcooker.block.AbstractSolarCookerBlock;
import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis;
import de.cech12.solarcooker.Constants;
import de.cech12.solarcooker.block.AbstractSolarCookerBlock;
import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.geom.ModelLayers;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.ChestBlock;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.world.item.ItemStack;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.ChestBlock;
import net.minecraft.world.level.block.state.BlockState;

import javax.annotation.Nonnull;

public class SolarCookerBlockEntityRenderer implements BlockEntityRenderer<SolarCookerBlockEntity> {

public static final ResourceLocation TEXTURE = new ResourceLocation(Constants.MOD_ID, "textures/entity/solar_cooker.png");
public static final ResourceLocation TEXTURE = Constants.id("textures/entity/solar_cooker.png");

private static final LayerDefinition innerCube = createInnerLayerDefinition();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import de.cech12.solarcooker.inventory.SolarCookerContainer;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;

import javax.annotation.Nonnull;

public class SolarCookerScreen extends AbstractContainerScreen<SolarCookerContainer> {
private static final ResourceLocation guiTexture = new ResourceLocation(Constants.MOD_ID, "textures/gui/container/solar_cooker.png");
private static final ResourceLocation guiTexture = Constants.id("textures/gui/container/solar_cooker.png");

public SolarCookerScreen(SolarCookerContainer screenContainer, Inventory inv, Component titleIn) {
super(screenContainer, inv, titleIn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity;
import de.cech12.solarcooker.platform.Services;
import net.minecraft.world.Container;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.SimpleContainer;
import net.minecraft.world.inventory.*;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.ContainerData;
import net.minecraft.world.inventory.SimpleContainerData;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.item.crafting.SingleRecipeInput;
import net.minecraft.world.level.Level;

import javax.annotation.Nonnull;
Expand Down Expand Up @@ -113,11 +117,12 @@ public void setItem(int slotID, int stateId, @Nonnull ItemStack stack) {

protected boolean hasRecipe(ItemStack stack) {
if (this.world != null) {
if (this.world.getRecipeManager().getRecipeFor(this.specificRecipeType, new SimpleContainer(stack), this.world).isPresent()) {
SingleRecipeInput recipeInput = new SingleRecipeInput(stack);
if (this.world.getRecipeManager().getRecipeFor(this.specificRecipeType, recipeInput, this.world).isPresent()) {
return true;
}
if (Services.CONFIG.areVanillaRecipesEnabled()) {
return this.world.getRecipeManager().getRecipesFor(Services.CONFIG.getRecipeType(), new SimpleContainer(stack), this.world)
return this.world.getRecipeManager().getRecipesFor(Services.CONFIG.getRecipeType(), recipeInput, this.world)
.stream().anyMatch(abstractCookingRecipe -> Services.CONFIG.isRecipeAllowed(abstractCookingRecipe.id()));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
import mezz.jei.api.registration.IRecipeRegistration;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.RecipeHolder;
import net.minecraft.world.item.crafting.RecipeManager;
import net.minecraft.resources.ResourceLocation;

import javax.annotation.Nonnull;
import java.util.stream.Collectors;
Expand All @@ -27,7 +27,7 @@ public class SolarCookerJEIPlugin implements IModPlugin {
@Override
@Nonnull
public ResourceLocation getPluginUid() {
return new ResourceLocation(Constants.MOD_ID, "plugin_" + Constants.MOD_ID);
return Constants.id("plugin_" + Constants.MOD_ID);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import mezz.jei.api.helpers.IGuiHelper;
import mezz.jei.api.recipe.RecipeType;
import mezz.jei.library.plugins.vanilla.cooking.AbstractCookingCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.crafting.RecipeHolder;

import javax.annotation.Nonnull;
Expand All @@ -21,7 +20,7 @@ public SolarCookingCategory(IGuiHelper guiHelper) {
@Nonnull
public RecipeType<RecipeHolder<SolarCookingRecipe>> getRecipeType() {
Class<? extends RecipeHolder<SolarCookingRecipe>> holderClass = (Class<? extends RecipeHolder<SolarCookingRecipe>>) (Object) RecipeHolder.class;
return new RecipeType<>(new ResourceLocation(Constants.MOD_ID, Constants.SOLAR_COOKING_NAME), holderClass);
return new RecipeType<>(Constants.id(Constants.SOLAR_COOKING_NAME), holderClass);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ default boolean isRecipeAllowed(final ResourceLocation id) {
if (!configValue.isEmpty()) {
String[] ids = configValue.split(",");
if (ids.length < 1) {
return !(new ResourceLocation(configValue).equals(id));
return !(ResourceLocation.parse(configValue).equals(id));
} else {
for (String recipeId : ids) {
if (new ResourceLocation(recipeId.trim()).equals(id)) {
if (ResourceLocation.parse(recipeId.trim()).equals(id)) {
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"description": {
"text": "${mod_id} resources"
},
"pack_format": 41
"pack_format": 48
}
}
Loading

0 comments on commit 65efe2f

Please sign in to comment.