Fix 1.14 support.
- Fixed addCompound for 1.14. New format requires an int.
This commit is contained in:
parent
da360b3d28
commit
45d5f90fef
10
pom.xml
10
pom.xml
@ -34,13 +34,13 @@
|
|||||||
<artifactId>spigot-1.10</artifactId>
|
<artifactId>spigot-1.10</artifactId>
|
||||||
<version>1.10.2-R0.1-SNAPSHOT</version>
|
<version>1.10.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-1.11</artifactId>
|
<artifactId>spigot-1.11</artifactId>
|
||||||
<version>1.11.2-R0.1-SNAPSHOT</version>
|
<version>1.11.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency> -->
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-1.12</artifactId>
|
<artifactId>spigot-1.12</artifactId>
|
||||||
@ -59,6 +59,12 @@
|
|||||||
<version>1.13.1-R0.1-SNAPSHOT</version>
|
<version>1.13.1-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-1.14</artifactId>
|
||||||
|
<version>1.14-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!--bStats -->
|
<!--bStats -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -116,7 +116,15 @@ public class NBTEditor
|
|||||||
setTag = NBTTagCompound.getMethod("set", String.class, NBTBase);
|
setTag = NBTTagCompound.getMethod("set", String.class, NBTBase);
|
||||||
|
|
||||||
NBTTagList = getNMSClass("NBTTagList");
|
NBTTagList = getNMSClass("NBTTagList");
|
||||||
|
// Starting in 1.14, you also need to provide an int value when adding nbt tags.
|
||||||
|
try
|
||||||
|
{
|
||||||
addCompound = NBTTagList.getMethod("add", NBTBase);
|
addCompound = NBTTagList.getMethod("add", NBTBase);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
addCompound = NBTTagList.getMethod("add", int.class, NBTBase);
|
||||||
|
}
|
||||||
|
|
||||||
setCompoundTagList = NBTTagCompound.getMethod("set", String.class, NBTBase);
|
setCompoundTagList = NBTTagCompound.getMethod("set", String.class, NBTBase);
|
||||||
setCompoundByte = NBTTagCompound.getMethod("set", String.class, NBTBase);
|
setCompoundByte = NBTTagCompound.getMethod("set", String.class, NBTBase);
|
||||||
@ -130,6 +138,14 @@ public class NBTEditor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addCompound(Object instance, Object nbtbase) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
|
||||||
|
{
|
||||||
|
if (addCompound.getParameterCount() == 2)
|
||||||
|
addCompound.invoke(instance, 0, nbtbase);
|
||||||
|
else
|
||||||
|
addCompound.invoke(instance, nbtbase);
|
||||||
|
}
|
||||||
|
|
||||||
// Add armor to the supplied item, based on the armorTier.
|
// Add armor to the supplied item, based on the armorTier.
|
||||||
public ItemStack addArmorNBTTags(ItemStack item, ArmorTier armorTier, boolean unbreakable)
|
public ItemStack addArmorNBTTags(ItemStack item, ArmorTier armorTier, boolean unbreakable)
|
||||||
{
|
{
|
||||||
@ -155,7 +171,7 @@ public class NBTEditor
|
|||||||
setTag.invoke (armor, "UUIDLeast", NBTTagIntCtor.newInstance(894654));
|
setTag.invoke (armor, "UUIDLeast", NBTTagIntCtor.newInstance(894654));
|
||||||
setTag.invoke (armor, "UUIDMost", NBTTagIntCtor.newInstance(2872));
|
setTag.invoke (armor, "UUIDMost", NBTTagIntCtor.newInstance(2872));
|
||||||
setTag.invoke (armor, "Slot", NBTTagStringCtor.newInstance("chest"));
|
setTag.invoke (armor, "Slot", NBTTagStringCtor.newInstance("chest"));
|
||||||
addCompound.invoke(modifiers, armor);
|
addCompound(modifiers, armor);
|
||||||
|
|
||||||
Object armorTough = NBTTagCompound.newInstance();
|
Object armorTough = NBTTagCompound.newInstance();
|
||||||
setTag.invoke (armorTough, "AttributeName", NBTTagStringCtor.newInstance("generic.armorToughness"));
|
setTag.invoke (armorTough, "AttributeName", NBTTagStringCtor.newInstance("generic.armorToughness"));
|
||||||
@ -165,7 +181,7 @@ public class NBTEditor
|
|||||||
setTag.invoke (armorTough, "UUIDLeast", NBTTagIntCtor.newInstance(894654));
|
setTag.invoke (armorTough, "UUIDLeast", NBTTagIntCtor.newInstance(894654));
|
||||||
setTag.invoke (armorTough, "UUIDMost", NBTTagIntCtor.newInstance(2872));
|
setTag.invoke (armorTough, "UUIDMost", NBTTagIntCtor.newInstance(2872));
|
||||||
setTag.invoke (armorTough, "Slot", NBTTagStringCtor.newInstance("chest"));
|
setTag.invoke (armorTough, "Slot", NBTTagStringCtor.newInstance("chest"));
|
||||||
addCompound.invoke(modifiers, armorTough);
|
addCompound(modifiers, armorTough);
|
||||||
|
|
||||||
if (unbreakable)
|
if (unbreakable)
|
||||||
setCompoundByte.invoke(compound, "Unbreakable", NBTTagByteCtor.newInstance((byte) 1));
|
setCompoundByte.invoke(compound, "Unbreakable", NBTTagByteCtor.newInstance((byte) 1));
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
name: ArmoredElytra
|
name: ArmoredElytra
|
||||||
main: nl.pim16aap2.armoredElytra.ArmoredElytra
|
main: nl.pim16aap2.armoredElytra.ArmoredElytra
|
||||||
version: 2.4.8
|
version: 2.4.8
|
||||||
author: Pim
|
author: pim16aap2
|
||||||
commands:
|
commands:
|
||||||
ArmoredElytra:
|
ArmoredElytra:
|
||||||
description: Give an armored elytra of the specified tier.
|
description: Give an armored elytra of the specified tier.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user