From 5affcfca51424eb29db199eb4c7179eba15abed2 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Wed, 27 Jul 2022 02:13:43 +0800 Subject: Make Architectury Plugin compile only --- .../me/shedaniel/rei/forge/AnnotationUtils.java | 4 +- .../me/shedaniel/rei/forge/PluginDetectorImpl.java | 31 ++++++---- .../rei/forge/PrimitivePlatformAdapterImpl.java | 69 ++++++++++++++++++++++ .../rei/forge/RoughlyEnoughItemsForge.java | 2 +- .../forge/RoughlyEnoughItemsInitializerImpl.java | 63 -------------------- .../client/gui/forge/ScreenOverlayImplForge.java | 53 +++++++++++++++++ .../client/gui/forge/ScreenOverlayImplImpl.java | 51 ---------------- .../client/forge/DefaultClientPluginImpl.java | 7 ++- .../rei/plugin/common/forge/DefaultPluginImpl.java | 11 ++-- 9 files changed, 154 insertions(+), 137 deletions(-) create mode 100644 forge/src/main/java/me/shedaniel/rei/forge/PrimitivePlatformAdapterImpl.java delete mode 100644 forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsInitializerImpl.java create mode 100644 forge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplForge.java delete mode 100644 forge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplImpl.java (limited to 'forge/src/main/java') diff --git a/forge/src/main/java/me/shedaniel/rei/forge/AnnotationUtils.java b/forge/src/main/java/me/shedaniel/rei/forge/AnnotationUtils.java index 57aa959c6..7a0cf0803 100644 --- a/forge/src/main/java/me/shedaniel/rei/forge/AnnotationUtils.java +++ b/forge/src/main/java/me/shedaniel/rei/forge/AnnotationUtils.java @@ -24,7 +24,7 @@ package me.shedaniel.rei.forge; import com.google.common.collect.Lists; -import me.shedaniel.rei.RoughlyEnoughItemsInitializer; +import me.shedaniel.rei.impl.init.PrimitivePlatformAdapter; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.loading.FMLEnvironment; @@ -84,7 +84,7 @@ public class AnnotationUtils { } catch (Throwable throwable) { Throwable t = throwable; while (t != null) { - if (t.getMessage() != null && t.getMessage().contains("invalid dist DEDICATED_SERVER") && !RoughlyEnoughItemsInitializer.isClient()) { + if (t.getMessage() != null && t.getMessage().contains("invalid dist DEDICATED_SERVER") && !PrimitivePlatformAdapter.get().isClient()) { LOGGER.warn("Plugin " + annotation.getMemberName() + " is attempting to load on the server, but is not compatible with the server. " + "The mod should declare the environments it is compatible with in the @" + annotationType.getClassName() + " annotation."); continue out; diff --git a/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java b/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java index 1f9f26811..db26e74c3 100644 --- a/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java +++ b/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java @@ -31,8 +31,10 @@ import me.shedaniel.rei.api.common.plugins.REIPluginProvider; import me.shedaniel.rei.api.common.plugins.REIServerPlugin; import me.shedaniel.rei.impl.ClientInternals; import me.shedaniel.rei.plugin.client.DefaultClientPlugin; +import me.shedaniel.rei.impl.init.PluginDetector; +import me.shedaniel.rei.plugin.client.forge.DefaultClientPluginImpl; import me.shedaniel.rei.plugin.client.DefaultClientRuntimePlugin; -import me.shedaniel.rei.plugin.common.DefaultPlugin; +import me.shedaniel.rei.plugin.common.forge.DefaultPluginImpl; import me.shedaniel.rei.plugin.common.DefaultRuntimePlugin; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -44,7 +46,7 @@ import java.util.Collections; import java.util.List; import java.util.function.Supplier; -public class PluginDetectorImpl { +public class PluginDetectorImpl implements PluginDetector { private static

> REIPluginProvider

wrapPlugin(List modId, REIPluginProvider

plugin) { return new REIPluginProvider

() { String nameSuffix = " [" + String.join(", ", modId) + "]"; @@ -66,15 +68,17 @@ public class PluginDetectorImpl { }; } - public static void detectServerPlugins() { - PluginView.getServerInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new DefaultPlugin())); + @Override + public void detectServerPlugins() { + PluginView.getServerInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new DefaultPluginImpl())); PluginView.getServerInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new DefaultRuntimePlugin())); AnnotationUtils.scanAnnotation(REIPlugin.class, REIServerPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> { ((PluginView) PluginManager.getServerInstance()).registerPlugin(wrapPlugin(modId, plugin.get())); }); } - public static void detectCommonPlugins() { + @Override + public void detectCommonPlugins() { EventBuses.registerModEventBus("roughlyenoughitems", FMLJavaModLoadingContext.get().getModEventBus()); AnnotationUtils.>scanAnnotation(REIPlugin.class, me.shedaniel.rei.api.common.plugins.REIPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> { ((PluginView) PluginManager.getInstance()).registerPlugin(wrapPlugin(modId, plugin.get())); @@ -82,12 +86,15 @@ public class PluginDetectorImpl { } @OnlyIn(Dist.CLIENT) - public static void detectClientPlugins() { - PluginView.getClientInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new DefaultClientPlugin())); - PluginView.getClientInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new DefaultClientRuntimePlugin())); - AnnotationUtils.scanAnnotation(REIPlugin.class, REIClientPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> { - ((PluginView) PluginManager.getClientInstance()).registerPlugin(wrapPlugin(modId, plugin.get())); - }); - ClientInternals.attachInstance((Supplier>) ArrayList::new, "jeiCompatMods"); + @Override + public Supplier detectClientPlugins() { + return () -> () -> { + PluginView.getClientInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new DefaultClientPluginImpl())); + PluginView.getClientInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new DefaultClientRuntimePlugin())); + AnnotationUtils.scanAnnotation(REIPlugin.class, REIClientPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> { + ((PluginView) PluginManager.getClientInstance()).registerPlugin(wrapPlugin(modId, plugin.get())); + }); + ClientInternals.attachInstance((Supplier>) ArrayList::new, "jeiCompatMods"); + }; } } diff --git a/forge/src/main/java/me/shedaniel/rei/forge/PrimitivePlatformAdapterImpl.java b/forge/src/main/java/me/shedaniel/rei/forge/PrimitivePlatformAdapterImpl.java new file mode 100644 index 000000000..5553597c7 --- /dev/null +++ b/forge/src/main/java/me/shedaniel/rei/forge/PrimitivePlatformAdapterImpl.java @@ -0,0 +1,69 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020, 2021, 2022 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.forge; + +import me.shedaniel.rei.RoughlyEnoughItemsState; +import me.shedaniel.rei.impl.init.PrimitivePlatformAdapter; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.fml.ModList; +import net.minecraftforge.fml.loading.FMLEnvironment; +import net.minecraftforge.fml.loading.FMLLoader; +import org.apache.maven.artifact.versioning.ComparableVersion; + +public class PrimitivePlatformAdapterImpl implements PrimitivePlatformAdapter { + @Override + public boolean isClient() { + return FMLEnvironment.dist == Dist.CLIENT; + } + + @Override + public void checkMods() { + if (ModList.get().isLoaded("moreoverlays")) { + RoughlyEnoughItemsState.error("REI is not compatible with MoreOverlays, and actually contains Builtin Inventory Highlighting, other features can be installed via different mods!"); + } + } + + @Override + public boolean isDev() { + return !FMLLoader.isProduction(); + } + + @Override + public String getMinecraftVersion() { + return ModList.get().getModContainerById("minecraft").get().getModInfo().getVersion().toString(); + } + + @Override + public int compareVersions(String version1, String version2) { + ComparableVersion v1 = new ComparableVersion(version1); + ComparableVersion v2 = new ComparableVersion(version2); + + try { + return v1.compareTo(v2); + } catch (IllegalStateException e) { + new IllegalStateException("Failed to compare versions: " + version1 + " and " + version2, e).printStackTrace(); + return 0; + } + } +} diff --git a/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java b/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java index aa049bcf2..838bb22ab 100644 --- a/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java +++ b/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsForge.java @@ -23,7 +23,7 @@ package me.shedaniel.rei.forge; -import me.shedaniel.rei.RoughlyEnoughItemsInitializer; +import me.shedaniel.rei.impl.init.RoughlyEnoughItemsInitializer; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.DatagenModLoader; import net.minecraftforge.fml.DistExecutor; diff --git a/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsInitializerImpl.java b/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsInitializerImpl.java deleted file mode 100644 index 76952dd4b..000000000 --- a/forge/src/main/java/me/shedaniel/rei/forge/RoughlyEnoughItemsInitializerImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * This file is licensed under the MIT License, part of Roughly Enough Items. - * Copyright (c) 2018, 2019, 2020, 2021, 2022 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.forge; - -import me.shedaniel.rei.RoughlyEnoughItemsState; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.fml.ModList; -import net.minecraftforge.fml.loading.FMLEnvironment; -import net.minecraftforge.fml.loading.FMLLoader; -import org.apache.maven.artifact.versioning.ComparableVersion; - -public class RoughlyEnoughItemsInitializerImpl { - public static boolean isClient() { - return FMLEnvironment.dist == Dist.CLIENT; - } - - public static void checkMods() { - if (ModList.get().isLoaded("moreoverlays")) { - RoughlyEnoughItemsState.error("REI is not compatible with MoreOverlays, and actually contains Builtin Inventory Highlighting, other features can be installed via different mods!"); - } - } - - public static boolean isDev() { - return !FMLLoader.isProduction(); - } - - public static String getMinecraftVersion() { - return ModList.get().getModContainerById("minecraft").get().getModInfo().getVersion().toString(); - } - - public static int compareVersions(String version1, String version2) { - ComparableVersion v1 = new ComparableVersion(version1); - ComparableVersion v2 = new ComparableVersion(version2); - - try { - return v1.compareTo(v2); - } catch (IllegalStateException e) { - new IllegalStateException("Failed to compare versions: " + version1 + " and " + version2, e).printStackTrace(); - return 0; - } - } -} diff --git a/forge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplForge.java b/forge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplForge.java new file mode 100644 index 000000000..030ca44d1 --- /dev/null +++ b/forge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplForge.java @@ -0,0 +1,53 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020, 2021, 2022 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.impl.client.gui.forge; + +import com.mojang.blaze3d.vertex.PoseStack; +import me.shedaniel.rei.api.client.gui.widgets.Tooltip; +import me.shedaniel.rei.api.common.entry.EntryStack; +import me.shedaniel.rei.api.common.util.CollectionUtils; +import net.minecraft.client.Minecraft; +import me.shedaniel.rei.impl.client.gui.ScreenOverlayImpl; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.network.chat.FormattedText; +import net.minecraft.network.chat.Style; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.fml.client.gui.GuiUtils; + +import java.util.List; + +public class ScreenOverlayImplForge extends ScreenOverlayImpl { + @Override + public void renderTooltipInner(Screen screen, PoseStack matrices, Tooltip tooltip, int mouseX, int mouseY) { + matrices.pushPose(); + matrices.translate(0, 0, 500); + EntryStack stack = tooltip.getContextStack(); + ItemStack itemStack = stack.getValue() instanceof ItemStack ? stack.castValue() : ItemStack.EMPTY; + GuiUtils.preItemToolTip(itemStack); + List texts = CollectionUtils.flatMap(tooltip.getText(), component -> Minecraft.getInstance().font.getSplitter().splitLines(component, 100000, Style.EMPTY)); + GuiUtils.drawHoveringText(matrices, texts, mouseX, mouseY, screen.width, screen.height, screen.width, Minecraft.getInstance().font); + GuiUtils.postItemToolTip(); + matrices.popPose(); + } +} diff --git a/forge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplImpl.java b/forge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplImpl.java deleted file mode 100644 index 200b418e1..000000000 --- a/forge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is licensed under the MIT License, part of Roughly Enough Items. - * Copyright (c) 2018, 2019, 2020, 2021, 2022 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.impl.client.gui.forge; - -import com.mojang.blaze3d.vertex.PoseStack; -import me.shedaniel.rei.api.client.gui.widgets.Tooltip; -import me.shedaniel.rei.api.common.entry.EntryStack; -import me.shedaniel.rei.api.common.util.CollectionUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screens.Screen; -import net.minecraft.network.chat.FormattedText; -import net.minecraft.network.chat.Style; -import net.minecraft.world.item.ItemStack; -import net.minecraftforge.fml.client.gui.GuiUtils; - -import java.util.List; - -public class ScreenOverlayImplImpl { - public static void renderTooltipInner(Screen screen, PoseStack matrices, Tooltip tooltip, int mouseX, int mouseY) { - matrices.pushPose(); - matrices.translate(0, 0, 500); - EntryStack stack = tooltip.getContextStack(); - ItemStack itemStack = stack.getValue() instanceof ItemStack ? stack.castValue() : ItemStack.EMPTY; - GuiUtils.preItemToolTip(itemStack); - List texts = CollectionUtils.flatMap(tooltip.getText(), component -> Minecraft.getInstance().font.getSplitter().splitLines(component, 100000, Style.EMPTY)); - GuiUtils.drawHoveringText(matrices, texts, mouseX, mouseY, screen.width, screen.height, screen.width, Minecraft.getInstance().font); - GuiUtils.postItemToolTip(); - matrices.popPose(); - } -} diff --git a/forge/src/main/java/me/shedaniel/rei/plugin/client/forge/DefaultClientPluginImpl.java b/forge/src/main/java/me/shedaniel/rei/plugin/client/forge/DefaultClientPluginImpl.java index 027cf3cac..a354e70cc 100644 --- a/forge/src/main/java/me/shedaniel/rei/plugin/client/forge/DefaultClientPluginImpl.java +++ b/forge/src/main/java/me/shedaniel/rei/plugin/client/forge/DefaultClientPluginImpl.java @@ -26,6 +26,8 @@ package me.shedaniel.rei.plugin.client.forge; import com.google.common.collect.Sets; import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; import me.shedaniel.rei.plugin.client.BuiltinClientPlugin; +import me.shedaniel.rei.plugin.client.DefaultClientPlugin; +import net.minecraft.core.Holder; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.alchemy.Potion; @@ -41,8 +43,9 @@ import net.minecraftforge.registries.IRegistryDelegate; import java.util.Arrays; import java.util.Set; -public class DefaultClientPluginImpl { - public static void registerForgePotions(DisplayRegistry registry, BuiltinClientPlugin clientPlugin) { +public class DefaultClientPluginImpl extends DefaultClientPlugin { + @Override + public void registerForgePotions(DisplayRegistry registry, BuiltinClientPlugin clientPlugin) { for (IBrewingRecipe recipe : BrewingRecipeRegistry.getRecipes()) { if (recipe instanceof VanillaBrewingRecipe) { registerVanillaPotions(registry, clientPlugin); diff --git a/forge/src/main/java/me/shedaniel/rei/plugin/common/forge/DefaultPluginImpl.java b/forge/src/main/java/me/shedaniel/rei/plugin/common/forge/DefaultPluginImpl.java index 2001f53ff..5798e50f4 100644 --- a/forge/src/main/java/me/shedaniel/rei/plugin/common/forge/DefaultPluginImpl.java +++ b/forge/src/main/java/me/shedaniel/rei/plugin/common/forge/DefaultPluginImpl.java @@ -28,6 +28,7 @@ import me.shedaniel.architectury.event.CompoundEventResult; import me.shedaniel.architectury.hooks.forge.FluidStackHooksForge; import me.shedaniel.rei.api.common.fluid.FluidSupportProvider; import me.shedaniel.rei.api.common.util.EntryStacks; +import me.shedaniel.rei.plugin.common.DefaultPlugin; import net.minecraft.world.item.BucketItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.material.Fluid; @@ -38,8 +39,10 @@ import net.minecraftforge.fluids.capability.IFluidHandlerItem; import java.util.stream.IntStream; -public class DefaultPluginImpl { - public static void registerForgeFluidSupport(FluidSupportProvider support) { +public class DefaultPluginImpl extends DefaultPlugin { + @Override + public void registerFluidSupport(FluidSupportProvider support) { + super.registerFluidSupport(support); support.register(stack -> { ItemStack itemStack = stack.getValue(); LazyOptional handlerOptional = FluidUtil.getFluidHandler(itemStack); @@ -57,8 +60,4 @@ public class DefaultPluginImpl { return CompoundEventResult.pass(); }); } - - public static Fluid getFluidFromBucket(BucketItem item) { - return item.getFluid(); - } } -- cgit