Parcourir la source

Update gradle to 4.10.3, fix #59, fix some Intellij IDEA complaints (#60)

remove "debug" println-s

remove stuff from testing

update gradle to 4.10.3, fix #59, fix some Intellij IDEA complaints

fix formatting

update gradle to 4.10.3, fix #59, fix some Intellij IDEA complaints
geni il y a 6 ans
Parent
commit
cbccc121dc

+ 4 - 4
gradle.properties

@@ -1,9 +1,9 @@
 mod_version=2.7.3+build.87
-minecraft_version=1.14 Pre-Release 1
-yarn_version=1.14 Pre-Release 1+build.3
+minecraft_version=1.14 Pre-Release 2
+yarn_version=1.14 Pre-Release 2+build.1
 fabric_version=0.2.7+build.122
-fabricloader_version=0.4.0+build.119
+fabricloader_version=0.4.0+build.121
 jankson_version=1.1.0
 cloth_events_version=0.3.1.23
 cloth_config_version=0.1.2.6
-modmenu_version=1.2.1-45
+modmenu_version=1.3.0-52

+ 1 - 1
gradle/wrapper/gradle-wrapper.properties

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip

+ 19 - 17
src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java

@@ -57,7 +57,7 @@ public class ContainerScreenOverlay extends AbstractParentElement implements Dra
         DisplayHelper.DisplayBoundsHandler boundsHandler = RoughlyEnoughItemsCore.getDisplayHelper().getResponsibleBoundsHandler(MinecraftClient.getInstance().currentScreen.getClass());
         this.rectangle = RoughlyEnoughItemsCore.getConfigManager().getConfig().mirrorItemPanel ? boundsHandler.getLeftBounds(MinecraftClient.getInstance().currentScreen) : boundsHandler.getRightBounds(MinecraftClient.getInstance().currentScreen);
         this.lastLeft = getLeft();
-        widgets.add(this.itemListOverlay = new ItemListOverlay(page));
+        widgets.add(itemListOverlay = new ItemListOverlay(page));
         itemListOverlay.updateList(boundsHandler, boundsHandler.getItemListArea(rectangle), page, searchTerm);
         
         widgets.add(buttonLeft = new ButtonWidget(rectangle.x, rectangle.y + 5, 16, 16, new TranslatableTextComponent("text.rei.left_arrow")) {
@@ -98,8 +98,10 @@ public class ContainerScreenOverlay extends AbstractParentElement implements Dra
                 return false;
             }
         });
+
         if (setPage)
             page = MathHelper.clamp(page, 0, getTotalPage());
