aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me
diff options
context:
space:
mode:
authorUnknown <shekwancheung0528@gmail.com>2019-06-14 22:10:42 +0800
committerUnknown <shekwancheung0528@gmail.com>2019-06-14 22:10:42 +0800
commit69a531030df74768d86025cd5668e0418a3c1f07 (patch)
treef128d5b07b0a8cfa8f02def50477ce8bfef4a50e /src/main/java/me
parent5c29f7917d71dc0042ee2b71a1f7ba4f4c347fde (diff)
downloadRoughlyEnoughItems-69a531030df74768d86025cd5668e0418a3c1f07.tar.gz
RoughlyEnoughItems-69a531030df74768d86025cd5668e0418a3c1f07.tar.bz2
RoughlyEnoughItems-69a531030df74768d86025cd5668e0418a3c1f07.zip
stuff
Diffstat (limited to 'src/main/java/me')
-rw-r--r--src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java2
-rw-r--r--src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java4
-rw-r--r--src/main/java/me/shedaniel/rei/api/PluginFunction.java1
-rw-r--r--src/main/java/me/shedaniel/rei/api/REIPlugin.java21
-rw-r--r--src/main/java/me/shedaniel/rei/api/REIPluginEntry.java9
-rw-r--r--src/main/java/me/shedaniel/rei/api/RecipeDisplay.java7
-rw-r--r--src/main/java/me/shedaniel/rei/client/BaseBoundsHandlerImpl.java12
-rw-r--r--src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java2
-rw-r--r--src/main/java/me/shedaniel/rei/gui/widget/AutoCraftingButtonWidget.java6
-rw-r--r--src/main/java/me/shedaniel/rei/listeners/AbstractInventoryScreenHooks.java11
-rw-r--r--src/main/java/me/shedaniel/rei/mixin/MixinBrewingRecipeRegistry.java4
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/DefaultAutoCraftingPlugin.java34
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java34
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java39
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java30
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/blasting/DefaultBlastingCategory.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultBlastingCategory.java)3
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/blasting/DefaultBlastingDisplay.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultBlastingDisplay.java)3
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/brewing/BrewingRecipe.java (renamed from src/main/java/me/shedaniel/rei/plugin/BrewingRecipe.java)2
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingCategory.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultBrewingCategory.java)3
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultBrewingDisplay.java)3
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireCategory.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultCampfireCategory.java)3
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireDisplay.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultCampfireDisplay.java)3
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingCategory.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultCompostingCategory.java)3
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingDisplay.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultCompostingDisplay.java)3
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/crafting/DefaultCraftingCategory.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultCraftingCategory.java)3
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/crafting/DefaultCraftingDisplay.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultCraftingDisplay.java)3
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/crafting/DefaultCustomDisplay.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultCustomDisplay.java)2
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapedDisplay.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultShapedDisplay.java)3
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapelessDisplay.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultShapelessDisplay.java)2
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/smelting/DefaultSmeltingCategory.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultSmeltingCategory.java)3
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/smelting/DefaultSmeltingDisplay.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultSmeltingDisplay.java)3
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/smoking/DefaultSmokingCategory.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultSmokingCategory.java)3
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/smoking/DefaultSmokingDisplay.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultSmokingDisplay.java)3
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/stonecutting/DefaultStoneCuttingCategory.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultStoneCuttingCategory.java)3
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/stonecutting/DefaultStoneCuttingDisplay.java (renamed from src/main/java/me/shedaniel/rei/plugin/DefaultStoneCuttingDisplay.java)3
35 files changed, 192 insertions, 81 deletions
diff --git a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
index 24991284b..ca1bef9b0 100644
--- a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
+++ b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
@@ -147,8 +147,6 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer {
private void discoverPluginEntries() {
for(REIPluginEntry reiPlugin : FabricLoader.getInstance().getEntrypoints("rei_plugins", REIPluginEntry.class)) {
try {
- if (reiPlugin instanceof REIPlugin)
- throw new IllegalStateException("REI Plugins on Entry Points should not implement REIPlugin");
registerPlugin(reiPlugin.getPluginIdentifier(), reiPlugin);
} catch (Exception e) {
e.printStackTrace();
diff --git a/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java b/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java
index 3dea674fe..7d311609f 100644
--- a/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java
+++ b/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java
@@ -18,7 +18,7 @@ public interface BaseBoundsHandler extends DisplayHelper.DisplayBoundsHandler<Sc
* @param isOnRightSide whether the user has set the overlay to the right
* @return the list of exclusion zones
*/
- List<Rectangle> getCurrentExclusionZones(Class<? extends Screen> currentScreenClass, boolean isOnRightSide);
+ List<Rectangle> getCurrentExclusionZones(Class<?> currentScreenClass, boolean isOnRightSide);
/**
* Register an exclusion zone
@@ -26,7 +26,7 @@ public interface BaseBoundsHandler extends DisplayHelper.DisplayBoundsHandler<Sc
* @param screenClass the screen
* @param supplier the exclusion zone supplier
*/
- void registerExclusionZones(Class<? extends Screen> screenClass, ExclusionZoneSupplier supplier);
+ void registerExclusionZones(Class<?> screenClass, ExclusionZoneSupplier supplier);
public static interface ExclusionZoneSupplier {
/**
diff --git a/src/main/java/me/shedaniel/rei/api/PluginFunction.java b/src/main/java/me/shedaniel/rei/api/PluginFunction.java
index 30844767f..ec20c317a 100644
--- a/src/main/java/me/shedaniel/rei/api/PluginFunction.java
+++ b/src/main/java/me/shedaniel/rei/api/PluginFunction.java
@@ -9,7 +9,6 @@ public enum PluginFunction {
REGISTER_ITEMS,
REGISTER_CATEGORIES,
REGISTER_RECIPE_DISPLAYS,
- REGISTER_SPEED_CRAFT,
REGISTER_BOUNDS,
REGISTER_OTHERS;
}
diff --git a/src/main/java/me/shedaniel/rei/api/REIPlugin.java b/src/main/java/me/shedaniel/rei/api/REIPlugin.java
deleted file mode 100644
index 77ee28d9d..000000000
--- a/src/main/java/me/shedaniel/rei/api/REIPlugin.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Roughly Enough Items by Danielshe.
- * Licensed under the MIT License.
- */
-
-package me.shedaniel.rei.api;
-
-import me.shedaniel.rei.RoughlyEnoughItemsCore;
-import net.minecraft.util.Identifier;
-
-/**
- * Get base class of a REI plugin.
- * This class has been replaced by {@link REIPluginEntry}
- */
-@Deprecated
-public interface REIPlugin extends REIPluginEntry {
- @Override
- default Identifier getPluginIdentifier() {
- return RoughlyEnoughItemsCore.getPluginIdentifier(this).orElse(Identifier.ofNullable("null"));
- }
-}
diff --git a/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java b/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java
index 87876b46e..2d0b2f236 100644
--- a/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java
+++ b/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java
@@ -41,15 +41,6 @@ public interface REIPluginEntry {
default void registerRecipeDisplays(RecipeHelper recipeHelper) {}
/**
- * Not called anymore!
- *
- * @param recipeHelper the helper class
- * @see REIPluginEntry#registerOthers(RecipeHelper)
- */
- @Deprecated
- default void registerSpeedCraft(RecipeHelper recipeHelper) {}
-
- /**
* Registers bounds handlers
*
* @param displayHelper the helper class
diff --git a/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java b/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java
index 26739d4cf..302667efd 100644
--- a/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java
+++ b/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java
@@ -50,4 +50,11 @@ public interface RecipeDisplay<T extends Recipe> {
return Optional.empty();
}
+ /**
+ * @return the optional recipe
+ * @deprecated stop
+ */
+ @Deprecated
+ default Optional<? extends Recipe> getRecipe() {return null;}
+
}
diff --git a/src/main/java/me/shedaniel/rei/client/BaseBoundsHandlerImpl.java b/src/main/java/me/shedaniel/rei/client/BaseBoundsHandlerImpl.java
index 972fba8b3..426ccd926 100644
--- a/src/main/java/me/shedaniel/rei/client/BaseBoundsHandlerImpl.java
+++ b/src/main/java/me/shedaniel/rei/client/BaseBoundsHandlerImpl.java
@@ -24,15 +24,15 @@ public class BaseBoundsHandlerImpl implements BaseBoundsHandler {
private static final Function<Rectangle, String> RECTANGLE_STRING_FUNCTION = rectangle -> rectangle.x + "," + rectangle.y + "," + rectangle.width + "," + rectangle.height;
private static final Comparator<Rectangle> RECTANGLE_COMPARATOR = BaseBoundsHandlerImpl::compare;
- private static final Comparator<Pair<Pair<Class<? extends Screen>, Float>, ExclusionZoneSupplier>> LIST_PAIR_COMPARATOR;
+ private static final Comparator<Pair<Pair<Class<?>, Float>, ExclusionZoneSupplier>> LIST_PAIR_COMPARATOR;
static {
- Comparator<Pair<Pair<Class<? extends Screen>, Float>, ExclusionZoneSupplier>> comparator = Comparator.comparingDouble(value -> value.getLeft().getRight());
+ Comparator<Pair<Pair<Class<?>, Float>, ExclusionZoneSupplier>> comparator = Comparator.comparingDouble(value -> value.getLeft().getRight());
LIST_PAIR_COMPARATOR = comparator.reversed();
}
private String lastArea = null;
- private List<Pair<Pair<Class<? extends Screen>, Float>, ExclusionZoneSupplier>> list = Lists.newArrayList();
+ private List<Pair<Pair<Class<?>, Float>, ExclusionZoneSupplier>> list = Lists.newArrayList();
private static int compare(Rectangle o1, Rectangle o2) {return RECTANGLE_STRING_FUNCTION.apply(o1).compareTo(RECTANGLE_STRING_FUNCTION.apply(o2));}
@@ -93,8 +93,8 @@ public class BaseBoundsHandlerImpl implements BaseBoundsHandler {
return ActionResult.PASS;
}
- public List<Rectangle> getCurrentExclusionZones(Class<? extends Screen> currentScreenClass, boolean isOnRightSide) {
- List<Pair<Pair<Class<? extends Screen>, Float>, ExclusionZoneSupplier>> only = list.stream().filter(pair -> pair.getLeft().getLeft().isAssignableFrom(currentScreenClass)).collect(Collectors.toList());
+ public List<Rectangle> getCurrentExclusionZones(Class<?> currentScreenClass, boolean isOnRightSide) {
+ List<Pair<Pair<Class<?>, Float>, ExclusionZoneSupplier>> only = list.stream().filter(pair -> pair.getLeft().getLeft().isAssignableFrom(currentScreenClass)).collect(Collectors.toList());
only.sort(LIST_PAIR_COMPARATOR);
List<Rectangle> rectangles = Lists.newArrayList();
only.forEach(pair -> rectangles.addAll(pair.getRight().apply(isOnRightSide)));
@@ -102,7 +102,7 @@ public class BaseBoundsHandlerImpl implements BaseBoundsHandler {
}
@Override
- public void registerExclusionZones(Class<? extends Screen> screenClass, ExclusionZoneSupplier supplier) {
+ public void registerExclusionZones(Class<?> screenClass, ExclusionZoneSupplier supplier) {
list.add(new Pair<>(new Pair<>(screenClass, 0f), supplier));
}
diff --git a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
index cda1acb3e..d28f2c9f1 100644
--- a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
+++ b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
@@ -280,7 +280,7 @@ public class RecipeViewingScreen extends Screen {
final Rectangle displayBounds = new Rectangle((int) getBounds().getCenterX() - displayWidth / 2, getBounds().y + 40 + recipeHeight * i + 7 * i, displayWidth, recipeHeight);
widgets.addAll(selectedCategory.setupDisplay(displaySupplier, displayBounds));
if (supplier.isPresent() && supplier.get().get(displayBounds) != null)
- widgets.add(new SpeedCraftingButtonWidget(supplier.get().get(displayBounds), supplier.get().getButtonText(), functional, displaySupplier));
+ widgets.add(new AutoCraftingButtonWidget(supplier.get().get(displayBounds), supplier.get().getButtonText(), displaySupplier));
}
if (choosePageActivated)
recipeChoosePageWidget = new RecipeChoosePageWidget(this, page, getTotalPages(selectedCategory));
diff --git a/src/main/java/me/shedaniel/rei/gui/widget/AutoCraftingButtonWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/AutoCraftingButtonWidget.java
index d62ac654f..2af5b1ea7 100644
--- a/src/main/java/me/shedaniel/rei/gui/widget/AutoCraftingButtonWidget.java
+++ b/src/main/java/me/shedaniel/rei/gui/widget/AutoCraftingButtonWidget.java
@@ -18,13 +18,13 @@ import java.util.function.Supplier;
public class AutoCraftingButtonWidget extends ButtonWidget {
- private final Supplier<RecipeDisplay> displaySupplier;
+ private final Supplier<RecipeDisplay<?>> displaySupplier;
private String extraTooltip;
- private AbstractContainerScreen containerScreen;
+ private AbstractContainerScreen<?> containerScreen;
public AutoCraftingButtonWidget(Rectangle rectangle, String text, Supplier<RecipeDisplay> displaySupplier) {
super(rectangle, text);
- this.displaySupplier = displaySupplier;
+ this.displaySupplier = () -> displaySupplier.get();
Optional<Identifier> recipe = displaySupplier.get().getRecipeLocation();
extraTooltip = recipe.isPresent() ? I18n.translate("text.rei.recipe_id", ChatFormat.GRAY.toString(), recipe.get().toString()) : "";
this.containerScreen = ScreenHelper.getLastContainerScreen();
diff --git a/src/main/java/me/shedaniel/rei/listeners/AbstractInventoryScreenHooks.java b/src/main/java/me/shedaniel/rei/listeners/AbstractInventoryScreenHooks.java
new file mode 100644
index 000000000..abc9a3288
--- /dev/null
+++ b/src/main/java/me/shedaniel/rei/listeners/AbstractInventoryScreenHooks.java
@@ -0,0 +1,11 @@
+package me.shedaniel.rei.listeners;
+
+import net.minecraft.client.gui.screen.ingame.AbstractInventoryScreen;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.gen.Accessor;
+
+@Mixin(AbstractInventoryScreen.class)
+public interface AbstractInventoryScreenHooks {
+ @Accessor("offsetGuiForEffects")
+ boolean rei_doesOffsetGuiForEffects();
+}
diff --git a/src/main/java/me/shedaniel/rei/mixin/MixinBrewingRecipeRegistry.java b/src/main/java/me/shedaniel/rei/mixin/MixinBrewingRecipeRegistry.java
index e7644c0ca..993782324 100644
--- a/src/main/java/me/shedaniel/rei/mixin/MixinBrewingRecipeRegistry.java
+++ b/src/main/java/me/shedaniel/rei/mixin/MixinBrewingRecipeRegistry.java
@@ -6,8 +6,8 @@
package me.shedaniel.rei.mixin;
import com.google.common.collect.Lists;
-import me.shedaniel.rei.plugin.BrewingRecipe;
-import me.shedaniel.rei.plugin.DefaultBrewingDisplay;
+import me.shedaniel.rei.plugin.brewing.BrewingRecipe;
+import me.shedaniel.rei.plugin.brewing.DefaultBrewingDisplay;
import me.shedaniel.rei.plugin.DefaultPlugin;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultAutoCraftingPlugin.java b/src/main/java/me/shedaniel/rei/plugin/DefaultAutoCraftingPlugin.java
new file mode 100644
index 000000000..34c088c52
--- /dev/null
+++ b/src/main/java/me/shedaniel/rei/plugin/DefaultAutoCraftingPlugin.java
@@ -0,0 +1,34 @@
+package me.shedaniel.rei.plugin;
+
+import me.shedaniel.rei.RoughlyEnoughItemsCore;
+import me.shedaniel.rei.api.PluginDisabler;
+import me.shedaniel.rei.api.PluginFunction;
+import me.shedaniel.rei.api.REIPluginEntry;
+import me.shedaniel.rei.api.RecipeHelper;
+import net.minecraft.util.Identifier;
+
+public class DefaultAutoCraftingPlugin implements REIPluginEntry {
+
+ public static final Identifier PLUGIN = new Identifier("roughlyenoughitems", "default_auto_crafting_plugin");
+
+ @Override
+ public Identifier getPluginIdentifier() {
+ return PLUGIN;
+ }
+
+ @Override
+ public void onFirstLoad(PluginDisabler pluginDisabler) {
+ if (!RoughlyEnoughItemsCore.getConfigManager().getConfig().loadDefaultPlugin) {
+ pluginDisabler.disablePluginFunction(PLUGIN, PluginFunction.REGISTER_ITEMS);
+ pluginDisabler.disablePluginFunction(PLUGIN, PluginFunction.REGISTER_CATEGORIES);
+ pluginDisabler.disablePluginFunction(PLUGIN, PluginFunction.REGISTER_RECIPE_DISPLAYS);
+ pluginDisabler.disablePluginFunction(PLUGIN, PluginFunction.REGISTER_OTHERS);
+ }
+ }
+
+ @Override
+ public void registerOthers(RecipeHelper recipeHelper) {
+
+ }
+
+}
diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java b/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java
index 243a12b89..8b095e88d 100644
--- a/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java
+++ b/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java
@@ -12,14 +12,30 @@ import me.shedaniel.rei.api.*;
import me.shedaniel.rei.client.ScreenHelper;
import me.shedaniel.rei.gui.RecipeViewingScreen;
import me.shedaniel.rei.gui.VillagerRecipeViewingScreen;
-import me.shedaniel.rei.listeners.ContainerScreenHooks;
+import me.shedaniel.rei.plugin.blasting.DefaultBlastingCategory;
+import me.shedaniel.rei.plugin.blasting.DefaultBlastingDisplay;
+import me.shedaniel.rei.plugin.brewing.DefaultBrewingCategory;
+import me.shedaniel.rei.plugin.brewing.DefaultBrewingDisplay;
+import me.shedaniel.rei.plugin.campfire.DefaultCampfireCategory;
+import me.shedaniel.rei.plugin.campfire.DefaultCampfireDisplay;
+import me.shedaniel.rei.plugin.composting.DefaultCompostingCategory;
+import me.shedaniel.rei.plugin.composting.DefaultCompostingDisplay;
+import me.shedaniel.rei.plugin.crafting.DefaultCraftingCategory;
+import me.shedaniel.rei.plugin.crafting.DefaultCustomDisplay;
+import me.shedaniel.rei.plugin.crafting.DefaultShapedDisplay;
+import me.shedaniel.rei.plugin.crafting.DefaultShapelessDisplay;
+import me.shedaniel.rei.plugin.smelting.DefaultSmeltingCategory;
+import me.shedaniel.rei.plugin.smelting.DefaultSmeltingDisplay;
+import me.shedaniel.rei.plugin.smoking.DefaultSmokingCategory;
+import me.shedaniel.rei.plugin.smoking.DefaultSmokingDisplay;
+import me.shedaniel.rei.plugin.stonecutting.DefaultStoneCuttingCategory;
+import me.shedaniel.rei.plugin.stonecutting.DefaultStoneCuttingDisplay;
import net.minecraft.block.ComposterBlock;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen;
+import net.minecraft.client.gui.screen.ingame.AbstractInventoryScreen;
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider;
-import net.minecraft.client.recipe.book.ClientRecipeBook;
-import net.minecraft.container.CraftingContainer;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.item.ItemConvertible;
@@ -152,16 +168,8 @@ public class DefaultPlugin implements REIPluginEntry {
@Override
public void registerBounds(DisplayHelper displayHelper) {
- displayHelper.getBaseBoundsHandler().registerExclusionZones(AbstractContainerScreen.class, isOnRightSide -> {
- if (isOnRightSide || !MinecraftClient.getInstance().player.getRecipeBook().isGuiOpen() || !(MinecraftClient.getInstance().currentScreen instanceof RecipeBookProvider) || !(ScreenHelper.getLastContainerScreen().getContainer() instanceof CraftingContainer))
- return Collections.emptyList();
- ContainerScreenHooks screenHooks = ScreenHelper.getLastContainerScreenHooks();
- List<Rectangle> l = Lists.newArrayList(new Rectangle(screenHooks.rei_getContainerLeft() - 4 - 145, screenHooks.rei_getContainerTop(), 4 + 145 + 30, screenHooks.rei_getContainerHeight()));
- int size = ClientRecipeBook.getGroupsForContainer((CraftingContainer) ScreenHelper.getLastContainerScreen().getContainer()).size();
- if (size > 0)
- l.add(new Rectangle(screenHooks.rei_getContainerLeft() - 4 - 145 - 30, screenHooks.rei_getContainerTop(), 30, (size - 1) * 27));
- return l;
- });
+ displayHelper.getBaseBoundsHandler().registerExclusionZones(AbstractInventoryScreen.class, new DefaultPotionEffectExclusionZones());
+ displayHelper.getBaseBoundsHandler().registerExclusionZones(RecipeBookProvider.class, new DefaultRecipeBookExclusionZones());
displayHelper.registerBoundsHandler(new DisplayHelper.DisplayBoundsHandler<AbstractContainerScreen>() {
@Override
public Class getBaseSupportedClass() {
diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java b/src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java
new file mode 100644
index 000000000..60df54dc0
--- /dev/null
+++ b/src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java
@@ -0,0 +1,39 @@
+package me.shedaniel.rei.plugin;
+
+import com.google.common.collect.Ordering;
+import me.shedaniel.rei.api.BaseBoundsHandler;
+import me.shedaniel.rei.client.ScreenHelper;
+import me.shedaniel.rei.listeners.AbstractInventoryScreenHooks;
+import me.shedaniel.rei.listeners.ContainerScreenHooks;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.screen.ingame.AbstractInventoryScreen;
+import net.minecraft.entity.effect.StatusEffectInstance;
+
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+public class DefaultPotionEffectExclusionZones implements BaseBoundsHandler.ExclusionZoneSupplier {
+ @Override
+ public List<Rectangle> apply(boolean isOnRightSide) {
+ if (isOnRightSide || !(ScreenHelper.getLastContainerScreen() instanceof AbstractInventoryScreen) || !((AbstractInventoryScreenHooks) ScreenHelper.getLastContainerScreen()).rei_doesOffsetGuiForEffects())
+ return Collections.emptyList();
+ Collection<StatusEffectInstance> activePotionEffects = MinecraftClient.getInstance().player.getStatusEffects();
+ if (activePotionEffects.isEmpty())
+ return Collections.emptyList();
+ ContainerScreenHooks hooks = ScreenHelper.getLastContainerScreenHooks();
+ List<Rectangle> list = new ArrayList<>();
+ int x = hooks.rei_getContainerLeft() - 124;
+ int y = hooks.rei_getContainerTop();
+ int height = 33;
+ if (activePotionEffects.size() > 5)
+ height = 132 / (activePotionEffects.size() - 1);
+ for(StatusEffectInstance instance : Ordering.natural().sortedCopy(activePotionEffects)) {
+ list.add(new Rectangle(x, y, 166, height));
+ y += height;
+ }
+ return list;
+ }
+}
diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java b/src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java
new file mode 100644
index 000000000..ef7c9a07a
--- /dev/null
+++ b/src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java
@@ -0,0 +1,30 @@
+package me.shedaniel.rei.plugin;
+
+import com.google.common.collect.Lists;
+import me.shedaniel.rei.api.BaseBoundsHandler;
+import me.shedaniel.rei.client.ScreenHelper;
+import me.shedaniel.rei.listeners.ContainerScreenHooks;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider;
+import net.minecraft.client.recipe.book.ClientRecipeBook;
+import net.minecraft.container.CraftingContainer;
+
+import java.awt.*;
+import java.util.Collections;
+import java.util.List;
+
+public class DefaultRecipeBookExclusionZones implements BaseBoundsHandler.ExclusionZoneSupplier {
+
+ @Override
+ public List<Rectangle> apply(boolean isOnRightSide) {
+ if (isOnRightSide || !MinecraftClient.getInstance().player.getRecipeBook().isGuiOpen() || !(MinecraftClient.getInstance().currentScreen instanceof RecipeBookProvider) || !(ScreenHelper.getLastContainerScreen().getContainer() instanceof CraftingContainer))
+ return Collections.emptyList();
+ ContainerScreenHooks screenHooks = ScreenHelper.getLastContainerScreenHooks();
+ List<Rectangle> l = Lists.newArrayList(new Rectangle(screenHooks.rei_getContainerLeft() - 4 - 145, screenHooks.rei_getContainerTop(), 4 + 145 + 30, screenHooks.rei_getContainerHeight()));
+ int size = ClientRecipeBook.getGroupsForContainer((CraftingContainer) ScreenHelper.getLastContainerScreen().getContainer()).size();
+ if (size > 0)
+ l.add(new Rectangle(screenHooks.rei_getContainerLeft() - 4 - 145 - 30, screenHooks.rei_getContainerTop(), 30, size * 27));
+ return l;
+ }
+
+}
diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultBlastingCategory.java b/src/main/java/me/shedaniel/rei/plugin/blasting/DefaultBlastingCategory.java
index 9455eb65a..6afa52724 100644
--- a/src/main/java/me/shedaniel/rei/plugin/DefaultBlastingCategory.java
+++ b/src/main/java/me/shedaniel/rei/plugin/blasting/DefaultBlastingCategory.java
@@ -3,7 +3,7 @@
* Licensed under the MIT License.
*/
-package me.shedaniel.rei.plugin;
+package me.shedaniel.rei.plugin.blasting;
import com.mojang.blaze3d.platform.GlStateManager;
import me.shedaniel.rei.api.RecipeCategory;
@@ -13,6 +13,7 @@ import me.shedaniel.rei.gui.renderables.RecipeRenderer;
import me.shedaniel.rei.gui.widget.RecipeBaseWidget;
import me.shedaniel.rei.gui.widget.SlotWidget;
import me.shedaniel.rei.gui.widget.Widget;
+import me.shedaniel.rei.plugin.DefaultPlugin;
import net.minecraft.ChatFormat;
import net.minecraft.block.Blocks;
import net.minecraft.client.MinecraftClient;
diff --git a/src/main/java/me/shedaniel/rei/plugin/DefaultBlastingDisplay.java b/src/main/java/me/shedaniel/rei/plugin/blasting/DefaultBlastingDisplay.java
index 6e490c47c..d64e1315d 100644
--- a/src/main/java/me/shedaniel/rei/plugin/DefaultBlastingDisplay.java
+++ b/src/main/java/me/shedaniel/rei/plugin/blasting/DefaultBlastingDisplay.java
@@ -3,9 +3,10 @@
* Licensed under the MIT License.
*/
-package me.shedaniel.rei.plugin;
+package me.shedaniel.rei.plugin.blasting;
import me.shedaniel.rei.api.RecipeDisplay;
+import me.shedaniel.rei.plugin.DefaultPlugin;
import net.minecraft.block.entity.FurnaceBlockEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
diff --git a/src/main/java/me/shedaniel/rei/plugin/B