aboutsummaryrefslogtreecommitdiff
path: root/RoughlyEnoughItems-default-plugin/src/main/java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2020-07-29 12:25:47 +0800
committershedaniel <daniel@shedaniel.me>2020-07-29 14:25:53 +0800
commitba446965dad004cb38679f0f0e1a526151d84213 (patch)
tree60fe2736316a63d47cf533a02bf29fbd5045b91c /RoughlyEnoughItems-default-plugin/src/main/java
parent929ca0ed6de9dd25208304cd0f51a8f2d0f22ceb (diff)
downloadRoughlyEnoughItems-ba446965dad004cb38679f0f0e1a526151d84213.tar.gz
RoughlyEnoughItems-ba446965dad004cb38679f0f0e1a526151d84213.tar.bz2
RoughlyEnoughItems-ba446965dad004cb38679f0f0e1a526151d84213.zip
5.x - 20w30a
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'RoughlyEnoughItems-default-plugin/src/main/java')
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java336
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java64
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java58
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultServerContainerPlugin.java40
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/autocrafting/DefaultRecipeBookHandler.java102
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/beacon/DefaultBeaconBaseCategory.java182
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/beacon/DefaultBeaconBaseDisplay.java64
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/blasting/DefaultBlastingDisplay.java44
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/brewing/BrewingRecipe.java41
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingCategory.java84
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/brewing/DefaultBrewingDisplay.java90
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/brewing/RegisteredBrewingRecipe.java41
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireCategory.java80
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/campfire/DefaultCampfireDisplay.java90
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingCategory.java118
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/composting/DefaultCompostingDisplay.java81
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/containers/CraftingContainerInfoWrapper.java77
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/cooking/DefaultCookingCategory.java109
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/cooking/DefaultCookingDisplay.java119
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultCraftingCategory.java113
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultCraftingDisplay.java73
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultCustomDisplay.java111
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapedDisplay.java85
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapelessDisplay.java89
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/fuel/DefaultFuelCategory.java117
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/fuel/DefaultFuelDisplay.java64
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/information/DefaultInformationCategory.java221
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/information/DefaultInformationDisplay.java101
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/mixin/MixinBrewingRecipeRegistry.java87
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/smelting/DefaultSmeltingDisplay.java44
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/smithing/DefaultSmithingCategory.java73
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/smithing/DefaultSmithingDisplay.java92
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/smoking/DefaultSmokingDisplay.java41
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/stonecutting/DefaultStoneCuttingCategory.java74
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/stonecutting/DefaultStoneCuttingDisplay.java83
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/stripping/DefaultStrippingCategory.java74
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/stripping/DefaultStrippingDisplay.java78
-rw-r--r--RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/stripping/DummyAxeItem.java40
38 files changed, 3480 insertions, 0 deletions
diff --git a/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java b/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java
new file mode 100644
index 000000000..d7a231a3b
--- /dev/null
+++ b/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java
@@ -0,0 +1,336 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020 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
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package me.shedaniel.rei.plugin;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import it.unimi.dsi.fastutil.objects.Object2FloatMap;
+import me.shedaniel.math.Rectangle;
+import me.shedaniel.rei.api.*;
+import me.shedaniel.rei.api.fluid.FluidSupportProvider;
+import me.shedaniel.rei.api.plugins.REIPluginV0;
+import me.shedaniel.rei.plugin.autocrafting.DefaultRecipeBookHandler;
+import me.shedaniel.rei.plugin.beacon.DefaultBeaconBaseCategory;
+import me.shedaniel.rei.plugin.beacon.DefaultBeaconBaseDisplay;
+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.brewing.RegisteredBrewingRecipe;
+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.cooking.DefaultCookingCategory;
+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.fuel.DefaultFuelCategory;
+import me.shedaniel.rei.plugin.fuel.DefaultFuelDisplay;
+import me.shedaniel.rei.plugin.information.DefaultInformationCategory;
+import me.shedaniel.rei.plugin.information.DefaultInformationDisplay;
+import me.shedaniel.rei.plugin.smelting.DefaultSmeltingDisplay;
+import me.shedaniel.rei.plugin.smithing.DefaultSmithingCategory;
+import me.shedaniel.rei.plugin.smithing.DefaultSmithingDisplay;
+import me.shedaniel.rei.plugin.smoking.DefaultSmokingDisplay;
+import me.shedaniel.rei.plugin.stonecutting.DefaultStoneCuttingCategory;
+import me.shedaniel.rei.plugin.stonecutting.DefaultStoneCuttingDisplay;
+import me.shedaniel.rei.plugin.stripping.DefaultStrippingCategory;
+import me.shedaniel.rei.plugin.stripping.DefaultStrippingDisplay;
+import me.shedaniel.rei.plugin.stripping.DummyAxeItem;
+import me.shedaniel.rei.utils.CollectionUtils;
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
+import net.minecraft.block.ComposterBlock;
+import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.screen.ingame.*;
+import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.fluid.Fluid;
+import net.minecraft.item.*;
+import net.minecraft.potion.PotionUtil;
+import net.minecraft.recipe.*;
+import net.minecraft.tag.BlockTags;
+import net.minecraft.tag.Tag;
+import net.minecraft.util.Identifier;
+import net.minecraft.util.Lazy;
+import net.minecraft.util.math.MathHelper;
+import net.minecraft.util.registry.Registry;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.*;
+
+@Environment(EnvType.CLIENT)
+public class DefaultPlugin implements REIPluginV0 {
+ private static final Logger LOGGER = LogManager.getFormatterLogger("REI/DefaultPlugin");
+ public static final Identifier CRAFTING = new Identifier("minecraft", "plugins/crafting");
+ public static final Identifier SMELTING = new Identifier("minecraft", "plugins/smelting");
+ public static final Identifier SMOKING = new Identifier("minecraft", "plugins/smoking");
+ public static final Identifier BLASTING = new Identifier("minecraft", "plugins/blasting");
+ public static final Identifier CAMPFIRE = new Identifier("minecraft", "plugins/campfire");
+ public static final Identifier STONE_CUTTING = new Identifier("minecraft", "plugins/stone_cutting");
+ public static final Identifier STRIPPING = new Identifier("minecraft", "plugins/stripping");
+ public static final Identifier BREWING = new Identifier("minecraft", "plugins/brewing");
+ public static final Identifier PLUGIN = new Identifier("roughlyenoughitems", "default_plugin");
+ public static final Identifier COMPOSTING = new Identifier("minecraft", "plugins/composting");
+ public static final Identifier FUEL = new Identifier("minecraft", "plugins/fuel");
+ public static final Identifier SMITHING = new Identifier("minecraft", "plugins/smithing");
+ public static final Identifier BEACON = new Identifier("minecraft", "plugins/beacon");
+ public static final Identifier INFO = new Identifier("roughlyenoughitems", "plugins/information");
+ private static final Identifier DISPLAY_TEXTURE = new Identifier("roughlyenoughitems", "textures/gui/display.png");
+ private static final Identifier DISPLAY_TEXTURE_DARK = new Identifier("roughlyenoughitems", "textures/gui/display_dark.png");
+ private static final List<Lazy<DefaultBrewingDisplay>> BREWING_DISPLAYS = Lists.newArrayList();
+ private static final List<DefaultInformationDisplay> INFO_DISPLAYS = Lists.newArrayList();
+
+ public static Identifier getDisplayTexture() {
+ return REIHelper.getInstance().getDefaultDisplayTexture();
+ }
+
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval
+ public static void registerBrewingDisplay(DefaultBrewingDisplay recipe) {
+ BREWING_DISPLAYS.add(new Lazy<>(() -> recipe));
+ }
+
+ public static void registerBrewingRecipe(RegisteredBrewingRecipe recipe) {
+ BREWING_DISPLAYS.add(new Lazy<>(() -> new DefaultBrewingDisplay(recipe.input, recipe.ingredient, recipe.output)));
+ }
+
+ public static void registerInfoDisplay(DefaultInformationDisplay display) {
+ INFO_DISPLAYS.add(display);
+ }
+
+ @Override
+ public Identifier getPluginIdentifier() {
+ return PLUGIN;
+ }
+
+ @Override
+ public void preRegister() {
+ INFO_DISPLAYS.clear();
+ }
+
+ @Override
+ public void registerEntries(EntryRegistry entryRegistry) {
+ for (Item item : Registry.ITEM) {
+ List<ItemStack> stacks = null;
+ try {
+ stacks = entryRegistry.appendStacksForItem(item);
+ } catch (Exception ignored) {
+ }
+ if (stacks != null) {
+ for (ItemStack stack : entryRegistry.appendStacksForItem(item)) {
+ entryRegistry.registerEntry(EntryStack.create(stack));
+ }
+ } else
+ entryRegistry.registerEntry(EntryStack.create(item));
+ }
+ EntryStack stack = EntryStack.create(Items.ENCHANTED_BOOK);
+ List<EntryStack> enchantments = new ArrayList<>();
+ for (Enchantment enchantment : Registry.ENCHANTMENT) {
+ for (int i = enchantment.getMinimumLevel(); i <= enchantment.getMaximumLevel(); i++) {
+ Map<Enchantment, Integer> map = new HashMap<>();
+ map.put(enchantment, i);
+ ItemStack itemStack = new ItemStack(Items.ENCHANTED_BOOK);
+ EnchantmentHelper.set(map, itemStack);
+ enchantments.add(EntryStack.create(itemStack).setting(EntryStack.Settings.CHECK_TAGS, EntryStack.Settings.TRUE));
+ }
+ }
+ entryRegistry.registerEntriesAfter(stack, enchantments);
+ for (Fluid fluid : Registry.FLUID) {
+ if (!fluid.getDefaultState().isEmpty() && fluid.getDefaultState().isStill())
+ entryRegistry.registerEntry(EntryStack.create(fluid));
+ }
+ }
+
+ @Override
+ public void registerPluginCategories(RecipeHelper recipeHelper) {
+ recipeHelper.registerCategories(
+ new DefaultCraftingCategory(),
+ new DefaultCookingCategory(SMELTING, EntryStack.create(Items.FURNACE), "category.rei.smelting"),
+ new DefaultCookingCategory(SMOKING, EntryStack.create(Items.SMOKER), "category.rei.smoking"),
+ new DefaultCookingCategory(BLASTING, EntryStack.create(Items.BLAST_FURNACE), "category.rei.blasting"), new DefaultCampfireCategory(),
+ new DefaultStoneCuttingCategory(),
+ new DefaultFuelCategory(),
+ new DefaultBrewingCategory(),
+ new DefaultCompostingCategory(),
+ new DefaultStrippingCategory(),
+ new DefaultSmithingCategory(),
+ new DefaultBeaconBaseCategory(),
+ new DefaultInformationCategory()
+ );
+ }
+
+ @Override
+ public void registerRecipeDisplays(RecipeHelper recipeHelper) {
+ recipeHelper.registerRecipes(CRAFTING, ShapelessRecipe.class, DefaultShapelessDisplay::new);
+ recipeHelper.registerRecipes(CRAFTING, ShapedRecipe.class, DefaultShapedDisplay::new);
+ recipeHelper.registerRecipes(SMELTING, SmeltingRecipe.class, DefaultSmeltingDisplay::new);
+ recipeHelper.registerRecipes(SMOKING, SmokingRecipe.class, DefaultSmokingDisplay::new);
+ recipeHelper.registerRecipes(BLASTING, BlastingRecipe.class, DefaultBlastingDisplay::new);
+ recipeHelper.registerRecipes(CAMPFIRE, CampfireCookingRecipe.class, DefaultCampfireDisplay::new);
+ recipeHelper.registerRecipes(STONE_CUTTING, StonecuttingRecipe.class, DefaultStoneCuttingDisplay::new);
+ recipeHelper.registerRecipes(SMITHING, SmithingRecipe.class, DefaultSmithingDisplay::new);
+ for (Lazy<DefaultBrewingDisplay> display : BREWING_DISPLAYS) {
+ recipeHelper.registerDisplay(display.get());
+ }
+ for (Map.Entry<Item, Integer> entry : AbstractFurnaceBlockEntity.createFuelTimeMap().entrySet()) {
+ recipeHelper.registerDisplay(new DefaultFuelDisplay(EntryStack.create(entry.getKey()), entry.getValue()));
+ }
+ List<EntryStack> arrowStack = Collections.singletonList(EntryStack.create(Items.ARROW));
+ EntryRegistry.getInstance().getEntryStacks().filter(entry -> entry.getItem() == Items.LINGERING_POTION).forEach(entry -> {
+ List<List<EntryStack>> input = new ArrayList<>();
+ for (int i = 0; i < 4; i++)
+ input.add(arrowStack);
+ input.add(Collections.singletonList(EntryStack.create(entry.getItemStack())));
+ for (int i = 0; i < 4; i++)
+ input.add(arrowStack);
+ ItemStack outputStack = new ItemStack(Items.TIPPED_ARROW, 8);
+ PotionUtil.setPotion(outputStack, PotionUtil.getPotion(entry.getItemStack()));
+ PotionUtil.setCustomPotionEffects(outputStack, PotionUtil.getCustomPotionEffects(entry.getItemStack()));
+ List<EntryStack> output = Collections.singletonList(EntryStack.create(outputStack).addSetting(EntryStack.Settings.CHECK_TAGS, EntryStack.Settings.TRUE));
+ recipeHelper.registerDisplay(new DefaultCustomDisplay(null, input, output));
+ });
+ Map<ItemConvertible, Float> map = Maps.newLinkedHashMap();
+ if (ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.isEmpty())
+ ComposterBlock.registerDefaultCompostableItems();
+ for (Object2FloatMap.Entry<ItemConvertible> entry : ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.object2FloatEntrySet()) {
+ if (entry.getFloatValue() > 0)
+ map.put(entry.getKey(), entry.getFloatValue());
+ }
+ List<ItemConvertible> stacks = Lists.newArrayList(map.keySet());
+ stacks.sort(Comparator.comparing(map::get));
+ for (int i = 0; i < stacks.size(); i += MathHelper.clamp(48, 1, stacks.size() - i)) {
+ List<ItemConvertible> thisStacks = Lists.newArrayList();
+ for (int j = i; j < i + 48; j++)
+ if (j < stacks.size())
+ thisStacks.add(stacks.get(j));
+ recipeHelper.registerDisplay(new DefaultCompostingDisplay(MathHelper.floor(i / 48f), thisStacks, map, new ItemStack(Items.BONE_MEAL)));
+ }
+ DummyAxeItem.getStrippedBlocksMap().entrySet().stream().sorted(Comparator.comparing(b -> Registry.BLOCK.getId(b.getKey()))).forEach(set -> {
+ recipeHelper.registerDisplay(new DefaultStrippingDisplay(EntryStack.create(set.getKey()), EntryStack.create(set.getValue())));
+ });
+ recipeHelper.registerDisplay(new DefaultBeaconBaseDisplay(CollectionUtils.map(Lists.newArrayList(BlockTags.BEACON_BASE_BLOCKS.values()), ItemStack::new)));
+ }
+
+ @Override
+ public void postRegister() {
+ for (DefaultInformationDisplay display : INFO_DISPLAYS)
+ RecipeHelper.getInstance().registerDisplay(display);
+ // TODO Turn this into an API
+ // Sit tight! This will be a fast journey!
+ long time = System.currentTimeMillis();
+ EntryRegistry.getInstance().getEntryStacks().forEach(this::applyPotionTransformer);
+ for (List<RecipeDisplay> displays : RecipeHelper.getInstance().getAllRecipesNoHandlers().values()) {
+ for (RecipeDisplay display : displays) {
+ for (List<EntryStack> entries : display.getInputEntries())
+ for (EntryStack stack : entries)
+ applyPotionTransformer(stack);
+ for (EntryStack stack : display.getOutputEntries())
+ applyPotionTransformer(stack);
+ }
+ }
+ time = System.currentTimeMillis() - time;
+ LOGGER.info("Applied Check Tags for potion in %dms.", time);
+ }
+
+ private void applyPotionTransformer(EntryStack stack) {
+ if (stack.getItem() instanceof PotionItem)
+ stack.addSetting(EntryStack.Settings.CHECK_TAGS, EntryStack.Settings.TRUE);
+ }
+
+ @Override
+ public void registerBounds(DisplayHelper displayHelper) {
+ BaseBoundsHandler baseBoundsHandler = BaseBoundsHandler.getInstance();
+ baseBoundsHandler.registerExclusionZones(AbstractInventoryScreen.class, new DefaultPotionEffectExclusionZones());
+ baseBoundsHandler.registerExclusionZones(RecipeBookProvider.class, new DefaultRecipeBookExclusionZones());
+ displayHelper.registerProvider(new DisplayHelper.DisplayBoundsProvider<ContainerScreen<?>>() {
+ @Override
+ public Rectangle getScreenBounds(ContainerScreen<?> screen) {
+ return new Rectangle(screen.x, screen.y, screen.containerWidth, screen.containerHeight);
+ }
+
+ @Override
+ public Class<?> getBaseSupportedClass() {
+ return ContainerScreen.class;
+ }
+ });
+ }
+
+ @Override
+ public void registerOthers(RecipeHelper recipeHelper) {
+ recipeHelper.registerAutoCraftingHandler(new DefaultRecipeBookHandler());
+
+ recipeHelper.registerWorkingStations(CRAFTING, EntryStack.create(Items.CRAFTING_TABLE));
+ recipeHelper.registerWorkingStations(SMELTING, EntryStack.create(Items.FURNACE));
+ recipeHelper.registerWorkingStations(SMOKING, EntryStack.create(Items.SMOKER));
+ recipeHelper.registerWorkingStations(BLASTING, EntryStack.create(Items.BLAST_FURNACE));
+ recipeHelper.registerWorkingStations(CAMPFIRE, EntryStack.create(Items.CAMPFIRE));
+ recipeHelper.registerWorkingStations(FUEL, EntryStack.create(Items.FURNACE), EntryStack.create(Items.SMOKER), EntryStack.create(Items.BLAST_FURNACE));
+ recipeHelper.registerWorkingStations(BREWING, EntryStack.create(Items.BREWING_STAND));
+ recipeHelper.registerWorkingStations(STONE_CUTTING, EntryStack.create(Items.STONECUTTER));
+ recipeHelper.registerWorkingStations(COMPOSTING, EntryStack.create(Items.COMPOSTER));
+ recipeHelper.registerWorkingStations(SMITHING, EntryStack.create(Items.SMITHING_TABLE));
+ recipeHelper.registerWorkingStations(BEACON, EntryStack.create(Items.BEACON));
+ Tag<Item> axes = MinecraftClient.getInstance().getNetworkHandler().getTagManager().getItems().getTag(new Identifier("fabric", "axes"));
+ if (axes != null) {
+ for (Item item : axes.values()) {
+ recipeHelper.registerWorkingStations(STRIPPING, EntryStack.create(item));
+ }
+ }
+ recipeHelper.removeAutoCraftButton(FUEL);
+ recipeHelper.removeAutoCraftButton(COMPOSTING);
+ recipeHelper.removeAutoCraftButton(BEACON);
+ recipeHelper.removeAutoCraftButton(INFO);
+ recipeHelper.registerScreenClickArea(new Rectangle(88, 32, 28, 23), CraftingTableScreen.class, CRAFTING);
+ recipeHelper.registerScreenClickArea(new Rectangle(137, 29, 10, 13), InventoryScreen.class, CRAFTING);
+ recipeHelper.registerScreenClickArea(new Rectangle(97, 16, 14, 30), BrewingStandScreen.class, BREWING);
+ recipeHelper.registerScreenClickArea(new Rectangle(78, 32, 28, 23), FurnaceScreen.class, SMELTING);
+ recipeHelper.registerScreenClickArea(new Rectangle(78, 32, 28, 23), SmokerScreen.class, SMOKING);
+ recipeHelper.registerScreenClickArea(new Rectangle(78, 32, 28, 23), BlastFurnaceScreen.class, BLASTING);
+ FluidSupportProvider.getInstance().registerFluidProvider(new FluidSupportProvider.FluidProvider() {
+ @Override
+ public @NotNull EntryStack itemToFluid(@NotNull EntryStack itemStack) {
+ Item item = itemStack.getItem();
+ if (item instanceof BucketItem)
+ return EntryStack.create(((BucketItem) item).fluid, 1000);
+ return EntryStack.empty();
+ }
+ });
+// SubsetsRegistry subsetsRegistry = SubsetsRegistry.INSTANCE;
+// subsetsRegistry.registerPathEntry("roughlyenoughitems:food", EntryStack.create(Items.MILK_BUCKET));
+// subsetsRegistry.registerPathEntry("roughlyenoughitems:food/roughlyenoughitems:cookies", EntryStack.create(Items.COOKIE));
+ }
+
+ @Override
+ public int getPriority() {
+ return -1;
+ }
+
+}
diff --git a/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java b/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java
new file mode 100644
index 000000000..79116da14
--- /dev/null
+++ b/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultPotionEffectExclusionZones.java
@@ -0,0 +1,64 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020 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
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package me.shedaniel.rei.plugin;
+
+import com.google.common.collect.Ordering;
+import me.shedaniel.math.Rectangle;
+import me.shedaniel.rei.api.REIHelper;
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.screen.ingame.AbstractInventoryScreen;
+import net.minecraft.client.gui.screen.ingame.ContainerScreen;
+import net.minecraft.entity.effect.StatusEffectInstance;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.function.Supplier;
+
+@Environment(EnvType.CLIENT)
+public class DefaultPotionEffectExclusionZones implements Supplier<List<Rectangle>> {
+ @Override
+ public List<Rectangle> get() {
+ if (!(REIHelper.getInstance().getPreviousContainerScreen() instanceof AbstractInventoryScreen) || !((AbstractInventoryScreen<?>) REIHelper.getInstance().getPreviousContainerScreen()).offsetGuiForEffects)
+ return Collections.emptyList();
+ Collection<StatusEffectInstance> activePotionEffects = MinecraftClient.getInstance().player.getStatusEffects();
+ if (activePotionEffects.isEmpty())
+ return Collections.emptyList();
+ ContainerScreen<?> containerScreen = REIHelper.getInstance().getPreviousContainerScreen();
+ List<Rectangle> list = new ArrayList<>();
+ int x = containerScreen.x - 124;
+ int y = containerScreen.y;
+ 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/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java b/RoughlyEnoughItems-default-plugin/src/main/java/me/shedaniel/rei/plugin/DefaultRecipeBookExclusionZones.java
new file mode 100644
index 000000000..099bd1161
--- /dev/null
+++ b/