mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 10:35:38 +01:00
Replace version constants with methods to prevent compiler inlining
This commit is contained in:
parent
a5b9c7b3ee
commit
5be2ddcbd5
@ -40,7 +40,7 @@
|
|||||||
+
|
+
|
||||||
+ NBTTagCompound savedStack = new NBTTagCompound();
|
+ NBTTagCompound savedStack = new NBTTagCompound();
|
||||||
+ this.save(savedStack);
|
+ this.save(savedStack);
|
||||||
+ savedStack = (NBTTagCompound) MinecraftServer.getServer().dataConverterManager.update(DataConverterTypes.ITEM_STACK, new Dynamic(DynamicOpsNBT.a, savedStack), -1, CraftMagicNumbers.DATA_VERSION).getValue();
|
+ savedStack = (NBTTagCompound) MinecraftServer.getServer().dataConverterManager.update(DataConverterTypes.ITEM_STACK, new Dynamic(DynamicOpsNBT.a, savedStack), -1, CraftMagicNumbers.INSTANCE.getDataVersion()).getValue();
|
||||||
+ this.load(savedStack);
|
+ this.load(savedStack);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
nbttagcompound2.setBoolean("Snapshot", false);
|
nbttagcompound2.setBoolean("Snapshot", false);
|
||||||
nbttagcompound.set("Version", nbttagcompound2);
|
nbttagcompound.set("Version", nbttagcompound2);
|
||||||
nbttagcompound.setInt("DataVersion", 1631);
|
nbttagcompound.setInt("DataVersion", 1631);
|
||||||
+ if (org.bukkit.craftbukkit.util.CraftMagicNumbers.DATA_VERSION != 1631) throw new AssertionError(); // CraftBukkit - sentinel
|
+ if (org.bukkit.craftbukkit.util.CraftMagicNumbers.INSTANCE.getDataVersion() != 1631) throw new AssertionError(); // CraftBukkit - sentinel
|
||||||
nbttagcompound.setLong("RandomSeed", this.e);
|
nbttagcompound.setLong("RandomSeed", this.e);
|
||||||
nbttagcompound.setString("generatorName", this.f.b());
|
nbttagcompound.setString("generatorName", this.f.b());
|
||||||
nbttagcompound.setInt("generatorVersion", this.f.getVersion());
|
nbttagcompound.setInt("generatorVersion", this.f.getVersion());
|
||||||
|
@ -400,7 +400,7 @@ public class CraftLegacy {
|
|||||||
stack.setInt("id", material.getId());
|
stack.setInt("id", material.getId());
|
||||||
stack.setShort("Damage", data);
|
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");
|
String newId = converted.getString("id");
|
||||||
// Recover spawn eggs with invalid data
|
// Recover spawn eggs with invalid data
|
||||||
|
@ -144,7 +144,6 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
|||||||
return CraftBlockData.fromData(getBlock(material, data));
|
return CraftBlockData.fromData(getBlock(material, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final int DATA_VERSION = 1631;
|
|
||||||
/**
|
/**
|
||||||
* This string should be changed if the NMS mappings do.
|
* 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
|
* 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
|
* feature and/or pull request for consideration, or use a well abstracted
|
||||||
* third-party API such as ProtocolLib.
|
* third-party API such as ProtocolLib.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static final String MAPPINGS_VERSION = "00ed8e5c39debc3ed194ad7c5645cc45";
|
public String getMappingsVersion() {
|
||||||
|
return "00ed8e5c39debc3ed194ad7c5645cc45";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDataVersion() {
|
public int getDataVersion() {
|
||||||
return DATA_VERSION;
|
return 1631;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user