Skip to content

Commit

Permalink
Add missing client interact prediction to InventoryTransactionPacket
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaooot committed Aug 14, 2024
1 parent 15613f3 commit dd22c73
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public void writeItemUse(ByteBuf buffer, InventoryTransactionPacket packet) {
this.writeVector3f(buffer, packet.getPlayerPosition());
this.writeVector3f(buffer, packet.getClickPosition());
VarInts.writeUnsignedInt(buffer, packet.getBlockDefinition().getRuntimeId());
VarInts.writeUnsignedInt(buffer, packet.getClientInteractPrediction().ordinal());
}

@Override
Expand All @@ -146,6 +147,7 @@ public void readItemUse(ByteBuf buffer, InventoryTransactionPacket packet) {
packet.setPlayerPosition(this.readVector3f(buffer));
packet.setClickPosition(this.readVector3f(buffer));
packet.setBlockDefinition(this.blockDefinitions.getDefinition(VarInts.readUnsignedInt(buffer)));
packet.setClientInteractPrediction(ItemUseTransaction.PredictedResult.values()[VarInts.readUnsignedInt(buffer)]);
}

protected void writeFullContainerName(ByteBuf buffer, FullContainerName containerName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public class InventoryTransactionPacket implements BedrockPacket {
*/
private ItemUseTransaction.TriggerType triggerType;

/**
* @since v712
*/
private ItemUseTransaction.PredictedResult clientInteractPrediction;

@Override
public final PacketSignal handle(BedrockPacketHandler handler) {
return handler.handle(this);
Expand Down

0 comments on commit dd22c73

Please sign in to comment.