From ccbaa4586ba2658a708dd1c1bc0ca31cc0a1e203 Mon Sep 17 00:00:00 2001 From: IntegerLimit <103940576+IntegerLimit@users.noreply.github.com> Date: Sun, 16 Apr 2023 22:15:31 +1000 Subject: [PATCH] Drop Waila Integration (It wasn't working, and TOP is superior) --- .../integration/IIntegrationPlugin.java | 50 -------------- .../integration/waila/WailaPlugin.java | 65 ------------------- 2 files changed, 115 deletions(-) delete mode 100644 src/main/java/io/github/nomiceu/integration/IIntegrationPlugin.java delete mode 100644 src/main/java/io/github/nomiceu/integration/waila/WailaPlugin.java diff --git a/src/main/java/io/github/nomiceu/integration/IIntegrationPlugin.java b/src/main/java/io/github/nomiceu/integration/IIntegrationPlugin.java deleted file mode 100644 index 04d280b..0000000 --- a/src/main/java/io/github/nomiceu/integration/IIntegrationPlugin.java +++ /dev/null @@ -1,50 +0,0 @@ -package io.github.nomiceu.integration; - -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModContainer; -import net.minecraftforge.fml.common.versioning.ArtifactVersion; -import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion; -import net.minecraftforge.fml.common.versioning.InvalidVersionSpecificationException; -import net.minecraftforge.fml.common.versioning.VersionRange; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.util.List; - -public interface IIntegrationPlugin { - - void init(); - - default boolean versionCheck() { - String pattern = versionPattern(); - if(pattern == null) - return true; - - List modList = Loader.instance().getModList(); - - for(ModContainer mod : modList) { - if(mod.getModId().equals(getModID())) { - try { - VersionRange validVersions = VersionRange.createFromVersionSpec(pattern); - ArtifactVersion version = new DefaultArtifactVersion(mod.getVersion()); - return validVersions.containsVersion(version); - } catch(InvalidVersionSpecificationException e) { - return false; - } - } - } - - return false; - } - - @Nullable - default String versionPattern() { - return null; - } - - @Nonnull - String getModID(); - - void postInit(); - -} diff --git a/src/main/java/io/github/nomiceu/integration/waila/WailaPlugin.java b/src/main/java/io/github/nomiceu/integration/waila/WailaPlugin.java deleted file mode 100644 index 06765c0..0000000 --- a/src/main/java/io/github/nomiceu/integration/waila/WailaPlugin.java +++ /dev/null @@ -1,65 +0,0 @@ -package io.github.nomiceu.integration.waila; - -import com.jaquadro.minecraft.storagedrawers.StorageDrawers; -import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers; -import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers; -import com.jaquadro.minecraft.storagedrawers.integration.Waila; -import io.github.nomiceu.integration.IIntegrationPlugin; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaRegistrar; -import mcp.mobius.waila.api.impl.ConfigHandler; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.fml.common.event.FMLInterModComms; - -import javax.annotation.Nonnull; -import java.util.List; - -public class WailaPlugin implements IIntegrationPlugin { - - @Nonnull - @Override - public String getModID() { - return "waila"; - } - - @Override - public void init() { - FMLInterModComms.sendMessage("waila", "register", "eutros.framedcompactdrawers.integration.waila.WailaPlugin.register"); - } - - @Override - public void postInit() { - } - - @SuppressWarnings("unused") - public static void register(IWailaRegistrar registrar) { - ConfigHandler configHandler = ConfigHandler.instance(); - - Waila.WailaDrawer provider = new OverwrittenWailaDrawer(); - - registrar.registerBodyProvider(provider, BlockDrawers.class); - registrar.registerStackProvider(provider, BlockDrawers.class); - - configHandler.addConfig(StorageDrawers.MOD_NAME, "display.content", I18n.format("storageDrawers.waila.config.displayContents"), true); - configHandler.addConfig(StorageDrawers.MOD_NAME, "display.stacklimit", I18n.format("storageDrawers.waila.config.displayStackLimit"), true); - configHandler.addConfig(StorageDrawers.MOD_NAME, "display.status", I18n.format("storageDrawers.waila.config.displayStatus"), true); - } - - public static class OverwrittenWailaDrawer extends Waila.WailaDrawer { - - @Override - @Nonnull - public List getWailaBody(@Nonnull ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - TileEntity te = accessor.getTileEntity(); - if(!(te instanceof TileEntityDrawers)) - return currenttip; - - return super.getWailaBody(itemStack, currenttip, accessor, config); - } - - } - -} \ No newline at end of file