Replace version constants with methods to prevent compiler inlining

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2018-12-30 16:00:31 +11:00
parent adabfc807a
commit 92b2d3a400
4 changed files with 9 additions and 6 deletions

View File

@@ -400,7 +400,7 @@ public class CraftLegacy {
stack.setInt("id", material.getId());
stack.setShort("Damage", data);
Dynamic<NBTBase> converted = DataConverterRegistry.a().update(DataConverterTypes.ITEM_STACK, new Dynamic<NBTBase>(DynamicOpsNBT.a, stack), -1, CraftMagicNumbers.DATA_VERSION);
Dynamic<NBTBase> converted = DataConverterRegistry.a().update(DataConverterTypes.ITEM_STACK, new Dynamic<NBTBase>(DynamicOpsNBT.a, stack), -1, CraftMagicNumbers.INSTANCE.getDataVersion());
String newId = converted.getString("id");
// Recover spawn eggs with invalid data

View File

@@ -144,7 +144,6 @@ public final class CraftMagicNumbers implements UnsafeValues {
return CraftBlockData.fromData(getBlock(material, data));
}
public static final int DATA_VERSION = 1631;
/**
* This string should be changed if the NMS mappings do.
*
@@ -157,12 +156,16 @@ public final class CraftMagicNumbers implements UnsafeValues {
* thing as many common NMS usages. If not, you are encouraged to open a
* feature and/or pull request for consideration, or use a well abstracted
* third-party API such as ProtocolLib.
*
* @return string
*/
public static final String MAPPINGS_VERSION = "00ed8e5c39debc3ed194ad7c5645cc45";
public String getMappingsVersion() {
return "00ed8e5c39debc3ed194ad7c5645cc45";
}
@Override
public int getDataVersion() {
return DATA_VERSION;
return 1631;
}
@Override