Skip to content

Commit

Permalink
Merge pull request #249 from Kaooot/fix-2
Browse files Browse the repository at this point in the history
Add missing client interact prediction to InventoryTransactionPacket
  • Loading branch information
SupremeMortal authored Aug 14, 2024
2 parents 1a357d3 + dd22c73 commit b9f49c0
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 b9f49c0

Please sign in to comment.