3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

Replace version constants with methods to prevent compiler inlining

Dieser Commit ist enthalten in:
md_5 2018-12-30 16:00:31 +11:00
Ursprung a5b9c7b3ee
Commit 5be2ddcbd5
4 geänderte Dateien mit 9 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -40,7 +40,7 @@
+
+ NBTTagCompound savedStack = new NBTTagCompound();
+ 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);
+ }
+ }

Datei anzeigen

@ -24,7 +24,7 @@
nbttagcompound2.setBoolean("Snapshot", false);
nbttagcompound.set("Version", nbttagcompound2);
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.setString("generatorName", this.f.b());
nbttagcompound.setInt("generatorVersion", this.f.getVersion());

Datei anzeigen

@ -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

Datei anzeigen

@ -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