Compare commits

..
5 Commits
10 changed files with 130 additions and 1 deletions

No files matched your search

+54 -1
View File
@@ -25,7 +25,7 @@ If you notice any problems when opening NEID worlds with EndlessIDs, please open
| Entity IDs | 256 | 256 | 256 | 32,768 | | Entity IDs | 256 | 256 | 256 | 32,768 |
| Potion IDs | 32 | 32 | 32 | 65,536 | | Potion IDs | 32 | 32 | 32 | 65,536 |
| Enchantment IDs | 256 | 256 | 256 | 32,768 | | 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 | | Dimension IDs | Theoretically unlimited, 4,294,967,295 in practice | Same | Same | Same |
## Mod compat ## Mod compat
@@ -98,3 +98,56 @@ Mods not listed here may or may not work.
user to this GitHub repo. user to this GitHub repo.
If you find any crashes or incompatibilities, don't hesitate to open an issue. If you find any crashes or incompatibilities, don't hesitate to open an issue.
## Depending On Metadata Increase In Another Mod
**NOTE:** This API is available as of version TODO of EndlessIDs.
EndlessIDs implements the common ID Extender API introduced in NotEnoughIDs Unofficial. See:
https://github.com/GTNewHorizons/NotEnoughIds/pull/17
The description below is an excerpt of NEID-U's readme concerning this API:
In order to use the metadata, you should not create a hard dependency on the `endlessids` Mod ID, but rather on the `idextender` Mod ID.
EndlessIDs bundles this "dummy" mod alongside itself.
Here is an example of how to use it, you could put this code in your Mod's pre-init for example:
```java
import idextender;
int maxMeta = 15;
if (Loader.isModLoaded("idextender")) {
maxMeta = (Integer) Class.forName("idextender.Metadata").getDeclaredMethod("maximumMetadata").invoke(null);
}
```
You can also query for the number of bits the metadata value is extended to, rather than the maximum value:
```java
import idextender;
int metadataBits = 4;
if (Loader.isModLoaded("idextender")){
metadataBits = (Integer) Class.forName("idextender.Metadata").getDeclaredMethod("metadataBits").invoke(null);
}
```
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.
If for some reason, you need to know what parent mod is providing the `idextender` mod, you can do the following, which will give you
back the Mod ID of the actual mod that has provided `idextender`. For example, `endlessids`:
```java
// This will give back the value "endlessids" which is EndlessIDs' Mod ID
String parentIDExtender = (String) Class.forName("idextender.IDExtender").getDeclaredMethod("parentModId").invoke(null);
```
For more information, see the NotEnoughIDs readme.
+5
View File
@@ -11,6 +11,11 @@ minecraft_fp {
rootPkg = "$group.endlessids" rootPkg = "$group.endlessids"
} }
api {
packages = listOf("idextender")
ignoreRootPkg = true
}
mixin { mixin {
pkg = "mixin.mixins" pkg = "mixin.mixins"
pluginClass = "mixin.plugin.MixinPlugin" pluginClass = "mixin.plugin.MixinPlugin"
@@ -58,6 +58,9 @@ public class ExtendedConstants {
public static final int itemIDCount = 1 << (bitsPerID - countCorrectionItemBits); public static final int itemIDCount = 1 << (bitsPerID - countCorrectionItemBits);
public static final int maxItemID = itemIDCount - 1; public static final int maxItemID = itemIDCount - 1;
public static final int metadataCount = (1 << bitsPerMetadata);
public static final int maxMetadata = metadataCount - 1;
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata; public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
public static final int nibblesPerBlock = bitsPerBlock / 4; public static final int nibblesPerBlock = bitsPerBlock / 4;
public static final int nibblesPerSubChunk = nibblesPerBlock * 16 * 16 * 16; public static final int nibblesPerSubChunk = nibblesPerBlock * 16 * 16 * 16;
@@ -48,6 +48,9 @@ public class VanillaConstants {
public static final int itemIDCount = 32000; public static final int itemIDCount = 32000;
public static final int maxItemID = itemIDCount - 1; public static final int maxItemID = itemIDCount - 1;
public static final int metadataCount = (1 << bitsPerMetadata);
public static final int maxMetadata = metadataCount - 1;
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata; public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
public static final int nibblesPerBlock = bitsPerBlock / 4; public static final int nibblesPerBlock = bitsPerBlock / 4;
public static final int nibblesPerSubChunk = nibblesPerBlock * 16 * 16 * 16; public static final int nibblesPerSubChunk = nibblesPerBlock * 16 * 16 * 16;
@@ -57,6 +57,15 @@ public abstract class S0FPacketSpawnMobMixin {
return 0; return 0;
} }
@Redirect(method = "readPacketData",
at = @At(value = "FIELD",
target = "Lnet/minecraft/network/play/server/S0FPacketSpawnMob;field_149040_b:I",
ordinal = 0),
require = 1)
private void noReadByte2(S0FPacketSpawnMob instance, int value) {
}
@Inject(method = "readPacketData", @Inject(method = "readPacketData",
at = @At(value = "INVOKE", at = @At(value = "INVOKE",
target = "Lnet/minecraft/network/PacketBuffer;readByte()B", target = "Lnet/minecraft/network/PacketBuffer;readByte()B",
+16
View File
@@ -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;
}
}
+14
View File
@@ -0,0 +1,14 @@
package idextender;
import com.falsepattern.endlessids.Tags;
import cpw.mods.fml.common.Mod;
@Mod(modid = "idextender", name = "ID Extender", version = "1.0.0")
public class IDExtender {
public static String parentModId() {
return Tags.MODID;
}
}
+16
View File
@@ -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 Metadata {
public static int maximumMetadata() {
return GeneralConfig.extendBlockItem ? ExtendedConstants.maxMetadata : VanillaConstants.maxMetadata;
}
public static int metadataBits() {
return GeneralConfig.extendBlockItem ? ExtendedConstants.bitsPerMetadata : VanillaConstants.bitsPerMetadata;
}
}
@@ -0,0 +1,4 @@
/**
* Interop with NEID Unofficial, to let mods avoid hard-depending on either NEIDu or EndlessIDs
*/
package idextender;
+6
View File
@@ -14,5 +14,11 @@
"logoFile": "", "logoFile": "",
"screenshots": [], "screenshots": [],
"dependencies": [] "dependencies": []
},
{
"modid": "idextender",
"name": "ID Extender",
"version": "1.0.0",
"parent": "${modId}"
} }
] ]