internal bool Construct(ItemSlot slot, IWorldAccessor world, BlockPos pos, IPlayer player) { Block belowBlock = world.BlockAccessor.GetBlock(pos.DownCopy()); if (!belowBlock.CanAttachBlockAt(world.BlockAccessor, this, pos.DownCopy(), BlockFacing.UP) && (belowBlock != this || FillLevel(world.BlockAccessor, pos.DownCopy()) != 16)) { return(false); } if (!world.BlockAccessor.GetBlock(pos).IsReplacableBy(this)) { return(false); } world.BlockAccessor.SetBlock(BlockId, pos); BlockEntity be = world.BlockAccessor.GetBlockEntity(pos); if (be is BlockEntityPlankPile) { BlockEntityPlankPile pile = (BlockEntityPlankPile)be; if (player.WorldData.CurrentGameMode == EnumGameMode.Creative) { pile.inventory[0].Itemstack = slot.Itemstack.Clone(); pile.inventory[0].Itemstack.StackSize = 1; } else { pile.inventory[0].Itemstack = slot.TakeOut(player.Entity.Controls.Sprint ? pile.BulkTakeQuantity : pile.DefaultTakeQuantity); } pile.MarkDirty(); world.BlockAccessor.MarkBlockDirty(pos); world.PlaySoundAt(new AssetLocation("sounds/block/planks"), pos.X, pos.Y, pos.Z, player, false); } return(true); }