Open PedroMPagani opened 1 month ago
Is you goal to record all entity metadata or something specific?
Well, the main idea is to have End crystals be able to report he setBottom to false, but you know, that's one state, there's a lot of stuff on the metadata that would be very useful to sync on replays of entities you know?
This is what I got to hae the metadata fully there: import io.netty.buffer.Unpooled; import me.jumper251.replay.replaysystem.replaying.Replayer; import net.minecraft.network.RegistryFriendlyByteBuf; import org.bukkit.craftbukkit.v1_20_R4.CraftWorld;
public class EntityMetaData extends PacketData {
private static final long serialVersionUID = 2305534557075148314L;
private byte[] serializedPacket;
private int entityID;
private String world;
public EntityMetaData(int entityID, RegistryFriendlyByteBuf serializedPacket, String world) {
this.entityID = entityID;
this.serializedPacket = serializedPacket.array();
this.world = world;
}
public int getEntityID() {
return entityID;
}
public RegistryFriendlyByteBuf getSerializedPacket(Replayer replayer) {
return new RegistryFriendlyByteBuf(Unpooled.copiedBuffer(this.serializedPacket), ((CraftWorld)replayer.getWatchingPlayer().getWorld()).getHandle().registryAccess());
}
}
I gave some thought, some abstraction on the metadata sounds nice.
Yeah it would be good to have some control over what kind of metadata we record, I guess there is also some unnecessary data in there. It would also make it less likely for replays to break in between minecraft versions.
Yeah, some level of abstraction and likely a PRotocol id on the replayer file, so that everything can be handled properly would be nice, certain entiteis have certain data so I assume something like a wrapper of global with submeta components and they write by their own, serialized on a list the metadata doesnt hold a lot of crap data from what I know, im really serializing the entire packet and the metadata isn't even close to being big
Currently My solution is to serialize the packet, a single-hand solution for 1.20.6+ is that, otherwise i think it becomes extremely hard to "maintain", unfortunately the background is a friendly bytebuf wrapping, it's not serializable, any ideas?