To reduce meaningless bandwidth overheads caused by #42 (with PDC), PDC Filter is set.
Patch
By redefine.
At FriendlyByteBuf (Paper, called PacketDataSerializer in spigot)
public FriendlyByteBuf writeItem(ItemStack stack) {
if (stack.isEmpty() || stack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem()
this.writeBoolean(false);
} else {
this.writeBoolean(true);
Item item = stack.getItem();
this.writeVarInt(Item.getId(item));
this.writeByte(stack.getCount());
CompoundTag nbttagcompound = null;
if (item.canBeDepleted() || item.shouldOverrideMultiplayerNbt()) {
// Spigot start - filter
stack = stack.copy();
// CraftItemStack.setItemMeta(stack, CraftItemStack.getItemMeta(stack)); // Paper - This is no longer needed due to NBT being supported
// Spigot end
nbttagcompound = stack.getTag();
// Paper start
if (nbttagcompound != null && nbttagcompound.contains("SkullOwner", 10)) {
CompoundTag owner = nbttagcompound.getCompound("SkullOwner");
if (owner.hasUUID("Id")) {
nbttagcompound.putUUID("SkullOwnerOrig", owner.getUUID("Id"));
net.minecraft.world.level.block.entity.SkullBlockEntity.sanitizeUUID(owner);
}
}
// Paper end
}
this.writeNbt(nbttagcompound);
}
return this;
}
Inserting hooks before this.writeNbt(nbttagcompound) would work, however it is leading to full of asm codes.
Tasks
So here're our tasks:
- Find CompoundTag in obfuscated environments. (including 1.18+, treat them as obfuscated)
- Find FriendlyByteBuf / PacketDataSerializer in obfuscated environments.
- Determine injector solution. Predefine or redefine or server patching? I prefer redefine with mixin but there're no projects has implemented mixin injection for bukkit ( or poor API )
Other
This feature is an option and disabled by default.
To reduce meaningless bandwidth overheads caused by #42 (with PDC), PDC Filter is set.
Patch
By redefine.
At
FriendlyByteBuf(Paper, calledPacketDataSerializerin spigot)Inserting hooks before
this.writeNbt(nbttagcompound)would work, however it is leading to full of asm codes.Tasks
So here're our tasks:
Other
This feature is an option and disabled by default.