diff --git a/platform/fabric/src/main/java/mcp/mobius/waila/fabric/FabricCommonService.java b/platform/fabric/src/main/java/mcp/mobius/waila/fabric/FabricCommonService.java
index 801f8f892..1d405a9fd 100644
--- a/platform/fabric/src/main/java/mcp/mobius/waila/fabric/FabricCommonService.java
+++ b/platform/fabric/src/main/java/mcp/mobius/waila/fabric/FabricCommonService.java
@@ -3,8 +3,8 @@
import java.nio.file.Path;
import java.util.Optional;
-import mcp.mobius.waila.api.IPluginInfo;
import mcp.mobius.waila.api.WailaConstants;
+import mcp.mobius.waila.plugin.PluginSide;
import mcp.mobius.waila.service.ICommonService;
import mcp.mobius.waila.util.ModInfo;
import net.fabricmc.loader.api.FabricLoader;
@@ -40,10 +40,10 @@ public boolean isDev() {
}
@Override
- public IPluginInfo.Side getSide() {
+ public PluginSide getSide() {
return switch (FabricLoader.getInstance().getEnvironmentType()) {
- case CLIENT -> IPluginInfo.Side.CLIENT;
- case SERVER -> IPluginInfo.Side.SERVER;
+ case CLIENT -> PluginSide.CLIENT;
+ case SERVER -> PluginSide.DEDICATED_SERVER;
};
}
diff --git a/platform/fabric/src/main/java/mcp/mobius/waila/fabric/FabricPluginLoader.java b/platform/fabric/src/main/java/mcp/mobius/waila/fabric/FabricPluginLoader.java
index 2b4a45b7e..b35ab8a21 100644
--- a/platform/fabric/src/main/java/mcp/mobius/waila/fabric/FabricPluginLoader.java
+++ b/platform/fabric/src/main/java/mcp/mobius/waila/fabric/FabricPluginLoader.java
@@ -6,9 +6,9 @@
import com.google.common.collect.Streams;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
-import mcp.mobius.waila.api.IPluginInfo;
import mcp.mobius.waila.plugin.PluginInfo;
import mcp.mobius.waila.plugin.PluginLoader;
+import mcp.mobius.waila.plugin.PluginSide;
import mcp.mobius.waila.util.Log;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
@@ -81,26 +81,26 @@ protected void gatherPlugins() {
var initializer = plugin.get("initializer").getAsString();
var sideStr = plugin.containsKey("environment") ? plugin.get("environment").getAsString() : "both";
- IPluginInfo.Side side;
+ PluginSide side;
switch (sideStr) {
- case "client" -> side = IPluginInfo.Side.CLIENT;
- case "server" -> side = IPluginInfo.Side.SERVER;
- case "both" -> side = IPluginInfo.Side.BOTH;
+ case "client" -> side = PluginSide.CLIENT;
+ case "server" -> side = PluginSide.DEDICATED_SERVER;
+ case "both" -> side = PluginSide.COMMON;
default -> {
LOG.error("Environment for plugin {} is not valid, must be one of [client, server, both].", id);
continue;
}
}
- if (side == IPluginInfo.Side.CLIENT && FabricLoader.getInstance().getEnvironmentType() != EnvType.CLIENT) {
+ if (side == PluginSide.CLIENT && FabricLoader.getInstance().getEnvironmentType() != EnvType.CLIENT) {
continue;
}
- if (side == IPluginInfo.Side.SERVER && FabricLoader.getInstance().getEnvironmentType() != EnvType.SERVER) {
+ if (side == PluginSide.DEDICATED_SERVER && FabricLoader.getInstance().getEnvironmentType() != EnvType.SERVER) {
continue;
}
- PluginInfo.register(mod.getMetadata().getId(), id, side, initializer, requiredDeps, true, true);
+ PluginInfo.registerDeprecated(mod.getMetadata().getId(), id, side, initializer, requiredDeps, true, true);
}
}
}
diff --git a/platform/fabric/src/main/resources/waila_plugins.json b/platform/fabric/src/main/resources/waila_plugins.json
index 043905e95..7c5040f43 100644
--- a/platform/fabric/src/main/resources/waila_plugins.json
+++ b/platform/fabric/src/main/resources/waila_plugins.json
@@ -1,36 +1,53 @@
{
"waila:core" : {
- "initializer": "mcp.mobius.waila.plugin.core.WailaPluginCore",
+ "entrypoints": {
+ "common": "mcp.mobius.waila.plugin.core.CoreCommonPlugin",
+ "client": "mcp.mobius.waila.plugin.core.CoreClientPlugin"
+ },
"side" : "*",
"required" : []
},
"waila:vanilla" : {
- "initializer": "mcp.mobius.waila.plugin.vanilla.WailaPluginVanilla",
+ "entrypoints": {
+ "common": "mcp.mobius.waila.plugin.vanilla.VanillaCommonPlugin",
+ "client": "mcp.mobius.waila.plugin.vanilla.VanillaClientPlugin"
+ },
"side" : "*",
"required" : ["minecraft"]
},
"waila:harvest" : {
- "initializer": "mcp.mobius.waila.plugin.harvest.WailaPluginHarvest",
+ "entrypoints": {
+ "common": "mcp.mobius.waila.plugin.harvest.HarvestCommonPlugin",
+ "client": "mcp.mobius.waila.plugin.harvest.HarvestClientPlugin"
+ },
"side" : "*",
"required" : []
},
"waila:extra" : {
- "initializer": "mcp.mobius.waila.plugin.extra.WailaPluginExtra",
+ "entrypoints": {
+ "common": "mcp.mobius.waila.plugin.extra.ExtraPlugin",
+ "client": "mcp.mobius.waila.plugin.extra.ExtraPlugin"
+ },
"side" : "*",
"required" : []
},
"waila:fabric" : {
- "initializer": "mcp.mobius.waila.plugin.fabric.WailaPluginFabric",
+ "entrypoints": {
+ "common": "mcp.mobius.waila.plugin.fabric.FabricCommonPlugin",
+ "client": "mcp.mobius.waila.plugin.fabric.FabricClientPlugin"
+ },
"side" : "*",
"required" : ["fabric-api"]
},
"waila:team_reborn_energy": {
- "initializer": "mcp.mobius.waila.plugin.trenergy.WailaPluginTeamRebornEnergy",
+ "entrypoints": {
+ "common": "mcp.mobius.waila.plugin.trenergy.TeamRebornCommonPlugin"
+ },
"side" : "*",
"required" : ["team_reborn_energy"]
}
diff --git a/platform/fabric/src/plugin/java/mcp/mobius/waila/plugin/fabric/FabricClientPlugin.java b/platform/fabric/src/plugin/java/mcp/mobius/waila/plugin/fabric/FabricClientPlugin.java
new file mode 100644
index 000000000..bb01f0921
--- /dev/null
+++ b/platform/fabric/src/plugin/java/mcp/mobius/waila/plugin/fabric/FabricClientPlugin.java
@@ -0,0 +1,7 @@
+package mcp.mobius.waila.plugin.fabric;
+
+import mcp.mobius.waila.plugin.textile.TextileClientPlugin;
+
+public class FabricClientPlugin extends TextileClientPlugin {
+
+}
diff --git a/platform/fabric/src/plugin/java/mcp/mobius/waila/plugin/fabric/FabricCommonPlugin.java b/platform/fabric/src/plugin/java/mcp/mobius/waila/plugin/fabric/FabricCommonPlugin.java
new file mode 100644
index 000000000..3b1c329f9
--- /dev/null
+++ b/platform/fabric/src/plugin/java/mcp/mobius/waila/plugin/fabric/FabricCommonPlugin.java
@@ -0,0 +1,6 @@
+package mcp.mobius.waila.plugin.fabric;
+
+import mcp.mobius.waila.plugin.textile.TextileCommonPlugin;
+
+public class FabricCommonPlugin extends TextileCommonPlugin {
+}
diff --git a/platform/fabric/src/plugin/java/mcp/mobius/waila/plugin/fabric/WailaPluginFabric.java b/platform/fabric/src/plugin/java/mcp/mobius/waila/plugin/fabric/WailaPluginFabric.java
deleted file mode 100644
index 5b5519ddc..000000000
--- a/platform/fabric/src/plugin/java/mcp/mobius/waila/plugin/fabric/WailaPluginFabric.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package mcp.mobius.waila.plugin.fabric;
-
-import mcp.mobius.waila.plugin.textile.WailaPluginTextile;
-
-public class WailaPluginFabric extends WailaPluginTextile {
-
-}
diff --git a/platform/forge/src/api/java/mcp/mobius/waila/api/WailaPlugin.java b/platform/forge/src/api/java/mcp/mobius/waila/api/WailaPlugin.java
index 46a971537..008bc04b2 100644
--- a/platform/forge/src/api/java/mcp/mobius/waila/api/WailaPlugin.java
+++ b/platform/forge/src/api/java/mcp/mobius/waila/api/WailaPlugin.java
@@ -10,7 +10,7 @@
import org.jetbrains.annotations.ApiStatus;
/**
- * @deprecated use {@code waila_plugins.json} file, see {@link IWailaPlugin} javadocs for more info.
+ * @deprecated use {@code waila_plugins.json} file, see {@link mcp.mobius.waila.api} javadocs for more info.
*/
@Deprecated
@Documented
diff --git a/platform/forge/src/main/java/mcp/mobius/waila/forge/ForgeCommonService.java b/platform/forge/src/main/java/mcp/mobius/waila/forge/ForgeCommonService.java
index d11d81e39..e86880bd9 100644
--- a/platform/forge/src/main/java/mcp/mobius/waila/forge/ForgeCommonService.java
+++ b/platform/forge/src/main/java/mcp/mobius/waila/forge/ForgeCommonService.java
@@ -3,8 +3,8 @@
import java.nio.file.Path;
import java.util.Optional;
-import mcp.mobius.waila.api.IPluginInfo;
import mcp.mobius.waila.api.WailaConstants;
+import mcp.mobius.waila.plugin.PluginSide;
import mcp.mobius.waila.service.ICommonService;
import mcp.mobius.waila.util.ModInfo;
import net.minecraftforge.fml.ModContainer;
@@ -43,10 +43,10 @@ public boolean isDev() {
}
@Override
- public IPluginInfo.Side getSide() {
+ public PluginSide getSide() {
return switch (FMLLoader.getDist()) {
- case CLIENT -> IPluginInfo.Side.CLIENT;
- case DEDICATED_SERVER -> IPluginInfo.Side.SERVER;
+ case CLIENT -> PluginSide.CLIENT;
+ case DEDICATED_SERVER -> PluginSide.DEDICATED_SERVER;
};
}
diff --git a/platform/forge/src/main/java/mcp/mobius/waila/forge/ForgePluginLoader.java b/platform/forge/src/main/java/mcp/mobius/waila/forge/ForgePluginLoader.java
index c4c5e720d..b65946403 100644
--- a/platform/forge/src/main/java/mcp/mobius/waila/forge/ForgePluginLoader.java
+++ b/platform/forge/src/main/java/mcp/mobius/waila/forge/ForgePluginLoader.java
@@ -7,6 +7,7 @@
import mcp.mobius.waila.api.WailaPlugin;
import mcp.mobius.waila.plugin.PluginInfo;
import mcp.mobius.waila.plugin.PluginLoader;
+import mcp.mobius.waila.plugin.PluginSide;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.loading.FMLLoader;
@@ -30,23 +31,27 @@ protected void gatherPlugins() {
if (annotation.annotationType().getClassName().equals(WAILA_PLUGIN)) {
var id = (String) annotation.annotationData().get("id");
var required = (String[]) annotation.annotationData().getOrDefault("required", new String[0]);
- var side = (IPluginInfo.Side) annotation.annotationData().get("side");
+ var side = switch ((IPluginInfo.Side) annotation.annotationData().get("side")) {
+ case CLIENT -> PluginSide.CLIENT;
+ case SERVER -> PluginSide.DEDICATED_SERVER;
+ case BOTH -> PluginSide.COMMON;
+ };
var satisfied = true;
for (var dep : required) {
satisfied = satisfied && ModList.get().isLoaded(dep);
}
- if (side == IPluginInfo.Side.CLIENT && FMLLoader.getDist() != Dist.CLIENT) {
+ if (side == PluginSide.CLIENT && FMLLoader.getDist() != Dist.CLIENT) {
satisfied = false;
}
- if (side == IPluginInfo.Side.SERVER && FMLLoader.getDist() != Dist.DEDICATED_SERVER) {
+ if (side == PluginSide.DEDICATED_SERVER && FMLLoader.getDist() != Dist.DEDICATED_SERVER) {
satisfied = false;
}
if (satisfied) {
- PluginInfo.register(modFile.getMods().get(0).getModId(), id, side, annotation.memberName(), Arrays.asList(required), true, true);
+ PluginInfo.registerDeprecated(modFile.getMods().get(0).getModId(), id, side, annotation.memberName(), Arrays.asList(required), true, true);
}
}
}
diff --git a/platform/forge/src/main/resources/waila_plugins.json b/platform/forge/src/main/resources/waila_plugins.json
index d3cfe65b7..e75d68a24 100644
--- a/platform/forge/src/main/resources/waila_plugins.json
+++ b/platform/forge/src/main/resources/waila_plugins.json
@@ -1,30 +1,45 @@
{
"waila:core" : {
- "initializer": "mcp.mobius.waila.plugin.core.WailaPluginCore",
+ "entrypoints": {
+ "common": "mcp.mobius.waila.plugin.core.CoreCommonPlugin",
+ "client": "mcp.mobius.waila.plugin.core.CoreClientPlugin"
+ },
"side" : "*",
"required" : []
},
"waila:vanilla": {
- "initializer": "mcp.mobius.waila.plugin.vanilla.WailaPluginVanilla",
+ "entrypoints": {
+ "common": "mcp.mobius.waila.plugin.vanilla.VanillaCommonPlugin",
+ "client": "mcp.mobius.waila.plugin.vanilla.VanillaClientPlugin"
+ },
"side" : "*",
"required" : ["minecraft"]
},
"waila:harvest": {
- "initializer": "mcp.mobius.waila.plugin.harvest.WailaPluginHarvest",
+ "entrypoints": {
+ "common": "mcp.mobius.waila.plugin.harvest.HarvestCommonPlugin",
+ "client": "mcp.mobius.waila.plugin.harvest.HarvestClientPlugin"
+ },
"side" : "*",
"required" : []
},
"waila:extra" : {
- "initializer": "mcp.mobius.waila.plugin.extra.WailaPluginExtra",
+ "entrypoints": {
+ "common": "mcp.mobius.waila.plugin.extra.ExtraPlugin",
+ "client": "mcp.mobius.waila.plugin.extra.ExtraPlugin"
+ },
"side" : "*",
"required" : []
},
"waila:forge" : {
- "initializer": "mcp.mobius.waila.plugin.forge.WailaPluginForge",
+ "entrypoints": {
+ "common": "mcp.mobius.waila.plugin.forge.ForgeCommonPlugin",
+ "client": "mcp.mobius.waila.plugin.forge.ForgeClientPlugin"
+ },
"side" : "*",
"required" : ["forge"]
}
diff --git a/platform/forge/src/plugin/java/mcp/mobius/waila/plugin/forge/WailaPluginForge.java b/platform/forge/src/plugin/java/mcp/mobius/waila/plugin/forge/ForgeClientPlugin.java
similarity index 77%
rename from platform/forge/src/plugin/java/mcp/mobius/waila/plugin/forge/WailaPluginForge.java
rename to platform/forge/src/plugin/java/mcp/mobius/waila/plugin/forge/ForgeClientPlugin.java
index 4b2480c18..9249ed6ed 100644
--- a/platform/forge/src/plugin/java/mcp/mobius/waila/plugin/forge/WailaPluginForge.java
+++ b/platform/forge/src/plugin/java/mcp/mobius/waila/plugin/forge/ForgeClientPlugin.java
@@ -1,30 +1,23 @@
package mcp.mobius.waila.plugin.forge;
-import mcp.mobius.waila.api.IRegistrar;
+import mcp.mobius.waila.api.IClientRegistrar;
import mcp.mobius.waila.api.IToolType;
-import mcp.mobius.waila.api.IWailaPlugin;
+import mcp.mobius.waila.api.IWailaClientPlugin;
import mcp.mobius.waila.api.data.FluidData;
import mcp.mobius.waila.plugin.forge.fluid.ForgeFluidDescriptor;
-import mcp.mobius.waila.plugin.forge.provider.EnergyCapabilityProvider;
-import mcp.mobius.waila.plugin.forge.provider.FluidCapabilityProvider;
-import mcp.mobius.waila.plugin.forge.provider.ItemCapabilityProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.DoublePlantBlock;
-import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.material.Fluid;
import net.minecraftforge.common.IForgeShearable;
import net.minecraftforge.common.ToolActions;
-public class WailaPluginForge implements IWailaPlugin {
+public class ForgeClientPlugin implements IWailaClientPlugin {
@Override
- public void register(IRegistrar registrar) {
+ public void register(IClientRegistrar registrar) {
FluidData.describeFluid(Fluid.class, ForgeFluidDescriptor.INSTANCE);
- registrar.addBlockData(EnergyCapabilityProvider.INSTANCE, BlockEntity.class, 2000);
- registrar.addBlockData(ItemCapabilityProvider.INSTANCE, BlockEntity.class, 2000);
- registrar.addBlockData(FluidCapabilityProvider.INSTANCE, BlockEntity.class, 2000);
registrar.addToolType(ResourceLocation.withDefaultNamespace("pickaxe"), IToolType.builder()
.lowestTierItem(Items.WOODEN_PICKAXE)
diff --git a/platform/forge/src/plugin/java/mcp/mobius/waila/plugin/forge/ForgeCommonPlugin.java b/platform/forge/src/plugin/java/mcp/mobius/waila/plugin/forge/ForgeCommonPlugin.java
new file mode 100644
index 000000000..db5aec990
--- /dev/null
+++ b/platform/forge/src/plugin/java/mcp/mobius/waila/plugin/forge/ForgeCommonPlugin.java
@@ -0,0 +1,19 @@
+package mcp.mobius.waila.plugin.forge;
+
+import mcp.mobius.waila.api.ICommonRegistrar;
+import mcp.mobius.waila.api.IWailaCommonPlugin;
+import mcp.mobius.waila.plugin.forge.provider.EnergyCapabilityProvider;
+import mcp.mobius.waila.plugin.forge.provider.FluidCapabilityProvider;
+import mcp.mobius.waila.plugin.forge.provider.ItemCapabilityProvider;
+import net.minecraft.world.level.block.entity.BlockEntity;
+
+public class ForgeCommonPlugin implements IWailaCommonPlugin {
+
+ @Override
+ public void register(ICommonRegistrar registrar) {
+ registrar.addBlockData(EnergyCapabilityProvider.INSTANCE, BlockEntity.class, 2000);
+ registrar.addBlockData(ItemCapabilityProvider.INSTANCE, BlockEntity.class, 2000);
+ registrar.addBlockData(FluidCapabilityProvider.INSTANCE, BlockEntity.class, 2000);
+ }
+
+}
diff --git a/platform/neo/src/main/java/mcp/mobius/waila/neo/NeoCommonService.java b/platform/neo/src/main/java/mcp/mobius/waila/neo/NeoCommonService.java
index d30c41293..4d005d176 100644
--- a/platform/neo/src/main/java/mcp/mobius/waila/neo/NeoCommonService.java
+++ b/platform/neo/src/main/java/mcp/mobius/waila/neo/NeoCommonService.java
@@ -3,8 +3,8 @@
import java.nio.file.Path;
import java.util.Optional;
-import mcp.mobius.waila.api.IPluginInfo;
import mcp.mobius.waila.api.WailaConstants;
+import mcp.mobius.waila.plugin.PluginSide;
import mcp.mobius.waila.service.ICommonService;
import mcp.mobius.waila.util.ModInfo;
import net.neoforged.fml.ModContainer;
@@ -43,10 +43,10 @@ public boolean isDev() {
}
@Override
- public IPluginInfo.Side getSide() {
+ public PluginSide getSide() {
return switch (FMLLoader.getDist()) {
- case CLIENT -> IPluginInfo.Side.CLIENT;
- case DEDICATED_SERVER -> IPluginInfo.Side.SERVER;
+ case CLIENT -> PluginSide.CLIENT;
+ case DEDICATED_SERVER -> PluginSide.DEDICATED_SERVER;
};
}
diff --git a/platform/neo/src/main/resources/waila_plugins.json b/platform/neo/src/main/resources/waila_plugins.json
index 6b469b6ca..b4fd99d15 100644
--- a/platform/neo/src/main/resources/waila_plugins.json
+++ b/platform/neo/src/main/resources/waila_plugins.json
@@ -1,30 +1,45 @@
{
"waila:core" : {
- "initializer": "mcp.mobius.waila.plugin.core.WailaPluginCore",
+ "entrypoints": {
+ "common": "mcp.mobius.waila.plugin.core.CoreCommonPlugin",
+ "client": "mcp.mobius.waila.plugin.core.CoreClientPlugin"
+ },
"side" : "*",
"required" : []
},
"waila:vanilla": {
- "initializer": "mcp.mobius.waila.plugin.vanilla.WailaPluginVanilla",
+ "entrypoints": {
+ "common": "mcp.mobius.waila.plugin.vanilla.VanillaCommonPlugin",
+ "client": "mcp.mobius.waila.plugin.vanilla.VanillaClientPlugin"
+ },
"side" : "*",
"required" : ["minecraft"]
},
"waila:harvest": {
- "initializer": "mcp.mobius.waila.plugin.harvest.WailaPluginHarvest",
+ "entrypoints": {
+ "common": "mcp.mobius.waila.plugin.harvest.HarvestCommonPlugin",
+ "client": "mcp.mobius.waila.plugin.harvest.HarvestClientPlugin"
+ },
"side" : "*",
"required" : []
},
"waila:extra" : {
- "initializer": "mcp.mobius.waila.plugin.extra.WailaPluginExtra",
+ "entrypoints": {
+ "common": "mcp.mobius.waila.plugin.extra.ExtraPlugin",
+ "client": "mcp.mobius.waila.plugin.extra.ExtraPlugin"
+ },
"side" : "*",
"required" : []
},
"waila:neo" : {
- "initializer": "mcp.mobius.waila.plugin.neo.WailaPluginNeo",
+ "entrypoints": {
+ "common": "mcp.mobius.waila.plugin.neo.NeoCommonPlugin",
+ "client": "mcp.mobius.waila.plugin.neo.NeoClientPlugin"
+ },
"side" : "*",
"required" : ["neoforge"]
}
diff --git a/platform/neo/src/plugin/java/mcp/mobius/waila/plugin/neo/WailaPluginNeo.java b/platform/neo/src/plugin/java/mcp/mobius/waila/plugin/neo/NeoClientPlugin.java
similarity index 77%
rename from platform/neo/src/plugin/java/mcp/mobius/waila/plugin/neo/WailaPluginNeo.java
rename to platform/neo/src/plugin/java/mcp/mobius/waila/plugin/neo/NeoClientPlugin.java
index 6b1278e00..be8640e28 100644
--- a/platform/neo/src/plugin/java/mcp/mobius/waila/plugin/neo/WailaPluginNeo.java
+++ b/platform/neo/src/plugin/java/mcp/mobius/waila/plugin/neo/NeoClientPlugin.java
@@ -1,30 +1,23 @@
package mcp.mobius.waila.plugin.neo;
-import mcp.mobius.waila.api.IRegistrar;
+import mcp.mobius.waila.api.IClientRegistrar;
import mcp.mobius.waila.api.IToolType;
-import mcp.mobius.waila.api.IWailaPlugin;
+import mcp.mobius.waila.api.IWailaClientPlugin;
import mcp.mobius.waila.api.data.FluidData;
import mcp.mobius.waila.plugin.neo.fluid.NeoFluidDescriptor;
-import mcp.mobius.waila.plugin.neo.provider.EnergyCapabilityProvider;
-import mcp.mobius.waila.plugin.neo.provider.FluidCapabilityProvider;
-import mcp.mobius.waila.plugin.neo.provider.ItemCapabilityProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.DoublePlantBlock;
-import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.material.Fluid;
import net.neoforged.neoforge.common.IShearable;
import net.neoforged.neoforge.common.ItemAbilities;
-public class WailaPluginNeo implements IWailaPlugin {
+public class NeoClientPlugin implements IWailaClientPlugin {
@Override
- public void register(IRegistrar registrar) {
+ public void register(IClientRegistrar registrar) {
FluidData.describeFluid(Fluid.class, NeoFluidDescriptor.INSTANCE);
- registrar.addBlockData(EnergyCapabilityProvider.INSTANCE, BlockEntity.class, 2000);
- registrar.addBlockData(ItemCapabilityProvider.INSTANCE, BlockEntity.class, 2000);
- registrar.addBlockData(FluidCapabilityProvider.INSTANCE, BlockEntity.class, 2000);
registrar.addToolType(ResourceLocation.withDefaultNamespace("pickaxe"), IToolType.builder()
.lowestTierItem(Items.WOODEN_PICKAXE)
diff --git a/platform/neo/src/plugin/java/mcp/mobius/waila/plugin/neo/NeoCommonPlugin.java b/platform/neo/src/plugin/java/mcp/mobius/waila/plugin/neo/NeoCommonPlugin.java
new file mode 100644
index 000000000..75bd4486f
--- /dev/null
+++ b/platform/neo/src/plugin/java/mcp/mobius/waila/plugin/neo/NeoCommonPlugin.java
@@ -0,0 +1,19 @@
+package mcp.mobius.waila.plugin.neo;
+
+import mcp.mobius.waila.api.ICommonRegistrar;
+import mcp.mobius.waila.api.IWailaCommonPlugin;
+import mcp.mobius.waila.plugin.neo.provider.EnergyCapabilityProvider;
+import mcp.mobius.waila.plugin.neo.provider.FluidCapabilityProvider;
+import mcp.mobius.waila.plugin.neo.provider.ItemCapabilityProvider;
+import net.minecraft.world.level.block.entity.BlockEntity;
+
+public class NeoCommonPlugin implements IWailaCommonPlugin {
+
+ @Override
+ public void register(ICommonRegistrar registrar) {
+ registrar.addBlockData(EnergyCapabilityProvider.INSTANCE, BlockEntity.class, 2000);
+ registrar.addBlockData(ItemCapabilityProvider.INSTANCE, BlockEntity.class, 2000);
+ registrar.addBlockData(FluidCapabilityProvider.INSTANCE, BlockEntity.class, 2000);
+ }
+
+}
diff --git a/platform/textile/src/plugin/java/mcp/mobius/waila/plugin/textile/WailaPluginTextile.java b/platform/textile/src/plugin/java/mcp/mobius/waila/plugin/textile/TextileClientPlugin.java
similarity index 81%
rename from platform/textile/src/plugin/java/mcp/mobius/waila/plugin/textile/WailaPluginTextile.java
rename to platform/textile/src/plugin/java/mcp/mobius/waila/plugin/textile/TextileClientPlugin.java
index b91eccc18..9924e9d66 100644
--- a/platform/textile/src/plugin/java/mcp/mobius/waila/plugin/textile/WailaPluginTextile.java
+++ b/platform/textile/src/plugin/java/mcp/mobius/waila/plugin/textile/TextileClientPlugin.java
@@ -1,13 +1,11 @@
package mcp.mobius.waila.plugin.textile;
-import mcp.mobius.waila.api.IRegistrar;
+import mcp.mobius.waila.api.IClientRegistrar;
import mcp.mobius.waila.api.IToolType;
-import mcp.mobius.waila.api.IWailaPlugin;
+import mcp.mobius.waila.api.IWailaClientPlugin;
import mcp.mobius.waila.api.data.FluidData;
import mcp.mobius.waila.mixed.IShearable;
import mcp.mobius.waila.plugin.textile.fluid.TextileFluidDescriptor;
-import mcp.mobius.waila.plugin.textile.provider.FluidStorageProvider;
-import mcp.mobius.waila.plugin.textile.provider.ItemStorageProvider;
import net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
@@ -15,17 +13,14 @@
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.DoublePlantBlock;
-import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.material.Fluid;
-public abstract class WailaPluginTextile implements IWailaPlugin {
+public abstract class TextileClientPlugin implements IWailaClientPlugin {
@Override
- public void register(IRegistrar registrar) {
+ public void register(IClientRegistrar registrar) {
FluidData.describeFluid(Fluid.class, TextileFluidDescriptor.INSTANCE);
FluidData.describeCauldron(Block.class, TextileFluidDescriptor.INSTANCE);
- registrar.addBlockData(ItemStorageProvider.INSTANCE, BlockEntity.class, 2000);
- registrar.addBlockData(FluidStorageProvider.INSTANCE, BlockEntity.class, 2000);
registrar.addToolType(ResourceLocation.withDefaultNamespace("pickaxe"), IToolType.builder()
.lowestTierItem(Items.WOODEN_PICKAXE)
diff --git a/platform/textile/src/plugin/java/mcp/mobius/waila/plugin/textile/TextileCommonPlugin.java b/platform/textile/src/plugin/java/mcp/mobius/waila/plugin/textile/TextileCommonPlugin.java
new file mode 100644
index 000000000..a0252ec5b
--- /dev/null
+++ b/platform/textile/src/plugin/java/mcp/mobius/waila/plugin/textile/TextileCommonPlugin.java
@@ -0,0 +1,17 @@
+package mcp.mobius.waila.plugin.textile;
+
+import mcp.mobius.waila.api.ICommonRegistrar;
+import mcp.mobius.waila.api.IWailaCommonPlugin;
+import mcp.mobius.waila.plugin.textile.provider.FluidStorageProvider;
+import mcp.mobius.waila.plugin.textile.provider.ItemStorageProvider;
+import net.minecraft.world.level.block.entity.BlockEntity;
+
+public abstract class TextileCommonPlugin implements IWailaCommonPlugin {
+
+ @Override
+ public void register(ICommonRegistrar registrar) {
+ registrar.addBlockData(ItemStorageProvider.INSTANCE, BlockEntity.class, 2000);
+ registrar.addBlockData(FluidStorageProvider.INSTANCE, BlockEntity.class, 2000);
+ }
+
+}
diff --git a/platform/textile/src/plugin/java/mcp/mobius/waila/plugin/trenergy/WailaPluginTeamRebornEnergy.java b/platform/textile/src/plugin/java/mcp/mobius/waila/plugin/trenergy/TeamRebornEnergyCommonPlugin.java
similarity index 56%
rename from platform/textile/src/plugin/java/mcp/mobius/waila/plugin/trenergy/WailaPluginTeamRebornEnergy.java
rename to platform/textile/src/plugin/java/mcp/mobius/waila/plugin/trenergy/TeamRebornEnergyCommonPlugin.java
index b0fa8f7db..64cb4c8c1 100644
--- a/platform/textile/src/plugin/java/mcp/mobius/waila/plugin/trenergy/WailaPluginTeamRebornEnergy.java
+++ b/platform/textile/src/plugin/java/mcp/mobius/waila/plugin/trenergy/TeamRebornEnergyCommonPlugin.java
@@ -1,14 +1,14 @@
package mcp.mobius.waila.plugin.trenergy;
-import mcp.mobius.waila.api.IRegistrar;
-import mcp.mobius.waila.api.IWailaPlugin;
+import mcp.mobius.waila.api.ICommonRegistrar;
+import mcp.mobius.waila.api.IWailaCommonPlugin;
import mcp.mobius.waila.plugin.trenergy.provider.EnergyStorageProvider;
import net.minecraft.world.level.block.entity.BlockEntity;
-public class WailaPluginTeamRebornEnergy implements IWailaPlugin {
+public class TeamRebornEnergyCommonPlugin implements IWailaCommonPlugin {
@Override
- public void register(IRegistrar registrar) {
+ public void register(ICommonRegistrar registrar) {
registrar.addBlockData(EnergyStorageProvider.INSTANCE, BlockEntity.class, 2000);
}
diff --git a/src/api/java/mcp/mobius/waila/api/IBlockComponentProvider.java b/src/api/java/mcp/mobius/waila/api/IBlockComponentProvider.java
index f98e8b6f3..8ab64ccca 100644
--- a/src/api/java/mcp/mobius/waila/api/IBlockComponentProvider.java
+++ b/src/api/java/mcp/mobius/waila/api/IBlockComponentProvider.java
@@ -12,10 +12,10 @@
* Used to provide {@link Block}/{@link BlockEntity} tooltip information to Waila.
*
* All methods in this interface shouldn't to be called by the implementing mod.
- * An instance of the class is to be registered via the {@link IRegistrar} instance provided in {@link IWailaPlugin}.
+ * An instance of the class is to be registered via the {@link IClientRegistrar} instance provided in {@link IWailaClientPlugin}.
*
- * @see IWailaPlugin
- * @see IRegistrar
+ * @see IWailaClientPlugin
+ * @see IClientRegistrar
*/
@ApiSide.ClientOnly
@ApiStatus.OverrideOnly
@@ -39,7 +39,7 @@ public interface IBlockComponentProvider {
* @return {@code null} if this method doesn't redirect to anything,
* any result from one of {@link ITargetRedirector}'s methods otherwise
*
- * @see IRegistrar#addRedirect(IBlockComponentProvider, Class)
+ * @see IClientRegistrar#addRedirect(IBlockComponentProvider, Class)
*/
@Nullable
@ApiStatus.Experimental
@@ -55,7 +55,7 @@ default ITargetRedirector.Result redirect(ITargetRedirector redirect, IBlockAcce
* Note that {@link IBlockAccessor#getData()} will always be empty at this time
* @param config current plugin configuration
*
- * @see IRegistrar#addDataContext(IBlockComponentProvider, Class)
+ * @see IClientRegistrar#addDataContext(IBlockComponentProvider, Class)
*/
default void appendDataContext(IDataWriter ctx, IBlockAccessor accessor, IPluginConfig config) {
}
@@ -73,7 +73,7 @@ default void appendDataContext(IDataWriter ctx, IBlockAccessor accessor, IPlugin
*
* @return {@code null} if override is not required, a {@link BlockState} otherwise
*
- * @see IRegistrar#addOverride(IBlockComponentProvider, Class, int)
+ * @see IClientRegistrar#addOverride(IBlockComponentProvider, Class, int)
* @see #EMPTY_BLOCK_STATE
*/
@Nullable
@@ -94,7 +94,7 @@ default BlockState getOverride(IBlockAccessor accessor, IPluginConfig config) {
*
* @return the component to render or {@code null} if this provider doesn't decide it
*
- * @see IRegistrar#addIcon(IEntityComponentProvider, Class, int)
+ * @see IClientRegistrar#addIcon(IEntityComponentProvider, Class, int)
*/
@Nullable
default ITooltipComponent getIcon(IBlockAccessor accessor, IPluginConfig config) {
@@ -114,7 +114,7 @@ default ITooltipComponent getIcon(IBlockAccessor accessor, IPluginConfig config)
* @param accessor contains most of the relevant information about the current environment
* @param config current plugin configuration
*
- * @see IRegistrar#addComponent(IBlockComponentProvider, TooltipPosition, Class, int)
+ * @see IClientRegistrar#addComponent(IBlockComponentProvider, TooltipPosition, Class, int)
*/
default void appendHead(ITooltip tooltip, IBlockAccessor accessor, IPluginConfig config) {
}
@@ -132,7 +132,7 @@ default void appendHead(ITooltip tooltip, IBlockAccessor accessor, IPluginConfig
* @param accessor contains most of the relevant information about the current environment
* @param config current plugin configuration
*
- * @see IRegistrar#addComponent(IBlockComponentProvider, TooltipPosition, Class, int)
+ * @see IClientRegistrar#addComponent(IBlockComponentProvider, TooltipPosition, Class, int)
*/
default void appendBody(ITooltip tooltip, IBlockAccessor accessor, IPluginConfig config) {
}
@@ -150,7 +150,7 @@ default void appendBody(ITooltip tooltip, IBlockAccessor accessor, IPluginConfig
* @param accessor contains most of the relevant information about the current environment
* @param config current plugin configuration
*
- * @see IRegistrar#addComponent(IBlockComponentProvider, TooltipPosition, Class, int)
+ * @see IClientRegistrar#addComponent(IBlockComponentProvider, TooltipPosition, Class, int)
*/
default void appendTail(ITooltip tooltip, IBlockAccessor accessor, IPluginConfig config) {
}
diff --git a/src/api/java/mcp/mobius/waila/api/IClientRegistrar.java b/src/api/java/mcp/mobius/waila/api/IClientRegistrar.java
new file mode 100644
index 000000000..b860d587c
--- /dev/null
+++ b/src/api/java/mcp/mobius/waila/api/IClientRegistrar.java
@@ -0,0 +1,262 @@
+package mcp.mobius.waila.api;
+
+import lol.bai.badpackets.impl.marker.ApiSide;
+import net.minecraft.network.chat.Component;
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.world.level.block.entity.BlockEntity;
+import org.jetbrains.annotations.ApiStatus;
+
+@ApiSide.ClientOnly
+@ApiStatus.NonExtendable
+public interface IClientRegistrar {
+
+ /**
+ * Adds an event listener
+ */
+ void addEventListener(IEventListener listener, int priority);
+
+ /**
+ * Adds an event listener
+ */
+ void addEventListener(IEventListener listener);
+
+ /**
+ * Registers an {@link IBlockComponentProvider} instance to allow redirecting the object being displayed.
+ * A {@link BlockEntity} is also an acceptable class type.
+ *
+ * @param provider the data provider instance
+ * @param clazz the highest level class to apply to
+ * @param priority the priority of this provider 0 is the minimum, lower number will be called first
+ *
+ * @see WailaConstants#DEFAULT_PRIORITY
+ */
+ @ApiStatus.Experimental
+ void addRedirect(IBlockComponentProvider provider, Class clazz, int priority);
+
+ /**
+ * Registers an {@link IBlockComponentProvider} instance to allow redirecting the object being displayed.
+ * A {@link BlockEntity} is also an acceptable class type.
+ *
+ * @param provider the data provider instance
+ * @param clazz the highest level class to apply to
+ *
+ * @see WailaConstants#DEFAULT_PRIORITY
+ */
+ @ApiStatus.Experimental
+ void addRedirect(IBlockComponentProvider provider, Class clazz);
+
+ /**
+ * Registers an {@link IBlockComponentProvider} instance to allow overriding the block being displayed.
+ * A {@link BlockEntity} is also an acceptable class type.
+ *
+ * @param provider the data provider instance
+ * @param clazz the highest level class to apply to
+ * @param priority the priority of this provider 0 is the minimum, lower number will be called first
+ *
+ * @see WailaConstants#DEFAULT_PRIORITY
+ */
+ void addOverride(IBlockComponentProvider provider, Class clazz, int priority);
+
+ /**
+ * Registers an {@link IBlockComponentProvider} instance with
+ * {@linkplain WailaConstants#DEFAULT_PRIORITY default priority} to allow overriding the block being displayed.
+ * A {@link BlockEntity} is also an acceptable class type.
+ *
+ * @param provider the data provider instance
+ * @param clazz the highest level class to apply to
+ *
+ * @see WailaConstants#DEFAULT_PRIORITY
+ */
+ void addOverride(IBlockComponentProvider provider, Class clazz);
+
+ /**
+ * Registers an {@link IBlockComponentProvider} instance to allow overriding the displayed icon for a block via the
+ * {@link IBlockComponentProvider#getIcon(IBlockAccessor, IPluginConfig)} method.
+ * A {@link BlockEntity} is also an acceptable class type.
+ *
+ * @param provider the data provider instance
+ * @param clazz the highest level class to apply to
+ * @param priority the priority of this provider 0 is the minimum, lower number will be called first
+ *
+ * @see WailaConstants#DEFAULT_PRIORITY
+ */
+ void addIcon(IBlockComponentProvider provider, Class clazz, int priority);
+
+ /**
+ * Registers an {@link IBlockComponentProvider} instance with
+ * {@linkplain WailaConstants#DEFAULT_PRIORITY default priority} to allow overriding the displayed icon for a block via the
+ * {@link IBlockComponentProvider#getIcon(IBlockAccessor, IPluginConfig)} method.
+ * A {@link BlockEntity} is also an acceptable class type.
+ *
+ * @param provider the data provider instance
+ * @param clazz the highest level class to apply to
+ */
+ void addIcon(IBlockComponentProvider provider, Class clazz);
+
+ /**
+ * Registers an {@link IBlockComponentProvider} instance for appending {@link Component} to the tooltip.
+ * A {@link BlockEntity} is also an acceptable class type.
+ *
+ * @param provider the data provider instance
+ * @param position the position on the tooltip this applies to
+ * @param clazz the highest level class to apply to
+ * @param priority the priority of this provider 0 is the minimum, lower number will be called first
+ *
+ * @see WailaConstants#DEFAULT_PRIORITY
+ */
+ void addComponent(IBlockComponentProvider provider, TooltipPosition position, Class clazz, int priority);
+
+ /**
+ * Registers an {@link IBlockComponentProvider} instance with
+ * {@linkplain WailaConstants#DEFAULT_PRIORITY default priority} for appending {@link Component} to the tooltip.
+ * A {@link BlockEntity} is also an acceptable class type.
+ *
+ * @param provider the data provider instance
+ * @param position the position on the tooltip this applies to
+ * @param clazz the highest level class to apply to
+ */
+ void addComponent(IBlockComponentProvider provider, TooltipPosition position, Class clazz);
+
+ /**
+ * Registers an {@link IBlockComponentProvider} instance for appending data context that get sent to the server.
+ * A {@link BlockEntity} is also an acceptable class type.
+ *
+ * @param provider the data provider instance
+ * @param clazz the highest level class to apply to
+ */
+ void addDataContext(IBlockComponentProvider provider, Class clazz);
+
+ /**
+ * Registers an {@link IEntityComponentProvider} instance to allow redirecting the object being displayed.
+ *
+ * @param provider the data provider instance
+ * @param clazz the highest level class to apply to
+ * @param priority the priority of this provider 0 is the minimum, lower number will be called first
+ *
+ * @see WailaConstants#DEFAULT_PRIORITY
+ */
+ @ApiStatus.Experimental
+ void addRedirect(IEntityComponentProvider provider, Class clazz, int priority);
+
+ /**
+ * Registers an {@link IEntityComponentProvider} instance to allow redirecting the object being displayed.
+ *
+ * @param provider the data provider instance
+ * @param clazz the highest level class to apply to
+ *
+ * @see WailaConstants#DEFAULT_PRIORITY
+ */
+ @ApiStatus.Experimental
+ void addRedirect(IEntityComponentProvider provider, Class clazz);
+
+ /**
+ * Registers an {@link IEntityComponentProvider} instance to allow overriding the entity being displayed.
+ *
+ * @param provider the data provider instance
+ * @param clazz the highest level class to apply to
+ * @param priority the priority of this provider 0 is the minimum, lower number will be called first
+ *
+ * @see WailaConstants#DEFAULT_PRIORITY
+ */
+ void addOverride(IEntityComponentProvider provider, Class clazz, int priority);
+
+ /**
+ * Registers an {@link IEntityComponentProvider} instance with
+ * {@linkplain WailaConstants#DEFAULT_PRIORITY default priority} to allow overriding the entity being displayed.
+ *
+ * @param provider the data provider instance
+ * @param clazz the highest level class to apply to
+ *
+ * @see WailaConstants#DEFAULT_PRIORITY
+ */
+ void addOverride(IEntityComponentProvider provider, Class clazz);
+
+ /**
+ * Registers an {@link IEntityComponentProvider} instance to allow displaying an icon via the
+ * {@link IEntityComponentProvider#getIcon(IEntityAccessor, IPluginConfig)} method.
+ *
+ * @param provider the data provider instance
+ * @param clazz the highest level class to apply to
+ * @param priority the priority of this provider 0 is the minimum, lower number will be called first
+ *
+ * @see WailaConstants#DEFAULT_PRIORITY
+ */
+ void addIcon(IEntityComponentProvider provider, Class clazz, int priority);
+
+ /**
+ * Registers an {@link IEntityComponentProvider} instance with
+ * {@linkplain WailaConstants#DEFAULT_PRIORITY default priority} to allow displaying an icon via the
+ * {@link IEntityComponentProvider#getIcon(IEntityAccessor, IPluginConfig)} method.
+ *
+ * @param provider the data provider instance
+ * @param clazz the highest level class to apply to
+ */
+ void addIcon(IEntityComponentProvider provider, Class clazz);
+
+ /**
+ * Registers an {@link IEntityComponentProvider} instance for appending {@link Component} to the tooltip.
+ *
+ * @param provider the data provider instance
+ * @param position the position on the tooltip this applies to
+ * @param clazz the highest level class to apply to
+ * @param priority the priority of this provider 0 is the minimum, lower number will be called first
+ *
+ * @see WailaConstants#DEFAULT_PRIORITY
+ */
+ void addComponent(IEntityComponentProvider provider, TooltipPosition position, Class clazz, int priority);
+
+ /**
+ * Registers an {@link IEntityComponentProvider} instance with
+ * {@linkplain WailaConstants#DEFAULT_PRIORITY default priority} for appending {@link Component} to the tooltip.
+ *
+ * @param provider the data provider instance
+ * @param position the position on the tooltip this applies to
+ * @param clazz the highest level class to apply to
+ */
+ void addComponent(IEntityComponentProvider provider, TooltipPosition position, Class clazz);
+
+ /**
+ * Registers an {@link IEntityComponentProvider} instance for appending data context that get sent to the server.
+ *
+ * @param provider the data provider instance
+ * @param clazz the highest level class to apply to
+ */
+ void addDataContext(IEntityComponentProvider provider, Class clazz);
+
+ /**
+ * Registers an {@link IThemeType} instance.
+ *
+ * @param id the theme type id
+ * @param type the theme type
+ */
+ @ApiStatus.Experimental
+ void addThemeType(ResourceLocation id, IThemeType type);
+
+ /**
+ * Registers an {@link IRayCastVectorProvider} instance
+ *
+ * @param provider the vector provider
+ * @param priority the priority of this provider 0 is the minimum, lower number will be called first
+ */
+ @ApiStatus.Experimental
+ void addRayCastVector(IRayCastVectorProvider provider, int priority);
+
+ /**
+ * Registers an {@link IRayCastVectorProvider} instance with
+ * {@linkplain WailaConstants#DEFAULT_PRIORITY default priority}
+ *
+ * @param provider the vector provider
+ */
+ @ApiStatus.Experimental
+ void addRayCastVector(IRayCastVectorProvider provider);
+
+ /**
+ * Registers a tool type, to be used for the harvestability tooltip.
+ *
+ * @param id the tool type id, also used as the translation key as {@code tooltip.waila.harvest.tool.[namespace].[path]}
+ * @param toolType the tool type
+ */
+ @ApiStatus.Experimental
+ void addToolType(ResourceLocation id, IToolType toolType);
+
+}
diff --git a/src/api/java/mcp/mobius/waila/api/ICommonRegistrar.java b/src/api/java/mcp/mobius/waila/api/ICommonRegistrar.java
new file mode 100644
index 000000000..c7447cf1b
--- /dev/null
+++ b/src/api/java/mcp/mobius/waila/api/ICommonRegistrar.java
@@ -0,0 +1,446 @@
+package mcp.mobius.waila.api;
+
+import java.nio.file.Path;
+
+import mcp.mobius.waila.api.__internal__.ApiSide;
+import net.minecraft.network.RegistryFriendlyByteBuf;
+import net.minecraft.network.codec.StreamCodec;
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.level.block.Block;
+import net.minecraft.world.level.block.entity.BlockEntity;
+import net.minecraft.world.level.block.entity.BlockEntityType;
+import org.jetbrains.annotations.ApiStatus;
+
+@ApiStatus.NonExtendable
+public interface ICommonRegistrar {
+
+ /**
+ * Registers a namespaced config key to be accessed within data providers.
+ *
+ * These translation keys will be used on the plugin config screen:
+ * - {@code config.waila.plugin_[namespace].[path]} for the config name.
+ * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
+ * This one is optional and can be left missing.
+ *
+ * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
+ * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
+ * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
+ * for it to be visible in the config screen.
+ *
+ * @param key the namespaced key
+ * @param defaultValue the default value
+ */
+ void addConfig(ResourceLocation key, boolean defaultValue);
+
+ /**
+ * Registers a namespaced config key to be accessed within data providers.
+ *
+ * These translation keys will be used on the plugin config screen:
+ * - {@code config.waila.plugin_[namespace].[path]} for the config name.
+ * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
+ * This one is optional and can be left missing.
+ *
+ * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
+ * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
+ * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
+ * for it to be visible in the config screen.
+ *
+ * @param key the namespaced key
+ * @param defaultValue the default value
+ * @param format used for formatting text box in plugin config screen
+ */
+ void addConfig(ResourceLocation key, int defaultValue, IntFormat format);
+
+ /**
+ * Registers a namespaced config key to be accessed within data providers.
+ *
+ * These translation keys will be used on the plugin config screen:
+ * - {@code config.waila.plugin_[namespace].[path]} for the config name.
+ * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
+ * This one is optional and can be left missing.
+ *
+ * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
+ * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
+ * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
+ * for it to be visible in the config screen.
+ *
+ * @param key the namespaced key
+ * @param defaultValue the default value
+ */
+ default void addConfig(ResourceLocation key, int defaultValue) {
+ addConfig(key, defaultValue, IntFormat.DECIMAL);
+ }
+
+ /**
+ * Registers a namespaced config key to be accessed within data providers.
+ *
+ * These translation keys will be used on the plugin config screen:
+ * - {@code config.waila.plugin_[namespace].[path]} for the config name.
+ * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
+ * This one is optional and can be left missing.
+ *
+ * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
+ * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
+ * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
+ * for it to be visible in the config screen.
+ *
+ * @param key the namespaced key
+ * @param defaultValue the default value
+ */
+ void addConfig(ResourceLocation key, double defaultValue);
+
+ /**
+ * Registers a namespaced config key to be accessed within data providers.
+ *
+ * These translation keys will be used on the plugin config screen:
+ * - {@code config.waila.plugin_[namespace].[path]} for the config name.
+ * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
+ * This one is optional and can be left missing.
+ *
+ * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
+ * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
+ * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
+ * for it to be visible in the config screen.
+ *
+ * @param key the namespaced key
+ * @param defaultValue the default value
+ */
+ void addConfig(ResourceLocation key, String defaultValue);
+
+ /**
+ * Registers a namespaced config key to be accessed within data providers.
+ *
+ * These translation keys will be used on the plugin config screen:
+ * - {@code config.waila.plugin_[namespace].[path]} for the config name.
+ * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
+ * This one is optional and can be left missing.
+ *
+ * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
+ * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
+ * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
+ * for it to be visible in the config screen.
+ *
+ * @param key the namespaced key
+ * @param defaultValue the default value
+ */
+ > void addConfig(ResourceLocation key, T defaultValue);
+
+ /**
+ * Adds an entry to the config screen to open a file with external editor.
+ *
+ * Does NOT handle file parsing, and will NOT available from {@link IPluginConfig}.
+ * Needs to be handled by the user manually.
+ *
+ * These translation keys will be used on the plugin config screen:
+ * - {@code config.waila.plugin_[namespace].[path]} for the config name.
+ * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
+ * This one is optional and can be left missing.
+ *
+ * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
+ * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
+ * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
+ * for it to be visible in the config screen.
+ *
+ * @param key the namespaced key
+ * @param path the path to the file
+ *
+ * @see IJsonConfig
+ */
+ void addConfig(ResourceLocation key, Path path);
+
+ /**
+ * Registers a namespaced config key to be accessed within data providers.
+ *
+ * The main purpose of this method is for toggling feature that enabled by default.
+ * This method allows server to disable the option remotely for all connected clients,
+ * the clients can then toggle the option for their own side only if it is enabled on the server.
+ *
+ * These translation keys will be used on the plugin config screen:
+ * - {@code config.waila.plugin_[namespace].[path]} for the config name.
+ * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
+ * This one is optional and can be left missing.
+ *
+ * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
+ * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
+ * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
+ * for it to be visible in the config screen.
+ *
+ * @param key the namespaced key to be used with {@link IPluginConfig#getBoolean(ResourceLocation)}
+ * @param clientOnly whether the feature available on client-only, e.g. not using {@linkplain IDataProvider server data}
+ */
+ void addFeatureConfig(ResourceLocation key, boolean clientOnly);
+
+ /**
+ * Registers a namespaced config key to be accessed within data providers.
+ * These values are sent from the server to the client upon connection.
+ *
+ * These translation keys will be used on the plugin config screen:
+ * - {@code config.waila.plugin_[namespace].[path]} for the config name.
+ * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
+ * This one is optional and can be left missing.
+ *
+ * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
+ * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
+ * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
+ * for it to be visible in the config screen.
+ *
+ * @param key the namespaced key
+ * @param defaultValue the default value
+ * @param clientOnlyValue the value that will be used when the server connected doesn't have waila installed
+ */
+ void addSyncedConfig(ResourceLocation key, boolean defaultValue, boolean clientOnlyValue);
+
+ /**
+ * Registers a namespaced config key to be accessed within data providers.
+ * These values are sent from the server to the client upon connection.
+ *
+ * These translation keys will be used on the plugin config screen:
+ * - {@code config.waila.plugin_[namespace].[path]} for the config name.
+ * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
+ * This one is optional and can be left missing.
+ *
+ * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
+ * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
+ * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
+ * for it to be visible in the config screen.
+ *
+ * @param key the namespaced key
+ * @param defaultValue the default value
+ * @param clientOnlyValue the value that will be used when the server connected doesn't have waila installed
+ * @param format used for formatting text box in plugin config screen
+ */
+ void addSyncedConfig(ResourceLocation key, int defaultValue, int clientOnlyValue, IntFormat format);
+
+ /**
+ * Registers a namespaced config key to be accessed within data providers.
+ * These values are sent from the server to the client upon connection.
+ *
+ * These translation keys will be used on the plugin config screen:
+ * - {@code config.waila.plugin_[namespace].[path]} for the config name.
+ * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
+ * This one is optional and can be left missing.
+ *
+ * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
+ * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
+ * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
+ * for it to be visible in the config screen.
+ *
+ * @param key the namespaced key
+ * @param defaultValue the default value
+ * @param clientOnlyValue the value that will be used when the server connected doesn't have waila installed
+ */
+ default void addSyncedConfig(ResourceLocation key, int defaultValue, int clientOnlyValue) {
+ addSyncedConfig(key, defaultValue, clientOnlyValue, IntFormat.DECIMAL);
+ }
+
+ /**
+ * Registers a namespaced config key to be accessed within data providers.
+ * These values are sent from the server to the client upon connection.
+ *
+ * These translation keys will be used on the plugin config screen:
+ * - {@code config.waila.plugin_[namespace].[path]} for the config name.
+ * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
+ * This one is optional and can be left missing.
+ *
+ * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
+ * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
+ * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
+ * for it to be visible in the config screen.
+ *
+ * @param key the namespaced key
+ * @param defaultValue the default value
+ * @param clientOnlyValue the value that will be used when the server connected doesn't have waila installed
+ */
+ void addSyncedConfig(ResourceLocation key, double defaultValue, double clientOnlyValue);
+
+ /**
+ * Registers a namespaced config key to be accessed within data providers.
+ * These values are sent from the server to the client upon connection.
+ *
+ * These translation keys will be used on the plugin config screen:
+ * - {@code config.waila.plugin_[namespace].[path]} for the config name.
+ * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
+ * This one is optional and can be left missing.
+ *
+ * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
+ * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
+ * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
+ * for it to be visible in the config screen.
+ *
+ * @param key the namespaced key
+ * @param defaultValue the default value
+ * @param clientOnlyValue the value that will be used when the server connected doesn't have waila installed
+ */
+ void addSyncedConfig(ResourceLocation key, String defaultValue, String clientOnlyValue);
+
+ /**
+ * Registers a namespaced config key to be accessed within data providers.
+ * These values are sent from the server to the client upon connection.
+ *
+ * These translation keys will be used on the plugin config screen:
+ * - {@code config.waila.plugin_[namespace].[path]} for the config name.
+ * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
+ * This one is optional and can be left missing.
+ *
+ * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
+ * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
+ * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
+ * for it to be visible in the config screen.
+ *
+ * @param key the namespaced key
+ * @param defaultValue the default value
+ * @param clientOnlyValue the value that will be used when the server connected doesn't have waila installed
+ */
+ > void addSyncedConfig(ResourceLocation key, T defaultValue, T clientOnlyValue);
+
+ /**
+ * Registers config key aliases that will be migrated gracefully to the actual key.
+ *
+ * Also sync the value using aliased keys, so outdated client can still get the correct value.
+ */
+ void addConfigAlias(ResourceLocation actual, ResourceLocation... aliases);
+
+ /**
+ * Adds the specified entity types to the default blacklist.
+ *
+ * @param priority the modifier priority, lower number will be called last
+ */
+ void addBlacklist(int priority, Block... blocks);
+
+ /**
+ * Adds the specified entity types to the default blacklist.
+ *
+ * @param priority the modifier priority, lower number will be called last
+ */
+ void addBlacklist(int priority, BlockEntityType>... blockEntityTypes);
+
+ /**
+ * Adds the specified entity types to the default blacklist.
+ */
+ default void addBlacklist(Block... blocks) {
+ addBlacklist(WailaConstants.DEFAULT_PRIORITY, blocks);
+ }
+
+ /**
+ * Adds the specified entity types to the default blacklist.
+ */
+ default void addBlacklist(BlockEntityType>... blockEntityTypes) {
+ addBlacklist(WailaConstants.DEFAULT_PRIORITY, blockEntityTypes);
+ }
+
+ /**
+ * Removes the specified entity types to the default blacklist.
+ *
+ * @param priority the modifier priority, lower number will be called last
+ */
+ void removeBlacklist(int priority, Block... blocks);
+
+ /**
+ * Removes the specified entity types to the default blacklist.
+ *
+ * @param priority the modifier priority, lower number will be called last
+ */
+ void removeBlacklist(int priority, BlockEntityType>... blockEntityTypes);
+
+ /**
+ * Removes the specified entity types to the default blacklist.
+ */
+ default void removeBlacklist(Block... blocks) {
+ removeBlacklist(WailaConstants.DEFAULT_PRIORITY, blocks);
+ }
+
+ /**
+ * Removes the specified entity types to the default blacklist.
+ */
+ default void removeBlacklist(BlockEntityType>... blockEntityTypes) {
+ removeBlacklist(WailaConstants.DEFAULT_PRIORITY, blockEntityTypes);
+ }
+
+ /**
+ * Registers an {@link IDataProvider} instance for data syncing purposes. A {@link BlockEntity}
+ * is also an acceptable class type.
+ *
+ * @param provider the data provider instance
+ * @param clazz the highest level class to apply to
+ * @param priority the priority of this provider 0 is the minimum, lower number will be called first
+ *
+ * @see WailaConstants#DEFAULT_PRIORITY
+ */
+ @ApiSide.ServerOnly
+ void addBlockData(IDataProvider provider, Class clazz, int priority);
+
+ /**
+ * Registers an {@link IDataProvider} instance with
+ * {@linkplain WailaConstants#DEFAULT_PRIORITY default priority} for data syncing purposes.
+ * A {@link BlockEntity} is also an acceptable class type.
+ *
+ * @param provider the data provider instance
+ * @param clazz the highest level class to apply to
+ */
+ default void addBlockData(IDataProvider provider, Class clazz) {
+ addBlockData(provider, clazz, WailaConstants.DEFAULT_PRIORITY);
+ }
+
+ /**
+ * Adds the specified entity types to the default blacklist.
+ *
+ * @param priority the modifier priority, lower number will be called last
+ */
+ void addBlacklist(int priority, EntityType>... entityTypes);
+
+ /**
+ * Adds the specified entity types to the default blacklist.
+ */
+ default void addBlacklist(EntityType>... entityTypes) {
+ addBlacklist(WailaConstants.DEFAULT_PRIORITY, entityTypes);
+ }
+
+ /**
+ * Removes the specified entity types to the default blacklist.
+ *
+ * @param priority the modifier priority, lower number will be called last
+ */
+ void removeBlacklist(int priority, EntityType>... entityTypes);
+
+ /**
+ * Removes the specified entity types to the default blacklist.
+ */
+ default void removeBlacklist(EntityType>... entityTypes) {
+ removeBlacklist(WailaConstants.DEFAULT_PRIORITY, entityTypes);
+ }
+
+ /**
+ * Registers an {@link IDataProvider} instance for data syncing purposes.
+ *
+ * @param provider the data provider instance
+ * @param clazz the highest level class to apply to
+ * @param priority the priority of this provider 0 is the minimum, lower number will be called first
+ *
+ * @see WailaConstants#DEFAULT_PRIORITY
+ */
+ @ApiSide.ServerOnly
+ void addEntityData(IDataProvider provider, Class clazz, int priority);
+
+ /**
+ * Registers an {@link IDataProvider} instance with
+ * {@linkplain WailaConstants#DEFAULT_PRIORITY default priority} for data syncing purposes.
+ *
+ * @param provider the data provider instance
+ * @param clazz the highest level class to apply to
+ */
+ default void addEntityData(IDataProvider provider, Class clazz) {
+ addEntityData(provider, clazz, WailaConstants.DEFAULT_PRIORITY);
+ }
+
+ /**
+ * Registers a data type used for syncing data from server to client.
+ *
+ * @param type the data type
+ * @param codec the data-to-buffer codec
+ */
+ void addDataType(IData.Type type, StreamCodec super RegistryFriendlyByteBuf, ? extends D> codec);
+
+
+}
diff --git a/src/api/java/mcp/mobius/waila/api/IData.java b/src/api/java/mcp/mobius/waila/api/IData.java
index e6adb10a9..6e439bd32 100644
--- a/src/api/java/mcp/mobius/waila/api/IData.java
+++ b/src/api/java/mcp/mobius/waila/api/IData.java
@@ -7,7 +7,7 @@
/**
* A typed data for syncing complex data.
*
- * Register data types with {@link IRegistrar#addDataType}
+ * Register data types with {@link ICommonRegistrar#addDataType}
*
* For simple data, consider using {@linkplain IDataWriter#raw() raw NBT data} instead,
* as it is easier to do and enough for most purpose.
diff --git a/src/api/java/mcp/mobius/waila/api/IDataProvider.java b/src/api/java/mcp/mobius/waila/api/IDataProvider.java
index c3501c755..d07c35cd5 100644
--- a/src/api/java/mcp/mobius/waila/api/IDataProvider.java
+++ b/src/api/java/mcp/mobius/waila/api/IDataProvider.java
@@ -16,10 +16,11 @@ public interface IDataProvider {
* @param data current synchronization data
* @param accessor contains the relevant context of the environment
* @param config current plugin configurations,
- * values could be different from the requesting client unless it was registered via {@link IRegistrar#addSyncedConfig}
+ * values could be different from the requesting client unless it was registered via
+ * {@link ICommonRegistrar#addSyncedConfig}
*
- * @see IRegistrar#addBlockData(IDataProvider, Class, int)
- * @see IRegistrar#addEntityData(IDataProvider, Class)
+ * @see ICommonRegistrar#addBlockData(IDataProvider, Class, int)
+ * @see ICommonRegistrar#addEntityData(IDataProvider, Class)
* @see IBlockComponentProvider#appendDataContext(IDataWriter, IBlockAccessor, IPluginConfig)
* @see IEntityComponentProvider#appendDataContext(IDataWriter, IEntityAccessor, IPluginConfig)
*/
diff --git a/src/api/java/mcp/mobius/waila/api/IEntityComponentProvider.java b/src/api/java/mcp/mobius/waila/api/IEntityComponentProvider.java
index ac68e4d1d..604b31470 100644
--- a/src/api/java/mcp/mobius/waila/api/IEntityComponentProvider.java
+++ b/src/api/java/mcp/mobius/waila/api/IEntityComponentProvider.java
@@ -11,10 +11,10 @@
* Used to provide {@link Entity} tooltip information to Waila.
*
* All methods in this interface shouldn't to be called by the implementing mod.
- * An instance of the class is to be registered via the {@link IRegistrar} instance provided in {@link IWailaPlugin}.
+ * An instance of the class is to be registered via the {@link IClientRegistrar} instance provided in {@link IWailaClientPlugin}.
*
- * @see IWailaPlugin
- * @see IRegistrar
+ * @see IWailaClientPlugin
+ * @see IClientRegistrar
*/
@ApiSide.ClientOnly
@ApiStatus.OverrideOnly
@@ -38,7 +38,7 @@ public interface IEntityComponentProvider {
* @return {@code null} if this method doesn't redirect to anything,
* any result from one of {@link ITargetRedirector}'s methods otherwise
*
- * @see IRegistrar#addRedirect(IEntityComponentProvider, Class)
+ * @see IClientRegistrar#addRedirect(IEntityComponentProvider, Class)
*/
@Nullable
@ApiStatus.Experimental
@@ -54,7 +54,7 @@ default ITargetRedirector.Result redirect(ITargetRedirector redirect, IEntityAcc
* Note that {@link IEntityAccessor#getData()} will always be empty at this time
* @param config current plugin configuration
*
- * @see IRegistrar#addDataContext(IEntityComponentProvider, Class)
+ * @see IClientRegistrar#addDataContext(IEntityComponentProvider, Class)
*/
default void appendDataContext(IDataWriter ctx, IEntityAccessor accessor, IPluginConfig config) {
}
@@ -67,7 +67,7 @@ default void appendDataContext(IDataWriter ctx, IEntityAccessor accessor, IPlugi
*
* @return {@code null} if override is not required, an {@link Entity} otherwise
*
- * @see IRegistrar#addOverride(IEntityComponentProvider, Class, int)
+ * @see IClientRegistrar#addOverride(IEntityComponentProvider, Class, int)
* @see #EMPTY_ENTITY
*/
@Nullable
@@ -88,7 +88,7 @@ default Entity getOverride(IEntityAccessor accessor, IPluginConfig config) {
*
* @return the component to render or {@code null} if this provider doesn't decide it
*
- * @see IRegistrar#addIcon(IEntityComponentProvider, Class, int)
+ * @see IClientRegistrar#addIcon(IEntityComponentProvider, Class, int)
*/
@Nullable
default ITooltipComponent getIcon(IEntityAccessor accessor, IPluginConfig config) {
@@ -108,7 +108,7 @@ default ITooltipComponent getIcon(IEntityAccessor accessor, IPluginConfig config
* @param accessor contains most of the relevant information about the current environment
* @param config current plugin configuration
*
- * @see IRegistrar#addComponent(IEntityComponentProvider, TooltipPosition, Class, int)
+ * @see IClientRegistrar#addComponent(IEntityComponentProvider, TooltipPosition, Class, int)
*/
default void appendHead(ITooltip tooltip, IEntityAccessor accessor, IPluginConfig config) {
}
@@ -126,7 +126,7 @@ default void appendHead(ITooltip tooltip, IEntityAccessor accessor, IPluginConfi
* @param accessor contains most of the relevant information about the current environment
* @param config current plugin configuration
*
- * @see IRegistrar#addComponent(IEntityComponentProvider, TooltipPosition, Class, int)
+ * @see IClientRegistrar#addComponent(IEntityComponentProvider, TooltipPosition, Class, int)
*/
default void appendBody(ITooltip tooltip, IEntityAccessor accessor, IPluginConfig config) {
}
@@ -144,7 +144,7 @@ default void appendBody(ITooltip tooltip, IEntityAccessor accessor, IPluginConfi
* @param accessor contains most of the relevant information about the current environment
* @param config current plugin configuration
*
- * @see IRegistrar#addComponent(IEntityComponentProvider, TooltipPosition, Class, int)
+ * @see IClientRegistrar#addComponent(IEntityComponentProvider, TooltipPosition, Class, int)
*/
default void appendTail(ITooltip tooltip, IEntityAccessor accessor, IPluginConfig config) {
}
diff --git a/src/api/java/mcp/mobius/waila/api/IEventListener.java b/src/api/java/mcp/mobius/waila/api/IEventListener.java
index e8ffabb03..995ba1f89 100644
--- a/src/api/java/mcp/mobius/waila/api/IEventListener.java
+++ b/src/api/java/mcp/mobius/waila/api/IEventListener.java
@@ -9,8 +9,8 @@
/**
* Used to listen to generic Waila events.
- *
- * Register implementations with {@link IRegistrar#addEventListener}
+ *
+ * Register implementations with {@link IClientRegistrar#addEventListener}
*/
@ApiStatus.OverrideOnly
public interface IEventListener {
diff --git a/src/api/java/mcp/mobius/waila/api/IPluginInfo.java b/src/api/java/mcp/mobius/waila/api/IPluginInfo.java
index 5ee244ef6..50f6a92ef 100644
--- a/src/api/java/mcp/mobius/waila/api/IPluginInfo.java
+++ b/src/api/java/mcp/mobius/waila/api/IPluginInfo.java
@@ -7,6 +7,10 @@
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.ApiStatus;
+/**
+ * @deprecated no replacement. In practice, plugin should never require this.
+ */
+@Deprecated
@ApiStatus.NonExtendable
public interface IPluginInfo {
@@ -28,6 +32,7 @@ static Collection getAll() {
Side getSide();
+ @Deprecated
IWailaPlugin getInitializer();
List getRequiredModIds();
diff --git a/src/api/java/mcp/mobius/waila/api/IRayCastVectorProvider.java b/src/api/java/mcp/mobius/waila/api/IRayCastVectorProvider.java
index 468c5c5b6..a70421bd8 100644
--- a/src/api/java/mcp/mobius/waila/api/IRayCastVectorProvider.java
+++ b/src/api/java/mcp/mobius/waila/api/IRayCastVectorProvider.java
@@ -8,7 +8,7 @@
/**
* Decides where Waila will start ray casting for objects.
*
- * @see IRegistrar#addRayCastVector(IRayCastVectorProvider, int)
+ * @see IClientRegistrar#addRayCastVector(IRayCastVectorProvider, int)
*/
@ApiSide.ClientOnly
@ApiStatus.Experimental
diff --git a/src/api/java/mcp/mobius/waila/api/IRegistrar.java b/src/api/java/mcp/mobius/waila/api/IRegistrar.java
index 14df0e229..ff7df2211 100644
--- a/src/api/java/mcp/mobius/waila/api/IRegistrar.java
+++ b/src/api/java/mcp/mobius/waila/api/IRegistrar.java
@@ -5,7 +5,6 @@
import mcp.mobius.waila.api.__internal__.ApiSide;
import mcp.mobius.waila.api.__internal__.IHarvestService;
import net.minecraft.network.RegistryFriendlyByteBuf;
-import net.minecraft.network.chat.Component;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
@@ -15,712 +14,245 @@
import net.minecraft.world.level.block.entity.BlockEntityType;
import org.jetbrains.annotations.ApiStatus;
+/**
+ * @deprecated use {@link ICommonRegistrar} or {@link IClientRegistrar} instead.
+ */
+@Deprecated
@ApiStatus.NonExtendable
-public interface IRegistrar {
+public interface IRegistrar extends ICommonRegistrar, IClientRegistrar {
- /**
- * The default priority for all component and data provider.
- */
- int DEFAULT_PRIORITY = 1000;
+ int DEFAULT_PRIORITY = WailaConstants.DEFAULT_PRIORITY;
- /**
- * Registers a namespaced config key to be accessed within data providers.
- *
- * These translation keys will be used on the plugin config screen:
- * - {@code config.waila.plugin_[namespace].[path]} for the config name.
- * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
- * This one is optional and can be left missing.
- *
- * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
- * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
- * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
- * for it to be visible in the config screen.
- *
- * @param key the namespaced key
- * @param defaultValue the default value
- */
+ @Override
void addConfig(ResourceLocation key, boolean defaultValue);
- /**
- * Registers a namespaced config key to be accessed within data providers.
- *
- * These translation keys will be used on the plugin config screen:
- * - {@code config.waila.plugin_[namespace].[path]} for the config name.
- * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
- * This one is optional and can be left missing.
- *
- * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
- * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
- * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
- * for it to be visible in the config screen.
- *
- * @param key the namespaced key
- * @param defaultValue the default value
- * @param format used for formatting text box in plugin config screen
- */
+ @Override
void addConfig(ResourceLocation key, int defaultValue, IntFormat format);
- /**
- * Registers a namespaced config key to be accessed within data providers.
- *
- * These translation keys will be used on the plugin config screen:
- * - {@code config.waila.plugin_[namespace].[path]} for the config name.
- * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
- * This one is optional and can be left missing.
- *
- * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
- * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
- * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
- * for it to be visible in the config screen.
- *
- * @param key the namespaced key
- * @param defaultValue the default value
- */
+ @Override
default void addConfig(ResourceLocation key, int defaultValue) {
addConfig(key, defaultValue, IntFormat.DECIMAL);
}
- /**
- * Registers a namespaced config key to be accessed within data providers.
- *
- * These translation keys will be used on the plugin config screen:
- * - {@code config.waila.plugin_[namespace].[path]} for the config name.
- * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
- * This one is optional and can be left missing.
- *
- * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
- * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
- * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
- * for it to be visible in the config screen.
- *
- * @param key the namespaced key
- * @param defaultValue the default value
- */
+ @Override
void addConfig(ResourceLocation key, double defaultValue);
- /**
- * Registers a namespaced config key to be accessed within data providers.
- *
- * These translation keys will be used on the plugin config screen:
- * - {@code config.waila.plugin_[namespace].[path]} for the config name.
- * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
- * This one is optional and can be left missing.
- *
- * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
- * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
- * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
- * for it to be visible in the config screen.
- *
- * @param key the namespaced key
- * @param defaultValue the default value
- */
+ @Override
void addConfig(ResourceLocation key, String defaultValue);
- /**
- * Registers a namespaced config key to be accessed within data providers.
- *
- * These translation keys will be used on the plugin config screen:
- * - {@code config.waila.plugin_[namespace].[path]} for the config name.
- * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
- * This one is optional and can be left missing.
- *
- * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
- * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
- * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
- * for it to be visible in the config screen.
- *
- * @param key the namespaced key
- * @param defaultValue the default value
- */
+ @Override
> void addConfig(ResourceLocation key, T defaultValue);
- /**
- * Adds an entry to the config screen to open a file with external editor.
- *
- * Does NOT handle file parsing, and will NOT available from {@link IPluginConfig}.
- * Needs to be handled by the user manually.
- *
- * These translation keys will be used on the plugin config screen:
- * - {@code config.waila.plugin_[namespace].[path]} for the config name.
- * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
- * This one is optional and can be left missing.
- *
- * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
- * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
- * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
- * for it to be visible in the config screen.
- *
- * @param key the namespaced key
- * @param path the path to the file
- *
- * @see IJsonConfig
- */
+ @Override
void addConfig(ResourceLocation key, Path path);
- /**
- * Registers a namespaced config key to be accessed within data providers.
- *
- * The main purpose of this method is for toggling feature that enabled by default.
- * This method allows server to disable the option remotely for all connected clients,
- * the clients can then toggle the option for their own side only if it is enabled on the server.
- *
- * These translation keys will be used on the plugin config screen:
- * - {@code config.waila.plugin_[namespace].[path]} for the config name.
- * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
- * This one is optional and can be left missing.
- *
- * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
- * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
- * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
- * for it to be visible in the config screen.
- *
- * @param key the namespaced key to be used with {@link IPluginConfig#getBoolean(ResourceLocation)}
- * @param clientOnly whether the feature available on client-only, e.g. not using {@linkplain IDataProvider server data}
- */
+ @Override
void addFeatureConfig(ResourceLocation key, boolean clientOnly);
- /**
- * Registers a namespaced config key to be accessed within data providers.
- * These values are sent from the server to the client upon connection.
- *
- * These translation keys will be used on the plugin config screen:
- * - {@code config.waila.plugin_[namespace].[path]} for the config name.
- * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
- * This one is optional and can be left missing.
- *
- * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
- * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
- * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
- * for it to be visible in the config screen.
- *
- * @param key the namespaced key
- * @param defaultValue the default value
- * @param clientOnlyValue the value that will be used when the server connected doesn't have waila installed
- */
+ @Override
void addSyncedConfig(ResourceLocation key, boolean defaultValue, boolean clientOnlyValue);
- /**
- * Registers a namespaced config key to be accessed within data providers.
- * These values are sent from the server to the client upon connection.
- *
- * These translation keys will be used on the plugin config screen:
- * - {@code config.waila.plugin_[namespace].[path]} for the config name.
- * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
- * This one is optional and can be left missing.
- *
- * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
- * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
- * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
- * for it to be visible in the config screen.
- *
- * @param key the namespaced key
- * @param defaultValue the default value
- * @param clientOnlyValue the value that will be used when the server connected doesn't have waila installed
- * @param format used for formatting text box in plugin config screen
- */
+ @Override
void addSyncedConfig(ResourceLocation key, int defaultValue, int clientOnlyValue, IntFormat format);
- /**
- * Registers a namespaced config key to be accessed within data providers.
- * These values are sent from the server to the client upon connection.
- *
- * These translation keys will be used on the plugin config screen:
- * - {@code config.waila.plugin_[namespace].[path]} for the config name.
- * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
- * This one is optional and can be left missing.
- *
- * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
- * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
- * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
- * for it to be visible in the config screen.
- *
- * @param key the namespaced key
- * @param defaultValue the default value
- * @param clientOnlyValue the value that will be used when the server connected doesn't have waila installed
- */
+ @Override
default void addSyncedConfig(ResourceLocation key, int defaultValue, int clientOnlyValue) {
addSyncedConfig(key, defaultValue, clientOnlyValue, IntFormat.DECIMAL);
}
- /**
- * Registers a namespaced config key to be accessed within data providers.
- * These values are sent from the server to the client upon connection.
- *
- * These translation keys will be used on the plugin config screen:
- * - {@code config.waila.plugin_[namespace].[path]} for the config name.
- * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
- * This one is optional and can be left missing.
- *
- * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
- * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
- * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
- * for it to be visible in the config screen.
- *
- * @param key the namespaced key
- * @param defaultValue the default value
- * @param clientOnlyValue the value that will be used when the server connected doesn't have waila installed
- */
+ @Override
void addSyncedConfig(ResourceLocation key, double defaultValue, double clientOnlyValue);
- /**
- * Registers a namespaced config key to be accessed within data providers.
- * These values are sent from the server to the client upon connection.
- *
- * These translation keys will be used on the plugin config screen:
- * - {@code config.waila.plugin_[namespace].[path]} for the config name.
- * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
- * This one is optional and can be left missing.
- *
- * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
- * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
- * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
- * for it to be visible in the config screen.
- *
- * @param key the namespaced key
- * @param defaultValue the default value
- * @param clientOnlyValue the value that will be used when the server connected doesn't have waila installed
- */
+ @Override
void addSyncedConfig(ResourceLocation key, String defaultValue, String clientOnlyValue);
- /**
- * Registers a namespaced config key to be accessed within data providers.
- * These values are sent from the server to the client upon connection.
- *
- * These translation keys will be used on the plugin config screen:
- * - {@code config.waila.plugin_[namespace].[path]} for the config name.
- * - {@code config.waila.plugin_[namespace].[path]_desc} for the config description.
- * This one is optional and can be left missing.
- *
- * Config options can also be grouped with the same prefix on its path followed by a period [{@code .}],
- * e.g. {@code my_plugin:group.option1} and {@code my_plugin:group.option2}.
- * Then, add a translation for {@code config.waila.plugin_[namespace].[group]} with the group name
- * for it to be visible in the config screen.
- *
- * @param key the namespaced key
- * @param defaultValue the default value
- * @param clientOnlyValue the value that will be used when the server connected doesn't have waila installed
- */
+ @Override
> void addSyncedConfig(ResourceLocation key, T defaultValue, T clientOnlyValue);
- /**
- * Registers config key aliases that will be migrated gracefully to the actual key.
- *
- * Also sync the value using aliased keys, so outdated client can still get the correct value.
- */
+ @Override
void addConfigAlias(ResourceLocation actual, ResourceLocation... aliases);
- /**
- * Adds an event listener
- */
+ @Override
void addEventListener(IEventListener listener, int priority);
- /**
- * Adds an event listener
- */
+ @Override
default void addEventListener(IEventListener listener) {
addEventListener(listener, DEFAULT_PRIORITY);
}
- /**
- * Adds the specified entity types to the default blacklist.
- *
- * @param priority the modifier priority, lower number will be called last
- */
+ @Override
void addBlacklist(int priority, Block... blocks);
- /**
- * Adds the specified entity types to the default blacklist.
- *
- * @param priority the modifier priority, lower number will be called last
- */
+ @Override
void addBlacklist(int priority, BlockEntityType>... blockEntityTypes);
- /**
- * Adds the specified entity types to the default blacklist.
- */
+ @Override
default void addBlacklist(Block... blocks) {
addBlacklist(DEFAULT_PRIORITY, blocks);
}
- /**
- * Adds the specified entity types to the default blacklist.
- */
+ @Override
default void addBlacklist(BlockEntityType>... blockEntityTypes) {
addBlacklist(DEFAULT_PRIORITY, blockEntityTypes);
}
- /**
- * Removes the specified entity types to the default blacklist.
- *
- * @param priority the modifier priority, lower number will be called last
- */
+ @Override
void removeBlacklist(int priority, Block... blocks);
- /**
- * Removes the specified entity types to the default blacklist.
- *
- * @param priority the modifier priority, lower number will be called last
- */
+ @Override
void removeBlacklist(int priority, BlockEntityType>... blockEntityTypes);
- /**
- * Removes the specified entity types to the default blacklist.
- */
+ @Override
default void removeBlacklist(Block... blocks) {
removeBlacklist(DEFAULT_PRIORITY, blocks);
}
- /**
- * Removes the specified entity types to the default blacklist.
- */
+ @Override
default void removeBlacklist(BlockEntityType>... blockEntityTypes) {
removeBlacklist(DEFAULT_PRIORITY, blockEntityTypes);
}
- /**
- * Registers an {@link IBlockComponentProvider} instance to allow redirecting the object being displayed.
- * A {@link BlockEntity} is also an acceptable class type.
- *
- * @param provider the data provider instance
- * @param clazz the highest level class to apply to
- * @param priority the priority of this provider 0 is the minimum, lower number will be called first
- *
- * @see #DEFAULT_PRIORITY
- */
+ @Override
@ApiStatus.Experimental
void addRedirect(IBlockComponentProvider provider, Class clazz, int priority);
- /**
- * Registers an {@link IBlockComponentProvider} instance to allow redirecting the object being displayed.
- * A {@link BlockEntity} is also an acceptable class type.
- *
- * @param provider the data provider instance
- * @param clazz the highest level class to apply to
- *
- * @see #DEFAULT_PRIORITY
- */
+ @Override
@ApiStatus.Experimental
default void addRedirect(IBlockComponentProvider provider, Class clazz) {
addRedirect(provider, clazz, DEFAULT_PRIORITY);
}
- /**
- * Registers an {@link IBlockComponentProvider} instance to allow overriding the block being displayed.
- * A {@link BlockEntity} is also an acceptable class type.
- *
- * @param provider the data provider instance
- * @param clazz the highest level class to apply to
- * @param priority the priority of this provider 0 is the minimum, lower number will be called first
- *
- * @see #DEFAULT_PRIORITY
- */
+ @Override
@ApiSide.ClientOnly
void addOverride(IBlockComponentProvider provider, Class clazz, int priority);
- /**
- * Registers an {@link IBlockComponentProvider} instance with {@link #DEFAULT_PRIORITY} to allow overriding the block being displayed.
- * A {@link BlockEntity} is also an acceptable class type.
- *
- * @param provider the data provider instance
- * @param clazz the highest level class to apply to
- *
- * @see #DEFAULT_PRIORITY
- */
+ @Override
@ApiSide.ClientOnly
default void addOverride(IBlockComponentProvider provider, Class clazz) {
addOverride(provider, clazz, DEFAULT_PRIORITY);
}
- /**
- * Registers an {@link IBlockComponentProvider} instance to allow overriding the displayed icon for a block via the
- * {@link IBlockComponentProvider#getIcon(IBlockAccessor, IPluginConfig)} method.
- * A {@link BlockEntity} is also an acceptable class type.
- *
- * @param provider the data provider instance
- * @param clazz the highest level class to apply to
- * @param priority the priority of this provider 0 is the minimum, lower number will be called first
- *
- * @see #DEFAULT_PRIORITY
- */
+ @Override
@ApiSide.ClientOnly
void addIcon(IBlockComponentProvider provider, Class clazz, int priority);
- /**
- * Registers an {@link IBlockComponentProvider} instance with {@link #DEFAULT_PRIORITY} to allow overriding the displayed icon for a block via the
- * {@link IBlockComponentProvider#getIcon(IBlockAccessor, IPluginConfig)} method.
- * A {@link BlockEntity} is also an acceptable class type.
- *
- * @param provider the data provider instance
- * @param clazz the highest level class to apply to
- */
+ @Override
@ApiSide.ClientOnly
default void addIcon(IBlockComponentProvider provider, Class clazz) {
addIcon(provider, clazz, DEFAULT_PRIORITY);
}
- /**
- * Registers an {@link IBlockComponentProvider} instance for appending {@link Component} to the tooltip.
- * A {@link BlockEntity} is also an acceptable class type.
- *
- * @param provider the data provider instance
- * @param position the position on the tooltip this applies to
- * @param clazz the highest level class to apply to
- * @param priority the priority of this provider 0 is the minimum, lower number will be called first
- *
- * @see #DEFAULT_PRIORITY
- */
+ @Override
@ApiSide.ClientOnly
void addComponent(IBlockComponentProvider provider, TooltipPosition position, Class clazz, int priority);
- /**
- * Registers an {@link IBlockComponentProvider} instance with {@link #DEFAULT_PRIORITY} for appending {@link Component} to the tooltip.
- * A {@link BlockEntity} is also an acceptable class type.
- *
- * @param provider the data provider instance
- * @param position the position on the tooltip this applies to
- * @param clazz the highest level class to apply to
- */
+ @Override
@ApiSide.ClientOnly
default void addComponent(IBlockComponentProvider provider, TooltipPosition position, Class clazz) {
addComponent(provider, position, clazz, DEFAULT_PRIORITY);
}
- /**
- * Registers an {@link IBlockComponentProvider} instance for appending data context that get sent to the server.
- * A {@link BlockEntity} is also an acceptable class type.
- *
- * @param provider the data provider instance
- * @param clazz the highest level class to apply to
- */
+ @Override
void addDataContext(IBlockComponentProvider provider, Class clazz);
- /**
- * Registers an {@link IDataProvider} instance for data syncing purposes. A {@link BlockEntity}
- * is also an acceptable class type.
- *
- * @param provider the data provider instance
- * @param clazz the highest level class to apply to
- * @param priority the priority of this provider 0 is the minimum, lower number will be called first
- *
- * @see #DEFAULT_PRIORITY
- */
+ @Override
@ApiSide.ServerOnly
void addBlockData(IDataProvider provider, Class clazz, int priority);
- /**
- * Registers an {@link IDataProvider} instance with {@link #DEFAULT_PRIORITY} for data syncing purposes. A {@link BlockEntity}
- * is also an acceptable class type.
- *
- * @param provider the data provider instance
- * @param clazz the highest level class to apply to
- */
+ @Override
default void addBlockData(IDataProvider provider, Class clazz) {
addBlockData(provider, clazz, DEFAULT_PRIORITY);
}
- /**
- * Adds the specified entity types to the default blacklist.
- *
- * @param priority the modifier priority, lower number will be called last
- */
+ @Override
void addBlacklist(int priority, EntityType>... entityTypes);
- /**
- * Adds the specified entity types to the default blacklist.
- */
+ @Override
default void addBlacklist(EntityType>... entityTypes) {
addBlacklist(DEFAULT_PRIORITY, entityTypes);
}
- /**
- * Removes the specified entity types to the default blacklist.
- *
- * @param priority the modifier priority, lower number will be called last
- */
+ @Override
void removeBlacklist(int priority, EntityType>... entityTypes);
- /**
- * Removes the specified entity types to the default blacklist.
- */
+ @Override
default void removeBlacklist(EntityType>... entityTypes) {
removeBlacklist(DEFAULT_PRIORITY, entityTypes);
}
- /**
- * Registers an {@link IEntityComponentProvider} instance to allow redirecting the object being displayed.
- *
- * @param provider the data provider instance
- * @param clazz the highest level class to apply to
- * @param priority the priority of this provider 0 is the minimum, lower number will be called first
- *
- * @see #DEFAULT_PRIORITY
- */
+ @Override
@ApiStatus.Experimental
void addRedirect(IEntityComponentProvider provider, Class clazz, int priority);
- /**
- * Registers an {@link IEntityComponentProvider} instance to allow redirecting the object being displayed.
- *
- * @param provider the data provider instance
- * @param clazz the highest level class to apply to
- *
- * @see #DEFAULT_PRIORITY
- */
+ @Override
@ApiStatus.Experimental
default void addRedirect(IEntityComponentProvider provider, Class clazz) {
addRedirect(provider, clazz, DEFAULT_PRIORITY);
}
- /**
- * Registers an {@link IEntityComponentProvider} instance to allow overriding the entity being displayed.
- *
- * @param provider the data provider instance
- * @param clazz the highest level class to apply to
- * @param priority the priority of this provider 0 is the minimum, lower number will be called first
- *
- * @see #DEFAULT_PRIORITY
- */
+ @Override
@ApiSide.ClientOnly
void addOverride(IEntityComponentProvider provider, Class clazz, int priority);
- /**
- * Registers an {@link IEntityComponentProvider} instance with {@link #DEFAULT_PRIORITY} to allow overriding the entity being displayed.
- *
- * @param provider the data provider instance
- * @param clazz the highest level class to apply to
- *
- * @see #DEFAULT_PRIORITY
- */
+ @Override
@ApiSide.ClientOnly
default void addOverride(IEntityComponentProvider provider, Class clazz) {
addOverride(provider, clazz, DEFAULT_PRIORITY);
}
- /**
- * Registers an {@link IEntityComponentProvider} instance to allow displaying an icon via the
- * {@link IEntityComponentProvider#getIcon(IEntityAccessor, IPluginConfig)} method.
- *
- * @param provider the data provider instance
- * @param clazz the highest level class to apply to
- * @param priority the priority of this provider 0 is the minimum, lower number will be called first
- *
- * @see #DEFAULT_PRIORITY
- */
+ @Override
@ApiSide.ClientOnly
void addIcon(IEntityComponentProvider provider, Class clazz, int priority);
- /**
- * Registers an {@link IEntityComponentProvider} instance with {@link #DEFAULT_PRIORITY} to allow displaying an icon via the
- * {@link IEntityComponentProvider#getIcon(IEntityAccessor, IPluginConfig)} method.
- *
- * @param provider the data provider instance
- * @param clazz the highest level class to apply to
- */
+ @Override
@ApiSide.ClientOnly
default void addIcon(IEntityComponentProvider provider, Class clazz) {
addIcon(provider, clazz, DEFAULT_PRIORITY);
}
- /**
- * Registers an {@link IEntityComponentProvider} instance for appending {@link Component} to the tooltip.
- *
- * @param provider the data provider instance
- * @param position the position on the tooltip this applies to
- * @param clazz the highest level class to apply to
- * @param priority the priority of this provider 0 is the minimum, lower number will be called first
- *
- * @see #DEFAULT_PRIORITY
- */
+ @Override
@ApiSide.ClientOnly
void addComponent(IEntityComponentProvider provider, TooltipPosition position, Class clazz, int priority);
- /**
- * Registers an {@link IEntityComponentProvider} instance with {@link #DEFAULT_PRIORITY} for appending {@link Component} to the tooltip.
- *
- * @param provider the data provider instance
- * @param position the position on the tooltip this applies to
- * @param clazz the highest level class to apply to
- */
+ @Override
@ApiSide.ClientOnly
default void addComponent(IEntityComponentProvider provider, TooltipPosition position, Class clazz) {
addComponent(provider, position, clazz, DEFAULT_PRIORITY);
}
- /**
- * Registers an {@link IEntityComponentProvider} instance for appending data context that get sent to the server.
- *
- * @param provider the data provider instance
- * @param clazz the highest level class to apply to
- */
+ @Override
void addDataContext(IEntityComponentProvider provider, Class clazz);
- /**
- * Registers an {@link IDataProvider} instance for data syncing purposes.
- *
- * @param provider the data provider instance
- * @param clazz the highest level class to apply to
- * @param priority the priority of this provider 0 is the minimum, lower number will be called first
- *
- * @see #DEFAULT_PRIORITY
- */
+ @Override
@ApiSide.ServerOnly
void addEntityData(IDataProvider provider, Class clazz, int priority);
- /**
- * Registers an {@link IDataProvider} instance eith {@link #DEFAULT_PRIORITY} for data syncing purposes.
- *
- * @param provider the data provider instance
- * @param clazz the highest level class to apply to
- */
+ @Override
default void addEntityData(IDataProvider provider, Class clazz) {
addEntityData(provider, clazz, DEFAULT_PRIORITY);
}
- /**
- * Registers a data type used for syncing data from server to client.
- *
- * @param type the data type
- * @param codec the data-to-buffer codec
- */
+ @Override
void addDataType(IData.Type type, StreamCodec super RegistryFriendlyByteBuf, ? extends D> codec);
- /**
- * Registers an {@link IThemeType} instance.
- *
- * @param id the theme type id
- * @param type the theme type
- */
+ @Override
@ApiSide.ClientOnly
@ApiStatus.Experimental
void addThemeType(ResourceLocation id, IThemeType type);
- /**
- * Registers an {@link IRayCastVectorProvider} instance
- *
- * @param provider the vector provider
- * @param priority the priority of this provider 0 is the minimum, lower number will be called first
- */
+ @Override
@ApiSide.ClientOnly
@ApiStatus.Experimental
void addRayCastVector(IRayCastVectorProvider provider, int priority);
- /**
- * Registers an {@link IRayCastVectorProvider} instance with {@link #DEFAULT_PRIORITY}
- *
- * @param provider the vector provider
- */
+ @Override
@ApiSide.ClientOnly
@ApiStatus.Experimental
default void addRayCastVector(IRayCastVectorProvider provider) {
addRayCastVector(provider, DEFAULT_PRIORITY);
}
- /**
- * Registers a tool type, to be used for the harvestability tooltip.
- *
- * @param id the tool type id, also used as the translation key as {@code tooltip.waila.harvest.tool.[namespace].[path]}
- * @param toolType the tool type
- */
+ @Override
@ApiSide.ClientOnly
@ApiStatus.Experimental
default void addToolType(ResourceLocation id, IToolType toolType) {
diff --git a/src/api/java/mcp/mobius/waila/api/IWailaClientPlugin.java b/src/api/java/mcp/mobius/waila/api/IWailaClientPlugin.java
new file mode 100644
index 000000000..dc8b32544
--- /dev/null
+++ b/src/api/java/mcp/mobius/waila/api/IWailaClientPlugin.java
@@ -0,0 +1,15 @@
+package mcp.mobius.waila.api;
+
+import lol.bai.badpackets.impl.marker.ApiSide;
+
+/**
+ * The client side entrypoint for Waila plugins.
+ *
+ * See {@linkplain mcp.mobius.waila.api package documentation} for more info.
+ */
+@ApiSide.ClientOnly
+public interface IWailaClientPlugin {
+
+ void register(IClientRegistrar registrar);
+
+}
diff --git a/src/api/java/mcp/mobius/waila/api/IWailaCommonPlugin.java b/src/api/java/mcp/mobius/waila/api/IWailaCommonPlugin.java
new file mode 100644
index 000000000..0feea034e
--- /dev/null
+++ b/src/api/java/mcp/mobius/waila/api/IWailaCommonPlugin.java
@@ -0,0 +1,12 @@
+package mcp.mobius.waila.api;
+
+/**
+ * The common side entrypoint for Waila plugins.
+ *
+ * See {@linkplain mcp.mobius.waila.api package documentation} for mor info.
+ */
+public interface IWailaCommonPlugin {
+
+ void register(ICommonRegistrar registrar);
+
+}
diff --git a/src/api/java/mcp/mobius/waila/api/IWailaPlugin.java b/src/api/java/mcp/mobius/waila/api/IWailaPlugin.java
index 978087460..fc20e000d 100644
--- a/src/api/java/mcp/mobius/waila/api/IWailaPlugin.java
+++ b/src/api/java/mcp/mobius/waila/api/IWailaPlugin.java
@@ -3,46 +3,9 @@
import org.jetbrains.annotations.ApiStatus;
/**
- * Main interface used for Waila plugins. Provides a valid instance of {@link IRegistrar}.
- *
- *
Plugin Definitions
- *
- * To register the plugin instance, create a file called {@code waila_plugins.json} or {@code wthit_plugins.json} in the root of your mod.
- * {
- * // the plugin identifier, [namespace:path]
- * "yourmodid:plugin": {
- * // the path to the implementation class
- * "initializer": "package.YourWailaPlugin",
- *
- * // optional, decide the environment the plugin will loaded, options:
- * // client load plugin only on client and integrated server
- * // server load plugin only on dedicated server
- * // * load plugin on both client and dedicated server
- * "side": "*",
- *
- * // optional, the required mods that this plugin needs
- * "required": {
- * "othermodid": "*", // match any version
- * "another_one": ">1.2" // match versions newer than 1.2, see below for more details
- * },
- *
- * // optional, whether the plugin is enabled by default. defaults to true
- * "defaultEnabled": true
- * }
- *
- * // register multiple plugins!
- * "yourmodid:another": {...}
- * }
- *
- *
- *
- *
Version Ranges
- *
- * Waila only implements primitive operator ({@code <, <=, >, >=, =}) alongside logical and ({@code &&}) and or ({@code ||})
- * for its version ranges.
- *
- * @see FlexVer project
+ * @deprecated use {@link IWailaCommonPlugin} or {@link IWailaClientPlugin} instead.
*/
+@Deprecated
@ApiStatus.OverrideOnly
public interface IWailaPlugin {
diff --git a/src/api/java/mcp/mobius/waila/api/WailaConstants.java b/src/api/java/mcp/mobius/waila/api/WailaConstants.java
index d86175f12..b263d0882 100644
--- a/src/api/java/mcp/mobius/waila/api/WailaConstants.java
+++ b/src/api/java/mcp/mobius/waila/api/WailaConstants.java
@@ -1,6 +1,5 @@
package mcp.mobius.waila.api;
-import com.google.common.base.Preconditions;
import net.minecraft.resources.ResourceLocation;
public class WailaConstants {
@@ -18,6 +17,11 @@ public class WailaConstants {
*/
public static final int CONFIG_VERSION = 1;
+ /**
+ * The default priority for all component and data provider.
+ */
+ public static final int DEFAULT_PRIORITY = 1000;
+
/**
* Tooltip tag for block, fluid, and entity name line.
*
diff --git a/src/api/java/mcp/mobius/waila/api/data/BlockingDataProvider.java b/src/api/java/mcp/mobius/waila/api/data/BlockingDataProvider.java
index f437e4a57..3e340def5 100644
--- a/src/api/java/mcp/mobius/waila/api/data/BlockingDataProvider.java
+++ b/src/api/java/mcp/mobius/waila/api/data/BlockingDataProvider.java
@@ -4,14 +4,14 @@
import mcp.mobius.waila.api.IDataProvider;
import mcp.mobius.waila.api.IDataWriter;
import mcp.mobius.waila.api.IPluginConfig;
-import mcp.mobius.waila.api.IRegistrar;
import mcp.mobius.waila.api.IServerAccessor;
+import mcp.mobius.waila.api.WailaConstants;
/**
* Implementation of {@link IDataProvider} that blocks specified data types.
*
* Usage of this class should probably be accompanied by a higher (lower number)
- * priority than the {@linkplain IRegistrar#DEFAULT_PRIORITY default}.
+ * priority than the {@linkplain WailaConstants#DEFAULT_PRIORITY default}.
*/
public final class BlockingDataProvider implements IDataProvider {
diff --git a/src/api/java/mcp/mobius/waila/api/data/EnergyData.java b/src/api/java/mcp/mobius/waila/api/data/EnergyData.java
index d090d46e9..c7b2b2e76 100644
--- a/src/api/java/mcp/mobius/waila/api/data/EnergyData.java
+++ b/src/api/java/mcp/mobius/waila/api/data/EnergyData.java
@@ -2,7 +2,7 @@
import mcp.mobius.waila.api.IData;
import mcp.mobius.waila.api.IDataProvider;
-import mcp.mobius.waila.api.IRegistrar;
+import mcp.mobius.waila.api.WailaConstants;
import mcp.mobius.waila.api.__internal__.ApiSide;
import mcp.mobius.waila.api.__internal__.IApiService;
import mcp.mobius.waila.api.__internal__.IExtraService;
@@ -48,7 +48,7 @@ public abstract class EnergyData implements IData {
/**
* Creates a {@linkplain IDataProvider data provider} that always returns infinite energy data.
*
- * Should probably be used with a higher (lower number) priority than the {@linkplain IRegistrar#DEFAULT_PRIORITY default}.
+ * Should probably be used with a higher (lower number) priority than the {@linkplain WailaConstants#DEFAULT_PRIORITY default}.
*
* Along with this method, Waila also provides {@code waila:extra/infinite_energy}
* tag that can be used for marking blocks, block entity types, or entity types to contain infinite energy.
diff --git a/src/api/java/mcp/mobius/waila/api/package-info.java b/src/api/java/mcp/mobius/waila/api/package-info.java
index 286839306..1aadc1b05 100644
--- a/src/api/java/mcp/mobius/waila/api/package-info.java
+++ b/src/api/java/mcp/mobius/waila/api/package-info.java
@@ -1,6 +1,49 @@
/**
* The WTHIT API.
*
- * @see mcp.mobius.waila.api.IWailaPlugin
+ *
Plugin Definitions
+ *
+ * To register the plugin instance, create a file called {@code waila_plugins.json} or {@code wthit_plugins.json} in the root of your mod.
+ * {
+ * // the plugin identifier, [namespace:path]
+ * "yourmodid:plugin": {
+ * "entrypoints" : {
+ * // common entrypoint, will always get called
+ * "common": "package.YourWailaCommonPlugin",
+ *
+ * // client entrypoint, only called on client side
+ * "client": "package.YourWailaClientPlugin"
+ * },
+ *
+ * // optional, decide the environment the plugin will loaded, options:
+ * // client load plugin only on client and integrated server
+ * // server load plugin only on dedicated server
+ * // * load plugin on both client and dedicated server
+ * "side": "*",
+ *
+ * // optional, the required mods that this plugin needs
+ * "required": {
+ * "othermodid": "*", // match any version
+ * "another_one": ">1.2" // match versions newer than 1.2, see below for more details
+ * },
+ *
+ * // optional, whether the plugin is enabled by default. defaults to true
+ * "defaultEnabled": true
+ * }
+ *
+ * // register multiple plugins!
+ * "yourmodid:another": {...}
+ * }
+ *
+ *
+ *
+ *
Version Ranges
+ *
+ * Waila only implements primitive operator ({@code <, <=, >, >=, =}) alongside logical and ({@code &&}) and or ({@code ||})
+ * for its version ranges.
+ *
+ * @see FlexVer project
+ * @see mcp.mobius.waila.api.IWailaCommonPlugin
+ * @see mcp.mobius.waila.api.IWailaClientPlugin
*/
package mcp.mobius.waila.api;
diff --git a/src/main/java/mcp/mobius/waila/Waila.java b/src/main/java/mcp/mobius/waila/Waila.java
index 5fd4e7de3..0a6c51a4f 100644
--- a/src/main/java/mcp/mobius/waila/Waila.java
+++ b/src/main/java/mcp/mobius/waila/Waila.java
@@ -4,13 +4,13 @@
import com.google.gson.GsonBuilder;
import mcp.mobius.waila.api.IJsonConfig;
-import mcp.mobius.waila.api.IPluginInfo;
import mcp.mobius.waila.api.WailaConstants;
import mcp.mobius.waila.api.__internal__.IHarvestService;
import mcp.mobius.waila.config.BlacklistConfig;
import mcp.mobius.waila.config.DebugConfig;
import mcp.mobius.waila.config.WailaConfig;
import mcp.mobius.waila.gui.hud.theme.ThemeDefinition;
+import mcp.mobius.waila.plugin.PluginSide;
import mcp.mobius.waila.registry.RegistryFilter;
import mcp.mobius.waila.service.ICommonService;
import mcp.mobius.waila.util.Log;
@@ -22,7 +22,7 @@ public abstract class Waila {
private static final Log LOG = Log.create();
public static final boolean DEV = ICommonService.INSTANCE.isDev();
- public static final boolean CLIENT_SIDE = ICommonService.INSTANCE.getSide().matches(IPluginInfo.Side.CLIENT);
+ public static final boolean CLIENT_SIDE = ICommonService.INSTANCE.getSide().matches(PluginSide.CLIENT);
public static final boolean ENABLE_DEBUG_COMMAND = DEV || Boolean.getBoolean("waila.debugCommands");
public static final String ISSUE_URL = ICommonService.INSTANCE.getIssueUrl();
diff --git a/src/main/java/mcp/mobius/waila/command/CommonCommand.java b/src/main/java/mcp/mobius/waila/command/CommonCommand.java
index eb9740716..12dce8991 100644
--- a/src/main/java/mcp/mobius/waila/command/CommonCommand.java
+++ b/src/main/java/mcp/mobius/waila/command/CommonCommand.java
@@ -10,7 +10,6 @@
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.suggestion.SuggestionProvider;
-import mcp.mobius.waila.api.IPluginInfo;
import mcp.mobius.waila.buildconst.Tl;
import mcp.mobius.waila.plugin.PluginInfo;
import net.minecraft.ChatFormatting;
@@ -99,7 +98,7 @@ public final void register(CommandDispatcher dispatcher) {
.register(dispatcher);
}
- private Stream getPlugins(boolean enabled) {
+ private Stream getPlugins(boolean enabled) {
return PluginInfo.getAll().stream().filter(it -> enabled == it.isEnabled());
}
@@ -121,9 +120,8 @@ else success(source, () -> Component.translatable(
private SuggestionProvider suggestPlugins(boolean enabled) {
return (context, builder) -> suggestResource(getPlugins(enabled)
- .map(it -> (PluginInfo) it)
.filter(it -> !it.isLocked() && !isPluginDisabledOnServer(it))
- .map(IPluginInfo::getPluginId), builder);
+ .map(PluginInfo::getPluginId), builder);
}
private int modifyPlugin(CommandContext context, boolean enable) {
diff --git a/src/main/java/mcp/mobius/waila/network/common/s2c/PluginSyncCommonS2CPacket.java b/src/main/java/mcp/mobius/waila/network/common/s2c/PluginSyncCommonS2CPacket.java
index b0b9320e9..1aa9e7cdc 100644
--- a/src/main/java/mcp/mobius/waila/network/common/s2c/PluginSyncCommonS2CPacket.java
+++ b/src/main/java/mcp/mobius/waila/network/common/s2c/PluginSyncCommonS2CPacket.java
@@ -6,7 +6,6 @@
import lol.bai.badpackets.api.config.ConfigPackets;
import lol.bai.badpackets.api.play.PlayPackets;
import mcp.mobius.waila.Waila;
-import mcp.mobius.waila.api.IPluginInfo;
import mcp.mobius.waila.network.Packet;
import mcp.mobius.waila.plugin.PluginInfo;
import mcp.mobius.waila.plugin.PluginLoader;
@@ -39,7 +38,7 @@ private static void receive(Payload payload) {
PluginInfo.refresh();
for (var plugin : payload.plugins) {
- ((PluginInfo) IPluginInfo.get(plugin)).setDisabledOnServer(true);
+ PluginInfo.get(plugin).setDisabledOnServer(true);
}
PluginLoader.INSTANCE.loadPlugins();
@@ -52,7 +51,7 @@ public record Payload(
public Payload() {
this(PluginInfo.getAll().stream()
.filter(it -> !it.isEnabled())
- .map(IPluginInfo::getPluginId)
+ .map(PluginInfo::getPluginId)
.toList());
}
diff --git a/src/main/java/mcp/mobius/waila/plugin/PluginInfo.java b/src/main/java/mcp/mobius/waila/plugin/PluginInfo.java
index 65485a12a..1e56a1f7e 100644
--- a/src/main/java/mcp/mobius/waila/plugin/PluginInfo.java
+++ b/src/main/java/mcp/mobius/waila/plugin/PluginInfo.java
@@ -4,21 +4,27 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.function.Supplier;
import java.util.stream.Collectors;
+import com.google.common.base.Suppliers;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.IJsonConfig;
import mcp.mobius.waila.api.IModInfo;
import mcp.mobius.waila.api.IPluginInfo;
+import mcp.mobius.waila.api.IWailaClientPlugin;
+import mcp.mobius.waila.api.IWailaCommonPlugin;
import mcp.mobius.waila.api.IWailaPlugin;
import mcp.mobius.waila.api.WailaConstants;
import mcp.mobius.waila.util.CachedSupplier;
import mcp.mobius.waila.util.Log;
import mcp.mobius.waila.util.ModInfo;
import net.minecraft.resources.ResourceLocation;
+import org.jetbrains.annotations.Nullable;
+@SuppressWarnings("deprecation")
public class PluginInfo implements IPluginInfo {
private static final Log LOG = Log.create();
@@ -34,57 +40,125 @@ public class PluginInfo implements IPluginInfo {
.create())
.build();
- private static final Map PLUGIN_ID_TO_PLUGIN_INFO = new LinkedHashMap<>();
- private static final CachedSupplier