+
         widgets.add(new ButtonWidget(RoughlyEnoughItemsCore.getConfigManager().getConfig().mirrorItemPanel ? window.getScaledWidth() - 30 : 10, 10, 20, 20, "") {
             @Override
             public void onPressed() {
@@ -328,7 +330,7 @@ public class ContainerScreenOverlay extends AbstractParentElement implements Dra
         ScreenHelper.searchField.laterRender(mouseX, mouseY, delta);
         Screen currentScreen = MinecraftClient.getInstance().currentScreen;
         if (!(currentScreen instanceof RecipeViewingScreen) || !((RecipeViewingScreen) currentScreen).choosePageActivated)
-            QUEUED_TOOLTIPS.stream().filter(queuedTooltip -> queuedTooltip != null).forEach(queuedTooltip -> renderTooltip(queuedTooltip.getText(), queuedTooltip.getLocation().x, queuedTooltip.getLocation().y));
+            QUEUED_TOOLTIPS.stream().filter(Objects::nonNull).forEach(queuedTooltip -> renderTooltip(queuedTooltip.getText(), queuedTooltip.getLocation().x, queuedTooltip.getLocation().y));
         QUEUED_TOOLTIPS.clear();
     }
     
@@ -340,9 +342,7 @@ public class ContainerScreenOverlay extends AbstractParentElement implements Dra
             GuiLighting.disable();
             GlStateManager.disableLighting();
             int int_3 = 0;
-            Iterator var5 = list_1.iterator();
-            while (var5.hasNext()) {
-                String string_1 = (String) var5.next();
+            for (String string_1 : list_1) {
                 int int_4 = font.getStringWidth(string_1);
                 if (int_4 > int_3)
                     int_3 = int_4;
@@ -384,17 +384,20 @@ public class ContainerScreenOverlay extends AbstractParentElement implements Dra
     }
     
     private boolean hasSameListContent(List<ItemStack> list1, List<ItemStack> list2) {
-        Collections.sort(list1, (itemStack, t1) -> {
-            return ItemListOverlay.tryGetItemStackName(itemStack).compareToIgnoreCase(ItemListOverlay.tryGetItemStackName(t1));
-        });
-        Collections.sort(list2, (itemStack, t1) -> {
-            return ItemListOverlay.tryGetItemStackName(itemStack).compareToIgnoreCase(ItemListOverlay.tryGetItemStackName(t1));
-        });
-        String lastString = String.join("", list1.stream().map(itemStack -> {
-            return ItemListOverlay.tryGetItemStackName(itemStack);
-        }).collect(Collectors.toList())), currentString = String.join("", list2.stream().map(itemStack -> {
-            return ItemListOverlay.tryGetItemStackName(itemStack);
-        }).collect(Collectors.toList()));
+        list1.sort((itemStack, t1) ->
+            ItemListOverlay.tryGetItemStackName(itemStack).compareToIgnoreCase(ItemListOverlay.tryGetItemStackName(t1))
+        );
+
+        list2.sort((itemStack, t1) ->
+            ItemListOverlay.tryGetItemStackName(itemStack).compareToIgnoreCase(ItemListOverlay.tryGetItemStackName(t1))
+        );
+
+        String lastString = list1.stream().map(
+            ItemListOverlay::tryGetItemStackName
+        ).collect(Collectors.joining("")), currentString = list2.stream().map(
+            ItemListOverlay::tryGetItemStackName
+        ).collect(Collectors.joining(""));
+
         return lastString.equals(currentString);
     }
     
@@ -461,7 +464,6 @@ public class ContainerScreenOverlay extends AbstractParentElement implements Dra
         }
         if (!ScreenHelper.isOverlayVisible())
             return false;
-        Point point = ClientUtils.getMouseLocation();
         ItemStack itemStack = null;
         if (MinecraftClient.getInstance().currentScreen instanceof ContainerScreen)
             if (ScreenHelper.getLastContainerScreenHooks().rei_getHoveredSlot() != null && !ScreenHelper.getLastContainerScreenHooks().rei_getHoveredSlot().getStack().isEmpty())

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

@@ -223,9 +223,8 @@ public class RecipeViewingScreen extends Screen {
             }
         });
         int recipesPerPageByHeight = getRecipesPerPageByHeight();
