Fix data version check for ItemStack serialization (#3394)
The expected version should be equal to or newer than the one stored. Although Aikar claims he did this on accident (and NOT my ligatures!), I claim this is all a big conspiracy by followers of the Taco cult.
This commit is contained in:
@@ -89,7 +89,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ );
|
||||
+ int dataVersion = compound.getInt("DataVersion");
|
||||
+
|
||||
+ Preconditions.checkArgument(dataVersion < getDataVersion(), "Newer version! Server downgrades are not supported!");
|
||||
+ Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!");
|
||||
+ Dynamic<NBTBase> converted = DataConverterRegistry.getDataFixer().update(DataConverterTypes.ITEM_STACK, new Dynamic<NBTBase>(DynamicOpsNBT.a, compound), -1, getDataVersion());
|
||||
+ return CraftItemStack.asCraftMirror(net.minecraft.server.ItemStack.fromCompound((NBTTagCompound) converted.getValue()));
|
||||
+ } catch (IOException ex) {
|
||||
|
||||
Reference in New Issue
Block a user