ソースを参照

Better refiltering, 20w09a, delta based PreRecipeViewingScreen animation and fix pressing E closes when searching.

Signed-off-by: shedaniel <daniel@shedaniel.me>
shedaniel 5 年 前
コミット
42e753b346

+ 10 - 7
build.gradle

@@ -52,12 +52,18 @@ dependencies {
     minecraft("com.mojang:minecraft:${project.minecraft_version}")
     mappings("net.fabricmc:yarn:${project.yarn_version}:v2")
     modApi("net.fabricmc:fabric-loader:${project.fabricloader_version}")
-    modApi("net.fabricmc.fabric-api:fabric-api:${project.fabric_api}")
+    modApi("net.fabricmc.fabric-api:fabric-api:${project.fabric_api}") {
+        exclude module: "fabric-renderer-indigo"
+    }
     modApi("me.shedaniel.cloth:cloth-events:${cloth_events_version}") {
         transitive = false
     }
-    modImplementation("me.shedaniel.cloth:config-2:${cloth_config_version}")
-    modApi("me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig1u}")
+    modImplementation("me.shedaniel.cloth:config-2:${cloth_config_version}") {
+        exclude module: "fabric-api"
+    }
+    modApi("me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig1u}") {
+        exclude module: "fabric-api"
+    }
     modApi("org.jetbrains:annotations:18.0.0")
     modCompileOnly("io.github.prospector:modmenu:${modmenu_version}") {
         transitive = false
@@ -65,9 +71,6 @@ dependencies {
     modRuntime("io.github.prospector:modmenu:${modmenu_version}") {
         transitive = false
     }
-//    modRuntime("com.lettuce.fudge:notenoughcrashes:1.1.5+1.15.1") {
-//        transitive = false
-//    }
     if (includeDep) {
         afterEvaluate {
             def listAdded = new ArrayList(Arrays.asList((api_exculde as String).split(',')))
@@ -130,7 +133,7 @@ curseforge {
                 embeddedLibrary 'cloth-config'
             }
             mainArtifact(file("${project.buildDir}/libs/${project.archivesBaseName}-${project.version}.jar")) {
-                displayName = "[Fabric 20w08a] v$project.version"
+                displayName = "[Fabric 20w09a] v$project.version"
             }
             afterEvaluate {
                 uploadTask.dependsOn("remapJar")

+ 2 - 2
gradle.properties

@@ -1,6 +1,6 @@
 mod_version=4.0.5-unstable
-minecraft_version=20w08a
-yarn_version=20w08a+build.1
+minecraft_version=20w09a
+yarn_version=20w09a+build.1
 fabricloader_version=0.7.8+build.184
 cloth_events_version=1.2.0
 cloth_config_version=2.10

+ 1 - 1
src/main/java/me/shedaniel/rei/gui/PreRecipeViewingScreen.java

@@ -156,7 +156,7 @@ public class PreRecipeViewingScreen extends Screen {
     private void updateFramePosition(float delta) {
         target = clamp(target);
         if (!DynamicNewSmoothScrollingEntryListWidget.Precision.almostEquals(frame, target, DynamicNewSmoothScrollingEntryListWidget.Precision.FLOAT_EPSILON))
-            frame = ease(frame, target, Math.min((System.currentTimeMillis() - start) / ((double) duration), 1));
+            frame = ease(frame, target, Math.min((System.currentTimeMillis() - start) / (double) duration * delta * 3.0D, 1));
         else
             frame = target;
     }

+ 5 - 5
src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java

@@ -150,11 +150,6 @@ public class RecipeViewingScreen extends Screen implements StackToNoticeScreen {
             init();
             return true;
         }
-        if ((int_1 == 256 || this.minecraft.options.keyInventory.matchesKey(int_1, int_2)) && this.shouldCloseOnEsc()) {
-            MinecraftClient.getInstance().openScreen(ScreenHelper.getLastContainerScreen());
-            ScreenHelper.getLastOverlay().init();
-            return true;
-        }
         if (int_1 == 258) {
             boolean boolean_1 = !hasShiftDown();
             if (!this.changeFocus(boolean_1))
@@ -175,6 +170,11 @@ public class RecipeViewingScreen extends Screen implements StackToNoticeScreen {
         for (Element element : children())
             if (element.keyPressed(int_1, int_2, int_3))
                 return true;
+        if (int_1 == 256 || this.minecraft.options.keyInventory.matchesKey(int_1, int_2)) {
+            MinecraftClient.getInstance().openScreen(ScreenHelper.getLastContainerScreen());
+            ScreenHelper.getLastOverlay().init();
+            return true;
+        }
         if (int_1 == 259) {
             if (ScreenHelper.hasLastRecipeScreen())
                 minecraft.openScreen(ScreenHelper.getLastRecipeScreen());

+ 10 - 5
src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java

@@ -104,6 +104,11 @@ public class VillagerRecipeViewingScreen extends Screen implements StackToNotice
         });
     }
     
+    @Override
+    public boolean isPauseScreen() {
+        return false;
+    }
+    
     @Override
     public void addIngredientStackToNotice(EntryStack stack) {
         ingredientStackToNotice = stack;
@@ -457,11 +462,6 @@ public class VillagerRecipeViewingScreen extends Screen implements StackToNotice
     
     @Override
     public boolean keyPressed(int int_1, int int_2, int int_3) {
-        if ((int_1 == 256 || this.minecraft.options.keyInventory.matchesKey(int_1, int_2)) && this.shouldCloseOnEsc()) {
-            MinecraftClient.getInstance().openScreen(ScreenHelper.getLastContainerScreen());
-            ScreenHelper.getLastOverlay().init();
-            return true;
-        }
         if (int_1 == 258) {
             boolean boolean_1 = !hasShiftDown();
             if (!this.changeFocus(boolean_1))
@@ -490,6 +490,11 @@ public class VillagerRecipeViewingScreen extends Screen implements StackToNotice
         for (Element element : children())
             if (element.keyPressed(int_1, int_2, int_3))
                 return true;
+        if (int_1 == 256 || this.minecraft.options.keyInventory.matchesKey(int_1, int_2)) {
+            MinecraftClient.getInstance().openScreen(ScreenHelper.getLastContainerScreen());
+            ScreenHelper.getLastOverlay().init();
+            return true;
+        }
         if (int_1 == 259) {
             if (ScreenHelper.hasLastRecipeScreen())
                 minecraft.openScreen(ScreenHelper.getLastRecipeScreen());

+ 3 - 4
src/main/java/me/shedaniel/rei/impl/EntryRegistryImpl.java

@@ -94,15 +94,14 @@ public class EntryRegistryImpl implements EntryRegistry {
     
     public void refilter() {
         long started = System.currentTimeMillis();
-        Set<EntryStack> set = Sets.newLinkedHashSet();
-        set.addAll(ConfigObject.getInstance().getFilteredStacks());
+        Collection<EntryStack> filteredStacks = ConfigObject.getInstance().getFilteredStacks();
         preFilteredList.clear();
         for (EntryStack stack : getStacksList()) {
-            if (findFirstOrNullEqualsEntryIgnoreAmount(set, stack) == null)
+            if (findFirstOrNullEqualsEntryIgnoreAmount(filteredStacks, stack) == null)
                 preFilteredList.add(stack);
         }
         long time = System.currentTimeMillis() - started;
-        RoughlyEnoughItemsCore.LOGGER.info("[REI] Refiltered %d entries in %dms.", set.size(), time);
+        RoughlyEnoughItemsCore.LOGGER.info("[REI] Refiltered %d entries in %dms.", filteredStacks.size(), time);
     }
     
     public void reset() {