Don't bother with nms to get block combined id for 1.12
This commit is contained in:
parent
84d95b5b2b
commit
20a017e686
@ -43,7 +43,7 @@ public class ParamInfoItemBlock extends ParamInfoItemStack {
|
||||
|
||||
@Override
|
||||
public Object fromString(String string) {
|
||||
String[] split = string.split("[ -]", -1);
|
||||
String[] split = string.split("[:, -]", -1);
|
||||
|
||||
if (split.length > (NmsVersion.v1_13.isSupported() ? 1 : 3)) {
|
||||
throw new IllegalArgumentException();
|
||||
|
@ -1530,18 +1530,12 @@ public class ReflectionManager {
|
||||
|
||||
public static int getCombinedIdByItemStack(ItemStack itemStack) {
|
||||
try {
|
||||
Object nmsBlock;
|
||||
|
||||
if (NmsVersion.v1_13.isSupported()) {
|
||||
nmsBlock = magicGetBlock.invoke(null, itemStack.getType());
|
||||
} else {
|
||||
Object nmsItem = getNmsItem(itemStack);
|
||||
|
||||
Object item = getNmsItem.invoke(nmsItem);
|
||||
|
||||
nmsBlock = getOldItemAsBlock.invoke(null, item);
|
||||
if (!NmsVersion.v1_13.isSupported()) {
|
||||
return itemStack.getType().ordinal() + (itemStack.getDurability() << 12);
|
||||
}
|
||||
|
||||
Object nmsBlock = magicGetBlock.invoke(null, itemStack.getType());
|
||||
|
||||
Object iBlockData = getBlockData.invoke(nmsBlock);
|
||||
|
||||
return (int) getBlockDataAsId.invoke(null, iBlockData);
|
||||
|
Loading…
Reference in New Issue
Block a user