mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-13 21:24:00 +01:00
Add in DataConverter
This commit is contained in:
parent
df3be3f436
commit
7d29c678f7
19 changed files with 954 additions and 991 deletions
252
paper-server/patches/features/0001-Add-PaperHooks.patch
Normal file
252
paper-server/patches/features/0001-Add-PaperHooks.patch
Normal file
|
@ -0,0 +1,252 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
Date: Mon, 16 Dec 2024 09:03:35 -0800
|
||||
Subject: [PATCH] Add PaperHooks
|
||||
|
||||
|
||||
diff --git a/ca/spottedleaf/moonrise/paper/PaperHooks.java b/ca/spottedleaf/moonrise/paper/PaperHooks.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..834c5ce238c7adb0164a6282582d709348ef96cc
|
||||
--- /dev/null
|
||||
+++ b/ca/spottedleaf/moonrise/paper/PaperHooks.java
|
||||
@@ -0,0 +1,240 @@
|
||||
+package ca.spottedleaf.moonrise.paper;
|
||||
+
|
||||
+import ca.spottedleaf.moonrise.common.PlatformHooks;
|
||||
+import com.mojang.datafixers.DSL;
|
||||
+import com.mojang.datafixers.DataFixer;
|
||||
+import com.mojang.serialization.Dynamic;
|
||||
+import java.util.Collection;
|
||||
+import net.minecraft.core.BlockPos;
|
||||
+import net.minecraft.nbt.CompoundTag;
|
||||
+import net.minecraft.nbt.NbtOps;
|
||||
+import net.minecraft.server.level.ChunkHolder;
|
||||
+import net.minecraft.server.level.GenerationChunkHolder;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import net.minecraft.world.entity.Entity;
|
||||
+import net.minecraft.world.entity.boss.EnderDragonPart;
|
||||
+import net.minecraft.world.level.BlockGetter;
|
||||
+import net.minecraft.world.level.ChunkPos;
|
||||
+import net.minecraft.world.level.Level;
|
||||
+import net.minecraft.world.level.block.state.BlockState;
|
||||
+import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
+import net.minecraft.world.level.chunk.LevelChunk;
|
||||
+import net.minecraft.world.level.chunk.ProtoChunk;
|
||||
+import net.minecraft.world.level.chunk.storage.SerializableChunkData;
|
||||
+import net.minecraft.world.level.entity.EntityTypeTest;
|
||||
+import net.minecraft.world.phys.AABB;
|
||||
+import java.util.List;
|
||||
+import java.util.function.Predicate;
|
||||
+
|
||||
+public final class PaperHooks implements PlatformHooks {
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBrand() {
|
||||
+ return "Paper";
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getLightEmission(final BlockState blockState, final BlockGetter world, final BlockPos pos) {
|
||||
+ return blockState.getLightEmission();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Predicate<BlockState> maybeHasLightEmission() {
|
||||
+ return (final BlockState state) -> {
|
||||
+ return state.getLightEmission() != 0;
|
||||
+ };
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasCurrentlyLoadingChunk() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public LevelChunk getCurrentlyLoadingChunk(final GenerationChunkHolder holder) {
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCurrentlyLoading(final GenerationChunkHolder holder, final LevelChunk levelChunk) {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void chunkFullStatusComplete(final LevelChunk newChunk, final ProtoChunk original) {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean allowAsyncTicketUpdates() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onChunkHolderTicketChange(final ServerLevel world, final ChunkHolder holder, final int oldLevel, final int newLevel) {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void chunkUnloadFromWorld(final LevelChunk chunk) {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void chunkSyncSave(final ServerLevel world, final ChunkAccess chunk, final SerializableChunkData data) {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onChunkWatch(final ServerLevel world, final LevelChunk chunk, final ServerPlayer player) {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onChunkUnWatch(final ServerLevel world, final ChunkPos chunk, final ServerPlayer player) {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void addToGetEntities(final Level world, final Entity entity, final AABB boundingBox, final Predicate<? super Entity> predicate, final List<Entity> into) {
|
||||
+ final Collection<EnderDragonPart> parts = world.dragonParts();
|
||||
+ if (parts.isEmpty()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ for (final EnderDragonPart part : parts) {
|
||||
+ if (part != entity && part.getBoundingBox().intersects(boundingBox) && (predicate == null || predicate.test(part))) {
|
||||
+ into.add(part);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public <T extends Entity> void addToGetEntities(final Level world, final EntityTypeTest<Entity, T> entityTypeTest, final AABB boundingBox, final Predicate<? super T> predicate, final List<? super T> into, final int maxCount) {
|
||||
+ if (into.size() >= maxCount) {
|
||||
+ // fix neoforge issue: do not add if list is already full
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ final Collection<EnderDragonPart> parts = world.dragonParts();
|
||||
+ if (parts.isEmpty()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ for (final EnderDragonPart part : parts) {
|
||||
+ if (!part.getBoundingBox().intersects(boundingBox)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ final T casted = (T)entityTypeTest.tryCast(part);
|
||||
+ if (casted != null && (predicate == null || predicate.test(casted))) {
|
||||
+ into.add(casted);
|
||||
+ if (into.size() >= maxCount) {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void entityMove(final Entity entity, final long oldSection, final long newSection) {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean screenEntity(final ServerLevel world, final Entity entity, final boolean fromDisk, final boolean event) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean configFixMC224294() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean configAutoConfigSendDistance() {
|
||||
+ return io.papermc.paper.configuration.GlobalConfiguration.get().chunkLoadingAdvanced.autoConfigSendDistance;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double configPlayerMaxLoadRate() {
|
||||
+ return io.papermc.paper.configuration.GlobalConfiguration.get().chunkLoadingBasic.playerMaxChunkLoadRate;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double configPlayerMaxGenRate() {
|
||||
+ return io.papermc.paper.configuration.GlobalConfiguration.get().chunkLoadingBasic.playerMaxChunkGenerateRate;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double configPlayerMaxSendRate() {
|
||||
+ return io.papermc.paper.configuration.GlobalConfiguration.get().chunkLoadingBasic.playerMaxChunkSendRate;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int configPlayerMaxConcurrentLoads() {
|
||||
+ return io.papermc.paper.configuration.GlobalConfiguration.get().chunkLoadingAdvanced.playerMaxConcurrentChunkLoads;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int configPlayerMaxConcurrentGens() {
|
||||
+ return io.papermc.paper.configuration.GlobalConfiguration.get().chunkLoadingAdvanced.playerMaxConcurrentChunkGenerates;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public long configAutoSaveInterval(final ServerLevel world) {
|
||||
+ return world.paperConfig().chunks.autoSaveInterval.value();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int configMaxAutoSavePerTick(final ServerLevel world) {
|
||||
+ return world.paperConfig().chunks.maxAutoSaveChunksPerTick;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean configFixMC159283() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean forceNoSave(final ChunkAccess chunk) {
|
||||
+ return chunk instanceof LevelChunk levelChunk && levelChunk.mustNotSave;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public CompoundTag convertNBT(final DSL.TypeReference type, final DataFixer dataFixer, final CompoundTag nbt,
|
||||
+ final int fromVersion, final int toVersion) {
|
||||
+ return (CompoundTag)dataFixer.update(
|
||||
+ type, new Dynamic<>(NbtOps.INSTANCE, nbt), fromVersion, toVersion
|
||||
+ ).getValue();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasMainChunkLoadHook() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void mainChunkLoad(final ChunkAccess chunk, final SerializableChunkData chunkData) {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public List<Entity> modifySavedEntities(final ServerLevel world, final int chunkX, final int chunkZ, final List<Entity> entities) {
|
||||
+ return entities;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void unloadEntity(final Entity entity) {
|
||||
+ entity.setRemoved(Entity.RemovalReason.UNLOADED_TO_CHUNK, org.bukkit.event.entity.EntityRemoveEvent.Cause.UNLOAD);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void postLoadProtoChunk(final ServerLevel world, final ProtoChunk chunk) {
|
||||
+ net.minecraft.world.level.chunk.status.ChunkStatusTasks.postLoadProtoChunk(world, chunk.getEntities());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int modifyEntityTrackingRange(final Entity entity, final int currentRange) {
|
||||
+ return org.spigotmc.TrackingRange.getEntityTrackingRange(entity, currentRange);
|
||||
+ }
|
||||
+}
|
|
@ -47,7 +47,7 @@ index 3aea76690bc3e35758d3bf274777130af17d8a0f..9e321ef1c3d5803519b243685f4ee598
|
|||
}
|
||||
}
|
||||
diff --git a/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
|
||||
index d2d21fe8d7275b01454e09be252d7dd7710cdc2d..5eef540242413df3ed136aa8837866a94cc285b3 100644
|
||||
index 5699bc15eba92e22433a20cb8326b59f2ebd3036..8578d1f78ddd1bb75f3230f04bfaa35af9f5f822 100644
|
||||
--- a/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
|
||||
+++ b/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
|
||||
@@ -84,4 +84,11 @@ public class ClientboundLevelChunkWithLightPacket implements Packet<ClientGamePa
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Check distance in entity interactions
|
|||
|
||||
|
||||
diff --git a/net/minecraft/Util.java b/net/minecraft/Util.java
|
||||
index 60952bd49a89b8d6247d0c8bac837e5b3d586a76..fe84fe69a2a9ed95ec45a9e5af6e6f5a5a74edda 100644
|
||||
index ae1d53cefb9cede1c93cb8b22122a4a2d2d9a40c..80a7a85e1a03a1ca406259207e1ae3b909b3284f 100644
|
||||
--- a/net/minecraft/Util.java
|
||||
+++ b/net/minecraft/Util.java
|
||||
@@ -130,6 +130,7 @@ public class Util {
|
File diff suppressed because it is too large
Load diff
|
@ -1,240 +0,0 @@
|
|||
package ca.spottedleaf.moonrise.paper;
|
||||
|
||||
import ca.spottedleaf.moonrise.common.PlatformHooks;
|
||||
import com.mojang.datafixers.DSL;
|
||||
import com.mojang.datafixers.DataFixer;
|
||||
import com.mojang.serialization.Dynamic;
|
||||
import java.util.Collection;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
import net.minecraft.server.level.ChunkHolder;
|
||||
import net.minecraft.server.level.GenerationChunkHolder;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.boss.EnderDragonPart;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||
import net.minecraft.world.level.chunk.storage.SerializableChunkData;
|
||||
import net.minecraft.world.level.entity.EntityTypeTest;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public final class PaperHooks implements PlatformHooks {
|
||||
|
||||
@Override
|
||||
public String getBrand() {
|
||||
return "Paper";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightEmission(final BlockState blockState, final BlockGetter world, final BlockPos pos) {
|
||||
return blockState.getLightEmission();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Predicate<BlockState> maybeHasLightEmission() {
|
||||
return (final BlockState state) -> {
|
||||
return state.getLightEmission() != 0;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCurrentlyLoadingChunk() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LevelChunk getCurrentlyLoadingChunk(final GenerationChunkHolder holder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentlyLoading(final GenerationChunkHolder holder, final LevelChunk levelChunk) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chunkFullStatusComplete(final LevelChunk newChunk, final ProtoChunk original) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowAsyncTicketUpdates() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkHolderTicketChange(final ServerLevel world, final ChunkHolder holder, final int oldLevel, final int newLevel) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chunkUnloadFromWorld(final LevelChunk chunk) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chunkSyncSave(final ServerLevel world, final ChunkAccess chunk, final SerializableChunkData data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkWatch(final ServerLevel world, final LevelChunk chunk, final ServerPlayer player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnWatch(final ServerLevel world, final ChunkPos chunk, final ServerPlayer player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addToGetEntities(final Level world, final Entity entity, final AABB boundingBox, final Predicate<? super Entity> predicate, final List<Entity> into) {
|
||||
final Collection<EnderDragonPart> parts = world.dragonParts();
|
||||
if (parts.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (final EnderDragonPart part : parts) {
|
||||
if (part != entity && part.getBoundingBox().intersects(boundingBox) && (predicate == null || predicate.test(part))) {
|
||||
into.add(part);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> void addToGetEntities(final Level world, final EntityTypeTest<Entity, T> entityTypeTest, final AABB boundingBox, final Predicate<? super T> predicate, final List<? super T> into, final int maxCount) {
|
||||
if (into.size() >= maxCount) {
|
||||
// fix neoforge issue: do not add if list is already full
|
||||
return;
|
||||
}
|
||||
|
||||
final Collection<EnderDragonPart> parts = world.dragonParts();
|
||||
if (parts.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (final EnderDragonPart part : parts) {
|
||||
if (!part.getBoundingBox().intersects(boundingBox)) {
|
||||
continue;
|
||||
}
|
||||
final T casted = (T)entityTypeTest.tryCast(part);
|
||||
if (casted != null && (predicate == null || predicate.test(casted))) {
|
||||
into.add(casted);
|
||||
if (into.size() >= maxCount) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void entityMove(final Entity entity, final long oldSection, final long newSection) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean screenEntity(final ServerLevel world, final Entity entity, final boolean fromDisk, final boolean event) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configFixMC224294() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configAutoConfigSendDistance() {
|
||||
return io.papermc.paper.configuration.GlobalConfiguration.get().chunkLoadingAdvanced.autoConfigSendDistance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double configPlayerMaxLoadRate() {
|
||||
return io.papermc.paper.configuration.GlobalConfiguration.get().chunkLoadingBasic.playerMaxChunkLoadRate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double configPlayerMaxGenRate() {
|
||||
return io.papermc.paper.configuration.GlobalConfiguration.get().chunkLoadingBasic.playerMaxChunkGenerateRate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double configPlayerMaxSendRate() {
|
||||
return io.papermc.paper.configuration.GlobalConfiguration.get().chunkLoadingBasic.playerMaxChunkSendRate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int configPlayerMaxConcurrentLoads() {
|
||||
return io.papermc.paper.configuration.GlobalConfiguration.get().chunkLoadingAdvanced.playerMaxConcurrentChunkLoads;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int configPlayerMaxConcurrentGens() {
|
||||
return io.papermc.paper.configuration.GlobalConfiguration.get().chunkLoadingAdvanced.playerMaxConcurrentChunkGenerates;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long configAutoSaveInterval(final ServerLevel world) {
|
||||
return world.paperConfig().chunks.autoSaveInterval.value();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int configMaxAutoSavePerTick(final ServerLevel world) {
|
||||
return world.paperConfig().chunks.maxAutoSaveChunksPerTick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configFixMC159283() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean forceNoSave(final ChunkAccess chunk) {
|
||||
return chunk instanceof LevelChunk levelChunk && levelChunk.mustNotSave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag convertNBT(final DSL.TypeReference type, final DataFixer dataFixer, final CompoundTag nbt,
|
||||
final int fromVersion, final int toVersion) {
|
||||
return (CompoundTag)dataFixer.update(
|
||||
type, new Dynamic<>(NbtOps.INSTANCE, nbt), fromVersion, toVersion
|
||||
).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMainChunkLoadHook() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mainChunkLoad(final ChunkAccess chunk, final SerializableChunkData chunkData) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Entity> modifySavedEntities(final ServerLevel world, final int chunkX, final int chunkZ, final List<Entity> entities) {
|
||||
return entities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unloadEntity(final Entity entity) {
|
||||
entity.setRemoved(Entity.RemovalReason.UNLOADED_TO_CHUNK, org.bukkit.event.entity.EntityRemoveEvent.Cause.UNLOAD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postLoadProtoChunk(final ServerLevel world, final ProtoChunk chunk) {
|
||||
net.minecraft.world.level.chunk.status.ChunkStatusTasks.postLoadProtoChunk(world, chunk.getEntities());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int modifyEntityTrackingRange(final Entity entity, final int currentRange) {
|
||||
return org.spigotmc.TrackingRange.getEntityTrackingRange(entity, currentRange);
|
||||
}
|
||||
}
|
|
@ -523,7 +523,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
|||
|
||||
net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data);
|
||||
final int dataVersion = compound.getInt("DataVersion");
|
||||
compound = (net.minecraft.nbt.CompoundTag) MinecraftServer.getServer().fixerUpper.update(References.ITEM_STACK, new Dynamic<>(NbtOps.INSTANCE, compound), dataVersion, this.getDataVersion()).getValue();
|
||||
compound = ca.spottedleaf.moonrise.common.PlatformHooks.get().convertNBT(References.ITEM_STACK, MinecraftServer.getServer().fixerUpper, compound, dataVersion, this.getDataVersion()); // Paper - possibly use dataconverter
|
||||
return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow());
|
||||
}
|
||||
|
||||
|
@ -574,7 +574,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
|||
|
||||
net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data);
|
||||
int dataVersion = compound.getInt("DataVersion");
|
||||
compound = (net.minecraft.nbt.CompoundTag) MinecraftServer.getServer().fixerUpper.update(References.ENTITY, new Dynamic<>(NbtOps.INSTANCE, compound), dataVersion, this.getDataVersion()).getValue();
|
||||
compound = ca.spottedleaf.moonrise.common.PlatformHooks.get().convertNBT(References.ENTITY, MinecraftServer.getServer().fixerUpper, compound, dataVersion, this.getDataVersion()); // Paper - possibly use dataconverter
|
||||
if (!preserveUUID) {
|
||||
// Generate a new UUID so we don't have to worry about deserializing the same entity twice
|
||||
compound.remove("UUID");
|
||||
|
|
Loading…
Reference in a new issue