use of net.minecraft.network.protocol.game.ClientboundSetCarriedItemPacket in project SpongeCommon by SpongePowered.
the class InventoryMixin_Bridge_Inventory method bridge$setSelectedItem.
@Override
public void bridge$setSelectedItem(int itemIndex, final boolean notify) {
itemIndex = itemIndex % 9;
if (notify && this.player instanceof ServerPlayer) {
final ClientboundSetCarriedItemPacket packet = new ClientboundSetCarriedItemPacket(itemIndex);
((ServerPlayer) this.player).connection.send(packet);
}
this.selected = itemIndex;
}
use of net.minecraft.network.protocol.game.ClientboundSetCarriedItemPacket in project SpongeCommon by SpongePowered.
the class SetCarriedItemTransaction method restore.
@Override
public void restore(final PhaseContext<@NonNull ?> context, final ChangeInventoryEvent event) {
this.player.connection.send(new ClientboundSetCarriedItemPacket(this.prevSlotId));
this.player.inventory.selected = this.prevSlotId;
this.handleEventResults(this.player, event);
}
Aggregations