-        recipeBack.enabled = categoriesMap.get(selectedCategory).size() > recipesPerPageByHeight;
-        recipeNext.enabled = categoriesMap.get(selectedCategory).size() > recipesPerPageByHeight;
-        
+        recipeBack.enabled = recipeNext.enabled = categoriesMap.get(selectedCategory).size() > recipesPerPageByHeight;
+
         for(int i = 0; i < 6; i++) {
             int j = i + categoryPages * 6;
             if (categories.size() > j) {
@@ -305,7 +304,7 @@ public class RecipeViewingScreen extends Screen {
     
     private int getRecipesPerPageByHeight() {
         int height = selectedCategory.getDisplayHeight();
-        return MathHelper.clamp(MathHelper.floor(((double) guiHeight - 40d) / ((double) height + 7d)) - 1, 0, Math.min(RoughlyEnoughItemsCore.getConfigManager().getConfig().maxRecipePerPage - 1, selectedCategory.getMaximumRecipePerPage() - 1));
+        return MathHelper.clamp(MathHelper.floor(((double) guiHeight - 40d) / ((double) height + 7d)), 0, Math.min(RoughlyEnoughItemsCore.getConfigManager().getConfig().maxRecipePerPage - 1, selectedCategory.getMaximumRecipePerPage() - 1));
     }
     
     @Override
@@ -318,9 +317,9 @@ public class RecipeViewingScreen extends Screen {
             fill(bounds.x + 17, bounds.y + 5, bounds.x + bounds.width - 17, bounds.y + 17, SUB_COLOR.getRGB());
             fill(bounds.x + 17, bounds.y + 21, bounds.x + bounds.width - 17, bounds.y + 33, SUB_COLOR.getRGB());
         }
-        tabs.stream().filter(tabWidget -> {
-            return !tabWidget.isSelected();
-        }).forEach(tabWidget -> tabWidget.render(mouseX, mouseY, delta));
+        tabs.stream().filter(tabWidget ->
+            !tabWidget.isSelected()
+        ).forEach(tabWidget -> tabWidget.render(mouseX, mouseY, delta));
         GuiLighting.disable();
         super.render(mouseX, mouseY, delta);
         widgets.forEach(widget -> {
@@ -351,9 +350,7 @@ public class RecipeViewingScreen extends Screen {
     @Override
     public boolean charTyped(char char_1, int int_1) {
         if (choosePageActivated) {
-            if (recipeChoosePageWidget.charTyped(char_1, int_1))
-                return true;
-            return false;
+            return recipeChoosePageWidget.charTyped(char_1, int_1);
         }
         for(Element listener : children())
             if (listener.charTyped(char_1, int_1))
@@ -364,9 +361,7 @@ public class RecipeViewingScreen extends Screen {
     @Override
     public boolean mouseDragged(double double_1, double double_2, int int_1, double double_3, double double_4) {
         if (choosePageActivated) {
-            if (recipeChoosePageWidget.mouseDragged(double_1, double_2, int_1, double_3, double_4))
-                return true;
-            return false;
+            return recipeChoosePageWidget.mouseDragged(double_1, double_2, int_1, double_3, double_4);
         }
         return super.mouseDragged(double_1, double_2, int_1, double_3, double_4);
     }
@@ -374,9 +369,7 @@ public class RecipeViewingScreen extends Screen {
     @Override
     public boolean mouseReleased(double double_1, double double_2, int int_1) {
         if (choosePageActivated) {
-            if (recipeChoosePageWidget.mouseReleased(double_1, double_2, int_1))
-                return true;
-            return false;
+            return recipeChoosePageWidget.mouseReleased(double_1, double_2, int_1);
         }
         return super.mouseReleased(double_1, double_2, int_1);
     }
@@ -405,9 +398,7 @@ public class RecipeViewingScreen extends Screen {
     public boolean mouseClicked(double double_1, double double_2, int int_1) {
         if (choosePageActivated)
             if (recipeChoosePageWidget.isHighlighted(double_1, double_2)) {
-                if (recipeChoosePageWidget.mouseClicked(double_1, double_2, int_1))
-                    return true;
-                return false;
+                return recipeChoosePageWidget.mouseClicked(double_1, double_2, int_1);
             } else {
                 choosePageActivated = false;
                 init();

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

@@ -9,7 +9,7 @@ public abstract class ClickableLabelWidget extends LabelWidget {
     
     public static final int hoveredColor = (new Color(102, 255, 204)).getRGB();
     public boolean focused;
-    
+
     public ClickableLabelWidget(int x, int y, String text) {
         super(x, y, text);
     }

+ 1 - 1
src/main/java/me/shedaniel/rei/utils/ClothScreenRegistry.java

@@ -51,7 +51,7 @@ public class ClothScreenRegistry {
         builder.addCategory("text.rei.config.general").addOption(new BooleanListEntry("text.rei.config.cheating", RoughlyEnoughItemsCore.getConfigManager().getConfig().cheating, "text.cloth-config.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().cheating = bool));
         ConfigScreenBuilder.CategoryBuilder appearance = builder.addCategory("text.rei.config.appearance");
         appearance.addOption(new BooleanListEntry("text.rei.config.side_search_box", RoughlyEnoughItemsCore.getConfigManager().getConfig().sideSearchField, "text.cloth-config.reset_value", () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().sideSearchField = bool));
-        appearance.addOption(new EnumListEntry<ItemListOrderingConfig>("text.rei.config.list_ordering", ItemListOrderingConfig.class, ItemListOrderingConfig.from(RoughlyEnoughItemsCore.getConfigManager().getConfig().itemListOrdering, RoughlyEnoughItemsCore.getConfigManager().getConfig().isAscending), "text.cloth-config.reset_value", () -> ItemListOrderingConfig.REGISTRY_ASCENDING, config -> {
+        appearance.addOption(new EnumListEntry<>("text.rei.config.list_ordering", ItemListOrderingConfig.class, ItemListOrderingConfig.from(RoughlyEnoughItemsCore.getConfigManager().getConfig().itemListOrdering, RoughlyEnoughItemsCore.getConfigManager().getConfig().isAscending), "text.cloth-config.reset_value", () -> ItemListOrderingConfig.REGISTRY_ASCENDING, config -> {
             RoughlyEnoughItemsCore.getConfigManager().getConfig().itemListOrdering = config.getOrdering();
             RoughlyEnoughItemsCore.getConfigManager().getConfig().isAscending = config.isAscending();
         }));