aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild.gradle22
-rw-r--r--gradle.properties17
-rw-r--r--src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java15
-rw-r--r--src/main/java/me/shedaniel/rei/client/ClientHelper.java6
-rw-r--r--src/main/java/me/shedaniel/rei/cloth/ClothRegistry.java21
-rw-r--r--src/main/java/me/shedaniel/rei/gui/config/ConfigScreen.java14
6 files changed, 69 insertions, 26 deletions
diff --git a/build.gradle b/build.gradle
index 61ad5b8b8..aa48bcd64 100755
--- a/build.gradle
+++ b/build.gradle
@@ -11,7 +11,7 @@ targetCompatibility = 1.8
group = "me.shedaniel"
archivesBaseName = "RoughlyEnoughItems"
-version = project.modVersion
+version = project.mod_version
minecraft {
}
@@ -20,6 +20,7 @@ repositories {
maven { url "https://tehnut.info/maven/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url "https://maven.jamieswhiteshirt.com/libs-release/" }
+ maven { url "https://minecraft.curseforge.com/api/maven"}
}
processResources {
@@ -45,15 +46,16 @@ task remapShadowJar(type: RemapJar) {
tasks.remapShadowJar.dependsOn tasks.shadowJar
dependencies {
- minecraft "com.mojang:minecraft:${project.minecraftVersion}"
- mappings "net.fabricmc:yarn:${project.yarnVersion}"
- modCompile "net.fabricmc:fabric-loader:${project.fabricLoaderVersion}"
- modCompile "com.jamieswhiteshirt:developer-mode:${project.developerModeVersion}"
- modCompile "info.tehnut.pluginloader:plugin-loader:${project.pluginLoaderVersion}"
- modCompile "net.fabricmc:fabric:${project.fabricVersion}"
+ minecraft "com.mojang:minecraft:${project.minecraft_version}"
+ mappings "net.fabricmc:yarn:${project.yarn_version}"
+ modCompile "net.fabricmc:fabric-loader:${project.fabricloader_version}"
+ modCompile "com.jamieswhiteshirt:developer-mode:${project.developermode_version}"
+ modCompile "info.tehnut.pluginloader:plugin-loader:${project.pluginloader_version}"
+ modCompile "net.fabricmc:fabric:${project.fabric_version}"
+ modCompile "cloth:Cloth:${cloth_version}"
- compile "blue.endless:jankson:${project.janksonVersion}"
- contained "blue.endless:jankson:${project.janksonVersion}"
+ compile "blue.endless:jankson:${project.jankson_version}"
+ contained "blue.endless:jankson:${project.jankson_version}"
}
curseforge {
@@ -67,7 +69,7 @@ curseforge {
releaseType = "release"
addGameVersion "1.14-Snapshot"
mainArtifact(remapShadowJar.jar) {
- displayName = "[Fabric $project.minecraftVersion] v$project.version"
+ displayName = "[Fabric $project.minecraft_version] v$project.version"
relations {
requiredDependency "fabric"
optionalDependency "pluginloader"
diff --git a/gradle.properties b/gradle.properties
index 87ae622c6..7c0aa95d4 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,8 +1,9 @@
-modVersion=2.4.0.61
-minecraftVersion=19w09a
-yarnVersion=19w09a.4
-fabricVersion=0.2.3.108
-fabricLoaderVersion=0.3.7.109
-pluginLoaderVersion=1.14-1.0.6-8
-developerModeVersion=1.0.3
-janksonVersion=1.1.0
+mod_version=2.4.0.62
+minecraft_version=19w09a
+yarn_version=19w09a.4
+fabric_version=0.2.3.108
+fabricloader_version=0.3.7.109
+pluginloader_version=1.14-1.0.6-8
+developermode_version=1.0.3
+jankson_version=1.1.0
+cloth_version=0.1.0.3
diff --git a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
index ee6bbeae1..652c2cb29 100644
--- a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
+++ b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
@@ -5,12 +5,14 @@ import me.shedaniel.rei.api.ItemRegistry;
import me.shedaniel.rei.api.PluginDisabler;
import me.shedaniel.rei.api.REIPlugin;
import me.shedaniel.rei.api.RecipeHelper;
-import me.shedaniel.rei.client.*;
+import me.shedaniel.rei.client.ConfigManager;
+import me.shedaniel.rei.client.ItemRegistryImpl;
+import me.shedaniel.rei.client.PluginDisablerImpl;
+import me.shedaniel.rei.client.RecipeHelperImpl;
import me.shedaniel.rei.gui.widget.ItemListOverlay;
import me.shedaniel.rei.plugin.DefaultPlugin;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.ModInitializer;
-import net.fabricmc.fabric.api.event.client.ClientTickCallback;
import net.fabricmc.fabric.api.network.ServerSidePacketRegistry;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.resource.language.I18n;
@@ -22,6 +24,7 @@ import net.minecraft.util.Identifier;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import java.lang.reflect.InvocationTargetException;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -81,6 +84,14 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer, ModInitiali
RoughlyEnoughItemsCore.LOGGER.warn("REI: Plugin Loader is not loaded! Please consider installing https://minecraft.curseforge.com/projects/pluginloader for REI plugin compatibility!");
registerPlugin(new Identifier("roughlyenoughitems", "default_plugin"), new DefaultPlugin());
}
+
+ if (FabricLoader.getInstance().isModLoaded("cloth")) {
+ try {
+ Class.forName("me.shedaniel.rei.cloth.ClothRegistry").getDeclaredMethod("register").invoke(null);
+ } catch (IllegalAccessException | InvocationTargetException | ClassNotFoundException | NoSuchMethodException e) {
+ e.printStackTrace();
+ }
+ }
}
@Override
diff --git a/src/main/java/me/shedaniel/rei/client/ClientHelper.java b/src/main/java/me/shedaniel/rei/client/ClientHelper.java
index 252d41a81..84a3706f3 100644
--- a/src/main/java/me/shedaniel/rei/client/ClientHelper.java
+++ b/src/main/java/me/shedaniel/rei/client/ClientHelper.java
@@ -120,8 +120,12 @@ public class ClientHelper implements ClientModInitializer {
return map.keySet().size() > 0;
}
+ public static void openConfigWindow(Screen parent, boolean initOverlay) {
+ MinecraftClient.getInstance().openScreen(new ConfigScreen(parent, initOverlay));
+ }
+
public static void openConfigWindow(Screen parent) {
- MinecraftClient.getInstance().openScreen(new ConfigScreen(parent));
+ openConfigWindow(parent, true);
}
public static List<ItemStack> getInventoryItemsTypes() {
diff --git a/src/main/java/me/shedaniel/rei/cloth/ClothRegistry.java b/src/main/java/me/shedaniel/rei/cloth/ClothRegistry.java
new file mode 100644
index 000000000..a644046b0
--- /dev/null
+++ b/src/main/java/me/shedaniel/rei/cloth/ClothRegistry.java
@@ -0,0 +1,21 @@
+package me.shedaniel.rei.cloth;
+
+import me.shedaniel.cloth.api.EventPriority;
+import me.shedaniel.cloth.hooks.ClothModMenuHooks;
+import me.shedaniel.rei.client.ClientHelper;
+import net.minecraft.client.MinecraftClient;
+
+public class ClothRegistry {
+
+ public static void register() {
+ Runnable configRunnable = () -> ClientHelper.openConfigWindow(MinecraftClient.getInstance().currentScreen, false);
+ ClothModMenuHooks.CONFIG_BUTTON_EVENT.registerListener(event -> {
+ if (event.getModContainer() != null && event.getModContainer().getMetadata().getId().equalsIgnoreCase("roughlyenoughitems")) {
+ event.setEnabled(true);
+ event.setClickedRunnable(configRunnable);
+ event.setCancelled(true);
+ }
+ }, EventPriority.LOWEST);
+ }
+
+}
diff --git a/src/main/java/me/shedaniel/rei/gui/config/ConfigScreen.java b/src/main/java/me/shedaniel/rei/gui/config/ConfigScreen.java
index 32624584a..5e1e7cc1f 100644
--- a/src/main/java/me/shedaniel/rei/gui/config/ConfigScreen.java
+++ b/src/main/java/me/shedaniel/rei/gui/config/ConfigScreen.java
@@ -3,8 +3,8 @@ package me.shedaniel.rei.gui.config;
import com.google.common.collect.Lists;
import me.shedaniel.rei.RoughlyEnoughItemsCore;
import me.shedaniel.rei.client.ClientHelper;
-import me.shedaniel.rei.client.ScreenHelper;
import me.shedaniel.rei.client.ItemListOrdering;
+import me.shedaniel.rei.client.ScreenHelper;
import me.shedaniel.rei.gui.widget.QueuedTooltip;
import me.shedaniel.rei.gui.widget.TextFieldWidget;
import net.minecraft.client.MinecraftClient;
@@ -24,10 +24,12 @@ public class ConfigScreen extends Screen {
private final List<QueuedTooltip> tooltipList;
private Screen parent;
+ private boolean initOverlay;
private ConfigEntryListWidget entryListWidget;
- public ConfigScreen(Screen parent) {
+ public ConfigScreen(Screen parent, boolean initOverlay) {
this.parent = parent;
+ this.initOverlay = initOverlay;
this.tooltipList = Lists.newArrayList();
}
@@ -35,7 +37,8 @@ public class ConfigScreen extends Screen {
public boolean keyPressed(int int_1, int int_2, int int_3) {
if (int_1 == 256 && this.doesEscapeKeyClose()) {
MinecraftClient.getInstance().openScreen(parent);
- ScreenHelper.getLastOverlay().onInitialized();
+ if (initOverlay)
+ ScreenHelper.getLastOverlay().onInitialized();
return true;
} else {
return super.keyPressed(int_1, int_2, int_3);
@@ -220,7 +223,7 @@ public class ConfigScreen extends Screen {
}
return true;
}
-
+
@Override
public String getText() {
return getTrueFalseText(RoughlyEnoughItemsCore.getConfigManager().getConfig().disableRecipeBook);
@@ -340,7 +343,8 @@ public class ConfigScreen extends Screen {
e.printStackTrace();
}
ConfigScreen.this.client.openScreen(parent);
- ScreenHelper.getLastOverlay().onInitialized();
+ if (initOverlay)
+ ScreenHelper.getLastOverlay().onInitialized();
}
});
super.onInitialized();