diff options
| author | Unknown <shekwancheung0528@gmail.com> | 2019-03-21 21:15:10 +0800 |
|---|---|---|
| committer | Unknown <shekwancheung0528@gmail.com> | 2019-03-21 21:15:10 +0800 |
| commit | 0d7431e4981226aba9d8011d76eabfb03d134499 (patch) | |
| tree | b21f733f3c98377907358109c1011193bfd5029a | |
| parent | c2d28cbf7028ffed2f56169adbce3f03cc0c5b49 (diff) | |
| download | RoughlyEnoughItems-0d7431e4981226aba9d8011d76eabfb03d134499.tar.gz RoughlyEnoughItems-0d7431e4981226aba9d8011d76eabfb03d134499.tar.bz2 RoughlyEnoughItems-0d7431e4981226aba9d8011d76eabfb03d134499.zip | |
Large v2.5 Update
46 files changed, 357 insertions, 735 deletions
diff --git a/.gitignore b/.gitignore index 907cdd67b..db1cc52cd 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,5 @@ Thumbs.db .DS_Store secret\.properties + +local\.properties diff --git a/CHANGELOG.md b/CHANGELOG.md index da2864ab8..a05b74b03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +# v2.5.0.70 +- Removed mouseScrolled Override in mixins +- Added spectator mode in gamemode switcher +- Gamemodes & Weather are now translatable: [#47](https://github.com/shedaniel/RoughlyEnoughItems/issues/47) +- Fixed Search Field +- Fixed Button Focus +- Added Button Tooltips +- Removed credits button (it will be back) +- Removed disabling credits option +- Update to 19w12a +- New config screen from [Cloth](https://minecraft.curseforge.com/projects/cloth) # v2.4.2.68 - Fixed [Cloth](https://minecraft.curseforge.com/projects/cloth) missing message # v2.4.2.67 diff --git a/build.gradle b/build.gradle index 9f88c353a..00fd462ae 100755 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,6 @@ import net.fabricmc.loom.task.RemapJar plugins { id 'fabric-loom' version '0.2.0-SNAPSHOT' id "com.github.johnrengelman.shadow" version "4.0.3" - id "com.matthewprenger.cursegradle" version "1.1.2" } sourceCompatibility = 1.8 @@ -49,7 +48,6 @@ dependencies { 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}" @@ -57,33 +55,3 @@ dependencies { compile "blue.endless:jankson:${project.jankson_version}" contained "blue.endless:jankson:${project.jankson_version}" } - -curseforge { - if (project.hasProperty("curseForgeApiKey")) { - apiKey = project.properties.curseForgeApiKey - } - project { - id = "310111" - changelogType = "markdown" - changelog = file("CHANGELOG.md") - releaseType = "release" - addGameVersion "1.14-Snapshot" - mainArtifact(remapShadowJar.jar) { - displayName = "[Fabric $project.minecraft_version] v$project.version" - relations { - requiredDependency "fabric" - optionalDependency "pluginloader" - tool "rei-addons" - } - } - } - options { - forgeGradleIntegration = false - } -} - -afterEvaluate { - // CurseGradle generates tasks in afterEvaluate for each project - // There isn't really any other way to make it depend on a task unless it is an AbstractArchiveTask - tasks.curseforge310111.dependsOn remapShadowJar -} diff --git a/gradle.properties b/gradle.properties index 80b1854a2..4de036ab5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,9 @@ -mod_version=2.5.0.69 -minecraft_version=19w11b -yarn_version=19w11b.11 -fabric_version=0.2.3.111 +mod_version=2.5.0.70 +minecraft_version=19w12a +yarn_version=19w12a.2 +fabric_version=0.2.4.113 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.1.8 +cloth_version=0.1.2.11 diff --git a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java index 886a5aa98..d293da2e0 100644 --- a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java +++ b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java @@ -15,6 +15,7 @@ import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.network.ServerSidePacketRegistry; import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.resource.language.I18n; import net.minecraft.item.ItemStack; import net.minecraft.server.network.ServerPlayerEntity; @@ -25,6 +26,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -99,6 +101,16 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer, ModInitiali RoughlyEnoughItemsCore.LOGGER.fatal("[REI] Cloth NOT found! It is a dependency of REI: https://minecraft.curseforge.com/projects/cloth"); System.exit(0); } + + if (!FabricLoader.getInstance().isModLoaded("modmenu")) { + try { + Class<?> modMenuApi_ = Class.forName("io.github.prospector.modmenu.api.ModMenuApi"); + Method addConfigOverride_ = modMenuApi_.getMethod("addConfigOverride", String.class, Runnable.class); + addConfigOverride_.invoke(null, "roughlyenoughitems", (Runnable) () -> getConfigManager().openConfigScreen(MinecraftClient.getInstance().currentScreen)); + } catch (Exception e) { + RoughlyEnoughItemsCore.LOGGER.error("Error enabling the Mod Menu config button for Hwyla", e); + } + } } @Override diff --git a/src/main/java/me/shedaniel/rei/api/ConfigManager.java b/src/main/java/me/shedaniel/rei/api/ConfigManager.java index 2e951f103..781c34143 100644 --- a/src/main/java/me/shedaniel/rei/api/ConfigManager.java +++ b/src/main/java/me/shedaniel/rei/api/ConfigManager.java @@ -1,6 +1,7 @@ package me.shedaniel.rei.api; import me.shedaniel.rei.client.ConfigObject; +import net.minecraft.client.gui.Screen; import java.io.IOException; @@ -16,4 +17,6 @@ public interface ConfigManager { void toggleCraftableOnly(); + void openConfigScreen(Screen parent); + } diff --git a/src/main/java/me/shedaniel/rei/api/DisplaySettings.java b/src/main/java/me/shedaniel/rei/api/DisplaySettings.java index 334d6cc6f..6eb5ef5a6 100644 --- a/src/main/java/me/shedaniel/rei/api/DisplaySettings.java +++ b/src/main/java/me/shedaniel/rei/api/DisplaySettings.java @@ -12,4 +12,12 @@ public interface DisplaySettings<T extends RecipeDisplay> { return -1; } + default VisableType canDisplay(T display) { + return VisableType.ALWAYS; + } + + public static enum VisableType { + ALWAYS, PASS, NEVER; + } + } diff --git a/src/main/java/me/shedaniel/rei/api/RecipeCategory.java b/src/main/java/me/shedaniel/rei/api/RecipeCategory.java index 9fdd35801..a20c505e2 100644 --- a/src/main/java/me/shedaniel/rei/api/RecipeCategory.java +++ b/src/main/java/me/shedaniel/rei/api/RecipeCategory.java @@ -1,5 +1,6 @@ package me.shedaniel.rei.api; +import me.shedaniel.rei.RoughlyEnoughItemsCore; import me.shedaniel.rei.gui.RecipeViewingScreen; import me.shedaniel.rei.gui.widget.RecipeBaseWidget; import me.shedaniel.rei.gui.widget.Widget; @@ -26,7 +27,7 @@ public interface RecipeCategory<T extends RecipeDisplay> { } default void drawCategoryBackground(Rectangle bounds, int mouseX, int mouseY, float delta) { - new RecipeBaseWidget(bounds).draw(mouseX, mouseY, delta); + new RecipeBaseWidget(bounds).render(); DrawableHelper.drawRect(bounds.x + 17, bounds.y + 5, bounds.x + bounds.width - 17, bounds.y + 17, RecipeViewingScreen.SUB_COLOR.getRGB()); DrawableHelper.drawRect(bounds.x + 17, bounds.y + 21, bounds.x + bounds.width - 17, bounds.y + 33, RecipeViewingScreen.SUB_COLOR.getRGB()); } @@ -50,6 +51,14 @@ public interface RecipeCategory<T extends RecipeDisplay> { }; } + default boolean canDisplay(RecipeDisplay display) { + if (getDisplaySettings().canDisplay(display) == DisplaySettings.VisableType.ALWAYS) + return true; + if (getDisplaySettings().canDisplay(display) == DisplaySettings.VisableType.NEVER) + return false; + return RoughlyEnoughItemsCore.getConfigManager().getConfig().preferVisibleRecipes; + } + default int getDisplayHeight() { return getDisplaySettings().getDisplayHeight(this); } diff --git a/src/main/java/me/shedaniel/rei/client/ClientHelper.java b/src/main/java/me/shedaniel/rei/client/ClientHelper.java index 89678caeb..dc5ae16d1 100644 --- a/src/main/java/me/shedaniel/rei/client/ClientHelper.java +++ b/src/main/java/me/shedaniel/rei/client/ClientHelper.java @@ -7,7 +7,6 @@ import me.shedaniel.rei.api.RecipeCategory; import me.shedaniel.rei.api.RecipeDisplay; import me.shedaniel.rei.api.RecipeHelper; import me.shedaniel.rei.gui.RecipeViewingScreen; -import me.shedaniel.rei.gui.config.ConfigScreen; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.client.keybinding.FabricKeyBinding; import net.fabricmc.fabric.api.network.ClientSidePacketRegistry; @@ -16,7 +15,6 @@ import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.ModContainer; import net.fabricmc.loader.api.metadata.ModMetadata; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.Screen; import net.minecraft.client.gui.ingame.CreativePlayerInventoryScreen; import net.minecraft.client.util.InputUtil; import net.minecraft.item.ItemStack; @@ -110,14 +108,6 @@ 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) { - openConfigWindow(parent, true); - } - public static List<ItemStack> getInventoryItemsTypes() { List<DefaultedList<ItemStack>> field_7543 = ImmutableList.of(MinecraftClient.getInstance().player.inventory.main, MinecraftClient.getInstance().player.inventory.armor, MinecraftClient.getInstance().player.inventory.offHand); List<ItemStack> inventoryStacks = new ArrayList<>(); diff --git a/src/main/java/me/shedaniel/rei/client/ConfigManager.java b/src/main/java/me/shedaniel/rei/client/ConfigManager.java index 8973e5865..60020526f 100644 --- a/src/main/java/me/shedaniel/rei/client/ConfigManager.java +++ b/src/main/java/me/shedaniel/rei/client/ConfigManager.java @@ -4,8 +4,18 @@ import blue.endless.jankson.Jankson; import blue.endless.jankson.JsonObject; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import javafx.util.Pair; +import me.shedaniel.cloth.api.ConfigScreenBuilder; +import me.shedaniel.cloth.gui.ClothConfigScreen; +import me.shedaniel.cloth.gui.entries.BooleanListEntry; +import me.shedaniel.cloth.gui.entries.IntegerListEntry; +import me.shedaniel.cloth.gui.entries.StringListEntry; import me.shedaniel.rei.RoughlyEnoughItemsCore; +import me.shedaniel.rei.gui.config.ItemListOrderingEntry; import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.Screen; +import net.minecraft.client.resource.language.I18n; import java.io.File; import java.io.FileOutputStream; @@ -118,4 +128,32 @@ public class ConfigManager implements me.shedaniel.rei.api.ConfigManager { craftableOnly = !craftableOnly; } + @Override + public void openConfigScreen(Screen parent) { + ClothConfigScreen.Builder builder = new ClothConfigScreen.Builder(parent, I18n.translate("text.rei.config.title"), null); + builder.addCategory(I18n.translate("text.rei.config.general")).addOption(new BooleanListEntry("text.rei.config.cheating", config.cheating, bool -> config.cheating = bool)); + ConfigScreenBuilder.CategoryBuilder appearance = builder.addCategory(I18n.translate("text.rei.config.appearance")); + appearance.addOption(new BooleanListEntry("text.rei.config.side_search_box", config.sideSearchField, bool -> config.sideSearchField = bool)); + appearance.addOption(new ItemListOrderingEntry("text.rei.config.list_ordering", new Pair<>(config.itemListOrdering, config.isAscending))); + appearance.addOption(new BooleanListEntry("text.rei.config.mirror_rei", config.mirrorItemPanel, bool -> config.mirrorItemPanel = bool)); + appearance.addOption(new IntegerListEntry("text.rei.config.max_recipes_per_page", config.maxRecipePerPage, i -> config.maxRecipePerPage = i).setMinimum(2).setMaximum(99)); + ConfigScreenBuilder.CategoryBuilder modules = builder.addCategory(I18n.translate("text.rei.config.modules")); + modules.addOption(new BooleanListEntry("text.rei.config.enable_craftable_only", config.enableCraftableOnlyButton, bool -> config.enableCraftableOnlyButton = bool)); + modules.addOption(new BooleanListEntry("text.rei.config.enable_util_buttons", config.showUtilsButtons, bool -> config.showUtilsButtons = bool)); + modules.addOption(new BooleanListEntry("text.rei.config.disable_recipe_book", config.disableRecipeBook, bool -> config.disableRecipeBook = bool)); + ConfigScreenBuilder.CategoryBuilder advanced = builder.addCategory(I18n.translate("text.rei.config.advanced")); + advanced.addOption(new StringListEntry("text.rei.give_command", config.giveCommand, s -> config.giveCommand = s)); + advanced.addOption(new StringListEntry("text.rei.gamemode_command", config.gamemodeCommand, s -> config.gamemodeCommand = s)); + advanced.addOption(new StringListEntry("text.rei.weather_command", config.weatherCommand, s -> config.weatherCommand = s)); + advanced.addOption(new BooleanListEntry("text.rei.config.prefer_visible_recipes", config.preferVisibleRecipes, bool -> config.preferVisibleRecipes = bool)); + builder.setOnSave(savedConfig -> { + try { + ConfigManager.this.saveConfig(); + } catch (IOException e) { + e.printStackTrace(); + } + }); + MinecraftClient.getInstance().openScreen(builder.build()); + } + } diff --git a/src/main/java/me/shedaniel/rei/client/ConfigObject.java b/src/main/java/me/shedaniel/rei/client/ConfigObject.java index b1303a697..67d81b5d4 100644 --- a/src/main/java/me/shedaniel/rei/client/ConfigObject.java +++ b/src/main/java/me/shedaniel/rei/client/ConfigObject.java @@ -31,7 +31,7 @@ public class ConfigObject { @Comment("True: item panel on the left, false: on the right") public boolean mirrorItemPanel = false; - @Comment("To disable REI's defualt plugin, don't change this unless you understand what you are doing") + @Comment("To disable REI's default plugin, don't change this unless you understand what you are doing") public boolean loadDefaultPlugin = true; @Comment("Maximum recipes viewed at one time.") @@ -43,6 +43,8 @@ public class ConfigObject { @Comment("Disable Recipe Book") public boolean disableRecipeBook = false; + public boolean preferVisibleRecipes = false; + @Comment("The location of choose page dialog") public RelativePoint choosePageDialogPoint = new RelativePoint(.5, .5); diff --git a/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java b/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java index 161f32fc9..539897376 100644 --- a/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java +++ b/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java @@ -81,7 +81,7 @@ public class RecipeHelperImpl implements RecipeHelper { Map<RecipeCategory, List<RecipeDisplay>> recipeCategoryListMap = Maps.newLinkedHashMap(); categories.forEach(category -> { if (categoriesMap.containsKey(category.getIdentifier()) && !categoriesMap.get(category.getIdentifier()).isEmpty()) - recipeCategoryListMap.put(category, categoriesMap.get(category.getIdentifier())); + recipeCategoryListMap.put(category, categoriesMap.get(category.getIdentifier()).stream().filter(display -> category.canDisplay(display)).collect(Collectors.toList())); }); return recipeCategoryListMap; } @@ -119,7 +119,7 @@ public class RecipeHelperImpl implements RecipeHelper { Map<RecipeCategory, List<RecipeDisplay>> recipeCategoryListMap = Maps.newLinkedHashMap(); categories.forEach(category -> { if (categoriesMap.containsKey(category.getIdentifier()) && !categoriesMap.get(category.getIdentifier()).isEmpty()) - recipeCategoryListMap.put(category, categoriesMap.get(category.getIdentifier())); + recipeCategoryListMap.put(category, categoriesMap.get(category.getIdentifier()).stream().filter(display -> category.canDisplay(display)).collect(Collectors.toList())); }); return recipeCategoryListMap; } @@ -200,7 +200,7 @@ public class RecipeHelperImpl implements RecipeHelper { recipeCategoryListMap.forEach((identifier, recipeDisplays) -> tempMap.put(identifier, new LinkedList<>(recipeDisplays))); categories.forEach(category -> { if (tempMap.containsKey(category.getIdentifier())) - map.put(category, tempMap.get(category.getIdentifier())); + map.put(category, tempMap.get(category.getIdentifier()).stream().filter(display -> category.canDisplay(display)).collect(Collectors.toList())); }); return map; } diff --git a/src/main/java/me/shedaniel/rei/client/ScreenHelper.java b/src/main/java/me/shedaniel/rei/client/ScreenHelper.java index 5c7112d41..fa109b98d 100644 --- a/src/main/java/me/shedaniel/rei/client/ScreenHelper.java +++ b/src/main/java/me/shedaniel/rei/client/ScreenHelper.java @@ -1,7 +1,6 @@ package me.shedaniel.rei.client; import com.google.common.collect.Lists; -import com.mojang.blaze3d.platform.GlStateManager; import me.shedaniel.rei.RoughlyEnoughItemsCore; import me.shedaniel.rei.gui.ContainerScreenOverlay; import me.shedaniel.rei.gui.widget.TextFieldWidget; @@ -10,13 +9,12 @@ import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.event.client.ClientTickCallback; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.ContainerScreen; -import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.InputListener; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.RecipeBookButtonWidget; -import net.minecraft.client.render.GuiLighting; import net.minecraft.client.util.Window; import net.minecraft.item.ItemStack; +import org.apache.logging.log4j.util.TriConsumer; import java.awt.*; import java.util.List; @@ -71,35 +69,19 @@ public class ScreenHelper implements ClientModInitializer { return (ContainerScreenHooks) lastContainerScreen; } - public static void drawHoveringWidget(int x, int y, Drawable drawable, int width, int height, float delta) { + public static void drawHoveringWidget(int x, int y, TriConsumer<Integer, Integer, Float> consumer, int width, int height, float delta) { Window window = MinecraftClient.getInstance().window; - drawHoveringWidget(new Dimension(window.getScaledWidth(), window.getScaledHeight()), x, y, drawable, width, height, delta); + drawHoveringWidget(new Dimension(window.getScaledWidth(), window.getScaledHeight()), x, y, consumer, width, height, delta); } - public static void drawHoveringWidget(Dimension dimension, int x, int y, Drawable drawable, int width, int height, float delta) { + public static void drawHoveringWidget(Dimension dimension, int x, int y, TriConsumer<Integer, Integer, Float> consumer, int width, int height, float delta) { int int_5 = x + 12; int int_6 = y - 12; - if (int_5 + width > dimension.width) int_5 -= 28 + width; if (int_6 + height + 6 > dimension.height) int_6 = dimension.height - height - 6; - - drawable.draw(int_5, int_6, delta); - // zOffset = 300.0F; - // itemRenderer.zOffset = 300.0F; - // int int_9 = -267386864; - // drawGradientRect(int_5 - 3, int_6 - 4, int_5 + width + 3, int_6 - 3, -267386864, -267386864); - // drawGradientRect(int_5 - 3, int_6 + height + 3, int_5 + width + 3, int_6 + height + 4, -267386864, -267386864); - // drawGradientRect(int_5 - 3, int_6 - 3, int_5 + width + 3, int_6 + height + 3, -267386864, -267386864); - // drawGradientRect(int_5 - 4, int_6 - 3, int_5 - 3, int_6 + height + 3, -267386864, -267386864); - // drawGradientRect(int_5 + width + 3, int_6 - 3, int_5 + width + 4, int_6 + height + 3, -267386864, -267386864); - // int int_10 = 1347420415; - // int int_11 = 1344798847; - // drawGradientRect(int_5 - 3, int_6 - 3 + 1, int_5 - 3 + 1, int_6 + height + 3 - 1, 1347420415, 1344798847); - // drawGradientRect(int_5 + width + 2, int_6 - 3 + 1, int_5 + width + 3, int_6 + height + 3 - 1, 1347420415, 1344798847); - // drawGradientRect(int_5 - 3, int_6 - 3, int_5 + width + 3, int_6 - 3 + 1, 1347420415, 1347420415); - // drawGradientRect(int_5 - 3, int_6 + height + 2, int_5 + width + 3, int_6 + height + 3, 1344798847, 1344798847); + consumer.accept(int_5, int_6, delta); } @Override diff --git a/src/main/java/me/shedaniel/rei/client/SearchArgument.java b/src/main/java/me/shedaniel/rei/client/SearchArgument.java index 445214871..f3a5a5032 100644 --- a/src/main/java/me/shedaniel/rei/client/SearchArgument.java +++ b/src/main/java/me/shedaniel/rei/client/SearchArgument.java @@ -2,14 +2,9 @@ package me.shedaniel.rei.client; public class SearchArgument { - public enum ArgumentType |
