aboutsummaryrefslogtreecommitdiff
path: root/RoughlyEnoughItems-runtime/src/main
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2020-12-15 20:52:36 +0800
committershedaniel <daniel@shedaniel.me>2021-01-21 09:19:56 +0800
commitac030ff9080cad34645d0adaba4f05da680d3b32 (patch)
tree59da2fd4260659bea69499192b813ce74d204355 /RoughlyEnoughItems-runtime/src/main
parentf1564b19763dd6c92950572ba02a3d13cc110a40 (diff)
downloadRoughlyEnoughItems-ac030ff9080cad34645d0adaba4f05da680d3b32.tar.gz
RoughlyEnoughItems-ac030ff9080cad34645d0adaba4f05da680d3b32.tar.bz2
RoughlyEnoughItems-ac030ff9080cad34645d0adaba4f05da680d3b32.zip
Make config screen animations more bearable, fix work station recipes ignoring the visibility handlers.
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'RoughlyEnoughItems-runtime/src/main')
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/TransformingScreen.java8
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryWidget.java4
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java3
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java2
4 files changed, 13 insertions, 4 deletions
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/TransformingScreen.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/TransformingScreen.java
index c85308476..ae6772e02 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/TransformingScreen.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/TransformingScreen.java
@@ -45,6 +45,7 @@ public class TransformingScreen extends DelegateScreen implements ScissorsScreen
private Runnable init;
private boolean renderingLastScreen = false;
private boolean translatingLast;
+ private boolean initAfter = false;
public TransformingScreen(boolean translatingLast, Screen parent, Screen lastScreen, Runnable init, DoubleSupplier xTransformer, DoubleSupplier yTransformer, BooleanSupplier finished) {
super(Minecraft.getInstance().level == null && parent == null ? new TitleScreen() : parent);
@@ -56,6 +57,10 @@ public class TransformingScreen extends DelegateScreen implements ScissorsScreen
this.finished = finished;
}
+ public void setInitAfter(boolean initAfter) {
+ this.initAfter = initAfter;
+ }
+
public void setParentScreen(Screen parent) {
this.parent = parent;
}
@@ -128,6 +133,9 @@ public class TransformingScreen extends DelegateScreen implements ScissorsScreen
Minecraft.getInstance().screen = parent;
if (parent != null) {
Minecraft.getInstance().noRender = false;
+ if (initAfter) {
+ parent.init(Minecraft.getInstance(), Minecraft.getInstance().getWindow().getGuiScaledWidth(), Minecraft.getInstance().getWindow().getGuiScaledHeight());
+ }
}
} else {
super.tick();
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryWidget.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryWidget.java
index 471c19606..45a1776a9 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryWidget.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryWidget.java
@@ -368,10 +368,10 @@ public class EntryWidget extends Slot {
public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
if (ScreenHelper.isWithinRecipeViewingScreen && entryStacks.size() > 1 && containsMouse(mouseX, mouseY)) {
if (amount < 0) {
- EntryWidget.stackDisplayOffset += 500;
+ EntryWidget.stackDisplayOffset = ((System.currentTimeMillis() + stackDisplayOffset) / 1000 - 1) * 1000;
return true;
} else if (amount > 0) {
- EntryWidget.stackDisplayOffset -= 500;
+ EntryWidget.stackDisplayOffset = ((System.currentTimeMillis() + stackDisplayOffset) / 1000 + 1) * 1000;
return true;
}
}
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java
index 42cadb835..6ff9efcf0 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java
@@ -220,11 +220,12 @@ public class ConfigManagerImpl implements ConfigManager {
TransformingScreen parentTranslated;
{
MutableLong current = new MutableLong(0);
- parentTranslated = new TransformingScreen(true, null,
+ parentTranslated = new TransformingScreen(true, parent,
null,
() -> current.setValue(current.getValue() == 0 ? Util.getMillis() + (getConfig().isReducedMotion() ? -3000 : 0) : current.getValue()),
() -> 0, () -> (EasingMethod.EasingMethodImpl.EXPO.apply(MathHelper.clamp((Util.getMillis() - current.getValue()) / 750.0, 0, 1)))
* Minecraft.getInstance().getWindow().getGuiScaledHeight(), () -> Util.getMillis() - current.getValue() > 800);
+ parentTranslated.setInitAfter(true);
}
ConfigScreenProvider<ConfigObjectImpl> provider = (ConfigScreenProvider<ConfigObjectImpl>) AutoConfig.getConfigScreen(ConfigObjectImpl.class, parentTranslated);
provider.setI13nFunction(manager -> "config.roughlyenoughitems");
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java
index 157329fab..f864d7ff8 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java
@@ -206,7 +206,7 @@ public class RecipeHelperImpl implements RecipeHelper {
}
for (EntryStack stack : usagesFor) {
if (isStackWorkStationOfCategory(categoryId, stack)) {
- set.addAll(allRecipesFromCategory);
+ set.addAll(CollectionUtils.filter(allRecipesFromCategory, this::isDisplayVisible));
break;
}
}