Skip to content

Commit

Permalink
chore: move REI integration to addon mod
Browse files Browse the repository at this point in the history
  • Loading branch information
raoulvdberge committed Jun 8, 2024
1 parent 4e73ddb commit 52f57d2
Show file tree
Hide file tree
Showing 38 changed files with 49 additions and 1,299 deletions.
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]

### Removed

- The REI integration has been removed and will be moved to an addon mod.

## [2.0.0-milestone.3.7] - 2024-06-03

### Removed
Expand Down
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ enableSonarQube("refinedmods_refinedstorage2")
sonarqube {
properties {
property "sonar.coverage.exclusions", "refinedstorage2-platform-forge/**/*,refinedstorage2-platform-fabric/**/*,refinedstorage2-platform-common/**/*,refinedstorage2-platform-api/**/*"
property "sonar.cpd.exclusions", "refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/recipemod/rei/*,refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/recipemod/rei/*"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.refinedmods.refinedstorage2.platform.api.grid.strategy.GridScrollingStrategy;
import com.refinedmods.refinedstorage2.platform.api.grid.strategy.GridScrollingStrategyFactory;
import com.refinedmods.refinedstorage2.platform.api.importer.ImporterTransferStrategyFactory;
import com.refinedmods.refinedstorage2.platform.api.recipemod.IngredientConverter;
import com.refinedmods.refinedstorage2.platform.api.security.BuiltinPermissions;
import com.refinedmods.refinedstorage2.platform.api.security.PlatformPermission;
import com.refinedmods.refinedstorage2.platform.api.storage.StorageContainerItemHelper;
Expand All @@ -38,6 +37,7 @@
import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReferenceFactory;
import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReferenceProvider;
import com.refinedmods.refinedstorage2.platform.api.support.registry.PlatformRegistry;
import com.refinedmods.refinedstorage2.platform.api.support.resource.RecipeModIngredientConverter;
import com.refinedmods.refinedstorage2.platform.api.support.resource.ResourceFactory;
import com.refinedmods.refinedstorage2.platform.api.support.resource.ResourceRendering;
import com.refinedmods.refinedstorage2.platform.api.support.resource.ResourceType;
Expand Down Expand Up @@ -165,9 +165,9 @@ GridScrollingStrategy createGridScrollingStrategy(AbstractContainerMenu containe

ResourceRendering getResourceRendering(ResourceKey resource);

void registerIngredientConverter(IngredientConverter converter);
void addIngredientConverter(RecipeModIngredientConverter converter);

IngredientConverter getIngredientConverter();
RecipeModIngredientConverter getIngredientConverter();

void addWirelessTransmitterRangeModifier(WirelessTransmitterRangeModifier rangeModifier);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.refinedmods.refinedstorage2.platform.api.grid.strategy.GridScrollingStrategy;
import com.refinedmods.refinedstorage2.platform.api.grid.strategy.GridScrollingStrategyFactory;
import com.refinedmods.refinedstorage2.platform.api.importer.ImporterTransferStrategyFactory;
import com.refinedmods.refinedstorage2.platform.api.recipemod.IngredientConverter;
import com.refinedmods.refinedstorage2.platform.api.security.BuiltinPermissions;
import com.refinedmods.refinedstorage2.platform.api.security.PlatformPermission;
import com.refinedmods.refinedstorage2.platform.api.storage.StorageContainerItemHelper;
Expand All @@ -38,6 +37,7 @@
import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReferenceFactory;
import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReferenceProvider;
import com.refinedmods.refinedstorage2.platform.api.support.registry.PlatformRegistry;
import com.refinedmods.refinedstorage2.platform.api.support.resource.RecipeModIngredientConverter;
import com.refinedmods.refinedstorage2.platform.api.support.resource.ResourceFactory;
import com.refinedmods.refinedstorage2.platform.api.support.resource.ResourceRendering;
import com.refinedmods.refinedstorage2.platform.api.support.resource.ResourceType;
Expand Down Expand Up @@ -307,12 +307,12 @@ public ResourceRendering getResourceRendering(final ResourceKey resource) {
}

@Override
public void registerIngredientConverter(final IngredientConverter converter) {
ensureLoaded().registerIngredientConverter(converter);
public void addIngredientConverter(final RecipeModIngredientConverter converter) {
ensureLoaded().addIngredientConverter(converter);
}

@Override
public IngredientConverter getIngredientConverter() {
public RecipeModIngredientConverter getIngredientConverter() {
return ensureLoaded().getIngredientConverter();
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.refinedmods.refinedstorage2.platform.api.recipemod;

import com.refinedmods.refinedstorage2.platform.api.support.resource.PlatformResourceKey;
package com.refinedmods.refinedstorage2.platform.api.support.resource;

import java.util.Optional;

import org.apiguardian.api.API;

@API(status = API.Status.STABLE, since = "2.0.0-milestone.2.5")
public interface IngredientConverter {
public interface RecipeModIngredientConverter {
Optional<PlatformResourceKey> convertToResource(Object ingredient);

Optional<Object> convertToIngredient(PlatformResourceKey resource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.refinedmods.refinedstorage2.platform.api.grid.strategy.GridScrollingStrategy;
import com.refinedmods.refinedstorage2.platform.api.grid.strategy.GridScrollingStrategyFactory;
import com.refinedmods.refinedstorage2.platform.api.importer.ImporterTransferStrategyFactory;
import com.refinedmods.refinedstorage2.platform.api.recipemod.IngredientConverter;
import com.refinedmods.refinedstorage2.platform.api.security.BuiltinPermissions;
import com.refinedmods.refinedstorage2.platform.api.security.PlatformPermission;
import com.refinedmods.refinedstorage2.platform.api.storage.StorageContainerItemHelper;
Expand All @@ -43,6 +42,7 @@
import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReferenceFactory;
import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReferenceProvider;
import com.refinedmods.refinedstorage2.platform.api.support.registry.PlatformRegistry;
import com.refinedmods.refinedstorage2.platform.api.support.resource.RecipeModIngredientConverter;
import com.refinedmods.refinedstorage2.platform.api.support.resource.ResourceFactory;
import com.refinedmods.refinedstorage2.platform.api.support.resource.ResourceRendering;
import com.refinedmods.refinedstorage2.platform.api.support.resource.ResourceType;
Expand All @@ -56,7 +56,6 @@
import com.refinedmods.refinedstorage2.platform.common.grid.strategy.CompositeGridExtractionStrategy;
import com.refinedmods.refinedstorage2.platform.common.grid.strategy.CompositeGridInsertionStrategy;
import com.refinedmods.refinedstorage2.platform.common.grid.strategy.CompositeGridScrollingStrategy;
import com.refinedmods.refinedstorage2.platform.common.recipemod.CompositeIngredientConverter;
import com.refinedmods.refinedstorage2.platform.common.security.BuiltinPermission;
import com.refinedmods.refinedstorage2.platform.common.storage.ClientStorageRepository;
import com.refinedmods.refinedstorage2.platform.common.storage.StorageContainerItemHelperImpl;
Expand All @@ -73,6 +72,7 @@
import com.refinedmods.refinedstorage2.platform.common.support.network.bounditem.InventorySlotReference;
import com.refinedmods.refinedstorage2.platform.common.support.network.bounditem.NetworkBoundItemHelperImpl;
import com.refinedmods.refinedstorage2.platform.common.support.registry.PlatformRegistryImpl;
import com.refinedmods.refinedstorage2.platform.common.support.resource.CompositeRecipeModIngredientConverter;
import com.refinedmods.refinedstorage2.platform.common.support.resource.FluidResourceFactory;
import com.refinedmods.refinedstorage2.platform.common.support.resource.ItemResourceFactory;
import com.refinedmods.refinedstorage2.platform.common.upgrade.BuiltinUpgradeDestinationsImpl;
Expand Down Expand Up @@ -147,7 +147,8 @@ public class PlatformApiImpl implements PlatformApi {
new CompositeStorageMonitorInsertionStrategy();
private final CompositeStorageMonitorExtractionStrategy storageMonitorExtractionStrategy =
new CompositeStorageMonitorExtractionStrategy();
private final CompositeIngredientConverter compositeConverter = new CompositeIngredientConverter();
private final CompositeRecipeModIngredientConverter ingredientConverter =
new CompositeRecipeModIngredientConverter();
private final StorageContainerItemHelper storageContainerItemHelper = new StorageContainerItemHelperImpl();
private final List<GridInsertionStrategyFactory> gridInsertionStrategyFactories = new ArrayList<>();
private final GridInsertionHintsImpl gridInsertionHints = new GridInsertionHintsImpl(
Expand Down Expand Up @@ -463,13 +464,13 @@ public ResourceRendering getResourceRendering(final ResourceKey resource) {
}

@Override
public void registerIngredientConverter(final IngredientConverter converter) {
this.compositeConverter.addConverter(converter);
public void addIngredientConverter(final RecipeModIngredientConverter converter) {
ingredientConverter.addConverter(converter);
}

@Override
public IngredientConverter getIngredientConverter() {
return compositeConverter;
public RecipeModIngredientConverter getIngredientConverter() {
return ingredientConverter;
}

@Override
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.refinedmods.refinedstorage2.platform.common.recipemod;
package com.refinedmods.refinedstorage2.platform.common.support.resource;

import com.refinedmods.refinedstorage2.platform.api.recipemod.IngredientConverter;
import com.refinedmods.refinedstorage2.platform.api.support.resource.PlatformResourceKey;
import com.refinedmods.refinedstorage2.platform.api.support.resource.RecipeModIngredientConverter;

import java.util.Collection;
import java.util.HashSet;
import java.util.Optional;

public class CompositeIngredientConverter implements IngredientConverter {
private final Collection<IngredientConverter> converters = new HashSet<>();
public class CompositeRecipeModIngredientConverter implements RecipeModIngredientConverter {
private final Collection<RecipeModIngredientConverter> converters = new HashSet<>();

@Override
public Optional<PlatformResourceKey> convertToResource(final Object ingredient) {
Expand All @@ -24,7 +24,7 @@ public Optional<Object> convertToIngredient(final PlatformResourceKey resource)
.findFirst();
}

public void addConverter(final IngredientConverter converter) {
public void addConverter(final RecipeModIngredientConverter converter) {
this.converters.add(converter);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@
"gui.refinedstorage2.grid.synchronizer": "Synchronization mode",
"gui.refinedstorage2.grid.synchronizer.off": "Off",
"gui.refinedstorage2.grid.synchronizer.off.help": "Don't sync the search box text.",
"gui.refinedstorage2.grid.synchronizer.rei": "REI",
"gui.refinedstorage2.grid.synchronizer.rei.help": "Sync the search box text to the REI filter.",
"gui.refinedstorage2.grid.synchronizer.rei.two_way": "REI two-way",
"gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the REI filter, and the REI filter to the search box text.",
"gui.refinedstorage2.grid.resource_type": "Resource type",
"gui.refinedstorage2.grid.resource_type.all": "All",
"gui.refinedstorage2.grid.resource_type.help": "Filter specific resource types.",
Expand Down
13 changes: 1 addition & 12 deletions refinedstorage2-platform-fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repositories {
url 'https://maven.terraformersmc.com/'
}
maven {
name = 'Cloth Config, REI'
name = 'Cloth Config'
url 'https://maven.shedaniel.me/'
}
maven {
Expand Down Expand Up @@ -41,17 +41,6 @@ dependencies {

modImplementation fabric.modmenu

modCompileOnly(common.rei.api) {
exclude(group: 'me.shedaniel.cloth')
exclude(group: 'dev.architectury')
}
modCompileOnly(fabric.rei.plugin) {
exclude(group: 'me.shedaniel.cloth')
exclude(group: 'dev.architectury')
}
modCompileOnly fabric.rei.architectury
modRuntimeOnly fabric.rei.impl

modRuntimeOnly fabric.wthit

// https://www.curseforge.com/minecraft/mc-mods/trinkets/files
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.refinedmods.refinedstorage2.platform.fabric;

import com.refinedmods.refinedstorage2.api.resource.ResourceAmount;
import com.refinedmods.refinedstorage2.platform.api.PlatformApi;
import com.refinedmods.refinedstorage2.platform.api.support.HelpTooltipComponent;
import com.refinedmods.refinedstorage2.platform.api.upgrade.AbstractUpgradeItem;
import com.refinedmods.refinedstorage2.platform.common.AbstractClientModInitializer;
Expand Down Expand Up @@ -33,9 +32,6 @@
import com.refinedmods.refinedstorage2.platform.fabric.packet.s2c.ResourceSlotUpdatePacket;
import com.refinedmods.refinedstorage2.platform.fabric.packet.s2c.StorageInfoResponsePacket;
import com.refinedmods.refinedstorage2.platform.fabric.packet.s2c.WirelessTransmitterRangePacket;
import com.refinedmods.refinedstorage2.platform.fabric.recipemod.rei.RefinedStorageREIClientPlugin;
import com.refinedmods.refinedstorage2.platform.fabric.recipemod.rei.ReiGridSynchronizer;
import com.refinedmods.refinedstorage2.platform.fabric.recipemod.rei.ReiProxy;
import com.refinedmods.refinedstorage2.platform.fabric.storage.diskdrive.DiskDriveBlockEntityRendererImpl;
import com.refinedmods.refinedstorage2.platform.fabric.storage.diskdrive.DiskDriveUnbakedModel;
import com.refinedmods.refinedstorage2.platform.fabric.storage.portablegrid.PortableGridBlockEntityRendererImpl;
Expand All @@ -53,7 +49,6 @@
import net.fabricmc.fabric.api.client.model.loading.v1.ModelLoadingPlugin;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.fabricmc.fabric.api.client.rendering.v1.TooltipComponentCallback;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraft.client.gui.screens.Screen;
Expand Down Expand Up @@ -96,7 +91,7 @@ public <M extends AbstractContainerMenu, U extends Screen & MenuAccess<M>> void
});
registerKeyBindings();
registerModelPredicates();
registerGridSynchronizers();
registerBaseGridSynchronizer();
registerResourceRendering();
registerAlternativeGridHints();
registerItemProperties();
Expand Down Expand Up @@ -433,30 +428,6 @@ private void registerModelPredicates() {
));
}

private void registerGridSynchronizers() {
registerBaseGridSynchronizer();
final FabricLoader loader = FabricLoader.getInstance();
if (loader.isModLoaded("roughlyenoughitems")) {
registerReiGridSynchronizers();
}
}

private void registerReiGridSynchronizers() {
LOGGER.debug("Enabling REI grid synchronizers");
// This is so the ingredient converters are only registered once
// see https://github.com/refinedmods/refinedstorage2/pull/302#discussion_r1070015672
RefinedStorageREIClientPlugin.registerIngredientConverters();
final ReiProxy reiProxy = new ReiProxy();
PlatformApi.INSTANCE.getGridSynchronizerRegistry().register(
createIdentifier("rei"),
new ReiGridSynchronizer(reiProxy, false)
);
PlatformApi.INSTANCE.getGridSynchronizerRegistry().register(
createIdentifier("rei_two_way"),
new ReiGridSynchronizer(reiProxy, true)
);
}

private void registerItemProperties() {
ItemProperties.register(
Items.INSTANCE.getWirelessGrid(),
Expand Down
Loading

0 comments on commit 52f57d2

Please sign in to comment.