Skip to content

Commit

Permalink
feat: use bukkit unsafe instead of craft magic numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmayr committed Oct 24, 2024
1 parent 39f8897 commit add2356
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion paper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {


group = "eu.cafestube"
version = "2.0.6-SNAPSHOT"
version = "2.0.7-SNAPSHOT"

val obfuscatedVersionSpecific = configurations.create("obfuscatedVersionSpecific") {
description = "Version Adapters to include in the JAR"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ public void setTileEntity(Location location, int dataVersion, NamespacedKey type
CompoundTag tag = convertNBTtoMC(nbt);
tag.putString("id", type.toString());

if(dataVersion != -1 && dataVersion < CraftMagicNumbers.INSTANCE.getDataVersion()) {
if(dataVersion != -1 && dataVersion < Bukkit.getUnsafe().getDataVersion()) {
tag = (CompoundTag) DataFixers.getDataFixer().update(References.BLOCK_ENTITY,
new Dynamic(NbtOps.INSTANCE, tag), dataVersion, CraftMagicNumbers.INSTANCE.getDataVersion()).getValue();
new Dynamic(NbtOps.INSTANCE, tag), dataVersion, Bukkit.getUnsafe().getDataVersion()).getValue();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ public void setTileEntity(Location location, int dataVersion, NamespacedKey type
net.minecraft.nbt.CompoundTag tag = convertNBTtoMC(nbt);
tag.putString("id", type.toString());

if(dataVersion != -1 && dataVersion < CraftMagicNumbers.INSTANCE.getDataVersion()) {
if(dataVersion != -1 && dataVersion < Bukkit.getUnsafe().getDataVersion()) {
tag = (net.minecraft.nbt.CompoundTag) DataFixers.getDataFixer().update(References.BLOCK_ENTITY,
new Dynamic(NbtOps.INSTANCE, tag), dataVersion, CraftMagicNumbers.INSTANCE.getDataVersion()).getValue();
new Dynamic(NbtOps.INSTANCE, tag), dataVersion, Bukkit.getUnsafe().getDataVersion()).getValue();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ public void setTileEntity(Location location, int dataVersion, NamespacedKey type
net.minecraft.nbt.CompoundTag tag = convertNBTtoMC(nbt);
tag.putString("id", type.toString());

if(dataVersion != -1 && dataVersion < CraftMagicNumbers.INSTANCE.getDataVersion()) {
if(dataVersion != -1 && dataVersion < Bukkit.getUnsafe().getDataVersion()) {
tag = (net.minecraft.nbt.CompoundTag) DataFixers.getDataFixer().update(References.BLOCK_ENTITY,
new Dynamic(NbtOps.INSTANCE, tag), dataVersion, CraftMagicNumbers.INSTANCE.getDataVersion()).getValue();
new Dynamic(NbtOps.INSTANCE, tag), dataVersion, Bukkit.getUnsafe().getDataVersion()).getValue();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ public void setTileEntity(Location location, int dataVersion, NamespacedKey type
net.minecraft.nbt.CompoundTag tag = convertNBTtoMC(nbt);
tag.putString("id", type.toString());

if(dataVersion != -1 && dataVersion < CraftMagicNumbers.INSTANCE.getDataVersion()) {
if(dataVersion != -1 && dataVersion < Bukkit.getUnsafe().getDataVersion()) {
tag = (net.minecraft.nbt.CompoundTag) DataFixers.getDataFixer().update(References.BLOCK_ENTITY,
new Dynamic(NbtOps.INSTANCE, tag), dataVersion, CraftMagicNumbers.INSTANCE.getDataVersion()).getValue();
new Dynamic(NbtOps.INSTANCE, tag), dataVersion, Bukkit.getUnsafe().getDataVersion()).getValue();
}

BlockEntity blockEntity = BlockEntity.loadStatic(blockPos, craftWorld.getHandle().getBlockState(blockPos), tag,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ public void setTileEntity(Location location, int dataVersion, NamespacedKey type
net.minecraft.nbt.CompoundTag tag = convertNBTtoMC(nbt);
tag.putString("id", type.toString());

if(dataVersion != -1 && dataVersion < CraftMagicNumbers.INSTANCE.getDataVersion()) {
if(dataVersion != -1 && dataVersion < Bukkit.getUnsafe().getDataVersion()) {
tag = (net.minecraft.nbt.CompoundTag) DataFixers.getDataFixer().update(References.BLOCK_ENTITY,
new Dynamic(NbtOps.INSTANCE, tag), dataVersion, CraftMagicNumbers.INSTANCE.getDataVersion()).getValue();
new Dynamic(NbtOps.INSTANCE, tag), dataVersion, Bukkit.getUnsafe().getDataVersion()).getValue();
}

BlockEntity blockEntity = BlockEntity.loadStatic(blockPos, craftWorld.getHandle().getBlockState(blockPos), tag,
Expand Down

0 comments on commit add2356

Please sign in to comment.