aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2021-03-16 01:47:33 +0800
committershedaniel <daniel@shedaniel.me>2021-03-16 01:47:33 +0800
commitd60fd316cc872c8e2d6500f071598ebf79364d4a (patch)
treeb0400b9e73758c86519cdc7a1f4434a818212247
parentde461fde691f593b85ffeae837b5b419a9abf7cc (diff)
downloadRoughlyEnoughItems-d60fd316cc872c8e2d6500f071598ebf79364d4a.tar.gz
RoughlyEnoughItems-d60fd316cc872c8e2d6500f071598ebf79364d4a.tar.bz2
RoughlyEnoughItems-d60fd316cc872c8e2d6500f071598ebf79364d4a.zip
Implement IGuiIngredientGroup, wrap FluidStack to arch FluidStack properly
Signed-off-by: shedaniel <daniel@shedaniel.me>
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/gui/widgets/Slot.java15
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/ingredient/EntryIngredient.java3
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/ingredient/EntryStack.java6
-rwxr-xr-xbuild.gradle2
-rw-r--r--fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java16
-rw-r--r--forge/build.gradle9
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java5
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryWidget.java11
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/AbstractEntryStack.java3
9 files changed, 44 insertions, 26 deletions
diff --git a/api/src/main/java/me/shedaniel/rei/api/gui/widgets/Slot.java b/api/src/main/java/me/shedaniel/rei/api/gui/widgets/Slot.java
index c11c3484c..1092d7675 100644
--- a/api/src/main/java/me/shedaniel/rei/api/gui/widgets/Slot.java
+++ b/api/src/main/java/me/shedaniel/rei/api/gui/widgets/Slot.java
@@ -24,6 +24,7 @@
package me.shedaniel.rei.api.gui.widgets;
import me.shedaniel.math.Point;
+import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.ingredient.EntryStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -32,21 +33,25 @@ import java.util.Collection;
import java.util.List;
public abstract class Slot extends WidgetWithBounds {
+ public static final byte UN_MARKED = 0;
+ public static final byte INPUT = 1;
+ public static final byte OUTPUT = 2;
+
@NotNull
public Slot unmarkInputOrOutput() {
- setNoticeMark((byte) 0);
+ setNoticeMark(UN_MARKED);
return this;
}
@NotNull
public final Slot markInput() {
- setNoticeMark((byte) 1);
+ setNoticeMark(INPUT);
return this;
}
@NotNull
public final Slot markOutput() {
- setNoticeMark((byte) 2);
+ setNoticeMark(OUTPUT);
return this;
}
@@ -148,9 +153,13 @@ public abstract class Slot extends WidgetWithBounds {
@NotNull
public abstract Slot entries(Collection<? extends EntryStack<?>> stacks);
+ public abstract EntryStack<?> getCurrentEntry();
+
@NotNull
public abstract List<EntryStack<?>> getEntries();
+ public abstract Rectangle getInnerBounds();
+
@Nullable
public Tooltip getCurrentTooltip(Point point) {
return null;
diff --git a/api/src/main/java/me/shedaniel/rei/api/ingredient/EntryIngredient.java b/api/src/main/java/me/shedaniel/rei/api/ingredient/EntryIngredient.java
index 2d9feb9bb..5eea0debe 100644
--- a/api/src/main/java/me/shedaniel/rei/api/ingredient/EntryIngredient.java
+++ b/api/src/main/java/me/shedaniel/rei/api/ingredient/EntryIngredient.java
@@ -44,7 +44,8 @@ public interface EntryIngredient extends List<EntryStack<?>> {
return Internals.getEntryIngredientProvider().of(stacks);
}
+ @SuppressWarnings({"RedundantCast", "rawtypes"})
static <T> EntryIngredient of(Iterable<? extends EntryStack<? extends T>> stacks) {
- return Internals.getEntryIngredientProvider().of((Iterable<EntryStack<?>>) stacks);
+ return Internals.getEntryIngredientProvider().of((Iterable<EntryStack<?>>) (Iterable) stacks);
}
}
diff --git a/api/src/main/java/me/shedaniel/rei/api/ingredient/EntryStack.java b/api/src/main/java/me/shedaniel/rei/api/ingredient/EntryStack.java
index 9e62eb9a1..57a51896e 100644
--- a/api/src/main/java/me/shedaniel/rei/api/ingredient/EntryStack.java
+++ b/api/src/main/java/me/shedaniel/rei/api/ingredient/EntryStack.java
@@ -155,12 +155,18 @@ public interface EntryStack<T> extends TextRepresentable, Renderer {
public static final Supplier<Boolean> TRUE = () -> true;
public static final Supplier<Boolean> FALSE = () -> false;
public static final Settings<Supplier<Boolean>> RENDER = new Settings<>(TRUE);
+ @Deprecated
public static final Settings<Supplier<Boolean>> CHECK_TAGS = new Settings<>(FALSE);
+ @Deprecated
public static final Settings<Supplier<Boolean>> CHECK_AMOUNT = new Settings<>(FALSE);
+ @Deprecated
public static final Settings<Supplier<Boolean>> TOOLTIP_ENABLED = new Settings<>(TRUE);
+ @Deprecated
public static final Settings<Supplier<Boolean>> TOOLTIP_APPEND_MOD = new Settings<>(TRUE);
public static final Settings<Supplier<Boolean>> RENDER_COUNTS = new Settings<>(TRUE);
+ @Deprecated
public static final Settings<Function<EntryStack<?>, List<Component>>> TOOLTIP_APPEND_EXTRA = new Settings<>(stack -> Collections.emptyList());
+ @Deprecated
public static final Settings<Function<EntryStack<?>, String>> COUNTS = new Settings<>(stack -> null);
private static short nextId;
diff --git a/build.gradle b/build.gradle
index 29607c1cd..927684add 100755
--- a/build.gradle
+++ b/build.gradle
@@ -1,5 +1,5 @@
plugins {
- id("architectury-plugin") version("3.0.97")
+ id("architectury-plugin") version("3.0-SNAPSHOT")
id("forgified-fabric-loom") version("0.6-SNAPSHOT") apply false
id("org.cadixdev.licenser") version("0.5.0")
id("com.matthewprenger.cursegradle") version("1.4.0")
diff --git a/fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java b/fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java
index b7a5900c2..55293fdde 100644
--- a/fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java
+++ b/fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java
@@ -40,14 +40,10 @@ public class PluginDetectorImpl {
@Environment(EnvType.CLIENT)
public static void detectClientPlugins() {
- for (ModContainer modContainer : FabricLoader.getInstance().getAllMods()) {
- if (modContainer.getMetadata().containsCustomElement("roughlyenoughitems:plugins"))
- RoughlyEnoughItemsCore.LOGGER.error("REI plugin from " + modContainer.getMetadata().getId() + " is not loaded because it is too old!");
- }
-
for (REIPlugin plugin : Iterables.concat(
+ FabricLoader.getInstance().getEntrypoints("rei", REIPlugin.class),
FabricLoader.getInstance().getEntrypoints("rei_plugins", REIPlugin.class),
- FabricLoader.getInstance().getEntrypoints("rei", REIPlugin.class)
+ FabricLoader.getInstance().getEntrypoints("rei_plugins_v0", REIPlugin.class)
)) {
try {
registerPlugin(plugin);
@@ -56,14 +52,6 @@ public class PluginDetectorImpl {
RoughlyEnoughItemsCore.LOGGER.error("Can't load REI plugins from %s: %s", plugin.getClass(), e.getLocalizedMessage());
}
}
- for (REIPlugin reiPlugin : FabricLoader.getInstance().getEntrypoints("rei_plugins_v0", REIPlugin.class)) {
- try {
- registerPlugin(reiPlugin);
- } catch (Exception e) {
- e.printStackTrace();
- RoughlyEnoughItemsCore.LOGGER.error("Can't load REI plugins from %s: %s", reiPlugin.getClass(), e.getLocalizedMessage());
- }
- }
if (FabricLoader.getInstance().isModLoaded("libblockattributes-fluids")) {
try {
registerPlugin((REIPlugin) Class.forName("me.shedaniel.rei.compat.LBASupportPlugin").getConstructor().newInstance());
diff --git a/forge/build.gradle b/forge/build.gradle
index ee643b74b..e19ea7a63 100644
--- a/forge/build.gradle
+++ b/forge/build.gradle
@@ -14,6 +14,14 @@ processResources {
repositories {
maven { url "https://www.cursemaven.com" }
+ maven {
+ name "Modmaven"
+ url "https://modmaven.dev/"
+ // For Gradle 5.1 and above, limit it to just AE2
+ content {
+ includeGroup 'appeng'
+ }
+ }
}
dependencies {
@@ -33,4 +41,5 @@ dependencies {
modRuntime("curse.maven:chiselsbits-231095:3176033")
modRuntime("curse.maven:jumbofurnace-390880:3120970")
modRuntime("curse.maven:cyclic-239286:3221427")
+ modRuntime("appeng:appliedenergistics2:8.2.0")
}
diff --git a/runtime/src/main/java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java b/runtime/src/main/java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java
index fd8007d19..02deb5231 100644
--- a/runtime/src/main/java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java
+++ b/runtime/src/main/java/me/shedaniel/rei/gui/AbstractRecipeViewingScreen.java
@@ -25,6 +25,7 @@ package me.shedaniel.rei.gui;
import com.google.common.collect.Lists;
import me.shedaniel.math.Rectangle;
+import me.shedaniel.rei.api.gui.widgets.Slot;
import me.shedaniel.rei.api.gui.widgets.Widget;
import me.shedaniel.rei.api.ingredient.EntryStack;
import me.shedaniel.rei.api.registry.display.Display;
@@ -110,11 +111,11 @@ public abstract class AbstractRecipeViewingScreen extends Screen implements Reci
}
protected void transformIngredientNotice(List<Widget> setupDisplay, EntryStack<?> noticeStack) {
- transformNotice(1, setupDisplay, noticeStack);
+ transformNotice(Slot.INPUT, setupDisplay, noticeStack);
}
protected void transformResultNotice(List<Widget> setupDisplay, EntryStack<?> noticeStack) {
- transformNotice(2, setupDisplay, noticeStack);
+ transformNotice(Slot.OUTPUT, setupDisplay, noticeStack);
}
private static void transformNotice(int marker, List<Widget> setupDisplay, EntryStack<?> noticeStack) {
diff --git a/runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryWidget.java b/runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryWidget.java
index e9288668b..2947539d4 100644
--- a/runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryWidget.java
+++ b/runtime/src/main/java/me/shedaniel/rei/gui/widget/EntryWidget.java
@@ -247,12 +247,14 @@ public class EntryWidget extends Slot {
return this;
}
+ @Override
public EntryStack<?> getCurrentEntry() {
- if (entryStacks.isEmpty())
+ int size = entryStacks.size();
+ if (size == 0)
return EntryStack.empty();
- if (entryStacks.size() == 1)
+ if (size == 1)
return entryStacks.get(0);
- return entryStacks.get(Mth.floor(((System.currentTimeMillis() + stackDisplayOffset) / 1000 % (double) entryStacks.size())));
+ return entryStacks.get(Mth.floor(((System.currentTimeMillis() + stackDisplayOffset) / 1000 % (double) size)));
}
@Override
@@ -266,7 +268,8 @@ public class EntryWidget extends Slot {
return bounds;
}
- protected Rectangle getInnerBounds() {
+ @Override
+ public Rectangle getInnerBounds() {
return new Rectangle(bounds.x + 1, bounds.y + 1, bounds.width - 2, bounds.height - 2);
}
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/AbstractEntryStack.java b/runtime/src/main/java/me/shedaniel/rei/impl/AbstractEntryStack.java
index 9556b2866..6c176dbc1 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/AbstractEntryStack.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/AbstractEntryStack.java
@@ -102,7 +102,8 @@ public abstract class AbstractEntryStack<A> extends AbstractRenderer implements
}
@Override
- public @Nullable Tooltip getTooltip(Point mouse) {
+ @Nullable
+ public Tooltip getTooltip(Point mouse) {
return this.getDefinition().getRenderer().getTooltip(this, mouse);
}