REI search integration.
This commit is contained in:
@@ -21,7 +21,6 @@ package appeng.client.gui.implementations;
|
||||
import java.util.List;
|
||||
|
||||
import appeng.mixins.SlotMixin;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
@@ -54,7 +53,7 @@ import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.ConfigValuePacket;
|
||||
import appeng.core.sync.packets.SwitchGuisPacket;
|
||||
import appeng.helpers.WirelessTerminalGuiObject;
|
||||
import appeng.integration.abstraction.JEIFacade;
|
||||
import appeng.integration.abstraction.ReiFacade;
|
||||
import appeng.parts.reporting.AbstractTerminalPart;
|
||||
import appeng.tile.misc.SecurityStationBlockEntity;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
@@ -242,7 +241,7 @@ public class MEMonitorableScreen<T extends MEMonitorableContainer> extends AEBas
|
||||
this.searchField.setFocused(this.isAutoFocus);
|
||||
|
||||
if (isJEIEnabled) {
|
||||
memoryText = JEIFacade.instance().getSearchText();
|
||||
memoryText = ReiFacade.instance().getSearchText();
|
||||
}
|
||||
|
||||
if (isKeepFilter && memoryText != null && !memoryText.isEmpty()) {
|
||||
|
||||
@@ -39,7 +39,7 @@ import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.widgets.IScrollSource;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.integration.abstraction.JEIFacade;
|
||||
import appeng.integration.abstraction.ReiFacade;
|
||||
import appeng.items.storage.ViewCellItem;
|
||||
import appeng.util.ItemSorters;
|
||||
import appeng.util.Platform;
|
||||
@@ -191,7 +191,7 @@ public class ItemRepo {
|
||||
}
|
||||
|
||||
private void updateJEI(String filter) {
|
||||
JEIFacade.instance().setSearchText(filter);
|
||||
ReiFacade.instance().setSearchText(filter);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import appeng.integration.IIntegrationModule;
|
||||
/**
|
||||
* Abstracts access to the JEI API functionality.
|
||||
*/
|
||||
public interface IJEI extends IIntegrationModule {
|
||||
public interface IRei extends IIntegrationModule {
|
||||
|
||||
default String getSearchText() {
|
||||
return "";
|
||||
@@ -32,6 +32,6 @@ public interface IJEI extends IIntegrationModule {
|
||||
default void setSearchText(String searchText) {
|
||||
}
|
||||
|
||||
class Stub extends IIntegrationModule.Stub implements IJEI {
|
||||
class Stub extends IIntegrationModule.Stub implements IRei {
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package appeng.integration.abstraction;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
public final class JEIFacade {
|
||||
|
||||
private JEIFacade() {
|
||||
}
|
||||
|
||||
private static IJEI instance = new IJEI.Stub();
|
||||
|
||||
public static IJEI instance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static void setInstance(IJEI jei) {
|
||||
instance = Preconditions.checkNotNull(jei);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package appeng.integration.abstraction;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
public final class ReiFacade {
|
||||
|
||||
private ReiFacade() {
|
||||
}
|
||||
|
||||
private static IRei instance = new IRei.Stub();
|
||||
|
||||
public static IRei instance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static void setInstance(IRei jei) {
|
||||
instance = Preconditions.checkNotNull(jei);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import appeng.container.implementations.PatternTermContainer;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.integration.abstraction.ReiFacade;
|
||||
import appeng.recipes.handlers.GrinderRecipe;
|
||||
import appeng.recipes.handlers.InscriberRecipe;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -93,6 +94,8 @@ public class ReiPlugin implements REIPluginV0 {
|
||||
public void postRegister() {
|
||||
IDefinitions definitions = AEApi.instance().definitions();
|
||||
registerDescriptions(definitions);
|
||||
|
||||
ReiFacade.setInstance(new ReiRuntimeAdapter());
|
||||
}
|
||||
|
||||
private void registerWorkingStations(RecipeHelper registration) {
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.jei;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import me.shedaniel.rei.api.REIHelper;
|
||||
|
||||
import appeng.integration.abstraction.IRei;
|
||||
|
||||
class ReiRuntimeAdapter implements IRei {
|
||||
|
||||
private final REIHelper runtime;
|
||||
|
||||
ReiRuntimeAdapter() {
|
||||
this.runtime = REIHelper.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSearchText() {
|
||||
return Strings.nullToEmpty(this.runtime.getSearchTextField().getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSearchText(String searchText) {
|
||||
this.runtime.getSearchTextField().setText(Strings.nullToEmpty(searchText));
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ import appeng.core.AELog;
|
||||
import appeng.core.stats.AeStats;
|
||||
import appeng.fluids.util.AEFluidStack;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.integration.abstraction.JEIFacade;
|
||||
import appeng.integration.abstraction.ReiFacade;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.GridNode;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
@@ -90,7 +90,6 @@ import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.RayTraceContext;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
@@ -1142,7 +1141,7 @@ public class Platform {
|
||||
|
||||
public static boolean isSearchModeAvailable(SearchBoxMode mode) {
|
||||
if (mode.isRequiresJei()) {
|
||||
return JEIFacade.instance().isEnabled();
|
||||
return ReiFacade.instance().isEnabled();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user