// Uses item in hand public void UseItem() { // If ain't aiming at anything if (!current.active) { return; } ItemStack its = playerEvents.GetSlotStack(); // If is holding no items if (its == null) { return; } Item it = its.GetItem(); // If is a placeable item if (it is IPlaceable) { IPlaceable itPlaceable = it as IPlaceable; // If block placement was successful in client if (this.PlaceBlock(itPlaceable.placeableBlockID)) { PlayerRaycast.lastBlockPlaced = it.id; if (its.Decrement()) { playerEvents.hotbar.SetNull(PlayerEvents.hotbarSlot); playerEvents.DestroyItemEntity(); } playerEvents.DrawHotbarSlot(PlayerEvents.hotbarSlot); playerEvents.invUIPlayer.DrawSlot(1, PlayerEvents.hotbarSlot); } } }