aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2023-02-19 02:05:30 +0800
committershedaniel <daniel@shedaniel.me>2024-04-16 00:38:18 +0900
commitab7a2bb72b9ee9591049d4ec3c8815d57986bd2c (patch)
treea8c0c0fb76ac58537f5d4bafdc55a416f3a31b43
parenteb2b1d1ecc00ba435e97b5d89879ebe379fd7390 (diff)
downloadRoughlyEnoughItems-ab7a2bb72b9ee9591049d4ec3c8815d57986bd2c.tar.gz
RoughlyEnoughItems-ab7a2bb72b9ee9591049d4ec3c8815d57986bd2c.tar.bz2
RoughlyEnoughItems-ab7a2bb72b9ee9591049d4ec3c8815d57986bd2c.zip
Mini Displays Favorites
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/entry/region/RegionEntry.java10
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/favorites/FavoriteEntry.java7
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/favorites/FavoriteEntryType.java6
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/common/entry/settings/EntryIngredientSetting.java2
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ArmorDyeRecipeFiller.java2
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/BannerDuplicateRecipeFiller.java2
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/BookCloningRecipeFiller.java2
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/CraftingRecipeFiller.java2
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/FireworkRocketRecipeFiller.java2
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/MapCloningRecipeFiller.java2
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/MapExtendingRecipeFiller.java2
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShieldDecorationRecipeFiller.java2
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShulkerBoxColoringFiller.java2
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/SuspiciousStewRecipeFiller.java2
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/TippedArrowRecipeFiller.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/FavoritesConfigManager.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/collapsible/CollapsibleConfigManager.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/favorites/DelegatingFavoriteEntryProviderImpl.java11
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/dragging/CurrentDraggingStack.java33
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntriesScreen.java23
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/collapsible/CollapsibleEntryWidget.java23
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/DisplayCompositeWidget.java80
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/favorites/FavoritesListWidget.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/favorites/listeners/FavoritesRegionListener.java12
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/favorites/panel/FavoritesPanel.java5
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/favorites/panel/rows/FavoritesPanelEntriesRow.java7
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/region/EntryStacksRegionWidget.java96
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/region/RegionDraggableStack.java25
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/region/RegionListener.java13
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/util/AbstractIndexedCyclingList.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/util/ClientTickCounter.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/util/ConcatenatedListIterator.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/util/CyclingList.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/util/OriginalRetainingCyclingList.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/plugin/client/runtime/DefaultClientRuntimePlugin.java171
-rw-r--r--runtime/src/test/java/CyclingListTest.java2
36 files changed, 476 insertions, 90 deletions
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/entry/region/RegionEntry.java b/api/src/main/java/me/shedaniel/rei/api/client/entry/region/RegionEntry.java
index cf88e5263..d6ed83471 100644
--- a/api/src/main/java/me/shedaniel/rei/api/client/entry/region/RegionEntry.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/entry/region/RegionEntry.java
@@ -25,7 +25,11 @@ package me.shedaniel.rei.api.client.entry.region;
import me.shedaniel.rei.api.client.favorites.FavoriteEntry;
import me.shedaniel.rei.api.client.favorites.FavoriteMenuEntry;
+import me.shedaniel.rei.api.client.gui.drag.component.DraggableComponent;
+import me.shedaniel.rei.api.client.gui.widgets.Slot;
import me.shedaniel.rei.api.common.entry.EntryStack;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Nullable;
import java.util.Collection;
import java.util.Optional;
@@ -55,4 +59,10 @@ public interface RegionEntry<T extends RegionEntry<T>> {
default boolean doAction(int button) {
return false;
}
+
+ @Nullable
+ @ApiStatus.Experimental
+ default DraggableComponent<?> asDraggableComponent(Slot slot) {
+ return null;
+ }
}
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/favorites/FavoriteEntry.java b/api/src/main/java/me/shedaniel/rei/api/client/favorites/FavoriteEntry.java
index 2c5293ba5..42a884d0d 100644
--- a/api/src/main/java/me/shedaniel/rei/api/client/favorites/FavoriteEntry.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/favorites/FavoriteEntry.java
@@ -28,12 +28,14 @@ import com.mojang.serialization.Lifecycle;
import me.shedaniel.rei.api.client.entry.region.RegionEntry;
import me.shedaniel.rei.api.client.gui.Renderer;
import me.shedaniel.rei.api.client.util.ClientEntryStacks;
+import me.shedaniel.rei.api.common.display.Display;
import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.impl.ClientInternals;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
+import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
@@ -73,6 +75,11 @@ public abstract class FavoriteEntry implements RegionEntry<FavoriteEntry> {
return delegateResult(() -> FavoriteEntryType.registry().get(FavoriteEntryType.ENTRY_STACK).fromArgs(stack), null);
}
+ @ApiStatus.Experimental
+ public static FavoriteEntry fromDisplay(Display display) {
+ return delegateResult(() -> FavoriteEntryType.registry().get(FavoriteEntryType.DISPLAY).fromArgs(display), null);
+ }
+
@Override
public boolean isEntryInvalid() {
return isInvalid();
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/favorites/FavoriteEntryType.java b/api/src/main/java/me/shedaniel/rei/api/client/favorites/FavoriteEntryType.java
index 40e1bcf43..62236f22c 100644
--- a/api/src/main/java/me/shedaniel/rei/api/client/favorites/FavoriteEntryType.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/favorites/FavoriteEntryType.java
@@ -25,6 +25,7 @@ package me.shedaniel.rei.api.client.favorites;
import com.mojang.serialization.DataResult;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
+import me.shedaniel.rei.api.common.display.Display;
import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.plugins.PluginManager;
import me.shedaniel.rei.api.common.registry.Reloadable;
@@ -44,6 +45,11 @@ public interface FavoriteEntryType<T extends FavoriteEntry> {
* A builtin type of favorites, wrapping a {@link EntryStack}.
*/
ResourceLocation ENTRY_STACK = new ResourceLocation("roughlyenoughitems", "entry_stack");
+ /**
+ * A builtin type of favorites, wrapping a {@link Display}.
+ */
+ @ApiStatus.Experimental
+ ResourceLocation DISPLAY = new ResourceLocation("roughlyenoughitems", "display");
static Registry registry() {
return PluginManager.getClientInstance().get(FavoriteEntryType.Registry.class);
diff --git a/api/src/main/java/me/shedaniel/rei/api/common/entry/settings/EntryIngredientSetting.java b/api/src/main/java/me/shedaniel/rei/api/common/entry/settings/EntryIngredientSetting.java
index 78f61f446..0a9666ca2 100644
--- a/api/src/main/java/me/shedaniel/rei/api/common/entry/settings/EntryIngredientSetting.java
+++ b/api/src/main/java/me/shedaniel/rei/api/common/entry/settings/EntryIngredientSetting.java
@@ -1,6 +1,6 @@
/*
* This file is licensed under the MIT License, part of Roughly Enough Items.
- * Copyright (c) 2018, 2019, 2020, 2021, 2022 shedaniel
+ * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ArmorDyeRecipeFiller.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ArmorDyeRecipeFiller.java
index ab3f38ce7..2582beb51 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ArmorDyeRecipeFiller.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ArmorDyeRecipeFiller.java
@@ -1,6 +1,6 @@
/*
* This file is licensed under the MIT License, part of Roughly Enough Items.
- * Copyright (c) 2018, 2019, 2020, 2021, 2022 shedaniel
+ * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/BannerDuplicateRecipeFiller.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/BannerDuplicateRecipeFiller.java
index ac37fa0e4..72003af8d 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/BannerDuplicateRecipeFiller.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/BannerDuplicateRecipeFiller.java
@@ -1,6 +1,6 @@
/*
* This file is licensed under the MIT License, part of Roughly Enough Items.
- * Copyright (c) 2018, 2019, 2020, 2021, 2022 shedaniel
+ * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/BookCloningRecipeFiller.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/BookCloningRecipeFiller.java
index 25a11cadb..74b3c0101 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/BookCloningRecipeFiller.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/BookCloningRecipeFiller.java
@@ -1,6 +1,6 @@
/*
* This file is licensed under the MIT License, part of Roughly Enough Items.
- * Copyright (c) 2018, 2019, 2020, 2021, 2022 shedaniel
+ * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/CraftingRecipeFiller.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/CraftingRecipeFiller.java
index ad4353e52..ac575045b 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/CraftingRecipeFiller.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/CraftingRecipeFiller.java
@@ -1,6 +1,6 @@
/*
* This file is licensed under the MIT License, part of Roughly Enough Items.
- * Copyright (c) 2018, 2019, 2020, 2021, 2022 shedaniel
+ * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/FireworkRocketRecipeFiller.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/FireworkRocketRecipeFiller.java
index 715fd61cf..90357ca88 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/FireworkRocketRecipeFiller.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/FireworkRocketRecipeFiller.java
@@ -1,6 +1,6 @@
/*
* This file is licensed under the MIT License, part of Roughly Enough Items.
- * Copyright (c) 2018, 2019, 2020, 2021, 2022 shedaniel
+ * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/MapCloningRecipeFiller.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/MapCloningRecipeFiller.java
index 5e85b41d0..e36a6fd8f 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/MapCloningRecipeFiller.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/MapCloningRecipeFiller.java
@@ -1,6 +1,6 @@
/*
* This file is licensed under the MIT License, part of Roughly Enough Items.
- * Copyright (c) 2018, 2019, 2020, 2021, 2022 shedaniel
+ * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/MapExtendingRecipeFiller.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/MapExtendingRecipeFiller.java
index 0341f2e2a..34a892e69 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/MapExtendingRecipeFiller.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/MapExtendingRecipeFiller.java
@@ -1,6 +1,6 @@
/*
* This file is licensed under the MIT License, part of Roughly Enough Items.
- * Copyright (c) 2018, 2019, 2020, 2021, 2022 shedaniel
+ * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShieldDecorationRecipeFiller.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShieldDecorationRecipeFiller.java
index 4af46ffdf..a26c3f14a 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShieldDecorationRecipeFiller.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShieldDecorationRecipeFiller.java
@@ -1,6 +1,6 @@
/*
* This file is licensed under the MIT License, part of Roughly Enough Items.
- * Copyright (c) 2018, 2019, 2020, 2021, 2022 shedaniel
+ * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShulkerBoxColoringFiller.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShulkerBoxColoringFiller.java
index 4dcbebf7d..1a1240925 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShulkerBoxColoringFiller.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/ShulkerBoxColoringFiller.java
@@ -1,6 +1,6 @@
/*
* This file is licensed under the MIT License, part of Roughly Enough Items.
- * Copyright (c) 2018, 2019, 2020, 2021, 2022 shedaniel
+ * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/SuspiciousStewRecipeFiller.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/SuspiciousStewRecipeFiller.java
index 9afc74f26..bfd82e763 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/SuspiciousStewRecipeFiller.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/SuspiciousStewRecipeFiller.java
@@ -1,6 +1,6 @@
/*
* This file is licensed under the MIT License, part of Roughly Enough Items.
- * Copyright (c) 2018, 2019, 2020, 2021, 2022 shedaniel
+ * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/TippedArrowRecipeFiller.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/TippedArrowRecipeFiller.java
index b560c9d7e..e0d62e357 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/TippedArrowRecipeFiller.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/filler/TippedArrowRecipeFiller.java
@@ -1,6 +1,6 @@
/*
* This file is licensed under the MIT License, part of Roughly Enough Items.
- * Copyright (c) 2018, 2019, 2020, 2021, 2022 shedaniel
+ * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/FavoritesConfigManager.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/FavoritesConfigManager.java
index b4a73f007..7c10ded8a 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/FavoritesConfigManager.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/FavoritesConfigManager.java
@@ -1,6 +1,6 @@
/*
* This file is licensed under the MIT License, part of Roughly Enough Items.
- * Copyright (c) 2018, 2019, 2020, 2021, 2022 shedaniel
+ * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/collapsible/CollapsibleConfigManager.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/collapsible/CollapsibleConfigManager.java
index edcca423d..1a7781111 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/collapsible/CollapsibleConfigManager.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/collapsible/CollapsibleConfigManager.java
@@ -1,6 +1,6 @@
/*
* This file is licensed under the MIT License, part of Roughly Enough Items.
- * Copyright (c) 2018, 2019, 2020, 2021, 2022 shedaniel
+ * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/favorites/DelegatingFavoriteEntryProviderImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/favorites/DelegatingFavoriteEntryProviderImpl.java
index 17d34c12f..e84b9f942 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/favorites/DelegatingFavoriteEntryProviderImpl.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/favorites/DelegatingFavoriteEntryProviderImpl.java
@@ -27,8 +27,11 @@ import com.mojang.serialization.DataResult;
import me.shedaniel.rei.api.client.favorites.FavoriteEntry;
import me.shedaniel.rei.api.client.favorites.FavoriteMenuEntry;
import me.shedaniel.rei.api.client.gui.Renderer;
+import me.shedaniel.rei.api.client.gui.drag.component.DraggableComponent;
+import me.shedaniel.rei.api.client.gui.widgets.Slot;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
+import org.jetbrains.annotations.Nullable;
import java.util.Collection;
import java.util.Objects;
@@ -93,6 +96,8 @@ public class DelegatingFavoriteEntryProviderImpl extends FavoriteEntry {
@Override
public FavoriteEntry copy() {
+ if (value != null && toJson != null) return value.copy();
+ if (value != null) return FavoriteEntry.delegateResult(() -> DataResult.success(value.copy()), toJson);
return FavoriteEntry.delegateResult(supplier, toJson);
}
@@ -114,4 +119,10 @@ public class DelegatingFavoriteEntryProviderImpl extends FavoriteEntry {
public boolean isSame(FavoriteEntry other) {
return getUnwrapped().isSame(other.getUnwrapped());
}
+
+ @Override
+ @Nullable
+ public DraggableComponent<?> asDraggableComponent(Slot slot) {
+ return getUnwrapped().asDraggableComponent(slot);
+ }
}
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/dragging/CurrentDraggingStack.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/dragging/CurrentDraggingStack.java
index 838c14516..4e1cbc59f 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/dragging/CurrentDraggingStack.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/dragging/CurrentDraggingStack.java
@@ -26,9 +26,7 @@ package me.shedaniel.rei.impl.client.gui.dragging;
import com.mojang.blaze3d.vertex.PoseStack;
import me.shedaniel.clothconfig2.api.animator.NumberAnimator;
import me.shedaniel.clothconfig2.api.animator.ValueAnimator;
-import me.shedaniel.math.FloatingRectangle;
-import me.shedaniel.math.Point;
-import me.shedaniel.math.Rectangle;
+import me.shedaniel.math.*;
import me.shedaniel.rei.RoughlyEnoughItemsCoreClient;
import me.shedaniel.rei.api.client.config.ConfigObject;
import me.shedaniel.rei.api.client.gui.drag.DraggableBoundsProvider;
@@ -87,13 +85,14 @@ public class CurrentDraggingStack extends Widget implements LateRenderable, Drag
if (entry.dragging) {
matrices.pushPose();
matrices.translate(0, 0, 600);
- entry.bounds.update(delta);
+ entry.point.update(delta);
+ entry.dimension.update(delta);
int width = entry.component.getWidth();
int height = entry.component.getHeight();
Vec2 mouseStartOffset = entry.mouseStartOffset;
- entry.bounds.setTo(new FloatingRectangle(mouseX - width / 2 - mouseStartOffset.x, mouseY - height / 2 - mouseStartOffset.y, width, height),
- reducedMotion ? 0 : 30);
- entry.component.render(matrices, entry.bounds.value().getBounds(), mouseX, mouseY, delta);
+ entry.point.setTo(new FloatingPoint(mouseX - mouseStartOffset.x * width, mouseY - mouseStartOffset.y * height), reducedMotion ? 0 : 30);
+ entry.dimension.setTo(new FloatingDimension(width, height), reducedMotion ? 0 : 700);
+ entry.component.render(matrices, getCurrentBounds(), mouseX, mouseY, delta);
matrices.popPose();
VoxelShape shape = entry.getBoundsProvider().bounds();
@@ -216,16 +215,18 @@ public class CurrentDraggingStack extends Widget implements LateRenderable, Drag
public Point getCurrentPosition() {
if (!isDraggingComponent()) return null;
Vec2 mouseStartOffset = entry.mouseStartOffset;
- FloatingRectangle rectangle = entry.bounds.value();
- return new Point(rectangle.getCenterX() + mouseStartOffset.x, rectangle.getCenterY() + mouseStartOffset.y);
+ FloatingPoint point = entry.point.value();
+ FloatingDimension dimension = entry.dimension.value();
+ return new Point(point.x + mouseStartOffset.x * dimension.width, point.y + mouseStartOffset.y * dimension.height);
}
@Override
@Nullable
public Rectangle getCurrentBounds() {
if (!isDraggingComponent()) return null;
- FloatingRectangle rectangle = entry.bounds.value();
- return rectangle.getBounds();
+ FloatingPoint point = entry.point.value();
+ FloatingDimension dimension = entry.dimension.value();
+ return new Rectangle(point.x - dimension.width / 2, point.y - dimension.height / 2, dimension.width, dimension.height);
}
@Override
@@ -249,7 +250,8 @@ public class CurrentDraggingStack extends Widget implements LateRenderable, Drag
private final DraggableComponent<?> component;
private final Point start;
private long startDragging = -1;
- private final ValueAnimator<FloatingRectangle> bounds;
+ private final ValueAnimator<FloatingPoint> point;
+ private final ValueAnimator<FloatingDimension> dimension;
private final Vec2 mouseStartOffset;
private boolean dragging = false;
private DraggableBoundsProvider boundsProvider;