Skip to content

Commit

Permalink
Merge pull request #16 from refinedmods/feat/GH-15/port
Browse files Browse the repository at this point in the history
feat: port to minecraft 1.21
  • Loading branch information
raoulvdberge authored Jul 6, 2024
2 parents 697bdca + 7c00d7e commit 5489d57
Show file tree
Hide file tree
Showing 35 changed files with 85 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
types: [ opened, synchronize, reopened ]
jobs:
build:
uses: refinedmods/refinedarchitect/.github/workflows/build.yml@v0.13.4
uses: refinedmods/refinedarchitect/.github/workflows/build.yml@v0.15.1
with:
mutation-testing: false
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
type: string
jobs:
draft:
uses: refinedmods/refinedarchitect/.github/workflows/draft-release.yml@v0.13.4
uses: refinedmods/refinedarchitect/.github/workflows/draft-release.yml@v0.15.1
with:
release-type: ${{ inputs.release-type }}
version-number-override: ${{ inputs.version-number-override }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue-for-unsupported-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ on:
types: [ labeled, unlabeled, reopened ]
jobs:
unsupported-labeler:
uses: refinedmods/refinedarchitect/.github/workflows/issue-for-unsupported-version.yml@v0.13.4
uses: refinedmods/refinedarchitect/.github/workflows/issue-for-unsupported-version.yml@v0.15.1
2 changes: 1 addition & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- closed
jobs:
publish-release:
uses: refinedmods/refinedarchitect/.github/workflows/publish-release.yml@v0.13.4
uses: refinedmods/refinedarchitect/.github/workflows/publish-release.yml@v0.15.1
secrets: inherit
with:
project-name: 'Refined Storage - JEI Integration'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/resolved-issue-locking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ on:
- cron: '0 0 * * *'
jobs:
lock:
uses: refinedmods/refinedarchitect/.github/workflows/resolved-issue-locking.yml@v0.13.4
uses: refinedmods/refinedarchitect/.github/workflows/resolved-issue-locking.yml@v0.15.1
2 changes: 1 addition & 1 deletion .github/workflows/validate-branch-name.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ name: Validate branch name
on: [ pull_request ]
jobs:
validate-branch-name:
uses: refinedmods/refinedarchitect/.github/workflows/validate-branch-name.yml@v0.13.4
uses: refinedmods/refinedarchitect/.github/workflows/validate-branch-name.yml@v0.15.1
2 changes: 1 addition & 1 deletion .github/workflows/validate-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ on:
types: [ opened, synchronize, reopened, ready_for_review, labeled, unlabeled ]
jobs:
validate-changelog:
uses: refinedmods/refinedarchitect/.github/workflows/validate-changelog.yml@v0.13.4
uses: refinedmods/refinedarchitect/.github/workflows/validate-changelog.yml@v0.15.1
2 changes: 1 addition & 1 deletion .github/workflows/validate-commit-messages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ name: Validate commit messages
on: [ pull_request ]
jobs:
validate-commit-messages:
uses: refinedmods/refinedarchitect/.github/workflows/validate-commit-messages.yml@v0.13.4
uses: refinedmods/refinedarchitect/.github/workflows/validate-commit-messages.yml@v0.15.1
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

- Support for Refined Storage v2.0.0-milestone.4.0.

## [0.2.2] - 2024-06-20

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
refinedstorageVersion=2.0.0-milestone.3.13
jeiVersion=17.3.0.52
refinedstorageVersion=2.0.0-milestone.4.1
jeiVersion=19.1.0.17
# Gradle
org.gradle.jvmargs=-Xmx1G
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion refinedstorage-jei-integration-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repositories {
commonProject()

dependencies {
api "com.refinedmods.refinedstorage2:refinedstorage2-platform-common:${refinedstorageVersion}"
api "com.refinedmods.refinedstorage:refinedstorage-platform-common:${refinedstorageVersion}"
api "mezz.jei:jei-${minecraftVersion}-common-api:${jeiVersion}"
api "mezz.jei:jei-${minecraftVersion}-common:${jeiVersion}"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.refinedmods.refinedstorage.jei.common;

import com.refinedmods.refinedstorage2.platform.api.PlatformApi;
import com.refinedmods.refinedstorage.platform.api.PlatformApi;

import net.minecraft.resources.ResourceLocation;

import static java.util.Objects.requireNonNull;
Expand All @@ -24,11 +25,11 @@ public static Platform getPlatform() {
public static void init(final PlatformApi platformApi) {
platformApi.addIngredientConverter(new JeiRecipeModIngredientConverter());
platformApi.getGridSynchronizerRegistry().register(
new ResourceLocation(Common.MOD_ID, "jei"),
ResourceLocation.fromNamespaceAndPath(Common.MOD_ID, "jei"),
new JeiGridSynchronizer(false)
);
platformApi.getGridSynchronizerRegistry().register(
new ResourceLocation(Common.MOD_ID, "jei_two_way"),
ResourceLocation.fromNamespaceAndPath(Common.MOD_ID, "jei_two_way"),
new JeiGridSynchronizer(true)
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package com.refinedmods.refinedstorage.jei.common;

import com.refinedmods.refinedstorage.api.resource.list.ResourceList;
import com.refinedmods.refinedstorage.platform.common.content.Menus;
import com.refinedmods.refinedstorage.platform.common.grid.CraftingGridContainerMenu;
import com.refinedmods.refinedstorage.platform.common.support.resource.ItemResource;

import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.Nullable;

import com.refinedmods.refinedstorage2.api.resource.list.ResourceList;
import com.refinedmods.refinedstorage2.platform.common.content.Menus;
import com.refinedmods.refinedstorage2.platform.common.grid.CraftingGridContainerMenu;
import com.refinedmods.refinedstorage2.platform.common.support.resource.ItemResource;
import mezz.jei.api.constants.RecipeTypes;
import mezz.jei.api.gui.ingredient.IRecipeSlotView;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.refinedmods.refinedstorage.jei.common;

import com.refinedmods.refinedstorage.platform.common.support.AbstractBaseScreen;

import java.util.List;

import com.refinedmods.refinedstorage2.platform.common.support.AbstractBaseScreen;
import mezz.jei.api.gui.handlers.IGuiContainerHandler;
import net.minecraft.client.renderer.Rect2i;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package com.refinedmods.refinedstorage.jei.common;

import com.refinedmods.refinedstorage.platform.api.PlatformApi;
import com.refinedmods.refinedstorage.platform.api.support.resource.PlatformResourceKey;
import com.refinedmods.refinedstorage.platform.common.support.AbstractBaseScreen;
import com.refinedmods.refinedstorage.platform.common.support.containermenu.AbstractResourceContainerMenu;
import com.refinedmods.refinedstorage.platform.common.support.containermenu.ResourceSlot;
import com.refinedmods.refinedstorage.platform.common.support.packet.c2s.C2SPackets;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.refinedmods.refinedstorage2.platform.api.PlatformApi;
import com.refinedmods.refinedstorage2.platform.api.support.resource.PlatformResourceKey;
import com.refinedmods.refinedstorage2.platform.common.Platform;
import com.refinedmods.refinedstorage2.platform.common.support.AbstractBaseScreen;
import com.refinedmods.refinedstorage2.platform.common.support.containermenu.AbstractResourceContainerMenu;
import com.refinedmods.refinedstorage2.platform.common.support.containermenu.ResourceSlot;
import mezz.jei.api.gui.handlers.IGhostIngredientHandler;
import mezz.jei.api.ingredients.ITypedIngredient;
import net.minecraft.client.renderer.Rect2i;
Expand Down Expand Up @@ -50,7 +51,7 @@ public void onComplete() {
// no op
}

private class TargetImpl<I> implements Target<I> {
private static class TargetImpl<I> implements Target<I> {
private final Rect2i area;
private final int slotIndex;

Expand All @@ -70,10 +71,7 @@ public void accept(final I ingredient) {
}

private void accept(final PlatformResourceKey resource) {
Platform.INSTANCE.getClientToServerCommunications().sendResourceFilterSlotChange(
resource,
slotIndex
);
C2SPackets.sendResourceFilterSlotChange(resource, slotIndex);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.refinedmods.refinedstorage.jei.common;

import com.refinedmods.refinedstorage.platform.api.PlatformApi;
import com.refinedmods.refinedstorage.platform.api.grid.view.PlatformGridResource;
import com.refinedmods.refinedstorage.platform.api.support.resource.PlatformResourceKey;
import com.refinedmods.refinedstorage.platform.common.grid.screen.AbstractGridScreen;

import java.util.Optional;

import com.refinedmods.refinedstorage2.platform.api.PlatformApi;
import com.refinedmods.refinedstorage2.platform.api.grid.view.PlatformGridResource;
import com.refinedmods.refinedstorage2.platform.api.support.resource.PlatformResourceKey;
import com.refinedmods.refinedstorage2.platform.common.grid.screen.AbstractGridScreen;
import mezz.jei.api.gui.handlers.IGuiContainerHandler;
import mezz.jei.api.ingredients.IIngredientHelper;
import mezz.jei.api.ingredients.ITypedIngredient;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.refinedmods.refinedstorage.jei.common;

import com.refinedmods.refinedstorage.platform.common.grid.AbstractGridSynchronizer;

import javax.annotation.Nullable;

import com.refinedmods.refinedstorage2.platform.common.grid.AbstractGridSynchronizer;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.refinedmods.refinedstorage.jei.common;

import com.refinedmods.refinedstorage.platform.api.support.resource.PlatformResourceKey;
import com.refinedmods.refinedstorage.platform.api.support.resource.RecipeModIngredientConverter;
import com.refinedmods.refinedstorage.platform.common.support.resource.FluidResource;
import com.refinedmods.refinedstorage.platform.common.support.resource.ItemResource;

import java.util.Optional;

import com.refinedmods.refinedstorage2.platform.api.support.resource.PlatformResourceKey;
import com.refinedmods.refinedstorage2.platform.api.support.resource.RecipeModIngredientConverter;
import com.refinedmods.refinedstorage2.platform.common.support.resource.FluidResource;
import com.refinedmods.refinedstorage2.platform.common.support.resource.ItemResource;
import mezz.jei.api.helpers.IPlatformFluidHelper;
import mezz.jei.common.platform.Services;
import net.minecraft.world.item.ItemStack;
Expand All @@ -24,16 +25,17 @@ public Optional<PlatformResourceKey> convertToResource(final Object ingredient)
}

@Override
@SuppressWarnings("deprecation")
public Optional<Object> convertToIngredient(final PlatformResourceKey resource) {
if (resource instanceof ItemResource itemResource) {
return Optional.of(itemResource.toItemStack());
}
if (resource instanceof FluidResource fluidResource) {
final IPlatformFluidHelper<?> fluidHelper = Services.PLATFORM.getFluidHelper();
return Optional.of(fluidHelper.create(
fluidResource.fluid(),
fluidResource.fluid().builtInRegistryHolder(),
fluidHelper.bucketVolume(),
fluidResource.tag()
fluidResource.components()
));
}
return Optional.empty();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.refinedmods.refinedstorage.jei.common;

import java.util.Optional;
import com.refinedmods.refinedstorage.platform.common.support.resource.FluidResource;

import com.refinedmods.refinedstorage2.platform.common.support.resource.FluidResource;
import java.util.Optional;

public interface Platform {
Optional<FluidResource> convertJeiIngredientToFluid(Object ingredient);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.refinedmods.refinedstorage.jei.common;

import com.refinedmods.refinedstorage.platform.common.grid.screen.AbstractGridScreen;
import com.refinedmods.refinedstorage.platform.common.support.AbstractBaseScreen;

import javax.annotation.Nullable;

import com.refinedmods.refinedstorage2.platform.common.grid.screen.AbstractGridScreen;
import com.refinedmods.refinedstorage2.platform.common.support.AbstractBaseScreen;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.JeiPlugin;
import mezz.jei.api.constants.RecipeTypes;
Expand All @@ -14,7 +15,7 @@

@JeiPlugin
public class RefinedStorageModPlugin implements IModPlugin {
private static final ResourceLocation ID = new ResourceLocation(Common.MOD_ID, "plugin");
private static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(Common.MOD_ID, "plugin");
@Nullable
private static IJeiRuntime runtime;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.refinedmods.refinedstorage.jei.common;

import com.refinedmods.refinedstorage.platform.api.PlatformApi;
import com.refinedmods.refinedstorage.platform.api.support.resource.PlatformResourceKey;
import com.refinedmods.refinedstorage.platform.common.support.AbstractBaseScreen;

import java.util.Optional;
import javax.annotation.Nullable;

import com.refinedmods.refinedstorage2.platform.api.PlatformApi;
import com.refinedmods.refinedstorage2.platform.api.support.resource.PlatformResourceKey;
import com.refinedmods.refinedstorage2.platform.common.support.AbstractBaseScreen;
import mezz.jei.api.gui.handlers.IGuiContainerHandler;
import mezz.jei.api.ingredients.IIngredientHelper;
import mezz.jei.api.ingredients.ITypedIngredient;
Expand Down
2 changes: 1 addition & 1 deletion refinedstorage-jei-integration-fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repositories {
}

dependencies {
modApi "com.refinedmods.refinedstorage2:refinedstorage2-platform-fabric:${refinedstorageVersion}"
modApi "com.refinedmods.refinedstorage:refinedstorage-platform-fabric:${refinedstorageVersion}"
modRuntimeOnly "mezz.jei:jei-${minecraftVersion}-fabric:${jeiVersion}"
modCompileOnlyApi "mezz.jei:jei-${minecraftVersion}-common-api:${jeiVersion}"
modCompileOnlyApi "mezz.jei:jei-${minecraftVersion}-fabric-api:${jeiVersion}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
package com.refinedmods.refinedstorage.jei.fabric;

import com.refinedmods.refinedstorage.jei.common.Platform;
import com.refinedmods.refinedstorage.platform.common.support.resource.FluidResource;

import java.util.Optional;

import com.refinedmods.refinedstorage2.platform.common.support.resource.FluidResource;
import mezz.jei.api.fabric.ingredients.fluids.IJeiFluidIngredient;

import static com.refinedmods.refinedstorage.platform.fabric.support.resource.VariantUtil.ofFluidVariant;

public class FabricPlatform implements Platform {
@Override
public Optional<FluidResource> convertJeiIngredientToFluid(final Object ingredient) {
if (ingredient instanceof IJeiFluidIngredient fluidIngredient) {
return Optional.of(new FluidResource(
fluidIngredient.getFluid(),
fluidIngredient.getTag().orElse(null)
));
return Optional.of(ofFluidVariant(fluidIngredient.getFluidVariant()));
}
return Optional.empty();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.refinedmods.refinedstorage.jei.fabric;

import com.refinedmods.refinedstorage2.platform.api.PlatformApi;
import com.refinedmods.refinedstorage2.platform.api.RefinedStoragePlugin;
import com.refinedmods.refinedstorage.platform.api.PlatformApi;
import com.refinedmods.refinedstorage.platform.api.RefinedStoragePlugin;

import static com.refinedmods.refinedstorage.jei.common.Common.init;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@
"links": {
"modmenu.discord": "https://discordapp.com/invite/VYzsydb"
},
"parent": "refinedstorage2"
"parent": "refinedstorage"
}
},
"depends": {
"fabricloader": ">=0.14.6",
"fabric-api": "*",
"minecraft": "~1.20.4",
"jei": ">=17",
"minecraft": "~1.21",
"refinedstorage": ">=2.0.0-milestone.4.0",
"jei": ">=19",
"java": ">=17"
}
}
1 change: 0 additions & 1 deletion refinedstorage-jei-integration-forge/.gitignore

This file was deleted.

1 change: 1 addition & 0 deletions refinedstorage-jei-integration-neoforge/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
run/
Loading

0 comments on commit 5489d57

Please sign in to comment.