From dc4879114d3b6427ade4b643eb755c9a83ece014 Mon Sep 17 00:00:00 2001 From: FalsePattern Date: Sat, 21 Sep 2024 12:54:14 +0200 Subject: [PATCH] DataWatcher idextender API --- README.MD | 5 ++++- src/main/java/idextender/DataWatcher.java | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 src/main/java/idextender/DataWatcher.java diff --git a/README.MD b/README.MD index 7b87d68..44bff78 100644 --- a/README.MD +++ b/README.MD @@ -25,7 +25,7 @@ If you notice any problems when opening NEID worlds with EndlessIDs, please open | Entity IDs | 256 | 256 | 256 | 32,768 | | Potion IDs | 32 | 32 | 32 | 65,536 | | Enchantment IDs | 256 | 256 | 256 | 32,768 | -| DataWatcher IDs | 32 | 127 (Broken) | 127 (Broken) | 65,536 | +| DataWatcher IDs | 32 | 127 (Broken) | 127 | 65,536 | | Dimension IDs | Theoretically unlimited, 4,294,967,295 in practice | Same | Same | Same | ## Mod compat @@ -135,6 +135,9 @@ if (Loader.isModLoaded("idextender")){ } ``` +The `idextender.DataWatcher` class also exposes the extended DataWatcher count (used for entity data syncing over network) +in a similar fashion. + Note that these values CAN be identical to the vanilla values if the ID Extension mod implementing it has a config to toggle itself, existence of the IDExtender class does not guarantee a fixed increase, and you should check that the returned value is large enough for your needs. diff --git a/src/main/java/idextender/DataWatcher.java b/src/main/java/idextender/DataWatcher.java new file mode 100644 index 0000000..973393d --- /dev/null +++ b/src/main/java/idextender/DataWatcher.java @@ -0,0 +1,16 @@ +package idextender; + +import com.falsepattern.endlessids.config.GeneralConfig; +import com.falsepattern.endlessids.constants.ExtendedConstants; +import com.falsepattern.endlessids.constants.VanillaConstants; + +public class DataWatcher { + public static int maxWatchableID() { + return GeneralConfig.extendDataWatcher ? ExtendedConstants.maxWatchableID : VanillaConstants.maxWatchableID; + } + + public static int watchableBits() { + return GeneralConfig.extendDataWatcher ? ExtendedConstants.watchableBits : VanillaConstants.watchableBits; + } + +} \ No newline at end of file